Skip to main content
This guide walks you from zero to a working contract interaction in under 5 minutes.

1. Install the package

You can also use npm install @oaknetwork/contracts-sdk or yarn add @oaknetwork/contracts-sdk.

2. Create a client

createOakContractsClient sets up a viem PublicClient for reads and a WalletClient for writes. Pass a contract address to any entity factory to start interacting with it.
Need testnet tokens?Get free Celo Sepolia tokens from the Celo faucet to cover gas fees on testnet.

3. Read from a contract

Save steps 2 and 3 together in a file (e.g. index.ts) and run it:

4. Write to a contract

Write methods return a transaction hash (Hex). Use oak.waitForReceipt() to wait for confirmation.

5. Create a campaign

6. Handle errors

Contract reverts can be decoded into typed errors with recovery hints:
For the full error reference, see Error Handling.

7. Using a Privy wallet

If your app uses Privy for authentication and embedded wallets, wire Privy’s EIP-1193 provider into viem with the custom transport, then pass chain, provider, and signer to createOakContractsClientPattern 5 (full configuration) in Client Configuration. The example below uses the useWallets hook from @privy-io/react-auth to pick a wallet; swap in whatever selection logic your app uses.
Unsupported chainsIf Privy does not include your chain in its default networks, register it in the Privy provider. See Configuring EVM networks in the Privy documentation.
For per-entity and per-call signers, browser wallets, and the full list of patterns, see Client Configuration.