Decentralized perps and options exchange running on Polynomial Chain (its own OP-Stack rollup). Pool-based AMM that upgrades to an orderbook as a market deepens, with cross-margin by default and gasless trading.
- 01perps + options under one cross-margin account
- 02gasless trading UIs
- 03structured-vault / yield-on-options apps
- 04frontends that want to abstract gas and bridging
- 05Synthetix-v3-powered backends with Polynomial UX
- pnpm add viem @polynomialfi/sdk
| Variable | Scope | Description |
|---|---|---|
| NEXT_PUBLIC_POLYNOMIAL_RPC | Client | Polynomial Chain RPC (e.g. https://rpc.polynomial.fi). |
| POLYNOMIAL_API_URL | Client | Off-chain trading API base URL (mainnet vs testnet). |
| POLYNOMIAL_API_KEY | Server | Optional API key for elevated rate limits on the trading API. |
Use the Polynomial trade API with viem for signing. Authenticate the user with an EIP-712 `Login` message, then place orders via `POST /v1/orders` with `{ marketId, sizeDelta, acceptablePrice, orderType: 'market'|'limit', reduceOnly }`. Stream fills, mark prices and book over WebSocket at `wss://api.polynomial.fi/ws`. Polynomial Chain is an OP-Stack L2 — bridge USDC in via the canonical bridge or Socket and trade gas-free (the protocol sponsors gas via paymaster).
- ⚑Polynomial Chain is its own OP-Stack rollup — bridge withdrawals to Ethereum follow the standard 7-day challenge window unless you use a fast-bridge partner.
- ⚑Gasless trading is implemented via a paymaster: orders are signed off-chain and relayed by Polynomial. If the paymaster is paused or your account is rate-limited, you must fall back to direct on-chain calls (which require ETH on Polynomial Chain).
- ⚑Markets transition from AMM to orderbook automatically as TVL/volume thresholds are hit — order behavior (slippage, partial fills) can change between modes; always read the live `marketMode` field.
- ⚑Funding is paid every block on perps and is netted into account equity, NOT margin. Your `availableMargin` already reflects it — don't double-count.
- ⚑Liquidations route through the on-chain risk engine (Synthetix-v3-derived for some markets). Maintenance margin per market differs from initial margin and may include an oracle-deviation buffer.
- ⚑Testnet and mainnet have different chain IDs and bridge contracts — switch network configs explicitly; the SDK does not auto-detect from the signer's connected chain.