Relayer API
Production Relayer API: https://relayer-v2.polymarket.com.
The relayer submits gas-sponsored transactions for Polymarket smart wallets. In polygolem it is used for deposit-wallet deploys and wallet batches such as trading approvals, adapter approvals, and V2 redeem calls.
Auth Modes
| Mode | Headers | Polygolem entry point | Use |
|---|---|---|---|
| Relayer API Key V2 | RELAYER_API_KEY, RELAYER_API_KEY_ADDRESS | pkg/relayer.NewV2 | Preferred relayer auth for headless onboarding |
| Legacy builder HMAC | POLY_BUILDER_API_KEY, POLY_BUILDER_TIMESTAMP, POLY_BUILDER_PASSPHRASE, POLY_BUILDER_SIGNATURE | pkg/relayer.New | Compatibility path |
| SIWE cookies | Browser/session cookies | internal/relayer.MintV2APIKey | Only for minting a V2 relayer API key |
Relayer credentials are not CLOB L2 credentials. They cannot place orders, cancel orders, or read authenticated CLOB account data.
REST Mapping
| Polygolem method | REST path | Auth | Notes |
|---|---|---|---|
MintV2APIKey | POST /relayer/api/auth | SIWE session cookies | Mints { apiKey, address, createdAt } for relayer header auth |
SubmitWalletCreate | POST /submit | Relayer API key or builder HMAC | Body type WALLET-CREATE; deploys a deposit wallet through DepositWalletFactory |
SubmitWalletBatch | POST /submit | Relayer API key or builder HMAC | Body type WALLET; submits a signed deposit-wallet batch |
GetNonce | GET /nonce?address=owner_address&type=WALLET | Relayer API key or builder HMAC | Current WALLET nonce for the owner |
GetTransaction | GET /transaction?id=tx_id | Relayer API key or builder HMAC | Polls a single relayer transaction; polygolem accepts object or array responses |
PollTransaction | GET /transaction?id=tx_id loop | Relayer API key or builder HMAC | Stops on terminal relayer states |
IsDeployed | GET /deployed?address=owner_address | Relayer API key or builder HMAC | Relayer/indexer deployment view, not chain truth |
| Not wrapped | GET /transactions | Relayer API key or builder HMAC | Upstream recent-transaction list |
| Not wrapped | `GET /relay-payload?address=owner_address&type=SAFE | PROXY` | Public |
| Not wrapped | GET /relayer/api/keys | Gamma auth or relayer API key | Lists relayer API keys when account auth allows it |
Deposit-Wallet Transaction Flow
- Derive the deterministic deposit wallet address locally from the owner EOA.
- Check
GET /deployed?address=owner_addressfor the relayer/indexer view. - Check Polygon
eth_getCode(deposit_wallet); bytecode wins for CLOB POLY_1271 readiness. - Submit
WALLET-CREATEthroughPOST /submitif no code exists. - Fetch
GET /nonce?address=owner_address&type=WALLET. - Sign an EIP-712 deposit-wallet batch with the owner EOA.
- Submit the signed
WALLETbatch throughPOST /submit. - Poll
GET /transaction?id=tx_iduntilSTATE_CONFIRMEDor another terminal state.
Transaction Types
| Type | Polygolem status | Purpose |
|---|---|---|
WALLET-CREATE | Supported | Deploy a deposit wallet |
WALLET | Supported | Execute deposit-wallet calls through the factory |
SAFE | Not a deposit-wallet flow | Legacy smart wallet transaction type |
PROXY | Not a deposit-wallet flow | Legacy proxy wallet transaction type |
Safety Boundaries
- A relayer transaction is gas-sponsored, but still executes against Polygon contracts. Treat submitted calldata as live money movement.
DepositWalletFactory.deployandDepositWalletFactory.proxyare operator-gated. Direct EOA calls are not a safe fallback.- If
/deployedis false but Polygon bytecode exists at the derived deposit wallet, the wallet is deployed for CLOB POLY_1271 order validation. - If the relayer rejects a WALLET batch as not allowlisted, verify the target contracts against the current Polymarket contract registry before retrying.