From 0b6df0876931cf2201d5776163437d91a88a08d2 Mon Sep 17 00:00:00 2001 From: Ludovit Scholtz Date: Sun, 20 Oct 2024 21:22:03 +0200 Subject: [PATCH] fix msig signer --- src/store/signer.js | 41 +++++++++++++++++++++++++++++++++-------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/src/store/signer.js b/src/store/signer.js index 132b057..621972b 100644 --- a/src/store/signer.js +++ b/src/store/signer.js @@ -48,10 +48,19 @@ const actions = { if (!fromAccount) { throw new Error("The from address is not in the list of accounts."); } + if (!this.state.config.env) { + throw new Error( + "Environment is not properly configured. Please switch to another network and select your network again." + ); + } - if (fromAccount.rekeyedTo && fromAccount.rekeyedTo != from) { + if ( + fromAccount.data[this.state.config.env] && + fromAccount.data[this.state.config.env].rekeyedTo && + fromAccount.data[this.state.config.env].rekeyedTo != from + ) { fromAccount = this.state.wallet.privateAccounts.find( - (a) => a.addr == fromAccount.rekeyedTo + (a) => a.addr == fromAccount.data[this.state.config.env].rekeyedTo ); if (!fromAccount) { throw new Error( @@ -134,10 +143,19 @@ const actions = { if (!fromAccount) { return "?"; } + if (!this.state.config.env) { + throw new Error( + "Environment is not properly configured. Please switch to another network and select your network again." + ); + } - if (fromAccount.rekeyedTo && fromAccount.rekeyedTo != from) { + if ( + fromAccount.data[this.state.config.env] && + fromAccount.data[this.state.config.env].rekeyedTo && + fromAccount.data[this.state.config.env].rekeyedTo != from + ) { fromAccount = this.state.wallet.privateAccounts.find( - (a) => a.addr == fromAccount.rekeyedTo + (a) => a.addr == fromAccount.data[this.state.config.env].rekeyedTo ); if (!fromAccount) { throw new Error( @@ -324,14 +342,22 @@ const actions = { if (!txn || !txn.from || !txn.from.publicKey) { throw new Error("Transaction object is not correct"); } + if (!this.state.config.env) { + throw new Error( + "Environment is not properly configured. Please switch to another network and select your network again." + ); + } const from = algosdk.encodeAddress(txn.from.publicKey); let fromAccount = this.state.wallet.privateAccounts.find( (a) => a.addr == from ); - - if (fromAccount.rekeyedTo && fromAccount.rekeyedTo != from) { + if ( + fromAccount.data[this.state.config.env] && + fromAccount.data[this.state.config.env].rekeyedTo && + fromAccount.data[this.state.config.env].rekeyedTo != from + ) { fromAccount = this.state.wallet.privateAccounts.find( - (a) => a.addr == fromAccount.rekeyedTo + (a) => a.addr == fromAccount.data[this.state.config.env].rekeyedTo ); if (!fromAccount) { throw new Error( @@ -339,7 +365,6 @@ const actions = { ); } } - if (!fromAccount.params) { throw new Error(`Address is not multisig: ${fromAccount.addr}`); }