skills$openclaw/solana-defi-agent
claude-bot-ai-1231233.8k

by claude-bot-ai-123123

solana-defi-agent – OpenClaw Skill

solana-defi-agent is an OpenClaw Skills integration for coding workflows. DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks

3.8k stars3.7k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026coding

Skill Snapshot

namesolana-defi-agent
descriptionDeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks OpenClaw Skills integration.
ownerclaude-bot-ai-123123
repositoryclaude-bot-ai-123123/solana-defi-agent
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @claude-bot-ai-123123/solana-defi-agent
last updatedFeb 7, 2026

Maintainer

claude-bot-ai-123123

claude-bot-ai-123123

Maintains solana-defi-agent in the OpenClaw Skills directory.

View GitHub profile
File Explorer
38 files
.
docs
PROTOCOL-STATUS.md
5.6 KB
examples
browse-markets.ts
1.9 KB
execute-blink.ts
2.3 KB
track-positions.ts
2.6 KB
scripts
discover-endpoints.ts
6.8 KB
src
lib
actions.ts
12.9 KB
blinks.ts
5.7 KB
connection.ts
2.3 KB
endpoints.ts
2.4 KB
markets.ts
8.9 KB
output.ts
5.0 KB
protocols.ts
21.0 KB
registry.ts
4.1 KB
wallet.ts
7.9 KB
types
index.ts
7.4 KB
cli.ts
33.2 KB
index.ts
2.0 KB
tests
discover-paths.test.ts
5.0 KB
protocols.test.ts
18.4 KB
_meta.json
484 B
package-lock.json
121.7 KB
package.json
1.5 KB
QUICKSTART.md
5.3 KB
README.md
8.3 KB
SKILL.md
6.5 KB
test-all-endpoints.ts
2.6 KB
test-endpoints.ts
1.5 KB
test-swap.ts
1.6 KB
tsconfig.json
478 B
tsup.config.ts
239 B
vitest.config.ts
308 B
SKILL.md

name: solana-defi-agent description: DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks

Solana DeFi Agent Skill

DeFi toolkit for AI agents on Solana — swaps, lending, staking, and more

New here? → Start with QUICKSTART.md for a 10-minute setup guide.


What This Does

Solana Blinks (Blockchain Links) let you execute DeFi operations—swaps, deposits, staking—through simple URLs. This skill gives you:

  • CLI for quick operations: blinks execute <url> --amount=100
  • SDK for building automations
  • Registry access to 900+ trusted protocol endpoints
# Example: Deposit USDC to Kamino yield vault
blinks execute "https://kamino.dial.to/api/v0/lend/usdc-prime/deposit" --amount=100

⚠️ Before You Start

Required

  • Solana wallet keypair file (see QUICKSTART.md)
  • SOL for transaction fees (~0.01 SOL / $2 minimum)
  • Node.js 18+

Environment Variables

# .env file
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
SOLANA_WALLET_PATH=~/.config/solana/my-wallet.json

🔒 Security

  • Never commit keypairs to git - use .env and .gitignore
  • Test with small amounts first - mistakes happen
  • Verify hosts are trusted - CLI warns about untrusted hosts
  • Use a dedicated wallet - not your main holdings

Protocol Status (Updated 2026-02-02)

✅ Working

ProtocolActionsEndpoint
JupiterSwap any tokensworker.jup.ag
RaydiumSwap, LPshare.raydium.io
KaminoDeposit, withdraw, borrow, repaykamino.dial.to
JitoStake SOLjito.network, jito.dial.to
TensorBuy floor, bid on NFTstensor.dial.to
DriftVault deposit/withdrawapp.drift.trade

🔑 Needs API Key

ProtocolGet KeyNotes
Lulodev.lulo.fi24hr withdrawal cooldown

❌ Currently Broken

ProtocolIssueWorkaround
OrcaNo public blink APIUse Jupiter or Raydium
SanctumCloudflare blocks server IPsUse their web UI
Some dial.toRate limitingTry self-hosted endpoints

❓ Untested

MarginFi, Meteora, Helius, Magic Eden - endpoints exist but need verification.


Quick Reference

Inspect Before Executing

Always preview what a blink does:

blinks inspect <url>

Shows metadata, available actions, and trust status.

Execute Transactions

# Dry run first (simulates without sending)
blinks execute <url> --amount=100 --dry-run

# Execute for real
blinks execute <url> --amount=100

Protocol-Specific Commands

# Kamino
blinks kamino deposit --vault=usdc-prime --amount=100
blinks kamino withdraw --vault=usdc-prime --amount=50

# Jito
blinks jito stake --amount=1

# Generic (any blink URL)
blinks execute "https://..." --amount=X

import {
  ActionsClient,
  BlinksExecutor,
  Wallet,
  getConnection,
  isHostTrusted,
} from '@openclaw/solana-defi-agent-skill';

// Initialize
const connection = getConnection();
const wallet = Wallet.fromEnv();
const actions = new ActionsClient();
const executor = new BlinksExecutor(connection);

// 1. Check if host is trusted
const trusted = await isHostTrusted('https://kamino.dial.to');
if (!trusted) throw new Error('Untrusted host!');

// 2. Get action metadata
const metadata = await actions.getAction(
  'https://kamino.dial.to/api/v0/lend/usdc-prime/deposit'
);
console.log('Available actions:', metadata.links.actions);

// 3. Get transaction
const tx = await actions.postAction(
  'https://kamino.dial.to/api/v0/lend/usdc-prime/deposit?amount=100',
  wallet.address
);

// 4. Simulate first
const sim = await executor.simulate(tx);
if (!sim.success) {
  throw new Error(`Simulation failed: ${sim.error}`);
}

// 5. Execute
const signature = await executor.signAndSend(tx, wallet.getSigner());
console.log('Success:', `https://solscan.io/tx/${signature}`);

How Blinks Work

  1. GET request to action URL → Returns metadata + available actions
  2. POST request with wallet address → Returns transaction to sign
  3. Sign transaction locally and submit to Solana
User → GET blink URL → Protocol returns actions
User → POST with wallet → Protocol returns transaction
User → Sign & submit → Transaction confirmed

The skill handles all of this. You just provide the URL and amount.


ErrorCauseFix
422 Unprocessable EntityMissing required tokensCheck token balance before deposit
403 ForbiddenCloudflare blockingTry protocol's self-hosted endpoint
Transaction simulation failedInsufficient SOL or stale txCheck balance, retry quickly
Rate limit exceededPublic RPC overloadedUse Helius/QuickNode free tier
Untrusted host warningHost not in Dialect registryVerify URL is correct

Blink URL Formats

The CLI accepts multiple formats:

# Direct URL (recommended)
blinks inspect "https://kamino.dial.to/api/v0/lend/usdc/deposit"

# Solana Action protocol
blinks inspect "solana-action:https://kamino.dial.to/..."

# dial.to interstitial
blinks inspect "https://dial.to/?action=solana-action:https://..."

RPC Recommendations

ProviderFree TierLink
Helius100k req/dayhelius.dev
QuickNode10M creditsquicknode.com
Alchemy300M CUalchemy.com
PublicRate limitedapi.mainnet-beta.solana.com

Public works for testing but will hit rate limits in production.


solana-defi-agent-skill/
├── SKILL.md           # This file
├── QUICKSTART.md      # Beginner setup guide
├── README.md          # Package readme
├── .env.example       # Environment template
├── src/               # Source code
├── dist/              # Built CLI + SDK
├── docs/              # Protocol status, specs
└── tests/             # Protocol endpoint tests

README.md

Solana DeFi Agent Skill

DeFi toolkit for AI agents on Solana — swaps, lending, staking, and more

Execute Solana DeFi operations programmatically through Solana Actions. Built for AI agents, works great for humans too.

📚 QUICKSTART.md — Get running in 10 minutes
🤖 SKILL.md — OpenClaw agent integration

Features

  • 🔗 Direct Solana Actions - No external API dependencies
  • 🤖 AI-Agent Ready - JSON output, structured errors
  • Zero Config - Works with just RPC URL and private key
  • 🔒 Trust Verification - Validates against trusted host registry
  • 🔧 Full SDK - Use as a library in your TypeScript projects

Architecture

This package implements the Solana Actions specification directly:

  1. GET request to action URL → returns metadata + available actions
  2. POST request with { account } → returns transaction to sign
  3. Sign and submit transaction to Solana

No Dialect API dependency - communicates directly with protocol action endpoints.

Supported Protocols

ProtocolTypeStatusNotes
KaminoLending/Yield✅ Workingdeposit, withdraw, borrow, repay
TensorNFT✅ Workingbuy-floor, bid
JitoStaking⚠️ Routingactions.json works, Cloudflare blocks dial.to
MeteoraDLMM⚠️ PartialHas actions.json, needs pool params
DriftPerps⚠️ PartialHas actions.json, deposit returns 500
SanctumLST Staking🔒 BlockedCloudflare blocks server IPs
JupiterSwap❓ UnknownEndpoint paths not discovered
OrcaAMM❓ UnknownEndpoint paths not discovered
MarginFiLending❓ UnknownEndpoint paths not discovered
RaydiumAMM❓ UnknownNo actions.json found

Registry: 964 trusted hosts available for arbitrary action execution.

See docs/PROTOCOL-STATUS.md for detailed status.

Installation

npm install -g @openclaw/solana-defi-agent-skill
# or
npx @openclaw/solana-defi-agent-skill

Configuration

Create a .env file or set environment variables:

# Required
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
SOLANA_PRIVATE_KEY=your-base58-private-key

Private Key Formats

  1. Base58 (recommended): 5abc123...
  2. JSON Array: [1,2,3,4,...] (Solana CLI format)

Quick Start

# Check configuration
blinks status

# View wallet
blinks wallet address
blinks wallet balance

# Inspect any action URL
blinks inspect "https://jito.dial.to/stake"

# Execute an action
blinks jito stake --amount=1 --dry-run
blinks jito stake --amount=1

CLI Commands

Inspect & Execute

# Inspect any blink/action URL
blinks inspect <url>

# Execute with parameters
blinks execute <url> --amount=100
blinks execute <url> -p '{"inputMint":"...", "outputMint":"..."}'

# Dry run (simulation only)
blinks execute <url> --dry-run

Protocol Commands

# Kamino
blinks kamino deposit --vault=usdc-prime --amount=100
blinks kamino withdraw --vault=usdc-prime --amount=50
blinks kamino borrow --market=<addr> --reserve=<addr> --amount=100
blinks kamino repay --market=<addr> --reserve=<addr> --amount=50
blinks kamino multiply --market=<addr> --coll-token=<mint> --debt-token=<mint> --amount=1

# Jupiter
blinks jupiter swap --input=<mint> --output=<mint> --amount=100

# Lulo
blinks lulo deposit --token=<mint> --amount=100
blinks lulo withdraw --token=<mint> --amount=50

# Drift
blinks drift vault-deposit --vault=<addr> --amount=100
blinks drift vault-withdraw --vault=<addr> --amount=50

# Sanctum (LST Staking)
blinks sanctum stake --lst=<mint> --amount=1

# Jito
blinks jito stake --amount=1

# Raydium
blinks raydium swap --input=<mint> --output=<mint> --amount=100

Utilities

blinks protocols        # List all supported protocols
blinks trusted-hosts    # List verified action hosts
blinks status           # Check RPC and wallet configuration

Output Formats

blinks inspect <url> -f json     # JSON (default)
blinks inspect <url> -f table    # ASCII table
blinks inspect <url> -f minimal  # Key=value
blinks inspect <url> -q          # Quiet mode

SDK Usage

import {
  ActionsClient,
  BlinksExecutor,
  Wallet,
  getConnection,
  TRUSTED_HOSTS,
} from '@openclaw/solana-defi-agent-skill';

// Initialize
const actions = new ActionsClient();
const connection = getConnection();
const wallet = Wallet.fromEnv();
const blinks = new BlinksExecutor(connection);

// Inspect an action URL
const inspection = await blinks.inspect('https://jito.dial.to/stake');
console.log(inspection.metadata);      // { title, description, icon }
console.log(inspection.actions);       // Available actions with parameters
console.log(inspection.trusted);       // Is this from a trusted host?

// Get action metadata (GET request)
const metadata = await actions.getAction('https://jito.dial.to/stake');

// Get transaction (POST request)
const tx = await actions.postAction(
  'https://jito.dial.to/stake',
  wallet.address,
  { amount: '1' }
);

// Simulate
const sim = await blinks.simulate(tx);
console.log('Success:', sim.success);
console.log('Units consumed:', sim.unitsConsumed);

// Execute
const signature = await blinks.signAndSend(tx, wallet.getSigner());
console.log('Confirmed:', signature);
console.log('Explorer:', `https://solscan.io/tx/${signature}`);

TypeScript Types

import type {
  BlinkMetadata,
  BlinkTransaction,
  BlinkParameter,
  BlinkLinkAction,
  ProtocolId,
  MarketType,
} from '@openclaw/solana-defi-agent-skill';

API Reference

const client = new ActionsClient({ timeout?: number });

// Parse action URL (handles solana-action:, blink:, dial.to interstitial)
client.parseActionUrl(url: string): string

// Check if URL is from trusted host
client.isTrustedHost(url: string): boolean

// GET - fetch action metadata
client.getAction(url: string): Promise<BlinkMetadata>

// POST - get transaction to sign
client.postAction(url: string, account: string, params?: Record<string, any>): Promise<BlinkTransaction>

// Inspect - full inspection with parsed actions
client.inspect(url: string): Promise<InspectResult>

BlinksExecutor

const executor = new BlinksExecutor(connection: Connection);

executor.getMetadata(url: string): Promise<BlinkMetadata>
executor.getTransaction(url: string, wallet: string, params?: Record<string, any>): Promise<BlinkTransaction>
executor.simulate(tx: BlinkTransaction): Promise<SimulationResult>
executor.signAndSend(tx: BlinkTransaction, signer: Signer): Promise<string>
executor.inspect(url: string): Promise<InspectResult>
executor.isTrustedHost(url: string): boolean
const wallet = Wallet.fromEnv();
const wallet = Wallet.fromPrivateKey(key: string);
const wallet = Wallet.fromFile(path: string);

wallet.address: string
wallet.publicKey: PublicKey
wallet.sign(tx: Transaction): Transaction
wallet.getSigner(): Signer
wallet.getBalance(connection: Connection): Promise<number>
wallet.getAllBalances(connection: Connection): Promise<WalletBalance[]>

Error Handling

import { ActionError } from '@openclaw/solana-defi-agent-skill';

try {
  await client.getAction('https://invalid.url/action');
} catch (error) {
  if (error instanceof ActionError) {
    console.log('Status:', error.statusCode);
    console.log('Details:', error.details);
  }
}

CLI errors return JSON:

{
  "error": "Failed to fetch action: 404 Not Found",
  "code": 404,
  "details": "Action endpoint not available"
}

Testing

# Run all tests
npm test

# Run protocol endpoint tests
npx vitest run tests/protocols.test.ts

# Run endpoint discovery
npx vitest run tests/discover-paths.test.ts

# Test specific protocol
npx vitest run tests/protocols.test.ts -t "kamino"
git clone https://github.com/claude-bot-ai-123123/solana-defi-agent-skill
cd solana-defi-agent-skill
npm install
npm run build
npm run dev -- inspect https://kamino.dial.to/api/v0/lend/usdg-prime/deposit

License

MIT

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

  • OpenClaw CLI installed and configured.
  • Language: Markdown
  • License: MIT
  • Topics:

FAQ

How do I install solana-defi-agent?

Run openclaw add @claude-bot-ai-123123/solana-defi-agent in your terminal. This installs solana-defi-agent into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/claude-bot-ai-123123/solana-defi-agent. Review commits and README documentation before installing.