Skip to main content

PumpSdk

Struct PumpSdk 

Source
pub struct PumpSdk;
Expand description

Instruction builders (no RPC).

Implementations§

Source§

impl PumpSdk

Source

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.

Source

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.

Source

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).

Source

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.

Source§

impl PumpSdk

Source

pub 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

Legacy create (SPL Token + Metaplex); prefer Self::create_v2_instruction.

Source

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

👎Deprecated:

Use buy_v2_instruction instead

Legacy bonding-curve buy; prefer Self::buy_v2_instruction. Appends bonding_curve_v2, buyback_fee_recipient.

Source

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

👎Deprecated:

Use sell_v2_instruction instead

Legacy sell; prefer Self::sell_v2_instruction. Appends UVA, bonding_curve_v2.

Source§

impl PumpSdk

Source

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).

Source

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.

Source

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).

Source

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.

Source

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).

Source

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.

Source

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).

Source

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).

Source

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.

Source

pub fn extend_account_ix(&self, mint: Pubkey, user: Pubkey) -> Instruction

Source

pub fn claim_cashback_v2_instruction( &self, user: Pubkey, quote_mint: Pubkey, quote_token_program: Pubkey, ) -> Instruction

claim_cashback_v2. Pulls accumulated cashback for user to either the user’s lamport balance (legacy wSOL curves) or to their quote ATA (non-SOL curves). Pass quote_mint = Pubkey::default() or constants::NATIVE_MINT for the legacy/wSOL claim path.

Source

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

Source

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.

Source

pub fn trade_tx_instructions( &self, params: TradeTxParams<'_>, ) -> Option<Vec<Instruction>>

Self::trade_tx_instructions_with_venue with routing from bonding_curve.complete.

Source

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

Source

pub const fn new() -> Self

Source

pub fn fee_recipient_from_pump_global( global: &Global, is_mayhem: bool, ) -> Option<Pubkey>

Random protocol fee recipient from Global (deduped).

Source

pub fn buyback_fee_recipient_from_pump_global(global: &Global) -> Option<Pubkey>

Random buyback fee recipient from Global.

Source

pub fn protocol_fee_recipient_from_amm_global( global_config: &GlobalConfig, ) -> Option<Pubkey>

Random protocol fee recipient from AMM GlobalConfig.

Source

pub fn buyback_fee_recipient_from_amm_global( global_config: &GlobalConfig, ) -> Option<Pubkey>

Random buyback fee recipient from AMM GlobalConfig.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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.

Source

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§

Source§

impl Clone for PumpSdk

Source§

fn clone(&self) -> PumpSdk

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PumpSdk

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PumpSdk

Source§

fn default() -> PumpSdk

Returns the “default value” for a type. Read more
Source§

impl Copy for PumpSdk

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V