import { Side } from "@polymarket/clob-client-v2"; import type { Address } from "viem"; import type { EVMWalletClient } from "../../../wallets/evm"; /** * Inputs for a single-order funding pre-flight. Mirrors the order shape * accepted by `createAndPostClobOrder` so callers can pass the same fields * unchanged before signing. */ export type AssertOrderFundingArgs = { walletClient: EVMWalletClient; ownerEOA: Address; depositWalletAddress: Address; side: Side | "BUY" | "SELL"; tokenId: string; size: number; price: number; chainId?: number; }; /** * Throws before signing/posting a Polymarket V2 CLOB order if the deposit * wallet cannot cover the maker side of the trade. * * - BUY: maker is pUSD. Required base units are `ceil(size * price * 1e6)`. * Reads pUSD `balanceOf` for the deposit wallet, and also for the owner * EOA so the thrown `InsufficientPusdError` can carry both balances and * let the CLI choose between "fund from EOA and retry" vs "top up EOA". * - SELL: maker is the conditional token (CTF ERC-1155) for `tokenId`. * Required base units are `ceil(size * 1e6)`. Reads CTF `balanceOf` for * the deposit wallet. There is no EOA fallback — CTF outcome shares only * ever live on the wallet that bought them. * * Required-amount math is a sub-cent over-approximation of the exact value * the upstream SDK signs (`@polymarket/clob-client-v2` rounds DOWN per the * tick-size config). This is the safe direction: pre-flight may surface a * false positive at ≤ 1 base unit ($0.000001) of precision, but never a * false negative. * * Resolves on success. Throws `InsufficientPusdError` / * `InsufficientCtfBalanceError` on shortfall, or * `PolymarketValidationError` on invalid inputs (non-finite or non-positive * size/price, unsupported chain). */ export declare function assertOrderFunding(args: AssertOrderFundingArgs): Promise; /** * Required pUSD in base units for a BUY at `size` shares and `price`, * rounded UP so the pre-flight never under-reports the requirement. See * `assertOrderFunding` for the precision trade-off. */ export declare function requiredPusdBaseUnits(size: number, price: number): bigint; /** * Required CTF in base units for a SELL at `size` shares. */ export declare function requiredCtfBaseUnits(size: number): bigint;