Get the FREE Ultimate OpenClaw Setup Guide →
s

Solana

Scanned

@spendit-ai

npx machina-cli add skill @spendit-ai/solana-skills --openclaw
Files (1)
SKILL.md
5.2 KB

Solana Wallet ◎

Solana wallet management and token operations for AI agents.

Setup

pip install -r requirements.txt

Initialize Wallet

First, create a new wallet and save the private key to your .env file:

python3 {baseDir}/scripts/initialize.py

This will:

  • Generate a new Solana keypair
  • Display the public key (wallet address)
  • Save the private key in base58 format to .env as SOLANA_PRIVATE_KEY

IMPORTANT: After running initialize.py, export the private key to your environment:

export SOLANA_PRIVATE_KEY=$(grep SOLANA_PRIVATE_KEY .env | cut -d '=' -f2)

Or source the .env file:

source .env

Wallet Operations

Check SOL Balance

python3 {baseDir}/scripts/wallet.py balance
python3 {baseDir}/scripts/wallet.py balance <wallet_address>

Check Token Balance

python3 {baseDir}/scripts/wallet.py token-balance <token_mint_address>
python3 {baseDir}/scripts/wallet.py token-balance <token_mint_address> --owner <wallet_address>

Send SOL

python3 {baseDir}/scripts/wallet.py send <recipient_address> <amount_in_sol>

Send SPL Token

python3 {baseDir}/scripts/wallet.py send-token <token_mint_address> <recipient_address> <amount>

Get Wallet Address

python3 {baseDir}/scripts/wallet.py address

Jupiter Swaps

Get Swap Quote

python3 {baseDir}/scripts/jup_swap.py quote <input_token> <output_token> <amount>
python3 {baseDir}/scripts/jup_swap.py quote SOL USDC 1

Execute Swap

python3 {baseDir}/scripts/jup_swap.py swap <input_token> <output_token> <amount>
python3 {baseDir}/scripts/jup_swap.py swap SOL USDC 0.1

List Known Tokens

python3 {baseDir}/scripts/jup_swap.py tokens

Token symbols: SOL, USDC, USDT, BONK, JUP, RAY, PYTH (or use full mint addresses)

Pump.fun Token Launch

Launch Token

python3 {baseDir}/scripts/pumpfun.py launch --name "Token Name" --symbol "TKN" --image ./logo.png

Launch with Dev Buy

python3 {baseDir}/scripts/pumpfun.py launch --name "Token Name" --symbol "TKN" --image ./logo.png --buy 0.5

Launch with Custom Mint (Vanity Address)

python3 {baseDir}/scripts/pumpfun.py launch --name "Token Name" --symbol "TKN" --image ./logo.png --mint-key <base58_key>

Use vanity addresses ending in 'pump' for more legit-looking tokens. Generate with:

solana-keygen grind --ends-with pump:1

Options

  • --name - Token name (required)
  • --symbol - Token symbol (required)
  • --image - Path to token image (required)
  • --description or -d - Token description
  • --buy or -b - Dev buy amount in SOL
  • --mint-key or -m - Custom mint private key (base58)

Network Configuration

By default, wallet operations run on mainnet. Use --network to switch:

python3 {baseDir}/scripts/wallet.py balance --network devnet
python3 {baseDir}/scripts/wallet.py balance --network testnet

Environment Variables

VariableDescription
SOLANA_PRIVATE_KEYBase58-encoded private key (required)
JUPITER_API_KEYJupiter API key for swaps (required)
SOLANA_RPC_URLCustom RPC endpoint (optional)

Examples

# Initialize new wallet
python3 {baseDir}/scripts/initialize.py

# Check your SOL balance
python3 {baseDir}/scripts/wallet.py balance

# Send 0.1 SOL to another wallet
python3 {baseDir}/scripts/wallet.py send 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 0.1

# Check USDC balance (mainnet USDC mint)
python3 {baseDir}/scripts/wallet.py token-balance EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v

# Send 10 USDC to another wallet
python3 {baseDir}/scripts/wallet.py send-token EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v 7xKXtg2CW87d97TXJSDpbD5jBkheTqA83TZRuJosgAsU 10

# Quote swap: 1 SOL to USDC
python3 {baseDir}/scripts/jup_swap.py quote SOL USDC 1

# Swap 0.5 SOL to USDC
python3 {baseDir}/scripts/jup_swap.py swap SOL USDC 0.5

# Launch token on Pump.fun
python3 {baseDir}/scripts/pumpfun.py launch --name "My Token" --symbol "MTK" --image ./logo.png

# Launch with dev buy
python3 {baseDir}/scripts/pumpfun.py launch --name "My Token" --symbol "MTK" --image ./logo.png --buy 1

Common Token Mints (Mainnet)

TokenMint Address
USDCEPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
USDTEs9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB
BONKDezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263

When to Use

  • Create wallets for new Solana accounts
  • Check balances of SOL or any SPL token
  • Send SOL for payments or transfers
  • Send tokens for SPL token transfers
  • Swap tokens via Jupiter aggregator
  • Launch tokens on Pump.fun with custom images and dev buys
  • Devnet testing with --network devnet

Source

git clone https://clawhub.ai/spendit-ai/solana-skillsView on GitHub

Overview

Solana Wallet ◎ provides comprehensive wallet management and token operations for AI agents. It covers creating wallets, checking SOL and SPL balances, sending SOL and tokens, swapping via Jupiter, and launching new tokens on Pump.fun.

How This Skill Works

The skill uses Python scripts (initialize.py, wallet.py, jup_swap.py, pumpfun.py) and relies on environment variables SOLANA_PRIVATE_KEY and JUPITER_API_KEY. Initialize creates a new keypair and saves the private key to .env; wallet.py handles balance checks and transfers; jup_swap.py handles swap quotes and executions; pumpfun.py launches new tokens. You can switch networks with --network (mainnet, devnet, testnet) and adjust RPC endpoints with SOLANA_RPC_URL.

When to Use It

  • Initialize a new Solana wallet and store the private key securely.
  • Check SOL or SPL token balances for a wallet or token mint.
  • Send SOL or SPL tokens to another address.
  • Get a swap quote and execute a swap via Jupiter.
  • Launch a new token on Pump.fun, optionally with vanity mint details.

Quick Start

  1. Step 1: Install dependencies with pip install -r requirements.txt and set SOLANA_PRIVATE_KEY and JUPITER_API_KEY in .env.
  2. Step 2: Initialize a wallet: python3 {baseDir}/scripts/initialize.py and export the private key if needed.
  3. Step 3: Perform actions like python3 {baseDir}/scripts/wallet.py balance, python3 {baseDir}/scripts/wallet.py send <recipient> <amount>, or python3 {baseDir}/scripts/jup_swap.py swap SOL USDC 0.1.

Best Practices

  • Always export and protect SOLANA_PRIVATE_KEY; use .env and environment variables securely.
  • Test on devnet or test swaps before mainnet transactions.
  • Verify token mint addresses when querying token balances or performing swaps.
  • When launching tokens, consider vanity addresses that end with 'pump' for branding, and generate them with solana-keygen grind.
  • Keep Jupiter API key and RPC URL confidential and rotate keys as needed.

Example Use Cases

  • Initialize a new wallet and export the private key to .env, then load it for operations.
  • Check your SOL balance with wallet.py balance on the desired network.
  • Send 0.1 SOL to a recipient using wallet.py send <recipient> 0.1.
  • Quote and swap SOL to USDC via Jupiter using jup_swap.py: quote SOL USDC 0.5 and then swap SOL USDC 0.5.
  • Launch a new token on Pump.fun with name 'Token Name', symbol 'TKN', and an image path, optionally using a vanity mint.

Frequently Asked Questions

Add this skill to your agents
Sponsor this space

Reach thousands of developers