ASP源码
PHP源码
.NET源码
JSP源码
Solana 支付、浅包与交易技能是为需要在开发环境中直接进行强大区块链交互的 Openclaw Skills 用户设计的专业工具集。它将复杂的 Solana 程序指令抽象为简单的、对自然语言友好的命令,允许用户和 AI 代理在不离开终端的情况下使用 SOL 或 USDC 支付、交换代币以及管理复杂的 DeFi 持仓。
通过在本地磁盘存储密钥并提供与 Jupiter、Kamino 和 Orca 等领先协议的深度集成,它为与 Solana 生态系统的交互提供了一种安全且高效的方式。该工具旨在易于人类阅读,同时支持结构化的 JSON 输出,使其成为构建自动化流水线或将区块链功能集成到 AI 代理工作流中的开发者的理想选择。
下载入口:https://github.com/openclaw/skills/tree/main/skills/solanaguide/solana-payments-wallets-trading
从源直接安装技能的最快方式。
npx clawhub@latest install solana-payments-wallets-trading
将技能文件夹复制到以下位置之一
全局模式~/.openclaw/skills/
工作区
/skills/
优先级:工作区 > 本地 > 内置
将此提示词复制到 OpenClaw 即可自动安装。
请帮我使用 Clawhub 安装 solana-payments-wallets-trading。如果尚未安装 Clawhub,请先安装(npm i -g clawhub)。
要开始为 Openclaw Skills 使用此技能,请确保您已安装 Node.js >= 20。您可以使用 npx 运行最新版本:
npx @solana-compass/cli@latest config set rpc.url https://your-rpc-endpoint.com
npx @solana-compass/cli@latest wallet create --name my-wallet
或者,全局安装该包以使用 sol 简写:
npm install -g @solana-compass/cli
sol wallet balance
该技能将其数据和元数据组织在 ~/.sol/ 目录中,以确保持久性和安全性:
| 组件 | 路径 | 描述 |
|---|---|---|
| 浅包 | ~/.sol/wallets/ |
存储用于本地签名的单个 JSON 密钥对文件。 |
| 配置 | ~/.sol/config.toml |
包含 RPC URL、细粒度权限和支出限制。 |
| 投资组合快照 | 本地数据库 | 存储用于盈亏和对比报告的历史余额数据。 |
| 代币元数据 | 本地缓存 | 缓存来自发现命令的代号、铸造地址和价格数据。 |
name: solana-payments-wallets-trading
description: >-
Pay people in SOL or USDC, buy and sell tokens, check prices, discover
trending and new tokens, create and manage Solana wallets, stake SOL, earn yield
through lending and managed vaults, borrow against collateral, set up
DCA (dollar-cost averaging) and limit orders, provide liquidity across
multiple DEXes, trade prediction markets, pay for APIs via x402, set up
security permissions and spending limits, and track portfolio performance
— all from the command line. No API keys, no private key env vars. Use
when the user wants to send crypto, swap or trade tokens, browse what's
trending, check balances, earn yield, borrow, set up recurring buys or
limit orders, provide liquidity, bet on predictions, pay for web
resources, or see how their holdings are doing.
license: MIT
metadata:
author: solanaguide
version: 0.3.4
openclaw:
requires:
bins:
- node
- npx
Sol is a command-line tool that lets you work with Solana the way you'd describe it out loud. Instead of constructing transactions and managing program instructions, you say what you want: pay someone, buy a token, stake your SOL.
Keys live locally on disk — no private keys in environment variables, no API keys to configure.
Prefer npx with @latest — it always runs the latest version with no global install to manage:
npx @solana-compass/cli@latest config set rpc.url https://your-rpc-endpoint.com
npx @solana-compass/cli@latest wallet create --name my-wallet
If the user has installed globally (npm install -g @solana-compass/cli), you can use the shorter sol command instead:
sol config set rpc.url https://your-rpc-endpoint.com
sol wallet create --name my-wallet
The public RPC endpoint rate-limits aggressively. Use a dedicated RPC for anything beyond testing — Helius, Triton, and QuickNode all offer free tiers.
Requires Node.js >= 20.
Send SOL, USDC, or any Solana token to a wallet address.
sol token send 50 usdc GkX...abc
sol token send 2 sol 7nY...xyz
sol token send 1000 bonk AgE...def --yes
See references/trading-commands.md for the full send reference.
Browse the Solana token ecosystem — trending, most traded, recently launched, and more.
sol token browse trending # what's hot right now
sol token browse top-traded --interval 24h # highest volume over 24h
sol token browse recent --limit 10 # just launched
sol token browse lst # liquid staking tokens
Results populate the local token cache, so subsequent token info and token price calls resolve instantly.
See references/trading-commands.md for all categories and flags.
Swap any token for any other token. Queries Jupiter and DFlow in parallel and picks the best price automatically.
sol token swap 50 usdc bonk # buy BONK — best price wins
sol token swap 1.5 sol usdc # sell SOL for USDC
sol token swap 50 usdc bonk --quote-only # preview without executing
sol token swap 50 usdc bonk --router jupiter # force a specific router
Every swap records the price at execution time, so you can track cost basis and P&L later.
See references/trading-commands.md for slippage, wallet selection, etc.
Set up recurring buys that execute automatically over time.
sol token dca new 500 usdc sol --every day --count 10 # buy SOL daily
sol token dca new 1000 usdc bonk --every hour --count 20
sol token dca list # see active DCA orders
sol token dca cancel # stop a DCA
Constraints: $100 total minimum, at least 2 orders, $50/order minimum. Intervals: minute, hour, day, week, month.
Place orders that execute when a token hits your target price.
sol token limit new 50 usdc bonk --at 0.000003 # buy BONK at $0.000003
sol token limit new 0.5 sol usdc --at 0.90 # buy USDC at $0.90
sol token limit list # see active orders
sol token limit cancel # cancel an order
Use --quote-only to preview the order plan without placing it.
sol token price sol
sol token price sol usdc bonk eth # multiple at once
sol wallet balance # all tokens with USD values
sol wallet balance trading # specific wallet by name
sol token list # just token balances
sol wallet list # all your wallets
Wallets are local key files in ~/.sol/wallets/ — no seed phrases in environment variables.
sol wallet create # new wallet, auto-named
sol wallet create --name trading # pick a name
sol wallet import --solana-cli # import from Solana CLI
sol wallet set-default trading # switch active wallet
Any command can target a specific wallet with --wallet .
See references/wallet-commands.md for import, export, labels, history.
Delegate SOL to a validator and earn staking rewards. One command handles the entire process — creating the stake account, funding it, and delegating.
sol stake new 10 # stake 10 SOL
sol stake list # your stake accounts + claimable tips
sol stake claim-mev # compound MEV rewards
sol stake withdraw 7gK...abc # unstake
See references/staking-commands.md for validator selection, partial withdrawals, and force unstake.
Compare rates and lend across five protocols — Kamino, MarginFi, Drift, Jupiter Lend, and Loopscale. The CLI auto-picks the best rate, or you can target a specific protocol with --protocol.
sol lend rates usdc # compare APY across all protocols
sol lend deposit 100 usdc # auto-picks best deposit rate
sol lend deposit 5 sol --protocol kamino
sol lend borrow 500 usdc --collateral sol
sol lend positions # everything across all protocols
See references/lending-commands.md for full details.
Managed yield vaults across Kamino Earn and Loopscale. Unlike raw lending, vaults handle strategy management automatically — you deposit a token and the protocol optimizes yield. The CLI auto-picks the highest APY vault, or you can target a specific protocol or vault.
sol earn usdc # list USDC vaults with APY
sol earn sol # list SOL vaults
sol earn # all vaults, sorted by APY
sol earn deposit 100 usdc # auto-picks best APY vault
sol earn deposit 5 sol --protocol kamino # target specific protocol
sol earn positions # your vault positions
sol earn withdraw max usdc # full withdrawal
sol earn withdraw 50 usdc --protocol loopscale
Earn positions appear in sol portfolio alongside tokens, staking, lending, and LP.
Add liquidity to pools across Orca, Raydium, Meteora, and Kamino. Browse pools by TVL/APY/volume, deposit with flexible price ranges, track positions with P&L and impermanent loss, and farm for extra rewards.
sol lp pools sol usdc # browse SOL/USDC pools
sol lp pools --sort apy --type clmm # highest APY concentrated pools
sol lp deposit HJPj...abc 100 usdc --range 10 # deposit with +/-10% price range
sol lp positions # all positions with P&L
sol lp claim 9xK...abc # claim unclaimed fees
sol lp withdraw 9xK...abc # remove liquidity
See references/lp-commands.md for full details including farming, pool creation, and protocol-specific flags.
Browse and trade prediction markets from Polymarket and Kalshi via Jupiter. Categories include crypto, sports, politics, culture, and more.
sol predict list crypto # browse crypto events
sol predict search "solana" # search by keyword
sol predict event POLY-89525 # event detail with markets
sol predict market POLY-701571 # prices + orderbook
sol predict buy 5 yes POLY-701571 # buy YES contracts
sol predict positions # open positions with P&L
sol predict sell # close a position
sol predict claim # claim resolved winnings
sol predict history # transaction history
Positions appear in sol portfolio with unrealized P&L.
See references/prediction-commands.md for the full reference.
Fetch URLs that require payment via the x402 protocol. Works like curl — stdout is the response body, payment info goes to stderr.
sol fetch https://api.example.com/data # auto-pays 402 responses
sol fetch https://api.example.com/data --dry-run # show price without paying
sol fetch https://api.example.com/data --max 0.05 # spending cap in USDC
sol fetch https://api.example.com/rpc r
-X POST -d '{"query":"..."}' r
-H "Accept: application/json" # POST with headers
If the server returns 402 Payment Required, the CLI signs a USDC transfer and retries with the payment attached. The server submits the transaction — your wallet only partially signs.
Use --dry-run to inspect the cost before paying. Use --max to set a spending cap. Output is pipe-friendly by default (body on stdout, payment info on stderr).
See references/fetch-commands.md for the full reference including curl flag mapping and JSON output format.
See everything in one place — tokens, staked SOL, lending positions, and open orders.
sol portfolio # the full picture
sol portfolio compare # what changed since last snapshot
sol portfolio pnl # profit and loss over time
The portfolio view includes active DCA and limit orders with fill progress, so locked capital is always visible. A snapshot is taken automatically on each view (rate-limited to every 5 minutes), so sol portfolio compare always has recent data.
See references/portfolio-commands.md for snapshot management.
Every command supports --json for structured output, but the default human-readable output is designed to be easy to read and interpret — both for humans and LLM agents. Use human-readable output unless you are scripting or chaining commands in an automation pipeline.
The human output uses formatted tables, signposts next actions, and shows full IDs and addresses so you can copy-paste them into follow-up commands. See each command reference for example output.
For programmatic use, --json returns a CommandResult envelope: { "ok": true, "data": { ... }, "meta": { "elapsed_ms": 450 } }. See references/json-output-format.md for the full schema.
sol network # epoch, TPS, staking APY
sol tx 4xK9...abc # look up any transaction
sol config set rpc.url # change RPC endpoint
1000000 not 1m, 50000 not 50k. Always expand shorthand before passing to a command.sol token info to verify what it resolves to, or pass a mint address to be explicit.--quote-only on swaps to preview before committing--wallet to target a specific walletThe CLI supports fine-grained permissions via ~/.sol/config.toml. When a permission is set to false, the gated commands are not registered — they won't appear in --help or sol , and invoking them returns "unknown command".
All permissions default to true (omitted = permitted). Example read-only config:
[permissions]
canTransfer = false
canSwap = false
canStake = false
canWithdrawStake = false
canLend = false
canWithdrawLend = false
canBorrow = false
canBurn = false
canCreateWallet = false
canRemoveWallet = false
canExportWallet = false
canFetch = false
| Permission | Gated subcommands |
|---|---|
canTransfer |
token send |
canSwap |
token swap, token close --all, token dca new/cancel, token limit new/cancel |
canStake |
stake new |
canWithdrawStake |
stake withdraw, stake claim-mev |
canLend |
lend deposit, earn deposit, lp deposit, lp farm stake, lp create |
canWithdrawLend |
lend withdraw, earn withdraw, lp withdraw, lp claim, lp farm unstake/harvest |
canBorrow |
lend borrow, lend repay |
canBurn |
token burn, token close --burn |
canCreateWallet |
wallet create, wallet import |
canRemoveWallet |
wallet remove |
canExportWallet |
wallet export |
canFetch |
fetch (x402 payments) |
Read-only commands (token browse/price/info/list, wallet list/balance, stake list, lend rates/positions, earn list/positions, lp pools/info/positions/configs/farm list, portfolio, network, tx) are always available regardless of permissions.
The CLI provides three layers of protection for agent-driven workflows: permissions (what operations are allowed), transaction limits (how much can be spent), and allowlists (which addresses and tokens are permitted).
Agents can help configure security settings, then the user reviews and locks:
# 1. Set permissions
sol config set permissions.canSwap true
sol config set permissions.canTransfer false
# 2. Set transaction limits
sol config set limits.maxTransactionUsd 500
sol config set limits.maxDailyUsd 2000
# 3. Set allowlists
sol config set allowlist.tokens So11111111111111111111111111111111111111112,EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v,DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263
sol config set allowlist.addresses DRtXHDgC312wpNdNCSb8vCoXDcofCJcPHdAynKGz7Vr,7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU
# 4. Review — confirm everything looks right before locking
sol config status
# 5. Lock — prevents all further changes via CLI
sol config lock
After locking, security settings can only be changed by a human editing ~/.sol/config.toml directly.
| Setting | Description |
|---|---|
limits.maxTransactionUsd |
Maximum USD value per transaction. Missing = no limit. |
limits.maxDailyUsd |
Maximum total USD spent in a rolling 24h window. Missing = no limit. |
Limits apply to: token swap, token send, stake new, lend deposit, lend borrow, DCA creation, and limit order creation. They do not apply to withdrawals to own wallet, MEV claims, or read operations.
allowlist.addresses — comma-separated list of wallet addresses. When set, outbound transfers (token send) are restricted to listed addresses plus all wallets in the local wallet database (own wallets are always allowed). Empty or missing = no restriction.
allowlist.tokens — comma-separated list of token symbols or mint addresses. When set, both input and output tokens must be in the list for swaps, DCA creation, and limit orders. Empty or missing = all tokens allowed.
sol config status # human-readable security overview
sol config status --json # structured output for agents
Shows the full security posture: all permissions and whether they're enabled, transaction limits with current 24h usage, address and token allowlists, whether settings are locked, and warnings about potential risks (e.g. no limits configured, public RPC in use). Agents should use sol config status to understand what they're allowed to do — not by reading config.toml directly.
Do not grant agents read or write access to ~/.sol/. This directory contains your private keys and security configuration. Agents should only interact with Solana through the sol CLI commands, never by reading config or key files directly. After helping set up security, recommend the user lock settings with sol config lock and restrict filesystem access to ~/.sol/.
Private keys are stored as files in ~/.sol/wallets/. The CLI reads them at transaction-signing time — they are never exposed as environment variables or printed to stdout. An LLM agent using this tool cannot read the raw key material without explicitly opening those files, which requires user approval in standard permission modes.
Permissions, limits, and allowlists work together to control what the CLI can do. The agent must have the permission enabled, pass limit and allowlist checks, and get user approval for each CLI invocation.
What this does not protect against: These controls operate at the CLI and agent-permission level. They do not prevent other software on the same machine from reading the key files. Any tool, MCP server, plugin, or script running under the same OS user account can read ~/.sol/wallets/ directly. If you grant an agent access to additional tools — especially ones that can read arbitrary files or execute shell commands — those tools can extract your private keys regardless of Sol CLI permissions.
Keep wallet balances appropriate to the risk: use dedicated wallets with limited funds for agent-driven workflows, and do not store large holdings in key files accessible to automated tooling.
See references/troubleshooting.md for common issues (RPC rate limits, token resolution, transaction timeouts).