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:
ysq
2025-09-10 00:18:31 +08:00
parent 5225cff73c
commit 30c41efece
22 changed files with 102 additions and 54 deletions
+11 -9
View File
@@ -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(
&params.payer.pubkey(),
&params.payer.pubkey(),
&params.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(
&params.payer.pubkey(),
&params.payer.pubkey(),
&params.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