multiliquid-svm-sdk 0.1.2

Unsigned transaction builders, account codecs, and quoting for Multiliquid on Solana
Documentation

Multiliquid SVM SDK for Rust

Quote swaps, read accounts, and build unsigned transactions for Multiliquid's swap and Treasury programs on Solana. Uses native Solana SDK 2.3 types, with no Anchor or Node.js runtime dependency.

crates.io · API reference · Protocol documentation

Quickstart

Use stable Rust. Create an application and install the SDK:

cargo new multiliquid-quickstart
cd multiliquid-quickstart
cargo add multiliquid-svm-sdk@0.1.2

Replace src/main.rs with this program to list known mainnet pairs from the bundled registry:

use multiliquid_svm_sdk::{get_offline_pairs, Cluster};

fn main() {
    for pair in get_offline_pairs(Cluster::MainnetBeta, None) {
        println!(
            "pair={} quote={} base={} lp={}",
            pair.pair, pair.quote_mint, pair.base_mint, pair.liquidity_provider,
        );
    }
}

Run cargo run. This first example needs no RPC endpoint or wallet and also works with default features disabled. Registry entries describe known addresses; current liquidity and trading status require on-chain reads.

To fetch accounts and oracle state and calculate a swap quote, follow the HTTP quote walkthrough. It includes a complete Tokio program, dependencies, and environment settings that you can use in this application. The program is compiled in CI but has not been run against live mainnet state.

Features and configuration

The default http feature provides HttpRpcClient, a reqwest/rustls RPC transport, and HTTP registry access. For offline operations or a custom Rpc implementation, install with --no-default-features. MultiliquidClient defaults to devnet; select Cluster::MainnetBeta in MultiliquidClientConfig when using a mainnet RPC endpoint. Commitment and HTTP settings belong to the RPC transport. See the integration guide for client configuration and custom transports.

Common operations

Task API
Quote a swap client.get_quote(&params).await?
Build a swap transaction client.build_swap_transaction(&params).await?
Add or remove liquidity client.build_add_liquidity_transaction(...), client.build_remove_liquidity_transaction(...)
Discover pairs client.get_offline_pairs(None) or client.discover_pairs(None).await?
Use program instructions and account codecs swap_program_client, treasury_program_client

Amounts are in native token units (u64); quote calculations use checked u128 math. Transaction builders return unsigned v0 transactions. Your application supplies slippage bounds, signing, and submission.

treasury_program_client decodes every populated pending deposit in reallocated Treasury user positions. The original fixed 50-slot Treasury ABI remains available in generated::treasury. SWAP_IDL and TREASURY_IDL are the bundled IDLs as JSON strings.

Integration notes

  • Program compatibility: the bundled production ABI includes optional amount_threshold bounds. Older instruction layouts are incompatible.
  • Liquidity hooks: Treasury-enabled transfer-hook assets are unsupported by all add/remove-liquidity convenience builders, including exact-out removal. Treasury-backed swap hook planning is supported.
  • Quotes and transactions: account state can change between quoting and execution. Rebuild and simulate before submitting.

Guides and examples

These guides and complete examples are published with the API reference and require no repository access:

Rust and TypeScript releases are versioned independently. Licensed under MIT.