Class

XdrLargeInt

XdrLargeInt(type, values)

A wrapper class to represent large XDR-encodable integers.

This operates at a lower level than ScInt by forcing you to specify the type / width / size in bits of the integer you're targeting, regardless of the input value(s) you provide.

Constructor

# new XdrLargeInt(type, values)

Parameters:
Name Type Description
type string

force a specific data type. the type choices are: 'i64', 'u64', 'i128', 'u128', 'i256', and 'u256' (default: the smallest one that fits the value) (see XdrLargeInt.isType)

values number | bigint | string | Array.<(number|bigint|string)>

a list of integer-like values interpreted in big-endian order

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 24

Classes

XdrLargeInt

Methods

# toBigInt() → {bigint}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 91

bigint

# toI128() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 118

if the value cannot fit in 128 bits

RangeError

the integer encoded with ScValType = I128

xdr.ScVal

# toI256() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 150

the integer encoded with ScValType = I256

xdr.ScVal

# toI64() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 96

the integer encoded with ScValType = I64

xdr.ScVal

# toNumber() → {number}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 78

if the value can't fit into a Number

RangeError
number

# toScVal() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 186

the smallest interpretation of the stored value

xdr.ScVal

# toU128() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 137

if the value cannot fit in 128 bits

RangeError

the integer encoded with ScValType = U128

xdr.ScVal

# toU256() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 168

the integer encoded with ScValType = U256

xdr.ScVal

# toU64() → {xdr.ScVal}

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 107

the integer encoded with ScValType = U64

xdr.ScVal

# static getType(scvType) → {string}

Convert the raw ScValType string (e.g. 'scvI128', generated by the XDR) to a type description for XdrLargeInt construction (e.g. 'i128')

Parameters:
Name Type Description
scvType string

the xdr.ScValType as a string

View Source js-stellar-base/src/numbers/xdr_large_int.js, line 247

a suitable equivalent type to construct this object

string