feat: add seed optimization and mint ATA creation control
- Add open_seed_optimize parameter for transaction CU optimization using createAccountWithSeed - Add create_mint_ata parameter to control automatic mint token account creation - Update all examples to include new create_mint_ata parameter (set to true) - Enhance documentation with detailed explanations of seed optimization features - Add warnings about compatibility requirements when using seed optimization - Support conditional mint ATA creation across all trading protocols (PumpFun, PumpSwap, Bonk, Raydium) BREAKING CHANGE: All buy functions now require create_mint_ata parameter
This commit is contained in:
@@ -93,15 +93,17 @@ impl InstructionBuilder for PumpFunInstructionBuilder {
|
||||
let mut instructions = Vec::with_capacity(2);
|
||||
|
||||
// Create associated token account
|
||||
instructions.extend(
|
||||
crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed(
|
||||
¶ms.payer.pubkey(),
|
||||
¶ms.payer.pubkey(),
|
||||
¶ms.mint,
|
||||
&crate::constants::TOKEN_PROGRAM,
|
||||
params.open_seed_optimize,
|
||||
),
|
||||
);
|
||||
if params.create_mint_ata {
|
||||
instructions.extend(
|
||||
crate::common::fast_fn::create_associated_token_account_idempotent_fast_use_seed(
|
||||
¶ms.payer.pubkey(),
|
||||
¶ms.payer.pubkey(),
|
||||
¶ms.mint,
|
||||
&crate::constants::TOKEN_PROGRAM,
|
||||
params.open_seed_optimize,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
let mut buy_data = [0u8; 24];
|
||||
buy_data[..8].copy_from_slice(&[102, 6, 61, 18, 1, 218, 235, 234]); // Method ID
|
||||
|
||||
Reference in New Issue
Block a user