Skip to main content
npm · GitHub · No runtime dependencies · Browsers and Node 20+

Create a client

The SDK sends X-Kairos-Wallet-Api: 2, switches the wallet to each step’s chain (adding Polygon, BNB Chain or Arbitrum when the wallet doesn’t know it), and waits until held orders’ holdUntilMs. It shows one wallet prompt at a time per provider, so a concurrent call can’t switch the chain before a signature. Reads that hit a network error, 408, 429, 502, 503 or 504 are retried until timeoutMs; a lost reply after signing is read back rather than signed twice.

Trading

order takes market (a market object from kairos.markets, or venue:market_id), outcome, side, price, size, and optionally timeInForce, postOnly, clientOrderId and expiresAt (unix seconds, GTD only). See venues for each venue’s rules.

Reading

Fees (preview)

See fees.

Trade plans (preview)

Before anything is signed, run recomputes the plan hash and rebuilds every signing request, checks the venue order and any Relay funding permit the wallet will sign, and throws SafetyCheckError if the wallet, market, side, price, size, deadlines, funding or budget differ, or if maxDebitRaw is exceeded. It accepts only the server’s documented rewrites: the outcome’s canonical name (on Hyperliquid, its #<digits> coin), and Predict.fun’s session-bound GTD. run supports only Kairos-submitted funding; for client-submitted funding use prepare, answer and report. run fills in clientOrderId, the Idempotency-Key, and a tradeSubmitBefore 4 minutes out. Pass your own idempotencyKey to resume the same plan after a crash. See trade plans.

On-chain intents (preview)

Amounts are base units (6 decimals). The SDK looks up the trading wallet, sends lowercase addresses, and throws SafetyCheckError before signing if the intent doesn’t move what you asked: it recomputes the intent hash, rebuilds both signing requests, and accepts only the approval and the split, merge or redeem call on Polymarket’s own contracts. See split, merge and redeem.

Errors