question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

parseCoins has to work with Big Int arithmetics. Uint64 is not enough

See original GitHub issue

parseCoins 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:closed
  • Created a year ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
webmaster128commented, Sep 15, 2022

Shipped as part of CosmJS 0.29.0

1reaction
webmaster128commented, Sep 14, 2022

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.

Read more comments on GitHub >

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

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found