madfish-solutions/templewallet-extension

"Invalid digit" RPC error when transferring FA 1.2 tokens with large number of decimals

maht0rz opened this issue · 2 comments

If you import a token to Thanos that uses 18 decimals, you can't transfer more than 999 of those tokens.

Transfer of >999 tokens will result in sending a scientific notation of the amount, rather than the full value as a string.

Assuming you guys are using Taquito with big-number.js, here's a snippet with a possible solution:

// ok
// 999 tokens
const largeNumber = BigNumber("999000000000000000000")
print(largeNumber.toString()) // "999000000000000000000"

// not ok
// 1000 tokens
const largerNumber = BigNumber("1000000000000000000000")
print(largeNumber.toString()) // "1e+21"

// ok (?)
// 1000 tokens
const largerNumber = BigNumber("1000000000000000000000")
print(largeNumber.toFixed(0)) // "1000000000000000000000"

Thanks @maht0rz . Thanos team, this is a blocker for us for 2 FA1.2 tokens we are launching on Tezos mainnet in the next 2 weeks. Blend Token (BLND) 18 decimals, and Staker Token (STKR) 18 decimals. We appreciate your attention to this!

Thanks a lot for reporting this issue!

0316d18 - it has been already fixed and we're pushing a new release now.