Architecture
The Opinion CLOB TypeScript SDK employs a hybrid architecture integrating off-chain order matching with on-chain settlement, providing access to BNB Chain prediction markets.
System Design
Core Layers
Client (client.ts)
├── API Layer → @opinion-labs/opinion-api (auto-generated OpenAPI client)
├── Chain Layer → viem
│ ├── ContractCaller → ConditionalTokens, MultiSend, ERC20, FeeManager
│ └── Safe → Gnosis Safe v1.3.0 multi-sig
└── Order Utils → EIP712 signing (viem hashTypedData)Operational Patterns
Market Data Queries
No
50-150ms (cached: <10ms)
getMarkets, getOrderbook, getLatestPrice
Order Placement
No (gas-free CLOB)
200-500ms
placeOrder, cancelOrder
Smart Contract Ops
Yes (BNB)
~3s (block confirmation)
enableTrading, split, merge, redeem
Authentication Model
A two-key security model separates signing from funding:
This architecture enables both individual traders and multi-signature wallet holders to participate seamlessly.
Token Specifications
All tokens use 18 decimal places (Wei standard)
1 USDT = 1,000,000,000,000,000,000 wei (10^18)Prices expressed as probability decimals:
"0.5"= 50% chanceValid price range:
0.01to0.99