steem2sol failed because of floating arithmetic precision error

in #sol2 months ago

There are two swaps this morning, one succeeds and the other failed.

I added the Priority Fee a few days ago, so that shouldn't be a problem anymore. When I looked into the log, I was surprised to find out that:

Error transferring SOL: RangeError: The number 1034197046.9999999 cannot be converted to a BigInt because it is not an integer

So one paramerter to feed into the transfer SOL api is lamports, the smallest unit and it was like:

amountSOL * solanaWeb3.LAMPORTS PER SOL

The amountSOL is 1.0341970473037272 which multiples 1000000000 somehow becomes 1034197046.9999999 However, I check the console in Chrome, the multiplication answer is different: 1034197047.3037271

Anyway, I just have to truncate the decima values and this should fix the problem.

Thank you for using the Swap tool!

Steem to the Moon🚀!

Sort:  

Thanks @justyy for the update and the fix!!
I will give it a try tomorrow Monday😀

Thank you!

Coin Marketplace

STEEM 0.28
TRX 0.13
JST 0.032
BTC 65035.33
ETH 2950.72
USDT 1.00
SBD 3.66