Skip to content

Commit 0033171

Browse files
committed
fix: proposal vote tx invalid option format
1 parent f1c435a commit 0033171

File tree

4 files changed

+770
-451
lines changed

4 files changed

+770
-451
lines changed

imports/ui/ledger/LedgerActions.jsx

+22
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,28 @@ class LedgerButton extends Component {
447447
this.initStateOnLoad('signing')
448448
try {
449449
let txMsg = this.state.txMsg;
450+
// simulate still need the option string ("yes/no...")
451+
// but broadcast want it as an int :)
452+
if (this.state.actionType == Types.VOTE) {
453+
switch (txMsg.value.msg[0].value.option) {
454+
case 'Yes':
455+
txMsg.value.msg[0].value.option = 1;
456+
break
457+
case 'Abstain':
458+
txMsg.value.msg[0].value.option = 2;
459+
break
460+
case 'No':
461+
txMsg.value.msg[0].value.option = 3;
462+
break
463+
case 'NoWithVeto':
464+
txMsg.value.msg[0].value.option = 4;
465+
break
466+
default:
467+
txMsg.value.msg[0].value.option = 0;
468+
break
469+
}
470+
}
471+
450472
const txContext = this.getTxContext();
451473
const bytesToSign = Ledger.getBytesToSign(txMsg, txContext);
452474
this.ledger.sign(bytesToSign, this.state.transportBLE).then((sig) => {

0 commit comments

Comments
 (0)