From b63313fa4fbb9108c7740791ad46218b25169b1c Mon Sep 17 00:00:00 2001 From: rassadin11 Date: Fri, 24 Jul 2026 19:19:59 +0300 Subject: [PATCH] fix --- src/widgets/send-modal/ui/SendModal.tsx | 13 +++++++++++-- src/widgets/token-table/model/tokens.ts | 3 +++ src/widgets/token-table/model/useChainTokenRows.ts | 2 ++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/widgets/send-modal/ui/SendModal.tsx b/src/widgets/send-modal/ui/SendModal.tsx index 1454d7b..92204ba 100644 --- a/src/widgets/send-modal/ui/SendModal.tsx +++ b/src/widgets/send-modal/ui/SendModal.tsx @@ -14,6 +14,9 @@ export interface SendModalToken { /** Network this balance row belongs to. Tickers repeat across chains * (USDT on ETH/SOL/TRX/…), so the "Макс" lookup must match on it too. */ chain?: Chain + /** Token decimals (from the balance endpoint), used to convert the human + * send amount into base units before submitting. */ + decimals?: number } interface Props { @@ -83,6 +86,11 @@ export function SendModal({ open, onClose, network, tokens = [], initialToken = } const maxAmount = maxSendable() + // Decimals used to scale the human amount into base units before sending. + // Native comes from chain config; tokens carry their own decimals from the + // balance row. Undefined ⇒ we can't safely convert, so the send is blocked. + const sendDecimals = isNative ? cfg.nativeDecimals : walletMatch?.decimals + useEffect(() => { setSelectedToken(initialToken) }, [initialToken]) useEffect(() => { setSelectedToken('') }, [network]) @@ -115,7 +123,8 @@ export function SendModal({ open, onClose, network, tokens = [], initialToken = } function handleSubmit() { - const convertedAmount = isNative ? toBaseUnits(amount, cfg.nativeDecimals) : amount + if (sendDecimals == null) return + const convertedAmount = toBaseUnits(amount, sendDecimals) mutation.mutate({ chain: network, to: address, @@ -300,7 +309,7 @@ export function SendModal({ open, onClose, network, tokens = [], initialToken =