Skip to main content

Installation

The @oaknetwork/contracts package is published on npm. Install it with your preferred package manager.

pnpm add @oaknetwork/contracts

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

Requirements

  • @oaknetwork/contracts >= 1.0.0
  • Node.js 18 or later
  • TypeScript 5.x recommended (the SDK ships type declarations)

The SDK depends on viem for blockchain interactions. It is included as a dependency — you do not need to install it separately.

Supported chains

The SDK ships a CHAIN_IDS constant with all supported networks:

import { CHAIN_IDS } from '@oaknetwork/contracts';

CHAIN_IDS.ETHEREUM_MAINNET; // 1
CHAIN_IDS.CELO_MAINNET; // 42220
CHAIN_IDS.ETHEREUM_TESTNET_SEPOLIA; // 11155111
CHAIN_IDS.ETHEREUM_TESTNET_GOERLI; // 5
CHAIN_IDS.CELO_TESTNET_SEPOLIA; // 11142220
ChainChain IDUse for
Celo Sepolia11142220Testnet development and integration testing
Celo Mainnet42220Production deployments
Ethereum Sepolia11155111Testnet development on Ethereum
Ethereum Mainnet1Production deployments on Ethereum
Ethereum Goerli5Legacy testnet (deprecated)
Start with testnet

Use CHAIN_IDS.CELO_TESTNET_SEPOLIA for development. You can get testnet tokens from the Celo faucet.

Environment variables

Store your private key in an environment variable — never hardcode it.

PRIVATE_KEY=0x...your-private-key
RPC_URL=https://forno.celo-sepolia.celo-testnet.org
VariableRequiredDescription
PRIVATE_KEYYes0x-prefixed private key for the signer account
RPC_URLYesRPC endpoint for the target chain

Install dotenv if you want to load variables from a .env file: pnpm add dotenv. Then add import 'dotenv/config' at the top of your entry file.