Convert a planck (smallest indivisible token unit) value to a human-readable decimal string.
Substrate chains store all token amounts as integer planck values. This function
converts them to human-readable form (e.g. 10_000_000_000n → "1.0" for DOT
with 10 decimals). Trailing zeros are trimmed but at least one fractional digit
is always shown.
Parameters
planck: bigint
The raw planck value as a bigint. Must be non-negative.
decimals: number = 10
Number of decimal places for the token (default: 10 for DOT).
Returns string
A decimal string representation (e.g. "1.5", "0.0001").
Convert a planck (smallest indivisible token unit) value to a human-readable decimal string.
Substrate chains store all token amounts as integer planck values. This function converts them to human-readable form (e.g.
10_000_000_000n→"1.0"for DOT with 10 decimals). Trailing zeros are trimmed but at least one fractional digit is always shown.