From 631d8fff0a14efc7e05e785803ec988896de81c0 Mon Sep 17 00:00:00 2001 From: Kheops <26880866+0xKheops@users.noreply.github.com> Date: Fri, 6 Oct 2023 09:23:22 +0900 Subject: [PATCH] fix: send funds input amount as fiat --- .../src/ui/domains/SendFunds/SendFundsAmountForm.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps/extension/src/ui/domains/SendFunds/SendFundsAmountForm.tsx b/apps/extension/src/ui/domains/SendFunds/SendFundsAmountForm.tsx index 7e0c1635b7..992ed7f90a 100644 --- a/apps/extension/src/ui/domains/SendFunds/SendFundsAmountForm.tsx +++ b/apps/extension/src/ui/domains/SendFunds/SendFundsAmountForm.tsx @@ -239,10 +239,11 @@ const FiatInput = () => { const text = e.target.value ?? "" const num = Number(text) + const tokenRate = tokenRates?.[currency] - if (token && tokenRates?.usd && text.length && !isNaN(num)) { + if (token && tokenRate && text.length && !isNaN(num)) { const fiat = parseFloat(text) - const tokens = (fiat / tokenRates.usd).toFixed(Math.ceil(token.decimals / 3)) + const tokens = (fiat / tokenRate).toFixed(Math.ceil(token.decimals / 3)) set("amount", tokensToPlanck(tokens, token.decimals)) } else remove("amount") }, 250),