Key Benefits
- Builder attribution: Orders routed through Dome’s builder for better execution
- No signature popups: After initial setup, no wallet signatures needed per order
- Wallet flexibility: Supports Privy embedded wallets and external wallets (MetaMask, Rabby)
Prerequisites
Before using the Order Router, you need:- A Dome API key from dashboard.domeapi.io
- The
@dome-api/sdkpackage installed - A wallet provider (Privy for embedded wallets, or any EVM wallet for external wallets)
- USDC.e funded on Polygon for your users’ wallets
Installation
Quick Start
1. Initialize the Router
2. Create a Signer
For Privy embedded wallets:RouterSigner interface:
3. Link User (One-Time Setup)
Link the user to Polymarket to create CLOB API credentials. This requires one wallet signature.4. Place Orders
Once linked, place orders without additional wallet signatures:Order Flow
REST Endpoint
The SDK uses the following REST endpoint under the hood. You can also call it directly if you’re not using the TypeScript SDK.POST /polymarket/placeOrder
Endpoint: https://api.domeapi.io/v1/polymarket/placeOrder
Headers:
LIVE- Order is on the orderbookMATCHED- Order was filled immediatelyDELAYED- Order is being processed
SDK Reference
PolymarketRouter
Initialize the router with your configuration:
linkUser(params)
Creates Polymarket CLOB API credentials. Returns credentials that should be stored in your database.
Returns:
PolymarketCredentials for EOA wallets, or SafeLinkResult for Safe wallets.
placeOrder(params, credentials?)
Places an order on Polymarket via Dome server.
Returns: Order result with status and transaction hashes.
setCredentials(userId, credentials)
Manually set credentials loaded from your database:
getCredentials(userId)
Get stored credentials from memory:
Order Types
For copy trading or instant confirmation, use
FOK or FAK:
Wallet Types
EOA Wallets (Privy Embedded)
For Privy-managed embedded wallets:Safe Wallets (External - MetaMask, Rabby)
For external wallets, the router deploys a Safe smart account:Credential Storage
Store credentials securely in your database after the initiallinkUser call:
Error Handling
Environment Variables
FAQ
Q: Do I need a Dome API key? Yes, forplaceOrder(). Get one at domeapi.io or contact support.
Q: Where do I store credentials?
In your own database. Encrypt apiSecret and apiPassphrase at rest.
Q: Why use Dome server instead of direct CLOB?
Geo-unrestricted access, builder attribution for better execution, and observability.
Q: What’s the minimum order size?
0.01 = $1).
Q: How do I find market IDs (token IDs)?
Browse markets at polymarket.com or use the Dome API markets endpoint.
Need Help?
- Email: support@domeapi.com
- Discord: Join our community
- SDKs: TypeScript | Python