strike-sdk
Rust SDK for Strike prediction markets on BNB Chain.
Installation
[]
= "0.2"
Or via cargo:
Quick Start
Read-only (no wallet)
use *;
async
Trading (with wallet)
use *;
async
Atomic Replace (cancel + place in one tx)
let new_orders = client.orders.replace.await?;
Event Subscriptions
use StreamExt;
let mut events = client.events.await?;
while let Some = events.next.await
Track an Order Through Fill / Cancel Lifecycle
For bots, treat a successful place_market() as accepted/live, not filled.
Keep the returned order_id locally and classify the final outcome from events:
OrderSettled-> filled (filled_lotsis authoritative)OrderCancelled-> explicitly cancelled / cleaned upGtcAutoCancelled-> auto-cancelled by the batch auction
Minimal example:
PRIVATE_KEY=0x...
Why local tracking matters:
OrderSettledcurrently includesorder_id,owner,filled_lots— but notmarket_idor side- bots should therefore keep local metadata keyed by returned
order_id - the SDK
nonce-managerfeature is enabled by default; use one serialized tx pipeline per wallet
API Response Format (v0.2+)
As of v0.2, the Strike indexer returns paginated envelopes for list endpoints:
The SDK handles both the new { data } envelope and the legacy { markets } format automatically — no changes needed in your code.
The get_markets() call now fetches active markets only by default (equivalent to ?status=active). To fetch all markets use the underlying indexer client directly with query params.
Market IDs matter:
market.idis retained as a backward-compatible alias of the factory market ID.market.factory_market_idis the canonical lifecycle/resolution ID.market.orderbook_market_idis the tradable ID forOrderBook.placeOrdersandreplaceOrders.orders().place_market()andorders().replace_market()fail closed if the indexer response does not includeorderbook_market_id.
Key Concepts
- LOT_SIZE = 1e16 wei ($0.01 per lot)
- Ticks are 1–99, representing $0.01–$0.99 probability
- 4-sided orderbook: Bid, Ask, SellYes, SellNo
- Order types: GoodTilBatch (GTB) expires after one batch, GoodTilCancelled (GTC) rolls forward
- Batch auctions: orders are collected into batches and cleared atomically
- All fills pay the clearing tick, not the limit tick
- Resting orders: orders >20 ticks from last clearing tick are placed on a resting list (emit
OrderRestinginstead ofOrderPlaced). The SDK tracks both automatically. - 1 YES + 1 NO = 1 USDT (always)
Features
| Feature | Default | Description |
|---|---|---|
nonce-manager |
Yes | Shared nonce management for sequential TX sends |
Disable the nonce manager if you manage nonces yourself:
= { = "0.2", = false }
Modules
| Module | Description |
|---|---|
client |
StrikeClient builder (read-only and trading modes) |
chain::orders |
placeOrders, replaceOrders, cancelOrders |
chain::vault |
USDT approval, balance queries |
chain::redeem |
Outcome token redemption |
chain::tokens |
ERC-1155 outcome token helpers |
chain::markets |
On-chain market state reads, including market_meta(factory_market_id) |
events::subscribe |
WSS event stream with auto-reconnect |
events::scan |
Historical event scanning (chunked getLogs) |
indexer |
REST client: markets, positions, trades, stats (API v1) |
nonce |
NonceSender for sequential TX sends |
Wallet Positions
Use the indexer for wallet snapshots and redeem backlog discovery:
let wallet = "0x...";
let positions = client.indexer.get_positions.await?;
println!;
let redeemable = client.indexer.get_redeemable_positions.await?;
for entry in &redeemable
The SDK normalizes evolving /positions/:address and /positions/:address/redeemable payloads into accessor-based position types, so callers do not need to chase field-name drift across indexer versions.
AI Markets
Markets with is_ai_market: true are resolved by the Flap AI Oracle instead of Pyth price feeds. The Market struct includes:
is_ai_market— whether this market uses AI resolutionai_prompt— the question sent to the LLMai_status— resolution status:pending,proposed,challenged,finalized,refunded
Checking AI Resolution
let market = client.indexer.get_market.await?;
if market.is_ai_market
AI Resolution Details
Use the indexer endpoint to fetch full resolution data including the IPFS proof:
// GET /v1/markets/{id}/ai-resolution
let resolution = client.indexer.get_ai_resolution.await?;
println!;
println!;
Coming Soon
- Python SDK
- Full API v1 query builder