multiliquid-svm-sdk 0.2.0

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 types from the split Solana crates (solana-address, solana-instruction, solana-message, solana-transaction), with no solana-sdk, Anchor, or Node.js runtime dependency.

crates.io · API reference · Protocol documentation

Quickstart

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

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

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 Parameters
Quote a swap client.get_quote(&params).await? SwapParams
Build a swap transaction client.build_swap_transaction(&params).await? SwapParams
Add or remove liquidity client.build_add_liquidity_transaction(...), client.build_remove_liquidity_transaction(...) LpLiquidityParams
Fund an LP's protocol-fee account client.build_fund_lp_fee_vault_transaction(&params).await? FundLpFeeVaultParams
Discover pairs client.get_offline_pairs(None) or client.discover_pairs(None).await? Optional PairFilters
List capital providers (http feature) client.get_capital_providers(None).await? Optional CapitalProviderFetchOptions
Use program instructions and account codecs swap_program_client, treasury_program_client

Each parameter type documents its fields, including defaults for optional token accounts and slippage bounds. The HTTP quote walkthrough builds a complete SwapParams. Capital provider info comes from the Multiliquid API and is optional; builders never require it.

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.
  • LP fee vaults: swaps pay protocol fees from the liquidity provider's fee-token account and fail until it exists and is funded. Swap builders reject a missing or empty account; see the integration guide.

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.