fix(meteora-damm-v2): use correct token program for output ATA creation

- Pass token_a/token_b program based on swap direction (is_a_in) when
  creating the output mint ATA in buy flow, matching ATA address derivation
  for SPL Token vs Token-2022 mints.
- Resolve token_a_program and token_b_program from on-chain mint account
  owners in MeteoraDammV2Params::from_pool_address_by_rpc instead of
  hardcoding the classic SPL Token program.

Fixes incorrect ATA creation for Token-2022 output mints (issue #99).

Made-with: Cursor
This commit is contained in:
0xfnzero
2026-04-14 13:04:01 +08:00
parent 06ef2fed84
commit d711346c55
2 changed files with 20 additions and 4 deletions
+5 -1
View File
@@ -87,7 +87,11 @@ impl InstructionBuilder for MeteoraDammV2InstructionBuilder {
&params.payer.pubkey(),
&params.payer.pubkey(),
&params.output_mint,
&crate::constants::TOKEN_PROGRAM,
if is_a_in {
&protocol_params.token_b_program
} else {
&protocol_params.token_a_program
},
params.open_seed_optimize,
),
);