Skip to main content

Function: toDisplayAmount()

function toDisplayAmount(nativeAmount, asset): string;

Defined in: packages/overcast-core/src/assets/index.ts:190

Convert a native integer amount to a whole-token (display) decimal string, exactly — e.g. 1_500_000_000n SOL (9 decimals) → "1.5".

Parameters

ParameterTypeDescription
nativeAmountbigint-
asset{ address: string; cashLike?: boolean; chain?: string; coinGeckoId?: string; decimals?: number; lastKnownPriceUsd?: number; logoUrl?: string; name?: string; rwa?: boolean; symbol?: string; volatility?: number; }-
asset.addressstringThe on-chain address (mint) that uniquely identifies the asset.
asset.cashLike?booleanWhether or not the asset can be treated similar to cash
asset.chain?stringThe chain the asset lives on.
asset.coinGeckoId?stringCoinGecko id for price lookups, e.g. usd-coin.
asset.decimals?numberNumber of decimal places in the asset's native units.
asset.lastKnownPriceUsd?numberLast known USD price, sourced best-effort from an external feed (CoinGecko). Untrusted — do not use for settlement, signing, valuation, or any value transfer. It is informational only (e.g. showing an approximate notional in a picker), may be stale, missing, or wrong, and is never part of the canonical, content-addressed asset identity. Present only once a price has actually been fetched for the asset.
asset.logoUrl?stringLogo of the coin
asset.name?stringHuman name of the asset.
asset.rwa?booleanWhether the asset is a real-world asset (RWA) — e.g. tokenized private equity — rather than a native crypto asset.
asset.symbol?stringHuman ticker, e.g. USDC.
asset.volatility?numberVolatility of the asset

Returns

string