Replies: 2 comments 2 replies
-
For the record, I suggested not to use the library and avoid u types, since they are not native to JS/TS and developers can be unfamiliar with the concept. @MaximusHaximus , what is your opinion on this? type u128 = bigint
type Balance = u128 This approach can be a good compromise. BTW, what type of error do user gets when they exids the limit? |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Currently they are all represent as bigint in JS SDK. In Rust SDK, it's more precise:
However, it is useful to know their maximum to avoid overflow. Basic ways can be just document the fact, or a simple alias:
A more type safe way can be using techique like this: https://github.com/skayo/TypedNumbers/blob/main/src/index.ts, but it's quite unpopular.
I wonder which is the best, JS/TS idiomatic way to do this.
Beta Was this translation helpful? Give feedback.
All reactions