Installation
Install and configure the Recur Protocol TypeScript SDK.
Requirements
| Requirement | Version |
|---|---|
| Node.js | 18.0 or later |
| TypeScript | 5.0 or later (optional but recommended) |
| Solana web3.js | 1.87 or later |
Install the package
npm install @recur/sdk
Or with other package managers:
yarn add @recur/sdk
pnpm add @recur/sdk
TypeScript configuration
@recur/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
RECUR_API_KEY=rk_live_...
SOLANA_NETWORK=mainnet-beta
WALLET_KEYPAIR_PATH=./wallet.json
import "dotenv/config";
import { RecurProvider } from "@recur/sdk";
import { loadKeypair } from "@recur/sdk/utils";
const recur = new RecurProvider({
wallet: loadKeypair(process.env.WALLET_KEYPAIR_PATH!),
apiKey: process.env.RECUR_API_KEY!,
network: process.env.SOLANA_NETWORK as "mainnet-beta" | "devnet",
});
The loadKeypair utility reads a standard Solana 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.
Solana RPC configuration
By default, the SDK uses the public Solana RPC endpoint. For production workloads, configure a dedicated RPC node:
const agent = new RecurAgent({
wallet: keypair,
network: "mainnet-beta",
rpcUrl: "https://your-helius-rpc-endpoint.com",
});
Recur’s own infrastructure uses Helius for RPC access. Any standard Solana JSON-RPC endpoint works.
Verifying the installation
import { RecurAgent } from "@recur/sdk";
const agent = new RecurAgent({ 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