sol-parser-sdk 0.5.13 → 0.5.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,14 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT = void 0;
4
+ exports.parseSwap2FromData = parseSwap2FromData;
5
+ exports.parseAddLiquidityFromData = parseAddLiquidityFromData;
6
+ exports.parseRemoveLiquidityFromData = parseRemoveLiquidityFromData;
7
+ exports.parseLiquidityChangeFromData = parseLiquidityChangeFromData;
8
+ exports.parseUpdateDelegatePermissionFromData = parseUpdateDelegatePermissionFromData;
9
+ exports.parseWithdrawDeadLiquidityRewardFromData = parseWithdrawDeadLiquidityRewardFromData;
10
+ exports.parseCreateConfigFromData = parseCreateConfigFromData;
11
+ exports.parseCreateDynamicConfigFromData = parseCreateDynamicConfigFromData;
3
12
  exports.parseMeteoraDammLog = parseMeteoraDammLog;
4
13
  const metadata_js_1 = require("../core/metadata.js");
5
14
  const dex_event_js_1 = require("../core/dex_event.js");
@@ -15,9 +24,22 @@ const SWAP = discOf([27, 60, 21, 213, 138, 170, 187, 147]);
15
24
  const SWAP2 = discOf([189, 66, 51, 168, 38, 80, 117, 153]);
16
25
  const ADD_LIQUIDITY = discOf([175, 242, 8, 157, 30, 247, 185, 169]);
17
26
  const REMOVE_LIQUIDITY = discOf([87, 46, 88, 98, 175, 96, 34, 91]);
27
+ const LIQUIDITY_CHANGE = discOf([197, 171, 78, 127, 224, 211, 87, 13]);
18
28
  const INITIALIZE_POOL = discOf([228, 50, 246, 85, 203, 66, 134, 37]);
19
29
  const CREATE_POSITION = discOf([156, 15, 119, 198, 29, 181, 221, 55]);
20
30
  const CLOSE_POSITION = discOf([20, 145, 144, 68, 143, 142, 214, 178]);
31
+ const UPDATE_DELEGATE_PERMISSION = discOf([66, 188, 75, 151, 150, 232, 87, 93]);
32
+ const WITHDRAW_DEAD_LIQUIDITY_REWARD = discOf([228, 66, 150, 195, 42, 62, 163, 13]);
33
+ const CREATE_CONFIG = discOf([131, 207, 180, 174, 180, 73, 165, 54]);
34
+ const CREATE_DYNAMIC_CONFIG = discOf([231, 197, 13, 164, 248, 213, 133, 152]);
35
+ /**
36
+ * Mainnet upgrade that replaced `trading_fee/partner_fee` in `EvtSwap2` with
37
+ * `claiming_fee/compounding_fee` without changing discriminator or size.
38
+ */
39
+ exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT = 406_048_752;
40
+ function usesCompoundingFeeLayout(slot) {
41
+ return slot === 0 || slot >= exports.COMPOUNDING_FEE_LAYOUT_ACTIVATION_SLOT;
42
+ }
21
43
  function bn64(v) {
22
44
  return v ?? 0n;
23
45
  }
@@ -35,11 +57,17 @@ function emptyVaults() {
35
57
  function parseSwapEvent(data, meta) {
36
58
  let o = 0;
37
59
  const pool = (0, binary_js_1.readPubkey)(data, o);
60
+ if (!pool)
61
+ return null;
38
62
  o += 32;
39
63
  o += 32;
40
64
  const trade_direction = (0, binary_js_1.readU8)(data, o);
65
+ if (trade_direction === null)
66
+ return null;
41
67
  o += 1;
42
68
  const has_referral = (0, binary_js_1.readBool)(data, o);
69
+ if (has_referral === null)
70
+ return null;
43
71
  o += 1;
44
72
  const amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
45
73
  o += 8;
@@ -50,6 +78,8 @@ function parseSwapEvent(data, meta) {
50
78
  const output_amount = bn64((0, binary_js_1.readU64LE)(data, o));
51
79
  o += 8;
52
80
  const next_sqrt_price = (0, binary_js_1.readU128LE)(data, o);
81
+ if (next_sqrt_price === null)
82
+ return null;
53
83
  o += 16;
54
84
  const lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
55
85
  o += 8;
@@ -78,54 +108,123 @@ function parseSwapEvent(data, meta) {
78
108
  };
79
109
  return { MeteoraDammV2Swap: ev };
80
110
  }
81
- function parseSwap2Event(data, meta) {
111
+ /** Aligns with Rust `parse_swap2_from_data` (full 180-byte EvtSwap2 layout). */
112
+ function parseSwap2FromData(data, meta) {
82
113
  let o = 0;
83
114
  const pool = (0, binary_js_1.readPubkey)(data, o);
115
+ if (!pool)
116
+ return null;
84
117
  o += 32;
85
118
  const trade_direction = (0, binary_js_1.readU8)(data, o);
119
+ if (trade_direction === null)
120
+ return null;
86
121
  o += 1;
122
+ const collect_fee_mode = (0, binary_js_1.readU8)(data, o);
123
+ if (collect_fee_mode === null)
124
+ return null;
87
125
  o += 1;
88
126
  const has_referral = (0, binary_js_1.readBool)(data, o);
127
+ if (has_referral === null)
128
+ return null;
89
129
  o += 1;
90
130
  const amount_0 = bn64((0, binary_js_1.readU64LE)(data, o));
91
131
  o += 8;
92
132
  const amount_1 = bn64((0, binary_js_1.readU64LE)(data, o));
93
133
  o += 8;
94
134
  const swap_mode = (0, binary_js_1.readU8)(data, o);
135
+ if (swap_mode === null)
136
+ return null;
95
137
  o += 1;
96
138
  const included_fee_input_amount = bn64((0, binary_js_1.readU64LE)(data, o));
97
139
  o += 8;
140
+ const excluded_fee_input_amount = bn64((0, binary_js_1.readU64LE)(data, o));
98
141
  o += 8;
142
+ const amount_left = bn64((0, binary_js_1.readU64LE)(data, o));
99
143
  o += 8;
100
144
  const output_amount = bn64((0, binary_js_1.readU64LE)(data, o));
101
145
  o += 8;
102
146
  const next_sqrt_price = (0, binary_js_1.readU128LE)(data, o);
147
+ if (next_sqrt_price === null)
148
+ return null;
103
149
  o += 16;
104
- const lp_fee = bn64((0, binary_js_1.readU64LE)(data, o));
150
+ const claiming_or_trading_fee = bn64((0, binary_js_1.readU64LE)(data, o));
105
151
  o += 8;
106
152
  const protocol_fee = bn64((0, binary_js_1.readU64LE)(data, o));
107
153
  o += 8;
154
+ const compounding_or_partner_fee = bn64((0, binary_js_1.readU64LE)(data, o));
155
+ o += 8;
108
156
  const referral_fee = bn64((0, binary_js_1.readU64LE)(data, o));
109
157
  o += 8;
158
+ const included_transfer_fee_amount_in = bn64((0, binary_js_1.readU64LE)(data, o));
159
+ o += 8;
160
+ const included_transfer_fee_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
110
161
  o += 8;
162
+ const excluded_transfer_fee_amount_out = bn64((0, binary_js_1.readU64LE)(data, o));
111
163
  o += 8;
112
164
  const current_timestamp = bn64((0, binary_js_1.readU64LE)(data, o));
113
- const [amount_in, minimum_amount_out] = swap_mode === 0 ? [amount_0, amount_1] : [amount_1, amount_0];
165
+ o += 8;
166
+ const reserve_a_amount = bn64((0, binary_js_1.readU64LE)(data, o));
167
+ o += 8;
168
+ const reserve_b_amount = bn64((0, binary_js_1.readU64LE)(data, o));
169
+ // ExactIn (0) / PartialFill (1): amount_0=in, amount_1=min_out.
170
+ // ExactOut (2): amount_0=out, amount_1=max_in.
171
+ let amount_in;
172
+ let minimum_amount_out;
173
+ if (swap_mode === 0 || swap_mode === 1) {
174
+ amount_in = amount_0;
175
+ minimum_amount_out = amount_1;
176
+ }
177
+ else if (swap_mode === 2) {
178
+ amount_in = amount_1;
179
+ minimum_amount_out = amount_0;
180
+ }
181
+ else {
182
+ return null;
183
+ }
184
+ let lp_fee;
185
+ let partner_fee;
186
+ let claiming_fee;
187
+ let compounding_fee;
188
+ if (usesCompoundingFeeLayout(meta.slot)) {
189
+ lp_fee = claiming_or_trading_fee + compounding_or_partner_fee;
190
+ partner_fee = compounding_or_partner_fee;
191
+ claiming_fee = claiming_or_trading_fee;
192
+ compounding_fee = compounding_or_partner_fee;
193
+ }
194
+ else {
195
+ lp_fee = claiming_or_trading_fee;
196
+ partner_fee = compounding_or_partner_fee;
197
+ claiming_fee = 0n;
198
+ compounding_fee = 0n;
199
+ }
114
200
  const ev = {
115
201
  metadata: meta,
116
202
  pool,
117
- amount_in,
118
- output_amount,
119
203
  trade_direction,
204
+ collect_fee_mode,
120
205
  has_referral,
206
+ amount_0,
207
+ amount_1,
208
+ swap_mode,
209
+ amount_in,
121
210
  minimum_amount_out,
211
+ output_amount,
122
212
  next_sqrt_price,
123
213
  lp_fee,
124
214
  protocol_fee,
125
- partner_fee: 0n,
215
+ partner_fee,
126
216
  referral_fee,
127
217
  actual_amount_in: included_fee_input_amount,
218
+ excluded_fee_input_amount,
219
+ amount_left,
220
+ claiming_fee,
221
+ compounding_fee,
222
+ included_transfer_fee_amount_in,
223
+ included_transfer_fee_amount_out,
224
+ excluded_transfer_fee_amount_out,
128
225
  current_timestamp,
226
+ reserve_a_amount,
227
+ reserve_b_amount,
129
228
  ...emptyVaults(),
130
229
  };
131
230
  return { MeteoraDammV2Swap: ev };
@@ -170,7 +269,7 @@ function parseClosePositionEvent(data, meta) {
170
269
  };
171
270
  return { MeteoraDammV2ClosePosition: ev };
172
271
  }
173
- function parseAddLiquidityEvent(data, meta) {
272
+ function parseAddLiquidityFromData(data, meta) {
174
273
  if (data.length < 32 * 3 + 16 + 8 * 6)
175
274
  return null;
176
275
  let o = 0;
@@ -208,7 +307,7 @@ function parseAddLiquidityEvent(data, meta) {
208
307
  };
209
308
  return { MeteoraDammV2AddLiquidity: ev };
210
309
  }
211
- function parseRemoveLiquidityEvent(data, meta) {
310
+ function parseRemoveLiquidityFromData(data, meta) {
212
311
  if (data.length < 32 * 3 + 16 + 8 * 4)
213
312
  return null;
214
313
  let o = 0;
@@ -240,6 +339,66 @@ function parseRemoveLiquidityEvent(data, meta) {
240
339
  };
241
340
  return { MeteoraDammV2RemoveLiquidity: ev };
242
341
  }
342
+ /** Parse current `EvtLiquidityChange`; `change_type` 0 = add, 1 = remove. */
343
+ function parseLiquidityChangeFromData(data, meta) {
344
+ const LEN = 177;
345
+ if (data.length < LEN)
346
+ return null;
347
+ const pool = (0, binary_js_1.readPubkey)(data, 0);
348
+ const position = (0, binary_js_1.readPubkey)(data, 32);
349
+ const owner = (0, binary_js_1.readPubkey)(data, 64);
350
+ if (!pool || !position || !owner)
351
+ return null;
352
+ const token_a_amount = bn64((0, binary_js_1.readU64LE)(data, 96));
353
+ const token_b_amount = bn64((0, binary_js_1.readU64LE)(data, 104));
354
+ const total_amount_a = bn64((0, binary_js_1.readU64LE)(data, 112));
355
+ const total_amount_b = bn64((0, binary_js_1.readU64LE)(data, 120));
356
+ const reserve_a_amount = bn64((0, binary_js_1.readU64LE)(data, 128));
357
+ const reserve_b_amount = bn64((0, binary_js_1.readU64LE)(data, 136));
358
+ const liquidity_delta = (0, binary_js_1.readU128LE)(data, 144);
359
+ if (liquidity_delta === null)
360
+ return null;
361
+ const token_a_amount_threshold = bn64((0, binary_js_1.readU64LE)(data, 160));
362
+ const token_b_amount_threshold = bn64((0, binary_js_1.readU64LE)(data, 168));
363
+ const change_type = (0, binary_js_1.readU8)(data, 176);
364
+ if (change_type === 0) {
365
+ const ev = {
366
+ metadata: meta,
367
+ pool,
368
+ position,
369
+ owner,
370
+ token_a_amount,
371
+ token_b_amount,
372
+ liquidity_delta,
373
+ token_a_amount_threshold,
374
+ token_b_amount_threshold,
375
+ total_amount_a,
376
+ total_amount_b,
377
+ reserve_a_amount,
378
+ reserve_b_amount,
379
+ };
380
+ return { MeteoraDammV2AddLiquidity: ev };
381
+ }
382
+ if (change_type === 1) {
383
+ const ev = {
384
+ metadata: meta,
385
+ pool,
386
+ position,
387
+ owner,
388
+ token_a_amount,
389
+ token_b_amount,
390
+ liquidity_delta,
391
+ token_a_amount_threshold,
392
+ token_b_amount_threshold,
393
+ total_amount_a,
394
+ total_amount_b,
395
+ reserve_a_amount,
396
+ reserve_b_amount,
397
+ };
398
+ return { MeteoraDammV2RemoveLiquidity: ev };
399
+ }
400
+ return null;
401
+ }
243
402
  function skipPoolFees(data, offset) {
244
403
  if (offset + 31 > data.length)
245
404
  return null;
@@ -339,6 +498,208 @@ function parseInitializePoolEvent(data, meta) {
339
498
  };
340
499
  return { MeteoraDammV2InitializePool: ev };
341
500
  }
501
+ function parseUpdateDelegatePermissionFromData(data, meta) {
502
+ let o = 0;
503
+ const position = (0, binary_js_1.readPubkey)(data, o);
504
+ if (!position)
505
+ return null;
506
+ o += 32;
507
+ const owner = (0, binary_js_1.readPubkey)(data, o);
508
+ if (!owner)
509
+ return null;
510
+ o += 32;
511
+ const permission = (0, binary_js_1.readU32LE)(data, o);
512
+ if (permission === null)
513
+ return null;
514
+ o += 4;
515
+ const has_delegate = (0, binary_js_1.readBool)(data, o);
516
+ if (has_delegate === null)
517
+ return null;
518
+ o += 1;
519
+ let delegate = null;
520
+ if (has_delegate) {
521
+ delegate = (0, binary_js_1.readPubkey)(data, o);
522
+ if (!delegate)
523
+ return null;
524
+ }
525
+ const ev = {
526
+ metadata: meta,
527
+ position,
528
+ owner,
529
+ permission,
530
+ delegate,
531
+ };
532
+ return { MeteoraDammV2UpdateDelegatePermission: ev };
533
+ }
534
+ function parseWithdrawDeadLiquidityRewardFromData(data, meta) {
535
+ let o = 0;
536
+ const pool = (0, binary_js_1.readPubkey)(data, o);
537
+ if (!pool)
538
+ return null;
539
+ o += 32;
540
+ const reward_mint = (0, binary_js_1.readPubkey)(data, o);
541
+ if (!reward_mint)
542
+ return null;
543
+ o += 32;
544
+ const amount = (0, binary_js_1.readU64LE)(data, o);
545
+ if (amount === null)
546
+ return null;
547
+ const ev = {
548
+ metadata: meta,
549
+ pool,
550
+ reward_mint,
551
+ amount,
552
+ };
553
+ return { MeteoraDammV2WithdrawDeadLiquidityReward: ev };
554
+ }
555
+ function parseDynamicFeeParameters(data, offset) {
556
+ let o = offset;
557
+ const bin_step = (0, binary_js_1.readU16LE)(data, o);
558
+ if (bin_step === null)
559
+ return null;
560
+ o += 2;
561
+ const bin_step_u128 = (0, binary_js_1.readU128LE)(data, o);
562
+ if (bin_step_u128 === null)
563
+ return null;
564
+ o += 16;
565
+ const filter_period = (0, binary_js_1.readU16LE)(data, o);
566
+ if (filter_period === null)
567
+ return null;
568
+ o += 2;
569
+ const decay_period = (0, binary_js_1.readU16LE)(data, o);
570
+ if (decay_period === null)
571
+ return null;
572
+ o += 2;
573
+ const reduction_factor = (0, binary_js_1.readU16LE)(data, o);
574
+ if (reduction_factor === null)
575
+ return null;
576
+ o += 2;
577
+ const max_volatility_accumulator = (0, binary_js_1.readU32LE)(data, o);
578
+ if (max_volatility_accumulator === null)
579
+ return null;
580
+ o += 4;
581
+ const variable_fee_control = (0, binary_js_1.readU32LE)(data, o);
582
+ if (variable_fee_control === null)
583
+ return null;
584
+ o += 4;
585
+ return {
586
+ params: {
587
+ bin_step,
588
+ bin_step_u128,
589
+ filter_period,
590
+ decay_period,
591
+ reduction_factor,
592
+ max_volatility_accumulator,
593
+ variable_fee_control,
594
+ },
595
+ next: o,
596
+ };
597
+ }
598
+ function parseCreateConfigFromData(data, meta) {
599
+ let o = 0;
600
+ if (data.length < o + 27)
601
+ return null;
602
+ const base_fee_data = Array.from(data.subarray(o, o + 27));
603
+ o += 27;
604
+ const compounding_fee_bps = (0, binary_js_1.readU16LE)(data, o);
605
+ if (compounding_fee_bps === null)
606
+ return null;
607
+ o += 2;
608
+ const padding = (0, binary_js_1.readU8)(data, o);
609
+ if (padding === null)
610
+ return null;
611
+ o += 1;
612
+ const has_dynamic_fee = (0, binary_js_1.readBool)(data, o);
613
+ if (has_dynamic_fee === null)
614
+ return null;
615
+ o += 1;
616
+ let dynamic_fee = null;
617
+ if (has_dynamic_fee) {
618
+ const parsed = parseDynamicFeeParameters(data, o);
619
+ if (!parsed)
620
+ return null;
621
+ dynamic_fee = parsed.params;
622
+ o = parsed.next;
623
+ }
624
+ const vault_config_key = (0, binary_js_1.readPubkey)(data, o);
625
+ if (!vault_config_key)
626
+ return null;
627
+ o += 32;
628
+ const pool_creator_authority = (0, binary_js_1.readPubkey)(data, o);
629
+ if (!pool_creator_authority)
630
+ return null;
631
+ o += 32;
632
+ const activation_type = (0, binary_js_1.readU8)(data, o);
633
+ if (activation_type === null)
634
+ return null;
635
+ o += 1;
636
+ const sqrt_min_price = (0, binary_js_1.readU128LE)(data, o);
637
+ if (sqrt_min_price === null)
638
+ return null;
639
+ o += 16;
640
+ const sqrt_max_price = (0, binary_js_1.readU128LE)(data, o);
641
+ if (sqrt_max_price === null)
642
+ return null;
643
+ o += 16;
644
+ const collect_fee_mode = (0, binary_js_1.readU8)(data, o);
645
+ if (collect_fee_mode === null)
646
+ return null;
647
+ o += 1;
648
+ const index = (0, binary_js_1.readU64LE)(data, o);
649
+ if (index === null)
650
+ return null;
651
+ o += 8;
652
+ const config = (0, binary_js_1.readPubkey)(data, o);
653
+ if (!config)
654
+ return null;
655
+ o += 32;
656
+ const permission = (0, binary_js_1.readU128LE)(data, o);
657
+ if (permission === null)
658
+ return null;
659
+ const ev = {
660
+ metadata: meta,
661
+ base_fee_data,
662
+ compounding_fee_bps,
663
+ padding,
664
+ dynamic_fee,
665
+ vault_config_key,
666
+ pool_creator_authority,
667
+ activation_type,
668
+ sqrt_min_price,
669
+ sqrt_max_price,
670
+ collect_fee_mode,
671
+ index,
672
+ config,
673
+ permission,
674
+ };
675
+ return { MeteoraDammV2CreateConfig: ev };
676
+ }
677
+ function parseCreateDynamicConfigFromData(data, meta) {
678
+ let o = 0;
679
+ const config = (0, binary_js_1.readPubkey)(data, o);
680
+ if (!config)
681
+ return null;
682
+ o += 32;
683
+ const pool_creator_authority = (0, binary_js_1.readPubkey)(data, o);
684
+ if (!pool_creator_authority)
685
+ return null;
686
+ o += 32;
687
+ const index = (0, binary_js_1.readU64LE)(data, o);
688
+ if (index === null)
689
+ return null;
690
+ o += 8;
691
+ const permission = (0, binary_js_1.readU128LE)(data, o);
692
+ if (permission === null)
693
+ return null;
694
+ const ev = {
695
+ metadata: meta,
696
+ config,
697
+ pool_creator_authority,
698
+ index,
699
+ permission,
700
+ };
701
+ return { MeteoraDammV2CreateDynamicConfig: ev };
702
+ }
342
703
  /**
343
704
  * Meteora DAMM Program data 入口;与 Rust `logs/meteora_damm.rs` 一致。
344
705
  */
@@ -352,16 +713,27 @@ function parseMeteoraDammLog(log, signature, slot, txIndex, blockTimeUs, grpcRec
352
713
  if (disc === SWAP)
353
714
  return parseSwapEvent(data, meta);
354
715
  if (disc === SWAP2)
355
- return parseSwap2Event(data, meta);
716
+ return parseSwap2FromData(data, meta);
356
717
  if (disc === ADD_LIQUIDITY)
357
- return parseAddLiquidityEvent(data, meta);
718
+ return parseAddLiquidityFromData(data, meta);
358
719
  if (disc === REMOVE_LIQUIDITY)
359
- return parseRemoveLiquidityEvent(data, meta);
720
+ return parseRemoveLiquidityFromData(data, meta);
721
+ if (disc === LIQUIDITY_CHANGE)
722
+ return parseLiquidityChangeFromData(data, meta);
360
723
  if (disc === INITIALIZE_POOL)
361
724
  return parseInitializePoolEvent(data, meta);
362
725
  if (disc === CREATE_POSITION)
363
726
  return parseCreatePositionEvent(data, meta);
364
727
  if (disc === CLOSE_POSITION)
365
728
  return parseClosePositionEvent(data, meta);
729
+ if (disc === UPDATE_DELEGATE_PERMISSION)
730
+ return parseUpdateDelegatePermissionFromData(data, meta);
731
+ if (disc === WITHDRAW_DEAD_LIQUIDITY_REWARD) {
732
+ return parseWithdrawDeadLiquidityRewardFromData(data, meta);
733
+ }
734
+ if (disc === CREATE_CONFIG)
735
+ return parseCreateConfigFromData(data, meta);
736
+ if (disc === CREATE_DYNAMIC_CONFIG)
737
+ return parseCreateDynamicConfigFromData(data, meta);
366
738
  return null;
367
739
  }
@@ -72,6 +72,11 @@ function parseDlmmEventFromData(discriminator, data, metadata) {
72
72
  const host_fee = bn64((0, binary_js_1.readU64LE)(data, o));
73
73
  const ev = {
74
74
  metadata,
75
+ token_x_mint: (0, dex_event_js_1.defaultPubkey)(),
76
+ token_y_mint: (0, dex_event_js_1.defaultPubkey)(),
77
+ user_token_in: (0, dex_event_js_1.defaultPubkey)(),
78
+ user_token_out: (0, dex_event_js_1.defaultPubkey)(),
79
+ min_amount_out: 0n,
75
80
  pool,
76
81
  from,
77
82
  start_bin_id,
@@ -115,6 +120,11 @@ function parseDlmmEventFromData(discriminator, data, metadata) {
115
120
  const host_fee = bn64((0, binary_js_1.readU64LE)(data, o));
116
121
  const ev = {
117
122
  metadata,
123
+ token_x_mint: (0, dex_event_js_1.defaultPubkey)(),
124
+ token_y_mint: (0, dex_event_js_1.defaultPubkey)(),
125
+ user_token_in: (0, dex_event_js_1.defaultPubkey)(),
126
+ user_token_out: (0, dex_event_js_1.defaultPubkey)(),
127
+ min_amount_out: 0n,
118
128
  pool,
119
129
  from,
120
130
  start_bin_id,
@@ -155,12 +155,25 @@ function discriminatorToEventType(disc) {
155
155
  return "MeteoraDammV2AddLiquidity";
156
156
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_REMOVE_LIQUIDITY)
157
157
  return "MeteoraDammV2RemoveLiquidity";
158
+ // Unified add/remove disc; public type selected after decode via change_type.
159
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_LIQUIDITY_CHANGE)
160
+ return null;
158
161
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_POOL)
159
162
  return "MeteoraDammV2InitializePool";
160
163
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION)
161
164
  return "MeteoraDammV2CreatePosition";
162
165
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION)
163
166
  return "MeteoraDammV2ClosePosition";
167
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION) {
168
+ return "MeteoraDammV2UpdateDelegatePermission";
169
+ }
170
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD) {
171
+ return "MeteoraDammV2WithdrawDeadLiquidityReward";
172
+ }
173
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG)
174
+ return "MeteoraDammV2CreateConfig";
175
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG)
176
+ return "MeteoraDammV2CreateDynamicConfig";
164
177
  return null;
165
178
  }
166
179
  function programScopedDiscriminatorToEventType(programId, disc) {
@@ -307,12 +320,24 @@ function programScopedDiscriminatorToEventType(programId, disc) {
307
320
  return "MeteoraDammV2AddLiquidity";
308
321
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_REMOVE_LIQUIDITY)
309
322
  return "MeteoraDammV2RemoveLiquidity";
323
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_LIQUIDITY_CHANGE)
324
+ return null;
310
325
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_POOL)
311
326
  return "MeteoraDammV2InitializePool";
312
327
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION)
313
328
  return "MeteoraDammV2CreatePosition";
314
329
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION)
315
330
  return "MeteoraDammV2ClosePosition";
331
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION) {
332
+ return "MeteoraDammV2UpdateDelegatePermission";
333
+ }
334
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD) {
335
+ return "MeteoraDammV2WithdrawDeadLiquidityReward";
336
+ }
337
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG)
338
+ return "MeteoraDammV2CreateConfig";
339
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG)
340
+ return "MeteoraDammV2CreateDynamicConfig";
316
341
  return null;
317
342
  }
318
343
  if (programId === program_ids_js_1.METEORA_DBC_PROGRAM_ID) {
@@ -476,6 +501,10 @@ function filterIncludesProgram(programId, filter) {
476
501
  "MeteoraDammV2InitializePool",
477
502
  "MeteoraDammV2CreatePosition",
478
503
  "MeteoraDammV2ClosePosition",
504
+ "MeteoraDammV2UpdateDelegatePermission",
505
+ "MeteoraDammV2WithdrawDeadLiquidityReward",
506
+ "MeteoraDammV2CreateConfig",
507
+ "MeteoraDammV2CreateDynamicConfig",
479
508
  ]);
480
509
  }
481
510
  if (programId === program_ids_js_1.METEORA_DBC_PROGRAM_ID) {
@@ -897,10 +926,15 @@ function parseLogOptimized(log, signature, slot, txIndex, blockTimeUs, grpcRecvU
897
926
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_SWAP2:
898
927
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_ADD_LIQUIDITY:
899
928
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_REMOVE_LIQUIDITY:
929
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_LIQUIDITY_CHANGE:
900
930
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_POOL:
901
931
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION:
902
932
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION:
903
- return (0, meteora_damm_js_1.parseMeteoraDammLog)(log, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
933
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION:
934
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD:
935
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG:
936
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG:
937
+ return applyActualEventTypeFilter((0, meteora_damm_js_1.parseMeteoraDammLog)(log, signature, slot, txIndex, blockTimeUs, grpcRecvUs), eventTypeFilter);
904
938
  default: {
905
939
  const raydium_launchlab = (0, raydium_launchlab_js_1.parseRaydiumLaunchlabFromDiscriminator)(disc, data, metadata);
906
940
  if (raydium_launchlab)
@@ -74,8 +74,13 @@ export declare const PROGRAM_LOG_DISC: {
74
74
  readonly METEORA_DAMM_SWAP2: bigint;
75
75
  readonly METEORA_DAMM_ADD_LIQUIDITY: bigint;
76
76
  readonly METEORA_DAMM_REMOVE_LIQUIDITY: bigint;
77
+ readonly METEORA_DAMM_LIQUIDITY_CHANGE: bigint;
77
78
  readonly METEORA_DAMM_INITIALIZE_POOL: bigint;
78
79
  readonly METEORA_DAMM_CREATE_POSITION: bigint;
79
80
  readonly METEORA_DAMM_CLOSE_POSITION: bigint;
81
+ readonly METEORA_DAMM_UPDATE_DELEGATE_PERMISSION: bigint;
82
+ readonly METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD: bigint;
83
+ readonly METEORA_DAMM_CREATE_CONFIG: bigint;
84
+ readonly METEORA_DAMM_CREATE_DYNAMIC_CONFIG: bigint;
80
85
  };
81
86
  export type ProgramLogDiscriminatorKey = keyof typeof PROGRAM_LOG_DISC;
@@ -84,7 +84,12 @@ exports.PROGRAM_LOG_DISC = {
84
84
  METEORA_DAMM_SWAP2: u64leDiscriminator([189, 66, 51, 168, 38, 80, 117, 153]),
85
85
  METEORA_DAMM_ADD_LIQUIDITY: u64leDiscriminator([175, 242, 8, 157, 30, 247, 185, 169]),
86
86
  METEORA_DAMM_REMOVE_LIQUIDITY: u64leDiscriminator([87, 46, 88, 98, 175, 96, 34, 91]),
87
+ METEORA_DAMM_LIQUIDITY_CHANGE: u64leDiscriminator([197, 171, 78, 127, 224, 211, 87, 13]),
87
88
  METEORA_DAMM_INITIALIZE_POOL: u64leDiscriminator([228, 50, 246, 85, 203, 66, 134, 37]),
88
89
  METEORA_DAMM_CREATE_POSITION: u64leDiscriminator([156, 15, 119, 198, 29, 181, 221, 55]),
89
90
  METEORA_DAMM_CLOSE_POSITION: u64leDiscriminator([20, 145, 144, 68, 143, 142, 214, 178]),
91
+ METEORA_DAMM_UPDATE_DELEGATE_PERMISSION: u64leDiscriminator([66, 188, 75, 151, 150, 232, 87, 93]),
92
+ METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD: u64leDiscriminator([228, 66, 150, 195, 42, 62, 163, 13]),
93
+ METEORA_DAMM_CREATE_CONFIG: u64leDiscriminator([131, 207, 180, 174, 180, 73, 165, 54]),
94
+ METEORA_DAMM_CREATE_DYNAMIC_CONFIG: u64leDiscriminator([231, 197, 13, 164, 248, 213, 133, 152]),
90
95
  };
package/dist/logs/pump.js CHANGED
@@ -171,6 +171,8 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
171
171
  const quote_amount = readOptionalU64(data, tail);
172
172
  const virtual_quote_reserves = readOptionalU64(data, tail);
173
173
  const real_quote_reserves = readOptionalU64(data, tail);
174
+ const holder_rewards_bps = readOptionalU64(data, tail);
175
+ const holder_rewards = readOptionalU64(data, tail);
174
176
  const trade = {
175
177
  metadata,
176
178
  mint,
@@ -206,6 +208,8 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
206
208
  quote_amount,
207
209
  virtual_quote_reserves,
208
210
  real_quote_reserves,
211
+ holder_rewards_bps,
212
+ holder_rewards,
209
213
  is_cashback_coin: cashback_fee_basis_points > 0n,
210
214
  bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
211
215
  associated_bonding_curve: (0, dex_event_js_1.defaultPubkey)(),
@@ -274,6 +278,10 @@ function parseCreateFromData(data, metadata) {
274
278
  const quote_mint = normalizePumpfunQuoteMint(o + 32 <= data.length ? (0, binary_js_1.readPubkey)(data, o) : (0, dex_event_js_1.defaultPubkey)());
275
279
  o += 32;
276
280
  const virtual_quote_reserves = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
281
+ o += 8;
282
+ const creator_fee_bps = o + 8 <= data.length ? bnU64((0, binary_js_1.readU64LE)(data, o)) : 0n;
283
+ o += 8;
284
+ const is_holder_reward = (0, binary_js_1.readBool)(data, o) ?? false;
277
285
  const ev = {
278
286
  metadata,
279
287
  name: n1.s,
@@ -295,6 +303,8 @@ function parseCreateFromData(data, metadata) {
295
303
  quote_vault: (0, dex_event_js_1.defaultPubkey)(),
296
304
  quote_token_program: (0, dex_event_js_1.defaultPubkey)(),
297
305
  virtual_quote_reserves,
306
+ creator_fee_bps,
307
+ is_holder_reward,
298
308
  ix_name: "create",
299
309
  };
300
310
  return { PumpFunCreate: ev };