The viem configuration below is provided as an example. If your project already has
publicClient and walletClient (e.g. from Wagmi, RainbowKit or another library), you can use them directly; the examples in this documentation only need clients compatible with viem’s interface for readContract, simulateContract, writeContract, and waitForTransactionReceipt.Dependencies
Client helpers
Create two helpers that take a chain (fromviem/chains) so the same code works on any network. The wallet client needs a private key (e.g. from process.env.PRIVATE_KEY).
resolve, wrappedOutcome, parentMarket, numOutcomes, etc.) use marketAbi from @seer-pm/sdk: import { marketAbi } from "@seer-pm/sdk".
Usage (any chain):
- publicClient: for
readContract,simulateContract,waitForTransactionReceipt, etc. - walletClient: for
writeContract(sending transactions). - account: use
account.addresswhen callingsimulateContractwith an explicit account.
Using in the integration docs
In the rest of the integration docs we obtain clients withgetPublicClient(chain) and getWalletClient(chain, process.env.PRIVATE_KEY!). Contract addresses come from @seer-pm/sdk (e.g. getMarketFactoryAddress(chainId, collateralProfile), getRouterAddress(market), getFutarchyFactoryAddress(chainId)). Import ERC20_APPROVE_ABI from this setup module; import marketAbi from @seer-pm/sdk for market reads (wrappedOutcome, resolve, etc.). Choose any chain from viem/chains (e.g. gnosis, mainnet, base); the examples are the same for all networks.