Amounts are raw bigints
Every amount the SDK accepts or returns is abigint in the token’s smallest unit, exactly as stored on-chain:
Get decimals from the token list (
(await powfi.token.getTokenById(id)).decimals) or from pool state (state.token0Info.decimals).
Convert with NumericUtils:
@alephium/web3 also exports convertAmountWithDecimals and prettifyTokenAmount for the same job.
Basis points
Slippage is expressed in basis points (bps) as a bigint, with BPS = 10_000n:
Valid values satisfy
0n <= slippage < 10_000n. Anything else throws.
CPMM: slippage on amounts
CPMM quotes apply slippage to the amount you are not fixing:computeSwapAmount fills minimalTokenOutAmount (exact-in) or maximalTokenInAmount (exact-out). The other field is undefined.
minimalAmount divides by (1 + s) rather than multiplying by (1 − s). For 0.5% this gives 99.5025% instead of 99.5%: slightly stricter, and it keeps minimalAmount and maximalAmount exact inverses.minimalAmount applied. On the first deposit into an empty pool no slippage is applied, because the depositor sets the price.
CLMM: slippage on price
CLMM operations turn slippage into a square-root price limit. The swap stops (or the add-liquidity reverts) if the pool price would move past it:Price impact
CpmmSwapQuote.priceImpact is a percentage number (for example 0.42 means 0.42%), computed from the reserves before and after the trade. cpmm.swap refuses trades with priceImpact >= 5 (MAX_PRICE_IMPACT).
Fees
Deadlines
CPMM write methods acceptttlMinutes (default 60). The SDK converts it to a millisecond timestamp (Date.now() + ttl), and the router rejects the transaction after that time.
ALPH deposits and dust
Alephium outputs that carry tokens must hold a minimum amount of ALPH (DUST_AMOUNT), and new contracts need MINIMAL_CONTRACT_DEPOSIT. The SDK attaches the right amount of ALPH automatically. For example, a CPMM swap attaches 2–3× DUST_AMOUNT on top of the input, and creating a CPMM pool attaches 1 ALPH as the contract deposit. Budget a little extra ALPH in the sender’s balance for this and for gas.