solana-web3.js icon indicating copy to clipboard operation
solana-web3.js copied to clipboard

JSON RPC API using (u)int64 whereas JS can only handle int53

Open linuskendall opened this issue 3 years ago • 7 comments

Problem

The JSON API uses int64 for fields like lamports. However, the maximum safe integer in browsers is 2^53-1

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number/MAX_SAFE_INTEGER

Proposed Solution

Make lamports a string in the HTTP/RPC API and parse with BigInt on the web3.js client side?

linuskendall avatar Jan 20 '22 17:01 linuskendall