Skip to content

Helpers

Utilities from propamm/common/helpers, plus the token/venue constants and viem re-exports.

applySlippage

ts
applySlippage(amount: bigint, bps: number): bigint

Shave basis points off an amount — derive amountOutMin from a quote.

ts
import { applySlippage } from "propamm/common/helpers";

const minOut = applySlippage(amountOut, 50); // quote - 0.5%

Parameters: amount: bigint, bps: number (integer in [0, 10000]; throws RangeError otherwise). Returns bigintamount - amount * bps / 10000.

deadlineIn

ts
deadlineIn(seconds: number): bigint

Unix-timestamp deadline some seconds from now, for swap deadline params.

ts
import { deadlineIn } from "propamm/common/helpers";

const deadline = deadlineIn(300); // now + 5 min

Parameters: seconds: number. Returns bigint.

parseEther / parseUnits / formatEther / formatUnits

ts
parseEther(value: string): bigint
parseUnits(value: string, decimals: number): bigint
formatEther(value: bigint): string
formatUnits(value: bigint, decimals: number): string

viem's unit conversion, re-exported.

ts
import { parseUnits, formatUnits } from "propamm/common/helpers";

parseUnits("1.5", 6);      // 1500000n
formatUnits(1500000n, 6);  // "1.5"

Constants

ModuleExports
common/tokensETH_SENTINEL (signals native ETH), USDC, USDT, WETH
common/pammsFERMI, BEBOP, KIPSELI, PAMMS (name → address), PammName
common/chainsviem's mainnet, anvil, sepolia, Chain
common/accountsviem's privateKeyToAccount, mnemonicToAccount, Account