solami 0.1.4

Rust SDK for Solami — Solana RPCs, gRPC streams, parsed data and transaction landing
Documentation

solami

Solana RPC, gRPC streams, and SWQOS transaction landing in Rust.

[dependencies]
solami = "0.1"
SOLAMI_RPC_TOKEN=your-token
SOLAMI_GRPC_TOKEN=your-grpc-token  # optional, falls back to RPC token (solami.fast uses same token for both)

Quick start

let mut client = solami::from_env().build().await?;

// rpc — all solana RpcClient methods work directly
let slot = client.get_slot().await?;
let block = client.rpc().get_block(slot).await?;

// grpc — subscribe to transactions
let (_sink, mut stream) = client
    .grpc()
    .subscribe_transactions(
        "pumpfun",
        vec!["6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P".into()],
        solami::CommitmentLevel::Processed,
    )
    .await?;

// resub by sending a new request through the sink
// sink.send(new_request).await?;

SWQOS

Pass your SWQOS keypair to land transactions via QUIC:

let client = solami::from_env()
    .swqos_key("base58-keypair")
    .build()
    .await?;

let tx = Transaction::new_signed_with_payer(
    &[
        system_instruction::transfer(&payer.pubkey(), &payer.pubkey(), 1000),
        solami::build_tip_ix(&payer.pubkey(), 10_000), // tip for priority landing
    ],
    Some(&payer.pubkey()),
    &[&payer],
    blockhash,
);

let sig = client.swqos().unwrap().send_transaction(&tx).await?;

Custom gRPC filters

use solami::{SubscriptionBuilder, TxFilter, CommitmentLevel};

let request = SubscriptionBuilder::new()
    .commitment(CommitmentLevel::Processed)
    .transactions("my_filter", TxFilter {
        vote: Some(false),
        failed: Some(false),
        account_include: vec!["6EF8r...".into()],
        ..Default::default()
    })
    .build();

let (_sink, mut stream) = client.grpc().subscribe(request).await?;