viem, socket.io-client, and fetch. No auth, no API keys.
1. Fetch network config
TypeScript
chancePool and usdg from this query — never hardcode addresses. See Networks & contracts.
2. Approve USDG
TypeScript
3. Place a bet
Read the live epoch id, then place. A 2× Strike as the simplest example:TypeScript
betId is returned by the call and indexed on the BetPlaced event. Check Bet constraints before quoting multiples, and Placing bets for Range / Ladder args.
4. Get the result and proof
Preferred (realtime): subscribe over Socket.IO and wait forbets:update.
TypeScript
betResult.
GraphQL
proof: null means proving is unavailable for that bet — wait for the epoch seed reveal and use plain claim instead. See Results & proofs.
5. Claim with proof
TypeScript
claimWithProof settles the pending bet from the proof and claims in one transaction. If the bet lost, the call settles it and returns without reverting.
Next steps
- Integrate — modes, history, claiming details
- API reference — exact GraphQL + Socket payloads
- Protocol — constraints and provably fair