From 93f931459ade63fcb37cb51e8fd213591ea9ab44 Mon Sep 17 00:00:00 2001 From: Fouad Date: Fri, 22 Jul 2022 09:40:06 +0100 Subject: [PATCH] fix type update issues with actions (bonding, delegating etc.) (#1469) --- .../components/Delegation/DelegateModal.tsx | 20 +++++++++----- .../components/Delegation/Modals.stories.tsx | 6 ++--- .../src/components/Rewards/CompoundModal.tsx | 8 +++--- .../Rewards/RedeemModal.stories.tsx | 8 +++--- .../src/components/Rewards/RedeemModal.tsx | 8 +++--- .../components/Send/SendDetails.stories.tsx | 1 + .../src/components/Send/SendDetailsModal.tsx | 5 +++- .../src/components/Send/SendInputModal.tsx | 5 +++- nym-wallet/src/components/Send/SendModal.tsx | 6 +++-- .../src/components/TokenPoolSelector.tsx | 6 +++-- nym-wallet/src/context/delegations.tsx | 2 +- nym-wallet/src/context/main.tsx | 7 +---- nym-wallet/src/context/mocks/main.tsx | 2 +- .../balance/components/TransferModal.tsx | 26 +++++++++++-------- nym-wallet/src/pages/balance/vesting.tsx | 12 +++++---- .../src/pages/bond/components/GatewayForm.tsx | 4 +-- .../src/pages/bond/components/MixnodeForm.tsx | 4 +-- .../src/pages/bond/components/SuccessView.tsx | 8 +++--- nym-wallet/src/pages/delegation/index.tsx | 9 +++---- nym-wallet/src/pages/receive/index.tsx | 4 +-- nym-wallet/src/requests/vesting.ts | 4 +-- .../components/currency/CurrencyFormField.tsx | 10 +++---- ts-packages/types/src/types/global.ts | 2 +- 23 files changed, 93 insertions(+), 74 deletions(-) diff --git a/nym-wallet/src/components/Delegation/DelegateModal.tsx b/nym-wallet/src/components/Delegation/DelegateModal.tsx index f9503e25e8..0efcef61f9 100644 --- a/nym-wallet/src/components/Delegation/DelegateModal.tsx +++ b/nym-wallet/src/components/Delegation/DelegateModal.tsx @@ -31,7 +31,7 @@ export const DelegateModal: React.FC<{ estimatedReward?: number; profitMarginPercentage?: number | null; nodeUptimePercentage?: number | null; - currency: string; + denom: CurrencyDenom; initialAmount?: string; hasVestingContract: boolean; sx?: SxProps; @@ -48,7 +48,7 @@ export const DelegateModal: React.FC<{ rewardInterval, accountBalance, estimatedReward, - currency, + denom, profitMarginPercentage, nodeUptimePercentage, initialAmount, @@ -103,7 +103,7 @@ export const DelegateModal: React.FC<{ } if (amount && Number(amount) < MIN_AMOUNT_TO_DELEGATE) { - errorAmountMessage = `Min. delegation amount: ${MIN_AMOUNT_TO_DELEGATE} ${currency}`; + errorAmountMessage = `Min. delegation amount: ${MIN_AMOUNT_TO_DELEGATE} ${denom.toUpperCase()}`; newValidatedValue = false; } @@ -118,7 +118,7 @@ export const DelegateModal: React.FC<{ const handleOk = async () => { if (onOk && amount && identityKey) { - onOk(identityKey, { amount, denom: currency as CurrencyDenom }, tokenPool, fee); + onOk(identityKey, { amount, denom }, tokenPool, fee); } }; @@ -170,7 +170,7 @@ export const DelegateModal: React.FC<{ onConfirm={handleOk} > - + ); } @@ -181,7 +181,7 @@ export const DelegateModal: React.FC<{ onClose={onClose} onOk={async () => { if (identityKey && amount) { - handleConfirm({ identity: identityKey, value: { amount, denom: currency as CurrencyDenom } }); + handleConfirm({ identity: identityKey, value: { amount, denom } }); } }} header={header || 'Delegate'} @@ -219,6 +219,7 @@ export const DelegateModal: React.FC<{ initialValue={amount} autoFocus={Boolean(initialIdentityKey)} onChanged={handleAmountChanged} + denom={denom} /> -