From 7c26cab4e6c1863bc42e4db92b212f6970994f65 Mon Sep 17 00:00:00 2001 From: fmtabbara Date: Thu, 13 Jan 2022 15:32:29 +0000 Subject: [PATCH] get updated mixnode details after bonding/unbonding txs --- nym-wallet/src/pages/bond/BondForm.tsx | 21 ++++++------------- nym-wallet/src/pages/bond/index.tsx | 14 ++++--------- .../src/pages/settings/system-variables.tsx | 15 +++++++------ nym-wallet/src/pages/unbond/index.tsx | 3 ++- nym-wallet/src/types/global.ts | 2 +- 5 files changed, 22 insertions(+), 33 deletions(-) diff --git a/nym-wallet/src/pages/bond/BondForm.tsx b/nym-wallet/src/pages/bond/BondForm.tsx index 55609d15fc..314088cb88 100644 --- a/nym-wallet/src/pages/bond/BondForm.tsx +++ b/nym-wallet/src/pages/bond/BondForm.tsx @@ -20,6 +20,7 @@ import { validationSchema } from './validationSchema' import { Coin, Gateway, MixNode } from '../../types' import { ClientContext, MAJOR_CURRENCY } from '../../context/main' import { checkHasEnoughFunds } from '../../utils' +import { Fee } from '../../components' type TBondFormFields = { withAdvancedOptions: boolean @@ -78,12 +79,10 @@ const formatData = (data: TBondFormFields) => { export const BondForm = ({ disabled, - fees, onError, onSuccess, }: { disabled: boolean - fees?: { [EnumNodeType.mixnode]: Coin; [EnumNodeType.gateway]?: Coin } onError: (message?: string) => void onSuccess: (details: { address: string; amount: string }) => void }) => { @@ -99,7 +98,7 @@ export const BondForm = ({ defaultValues, }) - const { userBalance } = useContext(ClientContext) + const { userBalance, getBondDetails } = useContext(ClientContext) const watchNodeType = watch('nodeType', defaultValues.nodeType) const watchAdvancedOptions = watch('withAdvancedOptions', defaultValues.withAdvancedOptions) @@ -114,7 +113,8 @@ export const BondForm = ({ const pledge = await majorToMinor(data.amount) await bond({ type: data.nodeType, ownerSignature: data.ownerSignature, data: formattedData, pledge }) - .then(() => { + .then(async () => { + await getBondDetails() userBalance.fetchBalance() onSuccess({ address: data.identityKey, amount: data.amount }) }) @@ -358,28 +358,19 @@ export const BondForm = ({ )} )} - {fees && ( - - - {' '} - {`Bonding fee: ${ - watchNodeType === EnumNodeType.mixnode ? fees.mixnode.amount : fees?.gateway?.amount - } ${MAJOR_CURRENCY}`} - - - )} `1px solid ${theme.palette.grey[200]}`, bgcolor: 'grey.100', padding: 2, }} > + {!disabled ? :
}