We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
为了方便开发者,建议添加对于 Package 的 Hasher
目前 sdk 中的 crypto_hash 中包含了 createUserTransactionHasher createUserTransactionHasher createSigningMessageHasher
createUserTransactionHasher createUserTransactionHasher createSigningMessageHasher
讨论在这里
结论如下: 样例代码
const fs = require('fs'); const { utils, bcs, crypto_hash } = require('@starcoin/starcoin'); const module_address = "your_module_address"; const mvFile = "path_to_your_mv_file"; const payload = utils.tx.encodePackage(module_address, [fs.readFileSync(mvFile)]); const s = (function () { const se = new bcs.BcsSerializer(); payload.value.serialize(se); // 这里要用 payload.value, 因为 payload 是 TransactionPayloadVariantPackage 结构,我们要用 Package 结构 return se.getBytes(); })(); const package_hash = crypto_hash.createHash("Package").crypto_hash(s); // 这里是固定的 Prefix: Package console.log(package_hash)
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
为了方便开发者,建议添加对于 Package 的 Hasher
目前 sdk 中的 crypto_hash 中包含了
createUserTransactionHasher createUserTransactionHasher createSigningMessageHasher
讨论在这里
结论如下:
样例代码
The text was updated successfully, but these errors were encountered: