在 Solana 上使用环境中已注入资金的签名密钥将原生 SOL 转账至收款地址。当用户请求发送 SOL、转账时使用。
Apply this skill when the user wants to send native SOL (not SPL tokens) from their wallet to another Solana address.
node).SOLANA_PRIVATE_KEY (see README — never commit or paste keys
into chat). Optionally set SOLANA_RPC_URL (defaults to public devnet).npm install (or npm ci).npm run build
and does not require Solana CLI ( solana) or Python.SOLANA_RPC_URL pointing at mainnet (or user clearly opts in).From the directory that contains this SKILL.md (skill root), after npm install:
bash
SOLANA_RPC_URL="${SOLANA_RPC_URL:-https://api.devnet.solana.com}" \
SOLANA_PRIVATE_KEY="<set-by-user-or-secrets>" \
npm run transfer -- --to "<RECIPIENT_PUBKEY>" --sol "<AMOUNT_SOL>"
--to — base58 public key of the recipient.--sol — amount in SOL (decimal string or number, e.g. 0.01).--rpc <url> overrides SOLANA_RPC_URL.On success, report the signature (transaction id) and a Solscan
link ( explorerUrl in CLI output) using the appropriate cluster ( devnet vs mainnet-beta).
On failure, report the error message from the script without exposing secrets.
npm run transfer -- --to ... --sol ....scripts/transfer_sol.py, .skill bundles, or any Python flow.solana CLI for this skill; transfers are sent via @solana/web3.js.Always show a visible step plan before execution and mark completed steps with a green indicator.
Use this exact checklist style in chat:
🟩 Step 1 - Collect input when done, otherwise ⬜ Step 1 - Collect input🟩 Step 2 - Validate input when done, otherwise ⬜ Step 2 - Validate input🟩 Step 3 - User confirmation when done, otherwise ⬜ Step 3 - User confirmation🟩 Step 4 - Execute transfer when done, otherwise ⬜ Step 4 - Execute transfer🟩 Step 5 - Report result when done, otherwise ⬜ Step 5 - Report resultRequired input:
to)sol)devnet or mainnet-beta, default devnet)If any field is missing, ask follow-up questions. Do not execute until all fields are present.
Validate:
devnet, mainnet-betaIf validation fails, explain the exact invalid field and stop.
Before running any command, send a confirmation summary and ask user to confirm:
To: recipientAmount: SOL amountNetwork: selected networkSource wallet: signer public key (if available)Only continue on explicit confirmation such as: confirm, yes, or equivalent.
If user rejects/corrects any value, cancel current run and return to Step 1.
Run only after confirmation:
bash
SOLANA_RPC_URL="${SOLANA_RPC_URL:-https://api.devnet.solana.com}" \
SOLANA_PRIVATE_KEY="<set-by-user-or-secrets>" \
npm run transfer -- --to "<RECIPIENT_PUBKEY>" --sol "<AMOUNT_SOL>"
If transaction succeeds, the response must include:
Successfully + icon ( ✅ or 🎉)Success response template:
✅ Successfully transferred <AMOUNT_SOL> SOL to <RECIPIENT> on <NETWORK>.
If transaction fails, report concise failure reason and suggest the next safe action (retry with corrected input, check balance, or switch network).
Keep all user-facing messages short, clear, and visually clean.
-) or short blocks; no long paragraphs.Use this exact compact template before execution:
Confirm this transaction? - Amount: <AMOUNT_SOL> SOL - To: <RECIPIENT> - Network: <NETWORK> Reply: yes / no
Use this exact compact template on success:
✅ Successfully transferred <AMOUNT_SOL> SOL - To: <RECIPIENT> - Network: <NETWORK> - Signature: <SIGNATURE> - Explorer: <EXPLORER_URL>
Use this exact compact template on failure:
❌ Transfer failed: <SHORT_REASON> - Network: <NETWORK> - Next: check amount/address/balance and confirm to retry
Implementation lives under src/ (shared Solana helpers) and scripts/ (one thin entry per user-facing command). Add new Solana features by new modules + a new script, then update this file so the agent knows when to use them.