Quickstart
Install SDK
npm install @rinnai/sdk # or pnpm add @rinnai/sdk
Initialize Client
import { RinnaiClient } from '@rinnai/sdk';
const client = new RinnaiClient({
cluster: 'devnet',
commitment: 'confirmed'
});Define Intent
const intent = defineIntent({
goal: 'Swap 10 SOL to USDC',
constraints: {
maxSlippage: 0.5,
timeout: '1h'
}
});Execute
const policy = attachPolicy(intent, {
maxSpend: 10,
allowedPrograms: ['Jupiter']
});
const result = await client.submitExecution(policy);API Reference
Core SDK methods and utilities
defineIntent(config)Create structured intent from user goals and constraints
IntentattachPolicy(intent, rules)Attach policy constraints to an intent for validation
PolicyIntentsimulatePlan(policy)Simulate execution plan without submitting to blockchain
Promise<Plan>submitExecution(policy)Submit signed execution request to on-chain program
Promise<Result>createAutomation(policy)Create recurring automation with specified schedule
Promise<Automation>getExecutionHistory()Retrieve complete execution history with audit trail
Promise<History[]>Example Integrations
Jupiter Swap Automation
Automated token swaps with price conditions
const swapIntent = defineIntent({
action: 'swap',
from: { token: 'SOL', amount: 10 },
to: { token: 'USDC' },
condition: { price: { gte: 150 } }
});
const policy = attachPolicy(swapIntent, {
maxSlippage: 0.5,
allowedPrograms: ['Jupiter']
});
await client.submitExecution(policy);Architecture for Builders
Understand how RINNAI components work together
Policy DSL
Domain-specific language for defining execution constraints. Supports spending limits, program allowlists, time windows, and custom validation rules.
policy {
maxSpend: 100 SOL
programs: [Jupiter, Raydium]
slippage: 0.5%
timeWindow: 1h
}Webhooks & Events
Subscribe to execution events for real-time notifications. Supports success, failure, and policy violation events.
client.on('execution:success', (event) => {
console.log('Executed:', event);
});