From f8bc0459180920b6a0ae00481f697ed25814e5dd Mon Sep 17 00:00:00 2001 From: "Felix C. Morency" <1102868+fmorency@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:01:42 -0500 Subject: [PATCH] fix: ibc send large numbers --- components/bank/forms/ibcSendForm.tsx | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/components/bank/forms/ibcSendForm.tsx b/components/bank/forms/ibcSendForm.tsx index f4d3c0e8..18f04138 100644 --- a/components/bank/forms/ibcSendForm.tsx +++ b/components/bank/forms/ibcSendForm.tsx @@ -2,7 +2,7 @@ import React, { useState, useMemo } from 'react'; import { chainName } from '@/config'; import { useFeeEstimation, useTx } from '@/hooks'; import { ibc } from '@liftedinit/manifestjs'; -import { getIbcInfo } from '@/utils'; +import { getIbcInfo, parseNumberToBigInt } from '@/utils'; import { PiCaretDownBold } from 'react-icons/pi'; import { MdContacts } from 'react-icons/md'; import { CombinedBalanceInfo } from '@/utils/types'; @@ -108,9 +108,7 @@ export default function IbcSendForm({ setIsSending(true); try { const exponent = values.selectedToken.metadata?.denom_units[1]?.exponent ?? 6; - const amountInBaseUnits = Math.floor( - parseFloat(values.amount) * Math.pow(10, exponent) - ).toString(); + const amountInBaseUnits = parseNumberToBigInt(values.amount, exponent).toString(); const { source_port, source_channel } = getIbcInfo(chainName ?? '', destinationChain ?? '');