Skip to main content
Wrap your React or Next.js app, list markets, and submit a trade with @voiz/markets-sdk/react.

Install

You also need a viem PublicClient, plus a wallet or AA sender for writes. Typical stacks use wagmi/viem for RPC and Privy (or another AA wallet) for sendCalls.

Wrap the app

Pass chainId and publicClient. Optionally override addresses, attach a walletClient, or inject custom sendCalls (Privy / smart-wallet batch).
Inject sendCalls when you use account abstraction. The provider builds a memoized VoizMarketsClient with that sender, so pool.swap, market.seed, and similar just work. You do not assemble or submit raw batches in UI code.
If you omit sendCalls but pass walletClient, the SDK falls back to sequential walletClient.sendTransaction. If you omit addresses, they resolve via getAddresses(chainId).

Use the client

useVoiz() returns { client, addresses, chainId, publicClient, walletClient?, ... } and throws outside VoizProvider.

Quote and swap

1

Pick a pool

Outcome tokens live on each MarketSummary as wrappedTokens (real outcomes first; Invalid last). Use client.pool(outcomeToken).
2

Quote exact-in

Call pool.quoteTrade for a live RPC quote. Prefer it over display prices for trade UI.
3

Swap

Pass the same side / amountIn, a slippage-aware minAmountOut, and the token-holding user (the AA smart wallet address when using Privy).

Where to go next