Skip to content

Commit 74bc6bb

Browse files
a00012025claude
andauthored
fix: handle optional binArrayBitmapExtension account in LbClmm parser (#27)
Three LbClmm instructions (AddLiquidityByStrategyOneSide, AddLiquidityOneSide, AddLiquidityOneSidePrecise) were using next_program_id_optional_account for binArrayBitmapExtension, which always expects the account to be present in the list (set to program ID if unused). However, Meteora's on-chain program allows truly omitting this optional account, resulting in 11 accounts instead of 12. Switch to next_optional_account which handles both cases: - 12 accounts: optional account present, consume it - 11 accounts: optional account omitted, return None Fixes: "Too few accounts provided: expected 12, got 11" errors. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 3067f14 commit 74bc6bb

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

crates/meteora-parser/src/generated_parser/instructions_parser.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -528,12 +528,12 @@ impl InstructionParser {
528528
))
529529
},
530530
[41, 5, 238, 175, 100, 225, 6, 205] => {
531-
let expected_accounts_len = 12;
531+
let mut expected_accounts_len = 11;
532532
check_min_accounts_req(accounts_len, expected_accounts_len)?;
533533
let ix_accounts = AddLiquidityByStrategyOneSideIxAccounts {
534534
position: next_account(accounts)?,
535535
lb_pair: next_account(accounts)?,
536-
bin_array_bitmap_extension: next_program_id_optional_account(accounts)?,
536+
bin_array_bitmap_extension: next_optional_account(accounts, accounts_len, &mut expected_accounts_len)?,
537537
user_token: next_account(accounts)?,
538538
reserve: next_account(accounts)?,
539539
token_mint: next_account(accounts)?,
@@ -552,12 +552,12 @@ impl InstructionParser {
552552
))
553553
},
554554
[94, 155, 103, 151, 70, 95, 220, 165] => {
555-
let expected_accounts_len = 12;
555+
let mut expected_accounts_len = 11;
556556
check_min_accounts_req(accounts_len, expected_accounts_len)?;
557557
let ix_accounts = AddLiquidityOneSideIxAccounts {
558558
position: next_account(accounts)?,
559559
lb_pair: next_account(accounts)?,
560-
bin_array_bitmap_extension: next_program_id_optional_account(accounts)?,
560+
bin_array_bitmap_extension: next_optional_account(accounts, accounts_len, &mut expected_accounts_len)?,
561561
user_token: next_account(accounts)?,
562562
reserve: next_account(accounts)?,
563563
token_mint: next_account(accounts)?,
@@ -1169,12 +1169,12 @@ impl InstructionParser {
11691169
))
11701170
},
11711171
[161, 194, 103, 84, 171, 71, 250, 154] => {
1172-
let expected_accounts_len = 12;
1172+
let mut expected_accounts_len = 11;
11731173
check_min_accounts_req(accounts_len, expected_accounts_len)?;
11741174
let ix_accounts = AddLiquidityOneSidePreciseIxAccounts {
11751175
position: next_account(accounts)?,
11761176
lb_pair: next_account(accounts)?,
1177-
bin_array_bitmap_extension: next_program_id_optional_account(accounts)?,
1177+
bin_array_bitmap_extension: next_optional_account(accounts, accounts_len, &mut expected_accounts_len)?,
11781178
user_token: next_account(accounts)?,
11791179
reserve: next_account(accounts)?,
11801180
token_mint: next_account(accounts)?,

0 commit comments

Comments
 (0)