@cardano-sdk/governance 0.2.0-nightly.13 → 0.2.0-nightly.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/cip36.js
CHANGED
|
@@ -25,18 +25,18 @@ var VotingPurpose;
|
|
|
25
25
|
})(VotingPurpose = exports.VotingPurpose || (exports.VotingPurpose = {}));
|
|
26
26
|
exports.metadataBuilder = {
|
|
27
27
|
buildVotingRegistration({ delegations, stakeKey, purpose, rewardAccount, nonce = Date.now() }) {
|
|
28
|
-
const
|
|
28
|
+
const cmlRewardAddress = core_1.CML.Address.from_bech32(rewardAccount.toString());
|
|
29
29
|
const votingRegistration = new Map([
|
|
30
30
|
[1n, delegations.map(({ votingKey, weight }) => [Buffer.from(votingKey, 'hex'), BigInt(weight)])],
|
|
31
31
|
[2n, Buffer.from(stakeKey, 'hex')],
|
|
32
|
-
[3n, Buffer.from(
|
|
32
|
+
[3n, Buffer.from(cmlRewardAddress.to_bytes())],
|
|
33
33
|
[4n, BigInt(nonce)],
|
|
34
34
|
[5n, BigInt(purpose)]
|
|
35
35
|
]);
|
|
36
36
|
return new Map([[BigInt(MetadataLabel.DATA), votingRegistration]]);
|
|
37
37
|
},
|
|
38
38
|
async signVotingRegistration(votingRegistrationMetadata, stakeKeyBlobSigner) {
|
|
39
|
-
const votingRegistrationMetadataBytes = (0, util_1.usingAutoFree)((scope) => core_1.
|
|
39
|
+
const votingRegistrationMetadataBytes = (0, util_1.usingAutoFree)((scope) => core_1.coreToCml.txMetadata(scope, votingRegistrationMetadata).to_bytes());
|
|
40
40
|
const hashedMetadata = (0, blake2b_1.default)(256 / 8)
|
|
41
41
|
.update(votingRegistrationMetadataBytes)
|
|
42
42
|
.digest('binary');
|