Skip to content

@lelantos-org/sdk / index / parseAmount

Function: parseAmount() โ€‹

ts
function parseAmount(value, asset): CircuitAmount;

Defined in: @lelantos-org/sdk/dist/wallet/assets.d.ts:60

Human decimal string โ†’ circuit units, ready to pass as amount.

ts
const weth = await wallet.asset(1n);
await wallet.deposit({ asset: weth.id, amount: parseAmount("0.25", weth) });

Parameters โ€‹

ParameterType
valuestring | number | bigint
assetAssetInfo

Returns โ€‹

CircuitAmount

Throws โ€‹

when the value is finer-grained than one circuit unit.

Throws โ€‹

when the chain adapter resolved no decimals.

Lelantosno cookies ๐Ÿช ยท no tracking ๐Ÿ‘๏ธ ยท no accounts ๐Ÿ‘คwalletexplorer4536080GitHub