meteora-dbc-client

Crates.iometeora-dbc-client
lib.rsmeteora-dbc-client
version0.1.1
created_at2026-01-07 08:40:37.049967+00
updated_at2026-01-07 10:16:55.289019+00
descriptionRust SDK for Meteora Dynamic Bonding Curve program
homepage
repositoryhttps://github.com/your-org/meteora-dbc-rust-sdk
max_upload_size
id2027811
size1,091,564
Anurag Negi (anuragnegi000)

documentation

README

Meteora DBC Rust SDK

A Rust SDK for interacting with the Meteora Dynamic Bonding Curve (DBC) program on Solana.

Installation

Add to your Cargo.toml:

[dependencies]
meteora-dbc-client = "0.1.0"

# For RPC operations (fetching pools, etc.)
meteora-dbc-client = { version = "0.1.0", features = ["fetch"] }

Features

  • fetch - Enables RPC client functions for fetching pool data
  • serde - Enables serialization support
  • anchor - Enables Anchor compatibility

Usage

use meteora_dbc_client::*;
use solana_client::rpc_client::RpcClient;
use solana_pubkey::Pubkey;
use std::str::FromStr;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let rpc = RpcClient::new("https://api.mainnet-beta.solana.com");
    let token_mint = Pubkey::from_str("YOUR_TOKEN_MINT")?;

    // Find pool by token mint
    let pool_address = find_pool_by_token_mint(&rpc, &token_mint)?;

    // Fetch pool data
    let pool = fetch_virtual_pool(&rpc, &pool_address)?;
    let pool_config = fetch_pool_config(&rpc, &pool.config)?;

    // Build buy instructions (with WSOL wrapping)
    let buy_instructions = build_buy_with_wrap(
        &pool_address,
        &pool,
        &pool_config,
        &wallet_pubkey,
        10_000_000,  // 0.01 SOL in lamports
        400,         // 4% slippage in basis points
    );

    // Build sell instructions (with WSOL unwrapping)
    let sell_instructions = build_sell_with_unwrap(
        &pool_address,
        &pool,
        &pool_config,
        &wallet_pubkey,
        token_amount,
        400,
    );

    Ok(())
}

Available Functions

RPC Functions (requires fetch feature)

  • find_pool_by_token_mint - Find pool address by token mint
  • fetch_virtual_pool - Fetch pool state
  • fetch_pool_config - Fetch pool configuration

Instruction Builders

  • build_buy_instruction - Build swap instruction for buying
  • build_sell_instruction - Build swap instruction for selling
  • build_buy_with_wrap - Complete buy with WSOL wrapping
  • build_sell_with_unwrap - Complete sell with WSOL unwrapping

WSOL Helpers

  • wrap_sol_instructions - Instructions to wrap SOL to WSOL
  • close_wsol_instruction - Close WSOL account

Price Calculations

  • calculate_tokens_out_dbc - Estimate tokens for a buy
  • calculate_sol_out_dbc - Estimate SOL for a sell
  • get_price_from_sqrt_price - Get price from sqrt_price

License

MIT

Commit count: 0

cargo fmt