parseCoins has to work with Big Int arithmetics. Uint64 is not enough
See original GitHub issueparseCoins
can work only with uint64 type which is too small for tokens with decimals like 12 or 18
https://github.com/cosmos/cosmjs/blob/main/packages/proto-signing/src/coins.ts#L20
has to be changed to work with BigInt and serialized to a string type after
Issue Analytics
- State:
- Created a year ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Cosmjs incompatibility with ES2018 · Issue #1144 - GitHub
Hi everyone, I'm trying to create a new rn project including cosmjs. After the inclusion, if I try to use part of the...
Read more >Lesson 8. Big numbers - Get Programming with Go
Integers are accurate but have a limited range. What if you need a really big, accurate number? This lesson explores two alternatives to...
Read more >Big Int in Go : Handling large numbers is easy - Dev Genius
This example demonstrates how to use big.Int to compute the smallest Fibonacci number with 100 decimal digits and to test whether it is...
Read more >BigInt - JavaScript - MDN Web Docs
BigInt values represent numeric values which are too large to be represented by the number primitive.
Read more >math/big - Go Packages
Package big implements arbitrary-precision arithmetic (big numbers). The following numeric types are supported: Int signed integers Rat rational numbers ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Shipped as part of CosmJS 0.29.0
The point I am trying to make is that
parseCoins
does not do any arithmetics. It splits and checks a string and converts a string number to a string number after this has been checked to be[0-9]+
. So we can get rid of the UintXYZ limitation entirely.We use bn.js for historic reasons and I’d like to avoid creating more usages of it. I’d like to use native BigInt but the React Native folks make me wonder if we can use it in critical places.
Anyways, I’ll fix this one way or another.