Layers
Prefer these factories over constructing market/pool/user classes yourself (they are not root package exports).
MarketSummary
MarketSummary is what you use for catalog and detail pages.
wrappedTokens (outcomes + Invalid), optional indexer outcomeStats, and image fields.
For display, prefer listMarkets, summary, and prices. Write helpers (resolve, seed, LP) load on-chain state privately when needed.
Collateral and outcomes
Each market has:- One collateral ERC-20 (
client.addresses.collateral, also viagetAddresses(chainId)) - Several outcome wrapped ERC-20s (
wrappedTokens[0..numOutcomes-1]) - An Invalid token at the end of
wrappedTokens
erc20Abi from @voiz/markets-sdk when you need approve / allowance / balanceOf outside the high-level paths.
Indexer vs RPC
listMarkets returns { markets, source: "indexer" \| "rpc", usedFallback }. Soft failures on indexer reads should drive empty UI states, not block trading.
Quote vs write: seed
There is no
client.seedMarket. Preview with quoteSeed, then send with market.seed.
Quote vs write: trade
side: "buy" is collateral → outcome; "sell" is the reverse. Apply your own slippage to minAmountOut from the quote.
Liquidity
Primary LP path ismarket.addLiquidity (split once, equal collateral share per outcome). Prefer it over any single-outcome LP helpers.
Writes and sendCalls
VoizProvider (or ClientConfig) injects sendCalls or a walletClient. High-level methods encode and submit for you.
- Custom
sendCalls— typical for Privy / AA; may receive{ requiredSigner }on admin-gated writes (e.g. resolve). - Default wallet path — sequential
sendTransactionwhen onlywalletClientis set.
client / market / pool methods. Inject sendCalls (or a walletClient) and let those methods submit for you.