The @oaknetwork/contracts-sdk package is a TypeScript SDK for interacting with Oak Network smart contracts. It provides a type-safe client with full read/write access to all Oak protocol contracts, built on top of viem.
Testnet firstStart by pointing the SDK at Celo Sepolia testnet (CHAIN_IDS.CELO_TESTNET_SEPOLIA) to experiment without risking real funds.
Deployed addressesYou need deployed contract addresses to use this SDK — including factory addresses (for example CampaignInfoFactory, TreasuryFactory) and any protocol contracts you call through the client. The SDK interacts with Oak Network smart contracts that must already be deployed on-chain. To get your contract addresses and sandbox environment access, contact our team at support@oaknetwork.org.
Highlights
- Flexible signers — simple keyed client, read-only RPC client, per-entity or per-call signer overrides, or full viem
PublicClient / WalletClient setup including Privy embedded wallets (see Client Configuration)
- Entity factories for every on-chain contract:
oak.globalParams(address), oak.campaignInfo(address), etc.
- Typed reads, writes, and simulations — every method is fully typed with TypeScript
- Typed error decoding —
parseContractError() turns raw revert data into SDK errors with recovery hints
- Pure utility exports — hashing, encoding, time helpers, and chain resolution with zero client dependency
- Tree-shakeable entry points — import only what you need:
@oaknetwork/contracts-sdk/utils, @oaknetwork/contracts-sdk/client, etc.
Quick example
See the full walkthrough in the Quickstart guide.
Contract entities
The SDK ships 8 contract entity modules. Call the factory method on the client to get a typed entity for a deployed contract address.
Multicall
Batch multiple read calls into a single RPC round-trip. Works across different contract entities:
See the full Multicall guide for standalone usage and cross-contract batching.
Events
Every contract entity exposes an events property for fetching historical logs, decoding raw logs, and watching live events:
See the full Events guide for all available events per contract.
Metrics
Pre-built aggregation functions that combine multiple on-chain reads into meaningful reports:
See the full Metrics guide.
Entry points
Next up
- Installation — install the package and configure your chain
- Quickstart — your first contract interaction in under 5 minutes
- Client Configuration — patterns, signer overrides, and resolution order
- Multicall — batch reads into a single RPC call
- Events — historical logs, decoding, and live event watching
- Metrics — pre-built aggregation reports
- Error Handling — typed error decoding and recovery hints