pub struct PumpSdk;Expand description
Instruction builders (no RPC).
Implementations§
Source§impl PumpSdk
impl PumpSdk
Sourcepub fn buy_amm_instruction(
&self,
pool: Pubkey,
amm_global: &GlobalConfig,
pool_state: &Pool,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
base_amount_out: u64,
max_quote_amount_in: u64,
) -> Option<Instruction>
pub fn buy_amm_instruction( &self, pool: Pubkey, amm_global: &GlobalConfig, pool_state: &Pool, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, base_amount_out: u64, max_quote_amount_in: u64, ) -> Option<Instruction>
pump_amm buy. Fees from GlobalConfig, pool layout from Pool. Use default coin_creator to omit pool_v2.
Sourcepub fn buy_amm_instructions(
&self,
pool: Pubkey,
amm_global: &GlobalConfig,
pool_state: &Pool,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
base_amount_out: u64,
max_quote_amount_in: u64,
) -> Option<Vec<Instruction>>
pub fn buy_amm_instructions( &self, pool: Pubkey, amm_global: &GlobalConfig, pool_state: &Pool, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, base_amount_out: u64, max_quote_amount_in: u64, ) -> Option<Vec<Instruction>>
Self::buy_amm_instruction plus idempotent user base ATA create.
Sourcepub fn sell_amm_instruction(
&self,
pool: Pubkey,
amm_global: &GlobalConfig,
pool_state: &Pool,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
base_amount_in: u64,
min_quote_amount_out: u64,
) -> Option<Instruction>
pub fn sell_amm_instruction( &self, pool: Pubkey, amm_global: &GlobalConfig, pool_state: &Pool, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, base_amount_in: u64, min_quote_amount_out: u64, ) -> Option<Instruction>
pump_amm sell (remaining accounts differ from buy for cashback / buyback).
Sourcepub fn sell_amm_instructions(
&self,
pool: Pubkey,
amm_global: &GlobalConfig,
pool_state: &Pool,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
base_amount_in: u64,
min_quote_amount_out: u64,
) -> Option<Vec<Instruction>>
pub fn sell_amm_instructions( &self, pool: Pubkey, amm_global: &GlobalConfig, pool_state: &Pool, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, base_amount_in: u64, min_quote_amount_out: u64, ) -> Option<Vec<Instruction>>
Self::sell_amm_instruction plus idempotent user quote ATA create.
Sourcepub fn collect_coin_creator_fee_instruction(
&self,
coin_creator: Pubkey,
quote_mint: Pubkey,
quote_token_program: Pubkey,
) -> Instruction
pub fn collect_coin_creator_fee_instruction( &self, coin_creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, ) -> Instruction
collect_coin_creator_fee. Sweeps the AMM coin-creator vault’s
quote_mint balance into the coin creator’s own quote ATA.
Works for any supported quote mint (wSOL or non-SOL).
Sourcepub fn collect_coin_creator_fee_instructions(
&self,
payer: Pubkey,
coin_creator: Pubkey,
quote_mint: Pubkey,
quote_token_program: Pubkey,
create_coin_creator_ata: bool,
) -> Vec<Instruction>
pub fn collect_coin_creator_fee_instructions( &self, payer: Pubkey, coin_creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, create_coin_creator_ata: bool, ) -> Vec<Instruction>
Self::collect_coin_creator_fee_instruction with an optional
idempotent ATA create for the coin creator’s quote ATA prepended.
payer only matters when the ATA create runs.
pub fn transfer_creator_fees_to_pump_v2_instruction( &self, payer: Pubkey, coin_creator: Pubkey, quote_mint: Pubkey, token_program: Pubkey, ) -> Instruction
Source§impl PumpSdk
impl PumpSdk
Sourcepub fn create_instruction(
&self,
mint: Pubkey,
user: Pubkey,
name: impl Into<String>,
symbol: impl Into<String>,
uri: impl Into<String>,
creator: Pubkey,
) -> Instruction
👎Deprecated: Use create_v2_instruction instead
pub fn create_instruction( &self, mint: Pubkey, user: Pubkey, name: impl Into<String>, symbol: impl Into<String>, uri: impl Into<String>, creator: Pubkey, ) -> Instruction
Use create_v2_instruction instead
Legacy create (SPL Token + Metaplex); prefer Self::create_v2_instruction.
Sourcepub fn buy_instruction(
&self,
mint: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
max_sol_cost: u64,
token_program: Pubkey,
) -> Instruction
👎Deprecated: Use buy_v2_instruction instead
pub fn buy_instruction( &self, mint: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, max_sol_cost: u64, token_program: Pubkey, ) -> Instruction
Use buy_v2_instruction instead
Legacy bonding-curve buy; prefer Self::buy_v2_instruction. Appends bonding_curve_v2, buyback_fee_recipient.
Sourcepub fn sell_instruction(
&self,
mint: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
min_sol_output: u64,
token_program: Pubkey,
is_cashback_coin: bool,
) -> Instruction
👎Deprecated: Use sell_v2_instruction instead
pub fn sell_instruction( &self, mint: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, min_sol_output: u64, token_program: Pubkey, is_cashback_coin: bool, ) -> Instruction
Use sell_v2_instruction instead
Legacy sell; prefer Self::sell_v2_instruction. Appends UVA, bonding_curve_v2.
Source§impl PumpSdk
impl PumpSdk
Sourcepub fn create_v2_instruction(
&self,
mint: Pubkey,
user: Pubkey,
name: impl Into<String>,
symbol: impl Into<String>,
uri: impl Into<String>,
creator: Pubkey,
quote_mint: Pubkey,
mayhem_mode: bool,
cashback: bool,
) -> Instruction
pub fn create_v2_instruction( &self, mint: Pubkey, user: Pubkey, name: impl Into<String>, symbol: impl Into<String>, uri: impl Into<String>, creator: Pubkey, quote_mint: Pubkey, mayhem_mode: bool, cashback: bool, ) -> Instruction
create_v2 (Token-2022, Mayhem PDAs).
quote_mint selects the curve’s quote asset. Pass Pubkey::default()
or constants::NATIVE_MINT for the standard wSOL curve. Any other
mint (e.g. USDC) is treated as a non-SOL quote and three remaining
accounts are appended (quote mint, the legacy-SPL ATA owned by the
bonding curve, and the legacy SPL Token program).
Sourcepub fn buy_v2_instruction(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
amount: u64,
max_quote_tokens: u64,
) -> Option<Instruction>
pub fn buy_v2_instruction( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, amount: u64, max_quote_tokens: u64, ) -> Option<Instruction>
buy_v2 with fee recipients from Global and quote layout from BondingCurve.
Sourcepub fn buy_v2_instructions(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
amount: u64,
max_quote_tokens: u64,
) -> Option<Vec<Instruction>>
pub fn buy_v2_instructions( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, amount: u64, max_quote_tokens: u64, ) -> Option<Vec<Instruction>>
buy_v2 with idempotent ATA creates for base/quote user accounts (skipped when quote_mint is the default).
Sourcepub fn buy_exact_quote_in_v2_instruction(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
spendable_quote_in: u64,
min_tokens_out: u64,
) -> Option<Instruction>
pub fn buy_exact_quote_in_v2_instruction( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, spendable_quote_in: u64, min_tokens_out: u64, ) -> Option<Instruction>
buy_exact_quote_in_v2: spend exactly spendable_quote_in, requiring at least min_tokens_out base tokens out.
Sourcepub fn buy_exact_quote_in_v2_instructions(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
spendable_quote_in: u64,
min_tokens_out: u64,
) -> Option<Vec<Instruction>>
pub fn buy_exact_quote_in_v2_instructions( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, spendable_quote_in: u64, min_tokens_out: u64, ) -> Option<Vec<Instruction>>
buy_exact_quote_in_v2 with idempotent ATA creates for base/quote user accounts (skipped when quote_mint is the default).
Sourcepub fn sell_v2_instruction(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
amount: u64,
min_sol_output: u64,
) -> Option<Instruction>
pub fn sell_v2_instruction( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, amount: u64, min_sol_output: u64, ) -> Option<Instruction>
sell_v2; fee recipients from Global, quote accounts from BondingCurve.
Sourcepub fn sell_v2_instructions(
&self,
global: &Global,
bonding_curve: &BondingCurve,
base_mint: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
amount: u64,
min_sol_output: u64,
) -> Option<Vec<Instruction>>
pub fn sell_v2_instructions( &self, global: &Global, bonding_curve: &BondingCurve, base_mint: Pubkey, quote_token_program: Pubkey, user: Pubkey, amount: u64, min_sol_output: u64, ) -> Option<Vec<Instruction>>
sell_v2 with idempotent ATA creates for base/quote user accounts (skipped when quote_mint is the default).
Sourcepub fn create_v2_and_buy_instruction(
&self,
mint: Pubkey,
user: Pubkey,
name: impl Into<String>,
symbol: impl Into<String>,
uri: impl Into<String>,
creator: Pubkey,
quote_mint: Pubkey,
mayhem_mode: bool,
cashback: bool,
tokenized_agent_buyback_bps: Option<u16>,
global: &Global,
amount: u64,
max_quote_tokens: u64,
) -> Option<Vec<Instruction>>
pub fn create_v2_and_buy_instruction( &self, mint: Pubkey, user: Pubkey, name: impl Into<String>, symbol: impl Into<String>, uri: impl Into<String>, creator: Pubkey, quote_mint: Pubkey, mayhem_mode: bool, cashback: bool, tokenized_agent_buyback_bps: Option<u16>, global: &Global, amount: u64, max_quote_tokens: u64, ) -> Option<Vec<Instruction>>
create_v2 then Self::buy_v2_instructions. Pass
quote_mint = Pubkey::default() for a wSOL-quoted coin, or a
supported quote mint (e.g. USDC) for a non-native quote.
Pass tokenized_agent_buyback_bps = Some(bps) to also append
Self::agent_initialize_instruction in the same tx (mirrors the
frontend’s tokenized-agent flow).
Sourcepub fn agent_initialize_instruction(
&self,
mint: Pubkey,
user: Pubkey,
creator: Pubkey,
buyback_bps: u16,
) -> Instruction
pub fn agent_initialize_instruction( &self, mint: Pubkey, user: Pubkey, creator: Pubkey, buyback_bps: u16, ) -> Instruction
agent_initialize (pump_agent_payments). Initializes the
TokenAgentPayments PDA for mint with creator as the agent
payment authority. user signs and pays for the new account.
pub fn extend_account_ix(&self, mint: Pubkey, user: Pubkey) -> Instruction
pub fn claim_cashback_v2_instruction( &self, user: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, ) -> Instruction
pub fn collect_creator_fee_v2_instructions( &self, payer: Pubkey, creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, create_creator_ata: bool, ) -> Vec<Instruction>
pub fn collect_creator_fee_v2_instruction( &self, creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, ) -> Instruction
pub fn distribute_creator_fees_v2_instructions( &self, payer: Pubkey, mint: Pubkey, creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, initialize_ata: bool, create_creator_vault_ata: bool, shareholders: &[Pubkey], ) -> Vec<Instruction>
pub fn distribute_creator_fees_v2_instruction( &self, payer: Pubkey, mint: Pubkey, creator: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, initialize_ata: bool, shareholders: &[Pubkey], ) -> Instruction
Sourcepub fn create_coin_instructions(
&self,
params: CreateCoinParams<'_>,
) -> Option<Vec<Instruction>>
pub fn create_coin_instructions( &self, params: CreateCoinParams<'_>, ) -> Option<Vec<Instruction>>
create_v2 then Self::buy_v2_instructions. Set
params.quote_mint = Pubkey::default() for a wSOL-quoted coin, or a
supported quote mint (e.g. USDC) for a non-native quote.
Setting params.tokenized_agent_buyback_bps = Some(bps) also appends
Self::agent_initialize_instruction.
Source§impl PumpSdk
impl PumpSdk
Sourcepub fn trade_tx_instructions_with_venue(
&self,
params: TradeTxWithVenueParams<'_>,
) -> Option<Vec<Instruction>>
pub fn trade_tx_instructions_with_venue( &self, params: TradeTxWithVenueParams<'_>, ) -> Option<Vec<Instruction>>
Full buy or sell: bonding curve via Self::buy_v2_instructions /
Self::sell_v2_instructions, or AMM with wSOL wrap/unwrap when the quote is native.
None if global fee recipients are missing.
Sourcepub fn trade_tx_instructions(
&self,
params: TradeTxParams<'_>,
) -> Option<Vec<Instruction>>
pub fn trade_tx_instructions( &self, params: TradeTxParams<'_>, ) -> Option<Vec<Instruction>>
Self::trade_tx_instructions_with_venue with routing from bonding_curve.complete.
Sourcepub fn quote_trade(
&self,
params: TradeQuoteParams<'_>,
) -> Option<QuoteResult<Quote>>
pub fn quote_trade( &self, params: TradeQuoteParams<'_>, ) -> Option<QuoteResult<Quote>>
Auto-routed quote: bonding curve via Self::buy_quote_bonding_curve_token_out /
Self::sell_quote_bonding_curve, or AMM via Self::buy_quote_amm_token_out /
Self::sell_quote_amm using bonding_curve.complete. None when the curve is
complete and pump_pool was not supplied — mirrors Self::trade_tx_instructions.
Source§impl PumpSdk
impl PumpSdk
pub const fn new() -> Self
Sourcepub fn fee_recipient_from_pump_global(
global: &Global,
is_mayhem: bool,
) -> Option<Pubkey>
pub fn fee_recipient_from_pump_global( global: &Global, is_mayhem: bool, ) -> Option<Pubkey>
Random protocol fee recipient from Global (deduped).
Sourcepub fn buyback_fee_recipient_from_pump_global(global: &Global) -> Option<Pubkey>
pub fn buyback_fee_recipient_from_pump_global(global: &Global) -> Option<Pubkey>
Random buyback fee recipient from Global.
Sourcepub fn protocol_fee_recipient_from_amm_global(
global_config: &GlobalConfig,
) -> Option<Pubkey>
pub fn protocol_fee_recipient_from_amm_global( global_config: &GlobalConfig, ) -> Option<Pubkey>
Random protocol fee recipient from AMM GlobalConfig.
Sourcepub fn buyback_fee_recipient_from_amm_global(
global_config: &GlobalConfig,
) -> Option<Pubkey>
pub fn buyback_fee_recipient_from_amm_global( global_config: &GlobalConfig, ) -> Option<Pubkey>
Random buyback fee recipient from AMM GlobalConfig.
Sourcepub fn pump_fee_recipients_pair(
global: &Global,
is_mayhem: bool,
) -> Option<(Pubkey, Pubkey)>
pub fn pump_fee_recipients_pair( global: &Global, is_mayhem: bool, ) -> Option<(Pubkey, Pubkey)>
(fee_recipient, buyback_fee_recipient) from Global. None when either pool is empty.
Sourcepub fn amm_fee_recipients_pair(
global_config: &GlobalConfig,
) -> Option<(Pubkey, Pubkey)>
pub fn amm_fee_recipients_pair( global_config: &GlobalConfig, ) -> Option<(Pubkey, Pubkey)>
(protocol_fee_recipient, buyback_fee_recipient) from AMM GlobalConfig. None when either pool is empty.
Sourcepub fn buy_quote_bonding_curve_sol_in(
&self,
global: &Global,
fee_config: Option<&FeeConfig>,
bonding_curve: &BondingCurve,
mint_supply: u64,
sol_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_bonding_curve_sol_in( &self, global: &Global, fee_config: Option<&FeeConfig>, bonding_curve: &BondingCurve, mint_supply: u64, sol_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
Bonding curve buy: SOL in → tokens out.
Sourcepub fn buy_quote_bonding_curve_token_out(
&self,
global: &Global,
fee_config: Option<&FeeConfig>,
bonding_curve: &BondingCurve,
mint_supply: u64,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_bonding_curve_token_out( &self, global: &Global, fee_config: Option<&FeeConfig>, bonding_curve: &BondingCurve, mint_supply: u64, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
Bonding curve buy: fixed token out → SOL cost.
Sourcepub fn sell_quote_bonding_curve(
&self,
global: &Global,
fee_config: Option<&FeeConfig>,
bonding_curve: &BondingCurve,
mint_supply: u64,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn sell_quote_bonding_curve( &self, global: &Global, fee_config: Option<&FeeConfig>, bonding_curve: &BondingCurve, mint_supply: u64, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
Bonding curve sell.
Sourcepub fn buy_quote_amm_sol_in(
&self,
global_config: &GlobalConfig,
fee_config: Option<&FeeConfig>,
source: AmmQuoteSource<'_>,
sol_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_amm_sol_in( &self, global_config: &GlobalConfig, fee_config: Option<&FeeConfig>, source: AmmQuoteSource<'_>, sol_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM buy: quote in.
Sourcepub fn buy_quote_amm_token_out(
&self,
global_config: &GlobalConfig,
fee_config: Option<&FeeConfig>,
source: AmmQuoteSource<'_>,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_amm_token_out( &self, global_config: &GlobalConfig, fee_config: Option<&FeeConfig>, source: AmmQuoteSource<'_>, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM buy: token amount out.
Sourcepub fn sell_quote_amm(
&self,
global_config: &GlobalConfig,
fee_config: Option<&FeeConfig>,
source: AmmQuoteSource<'_>,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn sell_quote_amm( &self, global_config: &GlobalConfig, fee_config: Option<&FeeConfig>, source: AmmQuoteSource<'_>, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM sell.
Trait Implementations§
impl Copy for PumpSdk
Auto Trait Implementations§
impl Freeze for PumpSdk
impl RefUnwindSafe for PumpSdk
impl Send for PumpSdk
impl Sync for PumpSdk
impl Unpin for PumpSdk
impl UnsafeUnpin for PumpSdk
impl UnwindSafe for PumpSdk
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more