Requirements

Requirement Version
Node.js 18.0 or newer
TypeScript 5.0 or newer (optional but recommended)
viem 2.0 or newer (handles local accounts and keys)

Install the package

npm install @opusprotocol/sdk

With yarn or pnpm instead:

yarn add @opusprotocol/sdk
pnpm add @opusprotocol/sdk

TypeScript settings

Type definitions come bundled with @opusprotocol/sdk, so there is no @types package to install. Set the target in tsconfig.json to ES2020 or later:

{
  "compilerOptions": {
    "target": "ES2020",
    "module": "CommonJS",
    "moduleResolution": "bundler",
    "strict": true,
    "esModuleInterop": true
  }
}

Environment variables

You can configure the agent and provider SDKs directly in code, but credentials should live in the environment, not in your source tree. Here is the recommended layout:

# .env
OPUSPROTOCOL_API_KEY=rk_live_...
CHAIN_NETWORK=mainnet
WALLET_PRIVATE_KEY=0x... # keep this out of version control
import "dotenv/config";
import { OpusProtocolProvider } from "@opusprotocol/sdk";
import { privateKeyToAccount } from "viem/accounts";

const opusprotocol = new OpusProtocolProvider({
  wallet: privateKeyToAccount(process.env.WALLET_PRIVATE_KEY as `0x${string}`),
  apiKey: process.env.OPUSPROTOCOL_API_KEY!,
  network: process.env.CHAIN_NETWORK as "mainnet" | "testnet",
});

privateKeyToAccount takes a raw 0x-prefixed private key and produces a viem local account, the shape the SDK’s signer interface expects. If an embedded wallet provider (Privy, Dynamic, or Turnkey, for example) holds your keys, supply a compatible signer object instead. The interface is described in the Agent SDK reference.

Configuring the Robinhood Chain RPC

Out of the box, the SDK uses the public RPC endpoint for Robinhood Chain. For production workloads, point it at a dedicated RPC node:

const agent = new OpusProtocolAgent({
  wallet: account,
  network: "mainnet",
  rpcUrl: "https://rpc.mainnet.chain.robinhood.com",
});

Opus Protocol runs its own infrastructure against a hosted RPC endpoint, but any standard Robinhood Chain JSON-RPC endpoint will do.

Check that it works

Run a short script to confirm the SDK loads and can reach the network:

import { OpusProtocolAgent } from "@opusprotocol/sdk";

const agent = new OpusProtocolAgent({ wallet: account, network: "testnet" });
const info = await agent.getInfo();

console.log(info.version);  // e.g. "0.1.0"
console.log(info.network);  // "testnet"

Next steps