> In the current implementation of the topUpBalance function, the balance is calculated incorrectly because it's being multiplied by a floating-point value and not converted to the smallest TON unit. This leads to an "Invalid number" error when sending transfers. #13
> In the current implementation of the topUpBalance function, the balance is calculated incorrectly because it's being multiplied by a floating-point value and not converted to the smallest TON unit. This leads to an "Invalid number" error when sending transfers.
Error Description:
The error occurs in the following line when trying to send the transaction:
Error: Invalid number
This happens because the amount is not being properly converted into nanoTONs, which is required for accurate transfer in TON.
Suggested Fix:
The issue can be resolved by using the toNano() function to convert the floating-point value into nanoTONs (smallest unit of TON). This will ensure the amount is in the correct format and prevent the "Invalid number" error.
Here's an example of how the amount calculation should be corrected:
Originally posted by @Amirbakhtiaro in https://github.com/tondiamonds/ton-nft-deployer/issues/10#issuecomment-2399379251