Developer SDK

Shiunex SDK

TypeScript SDK for secure registration, policy definition, and execution of AI agent intents

Installation

npm install @shiunex/sdk

Quick Start

Get started with the Shiunex SDK in minutes

Complete Example

import { ShiunexClient } from "@shiunex/sdk";

// Initialize client
const client = new ShiunexClient({
  rpcUrl: "https://api.mainnet-beta.solana.com",
  wallet: yourWallet
});

// Register a new agent
await client.registerAgent({
  agentId: "agent-alpha",
  permissions: ["swap", "stake"]
});

// Define execution policy
await client.definePolicy({
  agentId: "agent-alpha",
  maxValue: 5000,
  allowedPrograms: ["JUP", "ORCA"]
});

// Execute agent intent
await client.executeIntent({
  agentId: "agent-alpha",
  intent: {
    type: "swap",
    pair: "SOL/USDC",
    amount: 100
  }
});

API Reference

Core SDK methods and interfaces

registerAgent()

Register a new AI agent with permissions

Parameters
{ agentId: string, permissions: string[] }
Returns
Promise<{ success: boolean, agentId: string }>

definePolicy()

Define execution policy for an agent

Parameters
{ agentId: string, maxValue: number, allowedPrograms: string[] }
Returns
Promise<{ success: boolean, policyHash: string }>

executeIntent()

Submit agent intent for execution

Parameters
{ agentId: string, intent: Intent }
Returns
Promise<{ success: boolean, txHash: string }>

getAgentStatus()

Get current status of an agent

Parameters
{ agentId: string }
Returns
Promise<AgentStatus>

Usage Examples

Register Agent with Permissions

const result = await client.registerAgent({
  agentId: "trading-agent-01",
  permissions: ["swap", "stake", "lend"]
});

console.log("Agent registered:", result.agentId);

Define Complex Policy

await client.definePolicy({
  agentId: "trading-agent-01",
  constraints: {
    maxValue: 10000,
    allowedPrograms: ["JUP", "ORCA", "MARINADE"],
    rateLimit: {
      maxExecutions: 20,
      windowSeconds: 3600
    },
    timeRestrictions: {
      allowedHours: [9, 17] // Trading hours only
    }
  }
});

Execute DeFi Intent

const execution = await client.executeIntent({
  agentId: "trading-agent-01",
  intent: {
    type: "swap",
    params: {
      tokenIn: "SOL",
      tokenOut: "USDC",
      amountIn: 500,
      slippage: 0.01,
      program: "JUP"
    }
  }
});

console.log("Transaction hash:", execution.txHash);

Additional Resources

Documentation

Complete technical documentation

View Docs

GitHub

Source code and examples

View Repository

npm Package

Install via package manager

View on npm