solana-defi-agent

DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks

7 stars

Best use case

solana-defi-agent is best used when you need a repeatable AI agent workflow instead of a one-off prompt.

DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks

Teams using solana-defi-agent should expect a more consistent output, faster repeated execution, less prompt rewriting.

When to use this skill

  • You want a reusable workflow that can be run more than once with consistent structure.

When not to use this skill

  • You only need a quick one-off answer and do not need a reusable workflow.
  • You cannot install or maintain the underlying files, dependencies, or repository context.

Installation

Claude Code / Cursor / Codex

$curl -o ~/.claude/skills/solana-defi-agent/SKILL.md --create-dirs "https://raw.githubusercontent.com/Demerzels-lab/elsamultiskillagent/main/public/skills/claude-bot-ai-123123/solana-defi-agent/SKILL.md"

Manual Installation

  1. Download SKILL.md from GitHub
  2. Place it in .claude/skills/solana-defi-agent/SKILL.md inside your project
  3. Restart your AI agent — it will auto-discover the skill

How solana-defi-agent Compares

Feature / Agentsolana-defi-agentStandard Approach
Platform SupportNot specifiedLimited / Varies
Context Awareness High Baseline
Installation ComplexityUnknownN/A

Frequently Asked Questions

What does this skill do?

DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks

Where can I find the source code?

You can find the source code on GitHub using the link provided at the top of the page.

SKILL.md Source

# Solana DeFi Agent Skill

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

**New here?** → Start with [QUICKSTART.md](./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

```bash
# 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](./QUICKSTART.md#step-1-create-a-solana-wallet))
- [ ] SOL for transaction fees (~0.01 SOL / $2 minimum)
- [ ] Node.js 18+

### Environment Variables
```bash
# .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

| Protocol | Actions | Endpoint |
|----------|---------|----------|
| **Jupiter** | Swap any tokens | `worker.jup.ag` |
| **Raydium** | Swap, LP | `share.raydium.io` |
| **Kamino** | Deposit, withdraw, borrow, repay | `kamino.dial.to` |
| **Jito** | Stake SOL | `jito.network`, `jito.dial.to` |
| **Tensor** | Buy floor, bid on NFTs | `tensor.dial.to` |
| **Drift** | Vault deposit/withdraw | `app.drift.trade` |

### 🔑 Needs API Key

| Protocol | Get Key | Notes |
|----------|---------|-------|
| **Lulo** | [dev.lulo.fi](https://dev.lulo.fi) | 24hr withdrawal cooldown |

### ❌ Currently Broken

| Protocol | Issue | Workaround |
|----------|-------|------------|
| **Orca** | No public blink API | Use Jupiter or Raydium |
| **Sanctum** | Cloudflare blocks server IPs | Use their web UI |
| **Some dial.to** | Rate limiting | Try 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:

```bash
blinks inspect <url>
```

Shows metadata, available actions, and trust status.

### Execute Transactions

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

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

### Protocol-Specific Commands

```bash
# 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
```

---

## SDK Usage

```typescript
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.

---

## Troubleshooting

| Error | Cause | Fix |
|-------|-------|-----|
| `422 Unprocessable Entity` | Missing required tokens | Check token balance before deposit |
| `403 Forbidden` | Cloudflare blocking | Try protocol's self-hosted endpoint |
| `Transaction simulation failed` | Insufficient SOL or stale tx | Check balance, retry quickly |
| `Rate limit exceeded` | Public RPC overloaded | Use Helius/QuickNode free tier |
| `Untrusted host warning` | Host not in Dialect registry | Verify URL is correct |

---

## Blink URL Formats

The CLI accepts multiple formats:

```bash
# 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

| Provider | Free Tier | Link |
|----------|-----------|------|
| **Helius** | 100k req/day | [helius.dev](https://helius.dev) |
| **QuickNode** | 10M credits | [quicknode.com](https://quicknode.com) |
| **Alchemy** | 300M CU | [alchemy.com](https://alchemy.com) |
| **Public** | Rate limited | `api.mainnet-beta.solana.com` |

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

---

## Files

```
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
```

---

## Links

- [QUICKSTART.md](./QUICKSTART.md) - Get started in 10 minutes
- [Solana Actions Spec](https://solana.com/developers/guides/advanced/actions)
- [Dialect Registry](https://actions-registry.dial.to/all) - 900+ trusted hosts
- [Blinks Inspector](https://www.blinks.xyz/inspector) - Visual blink tester

Related Skills

solana-swaps

7
from Demerzels-lab/elsamultiskillagent

Swap tokens on Solana via Jupiter aggregator and check wallet balances. Use when user wants to swap tokens, check SOL/token balance, or get swap quotes.

agent-defibrillator

7
from Demerzels-lab/elsamultiskillagent

Watchdog that monitors your AI agent gateway and restarts it when it crashes.

solana-dev

7
from Demerzels-lab/elsamultiskillagent

End-to-end Solana development playbook (Jan 2026). Prefer Solana Foundation framework-kit (@solana/client + @solana/react-hooks) for React/Next.js UI. Prefer @solana/kit for all new client/RPC/transaction code. When legacy dependencies require web3.js, isolate it behind @solana/web3-compat (or @solana/web3.js as a true legacy fallback). Covers wallet-standard-first connection (incl. ConnectorKit), Anchor/Pinocchio programs, Codama-based client generation, LiteSVM/Mollusk/Surfpool testing, and security checklists.

ogt-docs-define

7
from Demerzels-lab/elsamultiskillagent

General guide for creating definition documents.

solana-skill

7
from Demerzels-lab/elsamultiskillagent

Interact with Solana blockchain via Helius APIs. Create/manage wallets, check balances (SOL + tokens), send transactions, swap tokens via Jupiter, and monitor addresses. Use for any Solana blockchain operation, crypto wallet management, token transfers, DeFi swaps, or portfolio tracking.

amped-defi

7
from Demerzels-lab/elsamultiskillagent

25 DeFi tools for cross-chain swaps, bridging, and money market operations via SODAX SDK. Supply on Chain A, borrow to Chain B. Supports Ethereum, Arbitrum, Base, Optimism, Avalanche, BSC, Polygon, Sonic, LightLink, HyperEVM, Kaia.

solana-trader

7
from Demerzels-lab/elsamultiskillagent

Solana wallet management and token trading via Jupiter aggregator. Check balances, view transaction history, swap tokens, and manage your Solana portfolio.

solana-pay

7
from Demerzels-lab/elsamultiskillagent

Solana Pay protocol integration. Generate payment requests, QR codes, and verify transactions on Solana blockchain.

defi

7
from Demerzels-lab/elsamultiskillagent

DeFi protocol interactions. Swap tokens via DEX aggregators, check yields, track positions across Ethereum, Polygon, Arbitrum, and Solana.

paylock

7
from Demerzels-lab/elsamultiskillagent

Non-custodial SOL escrow for AI agent deals.

agent-reputation

7
from Demerzels-lab/elsamultiskillagent

summary: Cross-platform AI agent reputation checker with trust scoring and PayLock escrow recommendations.

Telecom Agent Skill

7
from Demerzels-lab/elsamultiskillagent

Turn your AI Agent into a Telecom Operator. Bulk calling, ChatOps, and Field Monitoring.