SDK Guide
Official JavaScript/TypeScript and Rust SDKs for seamless integration
AUTONEX provides official SDKs for JavaScript/TypeScript and Rust, enabling seamless integration with existing agent frameworks and blockchain applications.
Available SDKs
JavaScript/TypeScript SDK
Full-featured SDK for Node.js and browser environments
npm install @autonex/sdk-jsRust SDK
Native Rust implementation for high-performance applications
autonex-sdk = "0.1.0"Core Features
Intent Builder
Fluent API for constructing agent intents
Policy Builder
Programmatic policy configuration
Simulation API
Dry-run execution before committing on-chain
Receipt Decoder
Parse and validate execution receipts
Event Streaming
Real-time updates on execution status
JavaScript Example
import { AutonexClient, Intent } from '@autonex/sdk-js'
// Initialize client
const client = new AutonexClient({
rpcUrl: process.env.SOLANA_RPC_URL,
agentKeypair: loadKeypair(),
policySet: 'trading-agent-policy'
})
// Build intent
const intent = new Intent.Swap({
from: { token: 'SOL', amount: 5 },
to: { token: 'USDC' },
maxSlippage: 0.02
})
// Submit and wait for execution
const receipt = await client.execute(intent)
console.log('Transaction:', receipt.signature)Rust Example
use autonex_sdk::{Client, Intent, SwapParams};
// Initialize client
let client = Client::new(
rpc_url,
agent_keypair,
"trading-agent-policy"
)?;
// Build intent
let intent = Intent::Swap(SwapParams {
from: Token::SOL,
amount: 5_000_000_000, // lamports
to: Token::USDC,
max_slippage_bps: 200,
});
// Execute
let receipt = client.execute(intent).await?;
println!("Transaction: {}", receipt.signature);