diff --git a/source/renderer/app/utils/dataSerialization.ts b/source/renderer/app/utils/dataSerialization.ts index 2c9fd47263..7479b2f196 100644 --- a/source/renderer/app/utils/dataSerialization.ts +++ b/source/renderer/app/utils/dataSerialization.ts @@ -177,12 +177,15 @@ export const toTxOutputAssets = (assets: CoinSelectionAssetsType) => { return policyIdMap; }; -const parseVoteDelegation = (vote: string): [number] | [number, string] => { +const parseVoteDelegation = (vote: string): [number] | [number, Buffer] => { if (!vote) throw new Error('Invalid voting power option'); if (vote === 'abstain') return [2]; if (vote === 'no_confidence') return [3]; - const voteHash = utils.buf_to_hex(utils.bech32_decodeAddress(vote)); + const voteHash = Buffer.from( + utils.buf_to_hex(utils.bech32_decodeAddress(vote)), + 'hex' + ); return [vote.includes('_script') ? 1 : 0, voteHash]; }; diff --git a/source/renderer/app/utils/shelleyLedger.ts b/source/renderer/app/utils/shelleyLedger.ts index af87c3eea8..0b80074c5f 100644 --- a/source/renderer/app/utils/shelleyLedger.ts +++ b/source/renderer/app/utils/shelleyLedger.ts @@ -67,16 +67,18 @@ const parseVoteDelegation = ( }; } + const votHash = utils.buf_to_hex(utils.bech32_decodeAddress(cert.vote)); + if (cert.vote.includes('_script')) { return { type: DRepParamsType.SCRIPT_HASH, - scriptHashHex: cert.vote, + scriptHashHex: votHash, }; } return { type: DRepParamsType.KEY_HASH, - keyHashHex: cert.vote, + keyHashHex: votHash, }; };