one-recurrr-sdk
v0.1.0
Published
SDK for One Recurrr Subscription Protocol
Maintainers
Readme
One Recurrr SDK
The official specific SDK for interacting with the One Recurrr subscription protocol.
Features
- Type-Safe: Full TypeScript support with Zod validation.
- Easy Integration: Simple API for fetching plans and managing subscriptions.
- Blockchain Ready: Built-in support for EIP-7702 delegation and smart contract interactions via
viem.
Installation
npm install @recurrr/sdk viemUsage
Public Data (No Wallet Required)
import { RecurrrSDK } from '@recurrr/sdk';
const sdk = new RecurrrSDK({
apiKey: 'YOUR_API_KEY',
chainId: 11155111 // Sepolia
});
// Get all available plans
const plans = await sdk.api.getPlans();Subscribing (Requires Wallet)
import { createWalletClient, custom } from 'viem';
import { sepolia } from 'viem/chains';
import { RecurrrSDK } from '@recurrr/sdk';
// 1. Setup Wallet Client (e.g., from generic window.ethereum)
const walletClient = createWalletClient({
chain: sepolia,
transport: custom(window.ethereum)
});
// 2. Initialize SDK with wallet
const sdk = new RecurrrSDK({
apiKey: 'YOUR_API_KEY',
chainId: 11155111
}, walletClient);
// 3. Subscribe to a plan
const txHash = await sdk.contracts.subscribe(
1n, // planId
'0xYourAddress...' // subscriber address
);