diff --git a/components/dataViews/TransactionInfo/TxMsgDelegateDetails.tsx b/components/dataViews/TransactionInfo/TxMsgDelegateDetails.tsx index 7b36a44..e0eaf45 100644 --- a/components/dataViews/TransactionInfo/TxMsgDelegateDetails.tsx +++ b/components/dataViews/TransactionInfo/TxMsgDelegateDetails.tsx @@ -1,5 +1,5 @@ import { useAppContext } from "../../../context/AppContext"; -import { printableCoins } from "../../../lib/displayHelpers"; +import { printableCoin } from "../../../lib/displayHelpers"; import { TxMsgDelegate } from "../../../types/txMsg"; import HashView from "../HashView"; @@ -17,7 +17,7 @@ const TxMsgDelegateDetails = ({ msg }: TxMsgDelegateDetailsProps) => {
  • -
    {printableCoins(msg.value.amount, state.chain)}
    +
    {printableCoin(msg.value.amount, state.chain)}
  • diff --git a/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx b/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx index eb04b44..1e82065 100644 --- a/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx +++ b/components/dataViews/TransactionInfo/TxMsgRedelegateDetails.tsx @@ -1,5 +1,5 @@ import { useAppContext } from "../../../context/AppContext"; -import { printableCoins } from "../../../lib/displayHelpers"; +import { printableCoin } from "../../../lib/displayHelpers"; import { TxMsgRedelegate } from "../../../types/txMsg"; import HashView from "../HashView"; @@ -17,7 +17,7 @@ const TxMsgRedelegateDetails = ({ msg }: TxMsgRedelegateDetailsProps) => {
  • -
    {printableCoins(msg.value.amount, state.chain)}
    +
    {printableCoin(msg.value.amount, state.chain)}
  • diff --git a/components/dataViews/TransactionInfo/TxMsgUndelegateDetails.tsx b/components/dataViews/TransactionInfo/TxMsgUndelegateDetails.tsx index 26f7bd2..cb7c182 100644 --- a/components/dataViews/TransactionInfo/TxMsgUndelegateDetails.tsx +++ b/components/dataViews/TransactionInfo/TxMsgUndelegateDetails.tsx @@ -1,5 +1,5 @@ import { useAppContext } from "../../../context/AppContext"; -import { printableCoins } from "../../../lib/displayHelpers"; +import { printableCoin } from "../../../lib/displayHelpers"; import { TxMsgUndelegate } from "../../../types/txMsg"; import HashView from "../HashView"; @@ -17,7 +17,7 @@ const TxMsgUndelegateDetails = ({ msg }: TxMsgUndelegateDetailsProps) => {
  • -
    {printableCoins(msg.value.amount, state.chain)}
    +
    {printableCoin(msg.value.amount, state.chain)}
  • diff --git a/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx index 31da48a..6819458 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgDelegateForm.tsx @@ -61,7 +61,7 @@ const MsgDelegateForm = ({ delegatorAddress, setMsgGetter, deleteMsg }: MsgDeleg value: { delegatorAddress, validatorAddress, - amount: [{ amount: amountInAtomics, denom: state.chain.denom }], + amount: { amount: amountInAtomics, denom: state.chain.denom }, }, }; diff --git a/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx index c95ed81..096b270 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgRedelegateForm.tsx @@ -77,7 +77,7 @@ const MsgRedelegateForm = ({ delegatorAddress, validatorSrcAddress, validatorDstAddress, - amount: [{ amount: amountInAtomics, denom: state.chain.denom }], + amount: { amount: amountInAtomics, denom: state.chain.denom }, }, }; diff --git a/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx b/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx index 3536e99..fccb754 100644 --- a/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx +++ b/components/forms/CreateTxForm/MsgForm/MsgUndelegateForm.tsx @@ -65,7 +65,7 @@ const MsgUndelegateForm = ({ value: { delegatorAddress, validatorAddress, - amount: [{ amount: amountInAtomics, denom: state.chain.denom }], + amount: { amount: amountInAtomics, denom: state.chain.denom }, }, }; diff --git a/components/forms/TransactionSigning.tsx b/components/forms/TransactionSigning.tsx index 281f591..7678eaf 100644 --- a/components/forms/TransactionSigning.tsx +++ b/components/forms/TransactionSigning.tsx @@ -5,7 +5,7 @@ import { SigningStargateClient } from "@cosmjs/stargate"; import { assert } from "@cosmjs/utils"; import TransportWebUSB from "@ledgerhq/hw-transport-webusb"; import axios from "axios"; -import { useState } from "react"; +import { useCallback, useLayoutEffect, useState } from "react"; import { useAppContext } from "../../context/AppContext"; import { getConnectError } from "../../lib/errorHelpers"; import { DbSignature, DbTransaction, WalletAccount } from "../../types"; @@ -41,7 +41,7 @@ const TransactionSigning = (props: Props) => { const [ledgerSigner, setLedgerSigner] = useState({}); const [loading, setLoading] = useState({}); - const connectKeplr = async () => { + const connectKeplr = useCallback(async () => { try { setLoading((oldLoading) => ({ ...oldLoading, keplr: true })); assert(state.chain.chainId, "chainId missing"); @@ -76,7 +76,17 @@ const TransactionSigning = (props: Props) => { } finally { setLoading((newLoading) => ({ ...newLoading, keplr: false })); } - }; + }, [memberPubkeys, props.signatures, state.chain.chainId]); + + useLayoutEffect(() => { + const accountChangeKey = "keplr_keystorechange"; + + if (walletType === "Keplr") { + window.addEventListener(accountChangeKey, connectKeplr); + } else { + window.removeEventListener(accountChangeKey, connectKeplr); + } + }, [connectKeplr, walletType]); const connectLedger = async () => { try { diff --git a/types/txMsg.ts b/types/txMsg.ts index b3d2ed4..a3b2a14 100644 --- a/types/txMsg.ts +++ b/types/txMsg.ts @@ -21,7 +21,7 @@ export interface TxMsgDelegate { readonly value: { readonly delegatorAddress: string; readonly validatorAddress: string; - readonly amount: [{ readonly amount: string; readonly denom: string }]; + readonly amount: { readonly amount: string; readonly denom: string }; }; } @@ -30,7 +30,7 @@ export interface TxMsgUndelegate { readonly value: { readonly delegatorAddress: string; readonly validatorAddress: string; - readonly amount: [{ readonly amount: string; readonly denom: string }]; + readonly amount: { readonly amount: string; readonly denom: string }; }; } @@ -40,7 +40,7 @@ export interface TxMsgRedelegate { readonly delegatorAddress: string; readonly validatorSrcAddress: string; readonly validatorDstAddress: string; - readonly amount: [{ readonly amount: string; readonly denom: string }]; + readonly amount: { readonly amount: string; readonly denom: string }; }; }