Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

> 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

Open
hajizade1992 opened this issue Oct 27, 2024 · 0 comments

Comments

@hajizade1992
Copy link

          > 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:

const amount = toNano(nftAmount * 0.026); // Correctly converts amount to nanoTONs
Screenshot 2024-09-06 at 12 13 05 PM

Originally posted by @Amirbakhtiaro in #10 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant