From 1bf7221059717abcd12b859e9cfc454e618ec0b2 Mon Sep 17 00:00:00 2001 From: saml33 Date: Mon, 14 Nov 2022 11:46:36 +1100 Subject: [PATCH] add deposit value to user setup --- components/UserSetup.tsx | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/components/UserSetup.tsx b/components/UserSetup.tsx index bf8ee570..f020024c 100644 --- a/components/UserSetup.tsx +++ b/components/UserSetup.tsx @@ -25,7 +25,7 @@ import { } from 'react' import { IS_ONBOARDED_KEY, MIN_SOL_BALANCE } from 'utils/constants' import { notify } from 'utils/notifications' -import { floorToDecimal } from 'utils/numbers' +import { floorToDecimal, formatFixedDecimals } from 'utils/numbers' import ActionTokenList from './account/ActionTokenList' import ButtonGroup from './forms/ButtonGroup' import Input from './forms/Input' @@ -186,6 +186,10 @@ const UserSetup = ({ onClose }: { onClose: () => void }) => { return banks }, [group?.banksMapByName, walletTokens]) + const depositBank = useMemo(() => { + return banks.find((b) => b.key === depositToken) + }, [depositToken]) + const tokenMax = useMemo(() => { const bank = banks.find((bank) => bank.key === depositToken) if (bank) { @@ -409,7 +413,7 @@ const UserSetup = ({ onClose }: { onClose: () => void }) => { ).toFixed()} /> -
+
+
+
+

{t('deposit-value')}

+

+ {formatFixedDecimals( + depositBank?.value[0].uiPrice! * Number(depositAmount), + true + )} +

+
+