rs-stellar-xdr icon indicating copy to clipboard operation
rs-stellar-xdr copied to clipboard

Render the u128/i128 ScVal types as an integer instead of as the hi/lo pairs

Open leighmcculloch opened this issue 11 months ago • 0 comments

For example:

$ echo -n 'AAAACgAAAAAAAAAAAAAAAAAAAAE=' | stellar-xdr d --type ScVal
{"i128":{"hi":0,"lo":1}}

That is not very ergonomic to work with.

Instead, we could render it as:

$ echo -n 'AAAACgAAAAAAAAAAAAAAAAAAAAE=' | stellar-xdr d --type ScVal
{"i128":1}

In the same way we render u64/i64:

$ echo -n 'AAAABgAAAAAAAAAB' | stellar-xdr d --type ScVal
{"i64":1}

_There is the issue that JavaScript implementations of JSON parsers cannot parse integer values over the size of 53-bits correctly, so the number should also probably be stringified, but that needs addressing for the 64-bit ScVal types as well, and is a separate issue tracked in the following issue and tackled at the same time there:

  • https://github.com/stellar/xdrgen/issues/181

leighmcculloch avatar Mar 21 '24 04:03 leighmcculloch