@lelantos-org/sdk / index / formatAmount
Function: formatAmount()
ts
function formatAmount(
amount,
asset,
opts?
): string;Defined in: @lelantos-org/sdk/dist/wallet/assets/amount.d.ts:36
Circuit units → human decimal string, trailing zeros dropped. Signed amounts keep their sign.
round (default "down") applies where a unit is not a whole number of base units (a yield asset) and where maxDecimals cuts digits. symbol: true appends the asset's symbol when it carries one.
ts
formatAmount(balance.total, balance.asset, { symbol: true }); // "0.25 WETH"Parameters
| Parameter | Type |
|---|---|
amount | bigint | CircuitAmount |
asset | AssetUnits |
opts? | { maxDecimals?: number; round?: "down" | "up"; symbol?: boolean; } |
opts.maxDecimals? | number |
opts.round? | "down" | "up" |
opts.symbol? | boolean |
Returns
string