-
Notifications
You must be signed in to change notification settings - Fork 923
JSON RPC API using (u)int64 whereas JS can only handle int53 #1116
Comments
@linuskendall thanks for opening this! Yea, we've switched to passing around While it's much nicer to get a |
We've switch over to strings in a couple of the methods already, and marked the It would be helpful to enumerate the remaining problematic methods to make this issue easier to pick up by somebody willing to clean them up too! |
@mvines The biggest offender right now is |
@mvines This also occurs when using This also happens with |
The use of JS numbers is terrifying, and has been added as a principle in #1111 as we consider a rewrite of web3.js. |
I removed the ‘good first issue’ tag. I think this is rather extremely complicated, and will require a months' (years'?) long deprecation strategy for the old fields, and possibly a version bump of the RPC itself. Some of the groundwork is already being laid in the new web3 rewrite through the use of |
@lorisleiva has a devilishly clever solution for this, coming to |
I can't believe this is done. |
Because there has been no activity on this issue for 7 days since it was closed, it has been automatically locked. Please open a new issue if it requires a follow up. |
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?
The text was updated successfully, but these errors were encountered: