Requirements

Requirement Version
Node.js 18.0 or later
TypeScript 5.0 or later (optional, recommended)
viem 2.0 or later (for local account and key handling)

Install the package

npm install @scribefinance/sdk

The equivalent for other package managers:

yarn add @scribefinance/sdk
pnpm add @scribefinance/sdk

TypeScript configuration

@scribefinance/sdk ships its own type definitions; no separate @types package exists or is needed. Target ES2020 or newer in tsconfig.json:

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

Environment variables

Both the agent and provider SDKs accept configuration in code, but credentials belong in the environment rather than in your source tree. The recommended setup:

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

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

privateKeyToAccount converts a raw 0x-prefixed private key into a viem local account, which is what the SDK’s signer interface expects. If your keys live with an embedded wallet provider such as Privy, Dynamic, or Turnkey, pass a compatible signer object in its place. The Agent SDK reference documents the interface.

Robinhood Chain RPC configuration

By default the SDK uses the public Robinhood Chain RPC endpoint. For production traffic, configure a dedicated RPC node:

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

Scribe Finance’s own infrastructure runs against a hosted RPC endpoint; any standard Robinhood Chain JSON-RPC endpoint works equally well.

Verify the installation

import { ScribeFinanceAgent } from "@scribefinance/sdk";

const agent = new ScribeFinanceAgent({ 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