@somnia-chain/markets-sdk


@somnia-chain/markets-sdk / index / balanceFloor

Function: balanceFloor()

balanceFloor(raw, decimals?): number

Defined in: packages/sdk/src/units.ts:355

Convert a raw balance to the largest JS number that does not exceed it — full token precision, no lot/display quantum. Number(formatUnits(raw)) rounds to nearest, so on high-precision balances it can land a ULP above the true value; this nudges the result down until it round-trips back to ≤ raw. Size "max" orders against this, never against a nearest-rounded conversion — a max that exceeds the wallet by one ULP is an on-chain "insufficient balance" revert.

Parameters

raw

bigint

decimals?

number = Store.DECIMALS

Returns

number