cosmwasm icon indicating copy to clipboard operation
cosmwasm copied to clipboard

Discussion: JSON formatted Numbers Are Different Form in uint64 vs uint128

Open loloicci opened this issue 3 years ago • 1 comments

In JSON used in cosmwasm, uint64 is formatted as the number, and uint128 (in coin, for example) is formatted as the string. I think it is a little confusing.

How they are formatted in JSON should be unified in my intuition. But, it may be a problem with the max number of JSON (JS). The max integer JS can use is 2^53 -1 (I don't know why we can use uint64 as the number...).

loloicci avatar Mar 31 '21 05:03 loloicci

The cosmos-sdk also uses 64 bit integer as string.

https://github.com/tendermint/go-amino/blob/master/json-encode.go#L103-L109

I'm not sure in the stargate version.

whylee259 avatar Mar 31 '21 05:03 whylee259