js-xdr
js-xdr copied to clipboard
Add `valueOf` support to XDR types.
Is your feature request related to a problem? Please describe.
It is very convenient to be able to use XDR types that correlate to a native type in an inline, convenient way. For example, you could use Hyper
inline with arithmetic operations, e.g.
let increment = new Hyper(1234n) + 1n;
Describe the solution you'd like
valueOf()
methods added to each XDR primitive type we support.
Describe alternatives you've considered Each type has a way to access its raw, underlying value, but this is a little jankier.
Additional context See @paulbellamy's comment here: https://github.com/stellar/dts-xdr/pull/6#discussion_r1236791838.