diff --git a/app/src/components/FurnacePage.tsx b/app/src/components/FurnacePage.tsx index b9e5d2f..8845d95 100755 --- a/app/src/components/FurnacePage.tsx +++ b/app/src/components/FurnacePage.tsx @@ -126,6 +126,7 @@ export const FurnacePage: FC = () => { if (signer) { try { + const floatToDecimals = convertToInt(amount) console.log(floatToDecimals) const tx = await burn( diff --git a/app/src/services/utils.tsx b/app/src/services/utils.tsx index 805d5c8..d9208d7 100755 --- a/app/src/services/utils.tsx +++ b/app/src/services/utils.tsx @@ -26,14 +26,22 @@ export interface TokenFaucetConfig { } -export const convertToInt = (withdrawAmount: string):[bigint, number] => { - let amountToWithdrawFloat = '' +export const convertToInt = (withdrawAmount: string): [bigint, number] => { + // Convert scientific notation to regular decimal + const normalizedNumber = Number(withdrawAmount).toLocaleString('fullwide', { + useGrouping: false, + maximumFractionDigits: 20 + }) + + // Split the number into integer and decimal parts + const [integerPart, decimalPart = ''] = normalizedNumber.split('.') + + // Combine integer and decimal parts without the decimal point + const fullNumber = integerPart + decimalPart - if (withdrawAmount.split('.').length > 0) - amountToWithdrawFloat = withdrawAmount.split('.')[0] + withdrawAmount.split('.')[1] return [ - withdrawAmount.split('.').length > 1 ? BigInt(amountToWithdrawFloat) : BigInt(withdrawAmount), - withdrawAmount.split('.').length > 1 ? Number(withdrawAmount.split('.')[1].length) : Number(0) + BigInt(fullNumber), + decimalPart.length ] }