Skip to main content
Client factories, where data comes from, and which methods quote vs submit.

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.
It includes name, outcomes, resolver metadata, resolution state, 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 via getAddresses(chainId))
  • Several outcome wrapped ERC-20s (wrappedTokens[0..numOutcomes-1])
  • An Invalid token at the end of wrappedTokens
Trades and pool quotes are always against one outcome token ↔ collateral. Seeding and across-outcome LP split a complete set once, then act per outcome. Use 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.
Display prices can be slightly stale (~indexer cadence). Trade quotes must stay live via pool.quoteTrade.

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 is market.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 sendTransaction when only walletClient is set.
Keep UI on client / market / pool methods. Inject sendCalls (or a walletClient) and let those methods submit for you.