feat: upgrade to v3.3.2 with explicit token_program parameter support

Major changes:
- Bump version from 3.3.1 to 3.3.2
- Add token_program field to PumpFun trading parameters
- Support explicit token_program passing for better TOKEN_PROGRAM_2022 compatibility
- Update all example code to pass token_program parameter
- Optimize token program determination logic from auto-inference to explicit parameter
This commit is contained in:
ysq
2025-11-18 10:04:46 +08:00
parent 8f945995a4
commit b04ca6c27a
9 changed files with 30 additions and 21 deletions
+5 -13
View File
@@ -1,6 +1,6 @@
use crate::{
common::spl_token::close_account,
constants::trade::trade::DEFAULT_SLIPPAGE,
constants::{trade::trade::DEFAULT_SLIPPAGE, TOKEN_PROGRAM_2022},
trading::core::{
params::{PumpFunParams, SwapParams},
traits::InstructionBuilder,
@@ -70,12 +70,8 @@ impl InstructionBuilder for PumpFunInstructionBuilder {
// Determine token program based on mayhem mode
let is_mayhem_mode = bonding_curve.is_mayhem_mode;
let token_program = if is_mayhem_mode {
crate::constants::TOKEN_PROGRAM_2022
} else {
crate::constants::TOKEN_PROGRAM
};
let token_program_meta = if is_mayhem_mode {
let token_program = protocol_params.token_program;
let token_program_meta = if protocol_params.token_program == TOKEN_PROGRAM_2022 {
crate::constants::TOKEN_PROGRAM_2022_META
} else {
crate::constants::TOKEN_PROGRAM_META
@@ -210,12 +206,8 @@ impl InstructionBuilder for PumpFunInstructionBuilder {
// Determine token program based on mayhem mode
let is_mayhem_mode = bonding_curve.is_mayhem_mode;
let token_program = if is_mayhem_mode {
crate::constants::TOKEN_PROGRAM_2022
} else {
crate::constants::TOKEN_PROGRAM
};
let token_program_meta = if is_mayhem_mode {
let token_program = protocol_params.token_program;
let token_program_meta = if protocol_params.token_program == TOKEN_PROGRAM_2022 {
crate::constants::TOKEN_PROGRAM_2022_META
} else {
crate::constants::TOKEN_PROGRAM_META