Installation
Install and configure the Cross Protocol TypeScript SDK.
Requirements
| Requirement | Version |
|---|---|
| Node.js | 18.0 or later |
| TypeScript | 5.0 or later (optional but recommended) |
| Robinhood Chain web3.js | 1.87 or later |
Install the package
npm install @crossprotocolorg/sdk
Or with other package managers:
yarn add @crossprotocolorg/sdk
pnpm add @crossprotocolorg/sdk
TypeScript configuration
@crossprotocolorg/sdk ships its own type definitions. No additional @types packages are needed. Your tsconfig.json should target ES2020 or later:
{
"compilerOptions": {
"target": "ES2020",
"module": "CommonJS",
"moduleResolution": "bundler",
"strict": true,
"esModuleInterop": true
}
}
Environment variables
Both the agent and provider SDK accept configuration directly in code, but using environment variables keeps credentials out of source. The recommended setup:
# .env
CROSS_API_KEY=rk_live_...
CHAIN_NETWORK=mainnet
WALLET_KEYPAIR_PATH=./wallet.json
import "dotenv/config";
import { CrossProvider } from "@crossprotocolorg/sdk";
import { loadKeypair } from "@crossprotocolorg/sdk/utils";
const cross = new CrossProvider({
wallet: loadKeypair(process.env.WALLET_KEYPAIR_PATH!),
apiKey: process.env.CROSS_API_KEY!,
network: process.env.CHAIN_NETWORK as "mainnet" | "devnet",
});
The loadKeypair utility reads a standard Robinhood Chain JSON keypair file. If you use an embedded wallet provider (Privy, Dynamic, Turnkey), you can pass a compatible signer object instead; see Agent SDK for details.
Robinhood Chain RPC configuration
By default, the SDK uses the public Robinhood Chain RPC endpoint. For production workloads, configure a dedicated RPC node:
const agent = new CrossAgent({
wallet: keypair,
network: "mainnet",
rpcUrl: "https://rpc.robinhoodchain.com",
});
Cross’s own infrastructure uses a hosted RPC endpoint. Any standard Robinhood Chain JSON-RPC endpoint works.
Verifying the installation
import { CrossAgent } from "@crossprotocolorg/sdk";
const agent = new CrossAgent({ wallet: keypair, network: "devnet" });
const info = await agent.getInfo();
console.log(info.version); // e.g. "0.1.0"
console.log(info.network); // "devnet"
Next steps
- Follow the Quickstart to make your first payment
- See the full Agent SDK or Provider SDK reference