From b3888dafa9e66feb0ebfb3a8951df1569246cd32 Mon Sep 17 00:00:00 2001 From: Matthew A Elder Date: Fri, 25 Feb 2022 10:18:40 -0700 Subject: [PATCH 1/3] waiting for signature implemented (shows addresses of signers) --- components/forms/TransactionSigning.js | 16 +++++++++++++++- .../[address]/transaction/[transactionID].js | 2 ++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/components/forms/TransactionSigning.js b/components/forms/TransactionSigning.js index 3605b516..840bc702 100644 --- a/components/forms/TransactionSigning.js +++ b/components/forms/TransactionSigning.js @@ -7,7 +7,7 @@ import { useAppContext } from "../../context/AppContext"; import Button from "../inputs/Button"; import HashView from "../dataViews/HashView"; import StackableContainer from "../layout/StackableContainer"; -import { AminoTypes } from "@cosmjs/stargate"; +import { pubkeyToAddress } from "@cosmjs/amino"; const TransactionSigning = (props) => { const { state } = useAppContext(); @@ -105,6 +105,20 @@ const TransactionSigning = (props) => { )}

Current Signers

+ {props.accountOnChain + ? props.accountOnChain.pubkey.value.pubkeys.map((pubkey, i) => ( + + {props.signatures.find( + (s) => s.address === pubkeyToAddress(pubkey, state.chain.addressPrefix), + ) ? ( + ✅ Signature received + ) : ( + ⌛ Waiting for signature + )} + + + )) + : null} {props.signatures.map((signature, i) => ( diff --git a/pages/multi/[address]/transaction/[transactionID].js b/pages/multi/[address]/transaction/[transactionID].js index a387095d..b4eb2b70 100644 --- a/pages/multi/[address]/transaction/[transactionID].js +++ b/pages/multi/[address]/transaction/[transactionID].js @@ -76,6 +76,7 @@ const transactionPage = ({ const client = await StargateClient.connect(state.chain.nodeAddress); const tempHoldings = await client.getBalance(address, state.chain.denom); const tempAccountOnChain = await getMultisigAccount(address, client); + console.log("MULTI", tempAccountOnChain); setHoldings(tempHoldings); setAccountOnChain(tempAccountOnChain); } catch (error) { @@ -146,6 +147,7 @@ const transactionPage = ({ {!transactionHash && ( Date: Fri, 25 Feb 2022 10:37:29 -0700 Subject: [PATCH 2/3] validation++ cant sign with wrong sig --- components/forms/TransactionSigning.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/forms/TransactionSigning.js b/components/forms/TransactionSigning.js index 840bc702..984dd778 100644 --- a/components/forms/TransactionSigning.js +++ b/components/forms/TransactionSigning.js @@ -32,6 +32,13 @@ const TransactionSigning = (props) => { window.keplr_wallet = tempWalletAccount; }; + const isValidSigner = + props.accountOnChain && + props.accountOnChain.pubkey.value.pubkeys.find( + (pubkey) => + pubkeyToAddress(pubkey, state.chain.addressPrefix) === walletAccount.bech32Address, + ); + const signTransaction = async () => { window.keplr.defaultOptions = { sign: { @@ -86,7 +93,7 @@ const TransactionSigning = (props) => {

You've signed this transaction.

- ) : ( + ) : isValidSigner ? ( <>

Sign this transaction

{walletAccount ? ( @@ -95,6 +102,11 @@ const TransactionSigning = (props) => {