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

NFT amount calculation error (toNano not a number) #10

Open
Sufiyan-dev opened this issue Sep 6, 2024 · 1 comment
Open

NFT amount calculation error (toNano not a number) #10

Sufiyan-dev opened this issue Sep 6, 2024 · 1 comment

Comments

@Sufiyan-dev
Copy link

Sufiyan-dev commented Sep 6, 2024

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
@Amirbakhtiaro
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

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

2 participants