Skip to main content

Module solana

Module solana 

Source
Expand description

§Solana Client

This module provides a Solana blockchain client for querying balances, transactions, and account information on the Solana network.

§Features

  • Balance queries via Solana JSON-RPC (with USD valuation via DexScreener)
  • Transaction details lookup via getTransaction RPC (jsonParsed encoding)
  • Enriched transaction history with slot, timestamp, and status from getSignaturesForAddress
  • SPL token balance fetching via getTokenAccountsByOwner
  • Base58 address and signature validation
  • Support for both legacy and versioned transactions

§Usage

use scope::chains::SolanaClient;
use scope::config::ChainsConfig;

#[tokio::main]
async fn main() -> scope::Result<()> {
    let config = ChainsConfig::default();
    let client = SolanaClient::new(&config)?;
     
    let mut balance = client.get_balance("DRpbCBMxVnDK7maPM5tGv6MvB3v1sRMC86PZ8okm21hy").await?;
    client.enrich_balance_usd(&mut balance).await;
    println!("Balance: {} SOL", balance.formatted);
    Ok(())
}

Structs§

SolanaClient
Solana blockchain client.
TokenBalance
SPL Token balance with metadata.

Functions§

validate_solana_address
Validates a Solana address format (base58 encoded, 32-44 characters).
validate_solana_signature
Validates a Solana transaction signature format (base58 encoded).