/** * V2 Order — EIP-712 signing and CLOB payload construction for Polymarket V2 exchange. * * V2 orders differ from V1: * - No taker, expiration, nonce, or feeRateBps fields * - New timestamp, metadata, and builder fields * - EIP-712 domain version "2" with V2 exchange addresses * - CLOB host: clob.polymarket.com * - Collateral: PolyUSD (wraps USDC.e), still 6 decimals */ import { SignatureType } from './types.js'; import type { V2OrderData, SignedV2Order, V2OrderPayload, V2NegRiskExchange, OrderType, OrderSide } from './types.js'; /** * Get the V2 exchange address for EIP-712 domain. * * Standard markets use CTF_EXCHANGE_V2. * NegRisk markets use either NEG_RISK_EXCHANGE_V2_A or NEG_RISK_EXCHANGE_V2_B. */ export declare function getV2ExchangeAddress(negRisk: boolean, negRiskVariant?: V2NegRiskExchange): string; /** * Compute makerAmount and takerAmount from price and size. * * For BUY: maker pays USDC (makerAmount), receives tokens (takerAmount) * makerAmount = price * size * 1e6 (USDC raw units) * takerAmount = size * 1e6 (token raw units) * * For SELL: maker pays tokens (makerAmount), receives USDC (takerAmount) * makerAmount = size * 1e6 (token raw units) * takerAmount = price * size * 1e6 (USDC raw units) * * Returns strings truncated to whole numbers (no decimals in raw units). */ export declare function computeV2Amounts(side: OrderSide, price: number, size: number): { makerAmount: string; takerAmount: string; }; export interface BuildV2OrderParams { /** Token ID for the outcome */ tokenId: string; /** BUY or SELL */ side: OrderSide; /** Price between 0 and 1 */ price: number; /** Size in tokens */ size: number; /** Maker address (funder/Safe for Safe wallets, EOA for EOA) */ maker: string; /** Signer address (always the EOA) */ signer: string; /** Signature type (0=EOA, 1=POLY_PROXY, 2=POLY_GNOSIS_SAFE) */ signatureType: SignatureType; /** Optional metadata bytes32 (default: zero) */ metadata?: string; /** Optional builder bytes32 (default: zero) */ builder?: string; } /** * Build an unsigned V2 order. */ export declare function buildV2Order(params: BuildV2OrderParams): V2OrderData; /** * Get the EIP-712 domain for V2 order signing. */ export declare function getV2Domain(exchangeAddress: string): { name: string; version: string; chainId: number; verifyingContract: `0x${string}`; }; /** * Sign a V2 order using a viem WalletClient (the normalized clobSigner). * * Supports: * - viem WalletClient (has signTypedData + account) * - ethers v5 Signer (has _signTypedData) * - Any signer exposed through our NormalizedSigner.clobSigner */ export declare function signV2Order(order: V2OrderData, clobSigner: any, exchangeAddress: string): Promise; /** * Build the full V2 CLOB submission payload. * * Matches @polymarket/clob-client-v2 wire format: * - adds `expiration: "0"` and `taker: "0x..."` to the order body * (not part of the signed EIP-712 hash, safe to add post-sign) * - includes `deferExec` and `postOnly` top-level fields */ export declare function buildV2Payload(signedOrder: SignedV2Order, owner: string, orderType: OrderType, opts?: { postOnly?: boolean; deferExec?: boolean; }): V2OrderPayload; //# sourceMappingURL=v2-order.d.ts.map