Crate riglr_solana_tools

Crate riglr_solana_tools 

Source
Expand description

§riglr-solana-tools

A comprehensive suite of rig-compatible tools for interacting with the Solana blockchain.

This crate provides ready-to-use tools for building Solana-native AI agents, including:

  • Balance Tools: Check SOL and SPL token balances
  • Transaction Tools: Send SOL and token transfers
  • DeFi Tools: Interact with Jupiter for swaps and quotes
  • Pump.fun Tools: Deploy, buy, and sell tokens on Pump.fun
  • Network Tools: Query blockchain state and transaction details

All tools are built with the #[tool] macro for seamless integration with rig agents and include comprehensive error handling and retry logic.

§Features

  • Production Ready: Built-in retry logic, timeouts, and error handling
  • Type Safe: Full Rust type safety with serde and schemars integration
  • Async First: Non-blocking operations using tokio
  • Composable: Mix and match tools as needed for your agent
  • Well Documented: Every tool includes usage examples

§Quick Start

use riglr_solana_tools::balance::get_sol_balance;
use riglr_core::provider::ApplicationContext;
use riglr_core::{ToolWorker, ExecutionConfig, Job, idempotency::InMemoryIdempotencyStore};
use riglr_config::Config;
use solana_client::rpc_client::RpcClient;
use std::sync::Arc;

// Set up ApplicationContext with Solana RPC client
let config = Config::from_env();
let context = ApplicationContext::from_config(&config);
let solana_client = Arc::new(RpcClient::new("https://api.mainnet-beta.solana.com"));
context.set_extension(solana_client);

// Create and register tools with worker
let worker = ToolWorker::<InMemoryIdempotencyStore>::new(
    ExecutionConfig::default(),
    context
);

worker.register_tool(Arc::new(get_sol_balance)).await;

// Execute the tool
let job = Job::new(
    "get_sol_balance",
    &serde_json::json!({"address": "So11111111111111111111111111111111111111112"}),
    3
)?;

let result = worker.process_job(job).await?;
println!("Balance result: {:?}", result);

§Tool Categories

  • balance - Balance checking tools for SOL and SPL tokens
  • transaction - Transaction creation and execution tools
  • swap - Jupiter DEX integration for token swaps
  • pump - Pump.fun integration for meme token deployment and trading
  • network - Network state and blockchain query tools

Re-exports§

pub use utils::execute_solana_transaction;
pub use utils::send_transaction;
pub use utils::send_transaction_with_retry;
pub use utils::validate_address;
pub use utils::TransactionConfig;
pub use utils::TransactionSubmissionResult;
pub use error::SolanaToolError;
pub use balance::*;
pub use network::*;
pub use pump::*;
pub use signer::*;
pub use swap::*;
pub use transaction::*;

Modules§

balance
Balance checking tools for Solana blockchain
clients
API clients for external services used by Solana tools
common
Common types and utilities for Solana tools
error
Error types for riglr-solana-tools.
network
Network state and blockchain query tools
pump
Pump.fun integration for token deployment, buying, and selling on Solana
signer
Solana-specific signer implementations.
swap
Jupiter DEX integration for token swaps on Solana
transaction
Transaction tools for Solana blockchain
utils
Organized utility modules for riglr-solana-tools

Structs§

SignerContext
The SignerContext provides thread-local signer management for secure multi-tenant operation.

Constants§

VERSION
Current version of riglr-solana-tools

Traits§

UnifiedSigner
Unified signer trait that can represent any type of signer This is used as the primary trait for SignerContext