solana-web3.js
solana-web3.js copied to clipboard
Create a type to handle Rust's `f64` from the RPC server
Motivation
Currently in the saga of the new (experimental) Web3 JS library, we've introduced the type U64UnsafeBeyond2Pow53Minus1
, which aims to represent a Rust u64
while quite obviously stating this type's limitations.
We do not have such a type for Rust's f64
, which is a return type used by many RPC methods in the RPC server.
Example use case
Two methods I've encountered will return one or more fields of type f64
:
There are likely more.
Details
We should ideally craft a similar type to U64UnsafeBeyond2Pow53Minus1
, so that it explicitly states the type's limitations, and perhaps as we move closer to release can iron this out - either by delving into the RPC server's code or our own.
Note: I am actively researching this, but throwing this flare up in case anyone has any immediate ideas!