Skip to main content

Module scalars

Module scalars 

Source
Expand description

Strict decimal ↔ scaled-integer codecs.

Constants§

INT64_MAX
INT64_MIN
LEDGER_SCALE
MAX_PROTOCOL_SCALE
Maximum accepted quantity/ledger scale for public formatters and catalog hydration.
PRICE_TICK_SCALE
UINT64_MAX

Functions§

decimal_to_scaled
decimal_to_scaled_str
format_id
format_ledger_u64
Format a smaller ledger quantity integer by 10^scale.
format_ledger_u128
Format a full-width unsigned ledger integer string by 10^scale.
format_price_ticks
format_qty_scaled
format_uint64_id
Format a uint64 id as base58, or "0" when zero (order/trade ids).
i128_to_u128
Encode a non-negative scaled integer as protobuf U128 (hi/lo).
id_to_u64
Parse a public id that may be base58 or decimal.
parse_decimal_input
parse_price_ticks
parse_price_ticks_str
parse_qty_scaled
parse_qty_scaled_str
try_decimal_to_scaled
Strict decimal→scaled. Never rounds; excess fractional digits fail.
u128_to_proto
Encode a u128 as protobuf U128 (hi/lo).
u128_to_str
Format protobuf U128 hi/lo as a decimal string.
validate_protocol_scale
Validate a caller/catalog scale before padding or allocation.