Skip to main content

Function: amountLE()

function amountLE(n): Uint8Array;

Defined in: packages/overcast-core/src/serialization.ts:97

A token amount as a 256-bit little-endian word.

Amounts are the one field group widened past their native width — the option hash is a cross-chain format, so chains whose token amounts are 256-bit must be able to reproduce these bytes. Mirrors write_amount in serialization.rs and Serialization.sol; every other number keeps its native width.

The full 256 bits are written, not just a u64 in the low 8 bytes. Solana can only ever put a u64 there, so for a Solana amount this is byte-identical to what serialization.rs writes — but an EVM amount routinely exceeds u64::MAX (it is only ~18.4 tokens at 18 decimals), and the ERC-20 side hashes all 32 bytes of it. Anything past uint256 throws rather than wrapping: a truncated amount would hash to an id no chain agrees with, and fail far from its origin.

Parameters

ParameterType
nbigint

Returns

Uint8Array