Skip to main content

Install

npm install @x0-protocol/sdk

Peer Dependencies

The SDK requires the following Solana packages:
npm install @solana/web3.js @coral-xyz/anchor bn.js
PackageVersionPurpose
@solana/web3.js^1.87.0Solana RPC and transaction primitives
@coral-xyz/anchor^0.30.1IDL deserialization and instruction building
bn.js^5.2.0Arbitrary-precision integers for token amounts

WASM Module (Optional)

For zero-knowledge proof generation in the browser or Node.js:
npm install @x0-protocol/zk-proofs-wasm
The WASM module is loaded lazily — it’s only initialized when you call a ZK proof function. No additional configuration is needed.

TypeScript Configuration

The SDK ships with full TypeScript declarations. Recommended tsconfig.json settings:
{
  "compilerOptions": {
    "target": "ES2020",
    "module": "ESNext",
    "moduleResolution": "bundler",
    "esModuleInterop": true,
    "strict": true
  }
}

Environment Setup

import { createDevnetClient } from '@x0-protocol/sdk';

const client = createDevnetClient(wallet);

Package Exports

The SDK exports everything from a single entry point:
// All managers, types, constants, and utilities
import {
  X0Client,
  PolicyManager,
  EscrowManager,
  RegistryManager,
  ReputationManager,
  TokenClient,
  WrapperClient,
  ConfidentialClient,
  ZkVerifierClient,
  // types
  AgentPolicyConfig,
  EscrowAccount,
  AgentRegistryEntry,
  // constants
  X0_GUARD_PROGRAM_ID,
  PROTOCOL_FEE_BASIS_POINTS,
  // utilities
  calculateProtocolFee,
  deriveAgentPolicyPda,
  // ... and more
} from '@x0-protocol/sdk';
Last modified on February 8, 2026