pub struct PumpSdk;Expand description
Offline instruction builders. No RPC calls are made and does not require RPC connection url.
Implementations§
Source§impl PumpSdk
impl PumpSdk
pub const fn new() -> Self
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
v1 create: SPL Token + Metaplex metadata. The TS SDK marks the
matching helper @deprecated in favor of create_v2_instruction,
but it remains supported on-chain.
Sourcepub fn create_v2_instruction(
&self,
mint: Pubkey,
user: Pubkey,
name: impl Into<String>,
symbol: impl Into<String>,
uri: impl Into<String>,
creator: 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, mayhem_mode: bool, cashback: bool, ) -> Instruction
v2 create: Token-2022 + Mayhem PDAs.
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
Buy tokens from a bonding curve. The caller picks fee_recipient and
buyback_fee_recipient from the on-chain Global state. max_sol_cost
is the slippage-adjusted ceiling on SOL spent. token_program is the
SPL Token program for the mint (Token-2022 for v2 coins, classic SPL
Token otherwise).
Remaining accounts (in order, mirrors pump-sdk-internal’s
getBuyInstructionInternal): bonding_curve_v2 (readonly),
buyback_fee_recipient (writable).
Sourcepub fn buy_v2_instruction(
&self,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
max_sol_cost: u64,
) -> Instruction
pub fn buy_v2_instruction( &self, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, max_sol_cost: u64, ) -> Instruction
Buy tokens with an arbitrary quote mint. Unlike buy_instruction, the
program takes the quote asset on its own token program and routes a
share of fees through the per-mint sharing_config.
Caller picks fee_recipient and buyback_fee_recipient from Global.
Sourcepub fn buy_v2_instructions(
&self,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
max_sol_cost: u64,
) -> Vec<Instruction>
pub fn buy_v2_instructions( &self, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, max_sol_cost: u64, ) -> Vec<Instruction>
buy_v2 preceded by idempotent ATA creates for every account the
program does NOT lazy-initialize. From programs/pump/src/buy_v2.rs,
validate_quote_token_account only initializes the creator-vault,
user-volume-accumulator, and quote-fee-recipient quote ATAs
(should_initialize = true); everything else must already exist.
We emit 4 prefixes:
associated_base_user(always required)associated_quote_bonding_curveassociated_quote_userassociated_quote_buyback_fee_recipient(2-4) are only enforced for non-legacy curves but are idempotent and cheap when already present.
Sourcepub fn sell_instruction(
&self,
mint: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
amount: u64,
min_sol_output: u64,
token_program: Pubkey,
) -> Instruction
👎Deprecated: Use sell_v2_instruction instead
pub fn sell_instruction( &self, mint: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, amount: u64, min_sol_output: u64, token_program: Pubkey, ) -> Instruction
Use sell_v2_instruction instead
Sell tokens back to a bonding curve. The caller picks fee_recipient
from the on-chain Global state. min_sol_output is the
slippage-adjusted floor on SOL received. token_program is the SPL
Token program for the mint (Token-2022 for v2 coins, classic SPL Token
otherwise).
Remaining accounts (in order, mirrors the on-chain handler’s cashback
path): user_volume_accumulator (writable), bonding_curve_v2
(readonly). Always appended; the program falls back to
creator_vault when these are absent or invalid.
Sourcepub fn sell_v2_instruction(
&self,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
min_sol_output: u64,
) -> Instruction
pub fn sell_v2_instruction( &self, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, min_sol_output: u64, ) -> Instruction
Sell tokens for an arbitrary quote mint. Mirror of buy_v2_instruction
on the sell side. Routes a share of fees through the per-mint
sharing_config. Caller picks fee_recipient and
buyback_fee_recipient from Global.
Sourcepub fn sell_v2_instructions(
&self,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
creator: Pubkey,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
min_sol_output: u64,
) -> Vec<Instruction>
pub fn sell_v2_instructions( &self, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, creator: Pubkey, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, min_sol_output: u64, ) -> Vec<Instruction>
sell_v2 preceded by idempotent ATA creates for every account the
program does NOT lazy-initialize. Mirrors buy_v2_instructions. We
emit 4 prefixes:
associated_base_user(user must hold the base token)associated_quote_bonding_curveassociated_quote_user(user receives quote)associated_quote_buyback_fee_recipient
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,
mayhem_mode: bool,
cashback: bool,
fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
amount: u64,
max_sol_cost: u64,
) -> 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, mayhem_mode: bool, cashback: bool, fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, amount: u64, max_sol_cost: u64, ) -> Vec<Instruction>
create_v2 + idempotent ATA + buy, in that order.
Mirrors createV2AndBuyInstructions in pump-sdk/src/sdk.ts.
fee_recipient is supplied by the caller (typically picked from
Global). Quote is wSOL on the classic SPL Token program — the
only sensible quote at creation time. For other quotes, call
buy_v2_instruction directly.
pub fn extend_account_ix(&self, mint: Pubkey, user: Pubkey) -> Instruction
Sourcepub fn buy_amm_instruction(
&self,
pool: Pubkey,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
coin_creator: Pubkey,
protocol_fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
is_cashback_coin: bool,
base_amount_out: u64,
max_quote_amount_in: u64,
) -> Instruction
pub fn buy_amm_instruction( &self, pool: Pubkey, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, coin_creator: Pubkey, protocol_fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, is_cashback_coin: bool, base_amount_out: u64, max_quote_amount_in: u64, ) -> Instruction
Buy on a graduated pump_amm pool. Mirrors PUMP_AMM_SDK.buyInstructions’
inner IX from pump-swap-sdk/src/sdk/offlinePumpAmm.ts. Caller picks
protocol_fee_recipient from GlobalConfig (via getFeeRecipient) and
buyback_fee_recipient likewise (via getBuybackFeeRecipient).
coin_creator and is_cashback_coin come from the on-chain Pool.
Pass Pubkey::default() for coin_creator to skip the
bonding_curve_v2 remaining account on default-creator pools.
track_volume is hardcoded to true (matches the TS SDK).
Sourcepub fn buy_amm_instructions(
&self,
pool: Pubkey,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
coin_creator: Pubkey,
protocol_fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
is_cashback_coin: bool,
base_amount_out: u64,
max_quote_amount_in: u64,
) -> Vec<Instruction>
pub fn buy_amm_instructions( &self, pool: Pubkey, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, coin_creator: Pubkey, protocol_fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, is_cashback_coin: bool, base_amount_out: u64, max_quote_amount_in: u64, ) -> Vec<Instruction>
buy_amm preceded by an idempotent ATA-create for the user’s base ATA
(the asset being received). Wsol management for the quote side is the
caller’s responsibility; the existing buy_v2_instructions wrapper
follows the same convention.
Sourcepub fn sell_amm_instruction(
&self,
pool: Pubkey,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
coin_creator: Pubkey,
protocol_fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
is_cashback_coin: bool,
base_amount_in: u64,
min_quote_amount_out: u64,
) -> Instruction
pub fn sell_amm_instruction( &self, pool: Pubkey, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, coin_creator: Pubkey, protocol_fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, is_cashback_coin: bool, base_amount_in: u64, min_quote_amount_out: u64, ) -> Instruction
Sell on a graduated pump_amm pool. Mirrors PUMP_AMM_SDK.sellInstructions’
inner IX from pump-swap-sdk/src/sdk/offlinePumpAmm.ts. The remaining-account
layout differs from buy in three places (cashback adds two accounts not one,
the cashback ATA uses quote_mint not NATIVE_MINT, and
buyback_fee_recipient is read-only). See buy_amm_instruction for the
rest of the parameter contract.
Sourcepub fn sell_amm_instructions(
&self,
pool: Pubkey,
base_mint: Pubkey,
quote_mint: Pubkey,
base_token_program: Pubkey,
quote_token_program: Pubkey,
user: Pubkey,
coin_creator: Pubkey,
protocol_fee_recipient: Pubkey,
buyback_fee_recipient: Pubkey,
is_cashback_coin: bool,
base_amount_in: u64,
min_quote_amount_out: u64,
) -> Vec<Instruction>
pub fn sell_amm_instructions( &self, pool: Pubkey, base_mint: Pubkey, quote_mint: Pubkey, base_token_program: Pubkey, quote_token_program: Pubkey, user: Pubkey, coin_creator: Pubkey, protocol_fee_recipient: Pubkey, buyback_fee_recipient: Pubkey, is_cashback_coin: bool, base_amount_in: u64, min_quote_amount_out: u64, ) -> Vec<Instruction>
sell_amm preceded by an idempotent ATA-create for the user’s quote ATA
(the asset being received).
Sourcepub fn trade_tx_instructions(&self, params: TradeTxParams) -> Vec<Instruction>
pub fn trade_tx_instructions(&self, params: TradeTxParams) -> Vec<Instruction>
Build a complete buy/sell against either the bonding curve (buy_v2/
sell_v2) or a graduated pump_amm pool. Mirrors TradeTxService.tradeTx.
Sourcepub fn create_coin_instructions(
&self,
params: CreateCoinParams,
) -> Vec<Instruction>
pub fn create_coin_instructions( &self, params: CreateCoinParams, ) -> Vec<Instruction>
Build a complete create_v2 + initial-buy with full SOL wrap/unwrap.
Mirrors TradeTxService.createCoin minus the optional tokenized-agent
step (no Rust pump-agent-payments SDK in this repo).
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 quoting where the user specifies SOL in.
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 quoting where the user specifies token amount out.
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 quoting.
Sourcepub fn buy_quote_amm_sol_in(
&self,
global_config: &GlobalConfig,
fee_config: Option<&AmmFeeConfig>,
source: AmmQuoteSource<'_>,
sol_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_amm_sol_in( &self, global_config: &GlobalConfig, fee_config: Option<&AmmFeeConfig>, source: AmmQuoteSource<'_>, sol_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM buy quoting where the user specifies quote (e.g. wSOL) in.
Sourcepub fn buy_quote_amm_token_out(
&self,
global_config: &GlobalConfig,
fee_config: Option<&AmmFeeConfig>,
source: AmmQuoteSource<'_>,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn buy_quote_amm_token_out( &self, global_config: &GlobalConfig, fee_config: Option<&AmmFeeConfig>, source: AmmQuoteSource<'_>, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM buy quoting where the user specifies token amount out.
Sourcepub fn sell_quote_amm(
&self,
global_config: &GlobalConfig,
fee_config: Option<&AmmFeeConfig>,
source: AmmQuoteSource<'_>,
token_amount: u64,
slippage_bps: u16,
) -> QuoteResult<Quote>
pub fn sell_quote_amm( &self, global_config: &GlobalConfig, fee_config: Option<&AmmFeeConfig>, source: AmmQuoteSource<'_>, token_amount: u64, slippage_bps: u16, ) -> QuoteResult<Quote>
AMM sell quoting.
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