From a690df520979976589e65df3f827531ae6a5bc63 Mon Sep 17 00:00:00 2001 From: PeeEmKay Date: Wed, 9 Jul 2025 20:55:17 +0100 Subject: [PATCH] fix: resolve BigInt conversion error in ICP withdrawal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed floating-point precision issue when converting ICP amounts to e8s units. Added Math.round() to ensure integer values before BigInt conversion. Resolves error: "the number 1550999.999998 cannot be converted to a Bigint because it is not an integer" when withdrawing decimal ICP amounts. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- .../components/withdraw-modal/withdraw-modal.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/nuance_assets/components/withdraw-modal/withdraw-modal.tsx b/src/nuance_assets/components/withdraw-modal/withdraw-modal.tsx index ac27c989..9bf7e59b 100755 --- a/src/nuance_assets/components/withdraw-modal/withdraw-modal.tsx +++ b/src/nuance_assets/components/withdraw-modal/withdraw-modal.tsx @@ -163,9 +163,10 @@ export const WithdrawModal = () => { setLoading(true); try { if (selectedCurrency === 'ICP') { - let e8s = + let e8s = Math.round( Math.pow(10, getSelectedCurrencyBalance().token.decimals) * - parseFloat(inputAmount); + parseFloat(inputAmount) + ); let response = await transferIcp(BigInt(e8s), inputAddressValue); if ('Ok' in response) { toast('Tokens transferred successfully', ToastType.Success);