Builder Mode
Build your own trading terminal on top of Opinion's prediction market with non-custodial user management and 2,000 free gasless transactions per day.
To request Builder access, Please kindly fill out this short application form .
Overview
Builder mode lets platforms manage user sub-accounts and place orders on behalf of users. Users retain control of their funds through Gnosis Safe wallets and sign all operations with their own keys.
Architecture
┌──────────────┐ ┌──────────────────┐ ┌────────────┐
│ Your App │ │ Opinion Backend │ │ BNB Chain │
│ (Builder) │────>│ (API + Relayer) │────>│ (On-chain) │
│ │ │ │ │ │
│ BuilderClient │ - Order matching │ │ - Safe │
│ + UserClient│<────│ - TX relay │<────│ - CTF │
│ │ │ - Safe creation │ │ - ERC20 │
└──────────────┘ └──────────────────┘ └────────────┘Three wallets involved:
EOA (signer)
Signs orders and Safe transactions
User (private key)
Safe (asset wallet)
Holds funds, executes trades
Multi-sig (EOA is owner)
Builder API key
Authenticates builder API calls
Builder (your server)
Quick Start
Configuration
host
string
Yes
API host URL
builderApiKey
string
Yes
Builder API key (uses builder-apikey header)
chainId
number
Yes
Blockchain chain ID (56 for BNB Chain)
rpcUrl
string
No
RPC endpoint URL (required for Safe operations)
proxyUrl
string
No
HTTP proxy URL for API requests
useBeta
boolean
No
Use beta/testnet addresses (default: false)
contractAddresses
object
No
Override specific contract addresses
quoteTokensCacheTtl
number
No
Cache TTL for quote tokens in seconds (default: 3600)
marketCacheTtl
number
No
Cache TTL for market data in seconds (default: 300)
API Reference
User Management
Create User -- register a sub-account and get an API key
Get User / Regenerate API Key -- query user info or regenerate credentials
Market Data
Get Quote Tokens -- list supported currencies
Get Market / Orderbook -- query market details and orderbook depth
Trading
Build Order -- build an EIP-712 order structure for signing
Place Order -- submit a signed order on behalf of a user
Cancel / Manage Orders -- cancel orders and query order history
On-chain Operations
Enable Trading -- one-time approval setup via Safe transaction
Split / Merge / Redeem / Withdraw -- token operations via Safe transactions
Testing
UserClient -- test wallet helper for signing
Error Handling
Signature Types
EOA
0
Direct EOA signature (maker == signer)
POLY_GNOSIS_SAFE
2
Gnosis Safe signature (maker != signer)
The signature type is automatically determined based on whether signerAddress differs from userWalletAddress in buildOrderForSigning().
Last updated