feat: add seed optimization and refactor wSOL account control

- Add `open_seed_optimize` parameter for enhanced performance
- Move wSOL account flags from protocol params to buy/sell params
- Add seed_trading example demonstrating optimization features
- Update all examples and upgrade dependencies
- Improve wSOL account management flexibility

BREAKING CHANGE: Modified buy/sell method signatures and protocol param structs
This commit is contained in:
ysq
2025-09-10 00:05:13 +08:00
parent 1f44de8f9a
commit 5225cff73c
22 changed files with 199 additions and 54 deletions
+4 -4
View File
@@ -91,7 +91,7 @@ impl InstructionBuilder for BonkInstructionBuilder {
// ========================================
let mut instructions = Vec::with_capacity(6);
if protocol_params.create_wsol_ata {
if params.create_wsol_ata {
instructions
.extend(crate::trading::common::handle_wsol(&params.payer.pubkey(), amount_in));
}
@@ -135,7 +135,7 @@ impl InstructionBuilder for BonkInstructionBuilder {
instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec()));
if protocol_params.close_wsol_ata {
if params.close_wsol_ata {
instructions.extend(crate::trading::common::close_wsol(&params.payer.pubkey()));
}
@@ -220,7 +220,7 @@ impl InstructionBuilder for BonkInstructionBuilder {
// ========================================
let mut instructions = Vec::with_capacity(3);
if protocol_params.create_wsol_ata {
if params.create_wsol_ata {
instructions.extend(crate::trading::common::create_wsol_ata(&params.payer.pubkey()));
}
@@ -253,7 +253,7 @@ impl InstructionBuilder for BonkInstructionBuilder {
instructions.push(Instruction::new_with_bytes(accounts::BONK, &data, accounts.to_vec()));
if protocol_params.close_wsol_ata {
if params.close_wsol_ata {
instructions.extend(crate::trading::common::close_wsol(&params.payer.pubkey()));
}