计划执行与检查节点
executing-plans
按既定实施计划完成工作,保持过程检查和反馈。
solana-defi-agent【效率与协作】DeFi toolkit for AI agents on Solana — swaps, lending, staking via Solana Actions/Blinks
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
DeFi toolkit for AI agents on Solana — swaps, lending, staking, and more
New here? → Start with QUICKSTART.md for a 10-minute setup guide.
Solana Blinks (Blockchain Links) let you execute DeFi operations—swaps, deposits, staking—through simple URLs. This skill gives you:
blinks execute <url> --amount=100# Example: Deposit USDC to Kamino yield vault
blinks execute "https://kamino.dial.to/api/v0/lend/usdc-prime/deposit" --amount=100
# .env file
SOLANA_RPC_URL=https://api.mainnet-beta.solana.com
SOLANA_WALLET_PATH=~/.config/solana/my-wallet.json
.env and .gitignore| 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 |
| Protocol | Get Key | Notes |
|---|---|---|
| Lulo | dev.lulo.fi | 24hr withdrawal cooldown |
| 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 |
MarginFi, Meteora, Helius, Magic Eden - endpoints exist but need verification.
Always preview what a blink does:
blinks inspect <url>
Shows metadata, available actions, and trust status.
# Dry run first (simulates without sending)
blinks execute <url> --amount=100 --dry-run
# Execute for real
blinks execute <url> --amount=100
# 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}`);
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.
| 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 |
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://..."
| Provider | Free Tier | Link |
|---|---|---|
| Helius | 100k req/day | helius.dev |
| QuickNode | 10M credits | quicknode.com |
| Alchemy | 300M CU | alchemy.com |
| Public | Rate limited | api.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