| Crates.io | meteora-dbc-client |
| lib.rs | meteora-dbc-client |
| version | 0.1.1 |
| created_at | 2026-01-07 08:40:37.049967+00 |
| updated_at | 2026-01-07 10:16:55.289019+00 |
| description | Rust SDK for Meteora Dynamic Bonding Curve program |
| homepage | |
| repository | https://github.com/your-org/meteora-dbc-rust-sdk |
| max_upload_size | |
| id | 2027811 |
| size | 1,091,564 |
A Rust SDK for interacting with the Meteora Dynamic Bonding Curve (DBC) program on Solana.
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"] }
fetch - Enables RPC client functions for fetching pool dataserde - Enables serialization supportanchor - Enables Anchor compatibilityuse 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(())
}
fetch feature)find_pool_by_token_mint - Find pool address by token mintfetch_virtual_pool - Fetch pool statefetch_pool_config - Fetch pool configurationbuild_buy_instruction - Build swap instruction for buyingbuild_sell_instruction - Build swap instruction for sellingbuild_buy_with_wrap - Complete buy with WSOL wrappingbuild_sell_with_unwrap - Complete sell with WSOL unwrappingwrap_sol_instructions - Instructions to wrap SOL to WSOLclose_wsol_instruction - Close WSOL accountcalculate_tokens_out_dbc - Estimate tokens for a buycalculate_sol_out_dbc - Estimate SOL for a sellget_price_from_sqrt_price - Get price from sqrt_priceMIT