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 =