@somnia-chain/markets-sdk


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

Function: floorRawBalance()

floorRawBalance(raw, decimals, quantum): number

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

Floor a raw on-chain balance to a whole multiple of quantum (a human decimal string — the market's lot size for base amounts, or a display precision like "0.01" for quote) and return it as a JS number that is provably ≤ the true balance. Flooring happens in raw (bigint) space, so float rounding can never push a "max" order above the wallet.

Parameters

raw

bigint

decimals

number

quantum

string

Returns

number