sol-parser-sdk 0.5.17 → 0.5.18

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.
Files changed (64) hide show
  1. package/README.md +24 -15
  2. package/README_CN.md +23 -14
  3. package/dist/accounts/pumpfun.js +15 -0
  4. package/dist/accounts/pumpswap.js +2 -0
  5. package/dist/core/account_dispatcher_rpc.d.ts +2 -1
  6. package/dist/core/account_dispatcher_rpc.js +94 -9
  7. package/dist/core/account_fill_pumpfun.js +20 -0
  8. package/dist/core/account_fill_pumpswap.d.ts +2 -0
  9. package/dist/core/account_fill_pumpswap.js +55 -6
  10. package/dist/core/account_fill_raydium.js +4 -0
  11. package/dist/core/dex_event.d.ts +149 -0
  12. package/dist/grpc/client.js +2 -0
  13. package/dist/grpc/log_instr_dedup.js +75 -7
  14. package/dist/grpc/order_buffer.d.ts +5 -0
  15. package/dist/grpc/order_buffer.js +53 -17
  16. package/dist/grpc/types.d.ts +4 -1
  17. package/dist/grpc/types.js +23 -0
  18. package/dist/index.d.ts +1 -0
  19. package/dist/index.js +1 -0
  20. package/dist/instr/inner.js +28 -1
  21. package/dist/instr/meteora_damm_ix.js +26 -0
  22. package/dist/instr/meteora_pools_ix.js +17 -9
  23. package/dist/instr/orca_whirlpool_ix.js +13 -9
  24. package/dist/instr/pumpfun_ix.js +84 -0
  25. package/dist/instr/pumpswap_ix.js +85 -10
  26. package/dist/instr/raydium_clmm_ix.js +5 -3
  27. package/dist/instr/raydium_cpmm_ix.js +11 -8
  28. package/dist/logs/meteora_damm.d.ts +7 -0
  29. package/dist/logs/meteora_damm.js +211 -0
  30. package/dist/logs/meteora_dbc.d.ts +3 -0
  31. package/dist/logs/meteora_dbc.js +23 -0
  32. package/dist/logs/meteora_dlmm.js +16 -4
  33. package/dist/logs/optimized_matcher.js +93 -10
  34. package/dist/logs/program_log_discriminators.d.ts +11 -0
  35. package/dist/logs/program_log_discriminators.js +11 -0
  36. package/dist/logs/pump.js +6 -3
  37. package/dist/logs/pump_amm.js +8 -2
  38. package/dist/logs/pump_upgrade.d.ts +68 -0
  39. package/dist/logs/pump_upgrade.js +128 -0
  40. package/dist/logs/raydium_cpmm.js +7 -3
  41. package/dist/rpc_transaction.js +84 -7
  42. package/dist/shredstream/alt_cache.d.ts +26 -0
  43. package/dist/shredstream/alt_cache.js +138 -0
  44. package/dist/shredstream/client.d.ts +11 -3
  45. package/dist/shredstream/client.js +76 -72
  46. package/dist/shredstream/config.d.ts +7 -3
  47. package/dist/shredstream/index.d.ts +3 -2
  48. package/dist/shredstream/index.js +5 -3
  49. package/dist/shredstream/instruction_parse.d.ts +1 -1
  50. package/dist/shredstream/instruction_parse.js +1 -0
  51. package/dist/simulation_route.d.ts +1 -1
  52. package/dist/simulation_route.js +17 -4
  53. package/dist/transaction_route.js +20 -1
  54. package/dist/wire_transaction.js +9 -10
  55. package/docs/USAGE.md +161 -0
  56. package/package.json +2 -5
  57. package/NATIVE_ALIGNMENT.md +0 -312
  58. package/NATIVE_DAMM_FACTORY_ALIGNMENT_20261004.md +0 -16
  59. package/NATIVE_DAMM_FACTORY_EVIDENCE_20261004.json +0 -55
  60. package/NATIVE_MIGRATION.md +0 -38
  61. package/NATIVE_PUMPFUN_NATIVE_DEBIT_ALIGNMENT_20261004.md +0 -18
  62. package/NATIVE_PUMPFUN_NATIVE_DEBIT_EVIDENCE_20261004.json +0 -57
  63. package/NATIVE_PUMPFUN_SETTLEMENT_ALIGNMENT_20261004.md +0 -11
  64. package/NATIVE_PUMPFUN_SETTLEMENT_EVIDENCE_20261004.json +0 -70
@@ -207,9 +207,17 @@ exports.ALL_EVENT_TYPES = [
207
207
  "MeteoraDammV2RemoveLiquidity",
208
208
  "MeteoraDammV2InitializePool",
209
209
  "MeteoraDammV2CreatePosition",
210
+ "MeteoraDammV2ClaimPositionFee",
211
+ "MeteoraDammV2ClaimReward",
212
+ "MeteoraDlmmClaimReward",
210
213
  "MeteoraDammV2ClosePosition",
211
214
  "MeteoraDammV2UpdateDelegatePermission",
212
215
  "MeteoraDammV2WithdrawDeadLiquidityReward",
216
+ "MeteoraDammV2WithdrawIneligibleReward",
217
+ "MeteoraDammV2UpdateRewardFunder",
218
+ "MeteoraDammV2UpdateRewardDuration",
219
+ "MeteoraDammV2InitializeReward",
220
+ "MeteoraDammV2FundReward",
213
221
  "MeteoraDammV2CreateConfig",
214
222
  "MeteoraDammV2CreateDynamicConfig",
215
223
  // Meteora DBC
@@ -249,6 +257,9 @@ exports.ALL_EVENT_TYPES = [
249
257
  "AccountOrcaWhirlpoolsConfig",
250
258
  "AccountLiquiditySnapshot",
251
259
  "AccountRawSnapshot",
260
+ "PumpFunPostCompleteBuy",
261
+ "PumpFunSweepBondingCurveFee",
262
+ "PumpSwapSweepPoolFee",
252
263
  ];
253
264
  const ALL_EVENT_TYPE_SET = new Set(exports.ALL_EVENT_TYPES);
254
265
  const PUMPFUN_BUY_FAMILY = ["PumpFunBuy", "PumpFunBuyExactSolIn"];
@@ -279,9 +290,12 @@ const PUMPFUN_FILTER_TYPES = [
279
290
  "PumpFunCreateV2",
280
291
  "PumpFunComplete",
281
292
  "PumpFunMigrate",
293
+ "PumpFunPostCompleteBuy",
294
+ "PumpFunSweepBondingCurveFee",
282
295
  "PumpFunMigrateBondingCurveCreator",
283
296
  ];
284
297
  const PUMPSWAP_FILTER_TYPES = [
298
+ "PumpSwapSweepPoolFee",
285
299
  "PumpSwapTrade",
286
300
  "PumpSwapBuy",
287
301
  "PumpSwapSell",
@@ -294,10 +308,17 @@ const METEORA_DAMM_V2_FILTER_TYPES = [
294
308
  "MeteoraDammV2AddLiquidity",
295
309
  "MeteoraDammV2RemoveLiquidity",
296
310
  "MeteoraDammV2CreatePosition",
311
+ "MeteoraDammV2ClaimPositionFee",
312
+ "MeteoraDammV2ClaimReward",
297
313
  "MeteoraDammV2InitializePool",
298
314
  "MeteoraDammV2ClosePosition",
299
315
  "MeteoraDammV2UpdateDelegatePermission",
300
316
  "MeteoraDammV2WithdrawDeadLiquidityReward",
317
+ "MeteoraDammV2WithdrawIneligibleReward",
318
+ "MeteoraDammV2UpdateRewardFunder",
319
+ "MeteoraDammV2UpdateRewardDuration",
320
+ "MeteoraDammV2InitializeReward",
321
+ "MeteoraDammV2FundReward",
301
322
  "MeteoraDammV2CreateConfig",
302
323
  "MeteoraDammV2CreateDynamicConfig",
303
324
  ];
@@ -323,6 +344,7 @@ const METEORA_DLMM_FILTER_TYPES = [
323
344
  "MeteoraDlmmCreatePosition",
324
345
  "MeteoraDlmmClosePosition",
325
346
  "MeteoraDlmmClaimFee",
347
+ "MeteoraDlmmClaimReward",
326
348
  ];
327
349
  const RAYDIUM_CLMM_FILTER_TYPES = [
328
350
  "RaydiumClmmSwap",
@@ -371,6 +393,7 @@ const INSTRUCTION_EVENT_TYPES = [
371
393
  ...PUMPFUN_FILTER_TYPES,
372
394
  ...PUMP_FEES_EVENT_TYPES,
373
395
  ...PUMPSWAP_FILTER_TYPES,
396
+ ...METEORA_DBC_FILTER_TYPES,
374
397
  ...METEORA_DAMM_V2_FILTER_TYPES,
375
398
  ...METEORA_POOLS_FILTER_TYPES,
376
399
  ...METEORA_DLMM_FILTER_TYPES,
package/dist/index.d.ts CHANGED
@@ -58,3 +58,4 @@ export { analyzeSimulationRoutes } from "./simulation_route.js";
58
58
  export { parseBlockMetaUpdate } from "./grpc/block_meta.js";
59
59
  export { buildSubscribeRequestWithEventFilter } from "./grpc/subscribe_builder.js";
60
60
  export type { LaunchLabPoolCreateEvent, StonkFunPoolCreateEvent, LaunchLabTradeEvent, StonkFunTradeEvent, } from "./core/dex_event.js";
61
+ export * from "./logs/pump_upgrade.js";
package/dist/index.js CHANGED
@@ -316,3 +316,4 @@ var block_meta_js_1 = require("./grpc/block_meta.js");
316
316
  Object.defineProperty(exports, "parseBlockMetaUpdate", { enumerable: true, get: function () { return block_meta_js_1.parseBlockMetaUpdate; } });
317
317
  var subscribe_builder_js_3 = require("./grpc/subscribe_builder.js");
318
318
  Object.defineProperty(exports, "buildSubscribeRequestWithEventFilter", { enumerable: true, get: function () { return subscribe_builder_js_3.buildSubscribeRequestWithEventFilter; } });
319
+ __exportStar(require("./logs/pump_upgrade.js"), exports);
@@ -2,6 +2,8 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.parseInnerCompiledInstructionIfSupported = parseInnerCompiledInstructionIfSupported;
4
4
  exports.parseInnerInstructionUnified = parseInnerInstructionUnified;
5
+ const meteora_dbc_js_1 = require("../logs/meteora_dbc.js");
6
+ const pump_upgrade_js_1 = require("../logs/pump_upgrade.js");
5
7
  const metadata_js_1 = require("../core/metadata.js");
6
8
  const types_js_1 = require("../grpc/types.js");
7
9
  const program_ids_js_1 = require("../grpc/program_ids.js");
@@ -116,6 +118,8 @@ const LOG = {
116
118
  METEORA_DAMM_INITIALIZE_POOL: [228, 50, 246, 85, 203, 66, 134, 37],
117
119
  METEORA_DAMM_CREATE_POSITION: [156, 15, 119, 198, 29, 181, 221, 55],
118
120
  METEORA_DAMM_CLOSE_POSITION: [20, 145, 144, 68, 143, 142, 214, 178],
121
+ METEORA_DAMM_CLAIM_POSITION_FEE: [198, 182, 183, 52, 97, 12, 49, 56],
122
+ METEORA_DAMM_CLAIM_REWARD: [218, 86, 147, 200, 235, 188, 215, 231],
119
123
  METEORA_DLMM_SWAP: [81, 108, 227, 190, 205, 208, 10, 196],
120
124
  METEORA_DLMM_SWAP2: [46, 116, 82, 215, 148, 27, 84, 77],
121
125
  METEORA_DLMM_ADD_LIQUIDITY: [31, 94, 125, 90, 227, 52, 61, 186],
@@ -131,6 +135,9 @@ const LOG = {
131
135
  };
132
136
  const IX = {
133
137
  PUMPFUN: [
138
+ [7, 5, 29, 196, 245, 23, 101, 80],
139
+ [225, 247, 80, 30, 213, 179, 132, 136],
140
+ [28, 146, 222, 119, 38, 196, 105, 213],
134
141
  [24, 30, 200, 40, 5, 28, 7, 119],
135
142
  [214, 144, 76, 236, 95, 139, 49, 180],
136
143
  [102, 6, 61, 18, 1, 218, 235, 234],
@@ -141,6 +148,9 @@ const IX = {
141
148
  [93, 246, 130, 60, 231, 233, 64, 178],
142
149
  ],
143
150
  PUMPSWAP: [
151
+ [184, 23, 238, 97, 103, 197, 211, 61],
152
+ [194, 171, 28, 70, 104, 77, 91, 47],
153
+ [93, 246, 130, 60, 231, 233, 64, 178],
144
154
  [102, 6, 61, 18, 1, 218, 235, 234],
145
155
  [51, 230, 133, 164, 1, 127, 131, 173],
146
156
  [233, 146, 209, 142, 207, 104, 64, 188],
@@ -171,6 +181,7 @@ const IX = {
171
181
  [37, 190, 126, 222, 44, 154, 171, 17],
172
182
  ],
173
183
  RAYDIUM_CPMM: [
184
+ [63, 55, 254, 65, 49, 178, 89, 121],
174
185
  LOG.RAYDIUM_CPMM_SWAP_BASE_IN,
175
186
  LOG.RAYDIUM_CPMM_SWAP_BASE_OUT,
176
187
  [175, 175, 109, 31, 13, 152, 155, 237],
@@ -194,13 +205,16 @@ const IX = {
194
205
  [43, 4, 237, 11, 26, 201, 30, 98],
195
206
  [46, 156, 243, 118, 13, 205, 251, 178],
196
207
  [160, 38, 208, 111, 104, 91, 44, 1],
208
+ [133, 29, 89, 223, 69, 238, 176, 10],
209
+ [58, 127, 188, 62, 79, 82, 196, 96],
197
210
  [17, 43, 80, 74, 168, 202, 6, 113],
198
211
  ],
199
212
  METEORA_POOLS: [
200
213
  [248, 198, 158, 145, 225, 117, 135, 200],
201
214
  [181, 157, 89, 67, 143, 182, 52, 72],
202
215
  [80, 85, 209, 72, 24, 206, 177, 108],
203
- [95, 180, 10, 172, 84, 174, 232, 40],
216
+ [7, 166, 138, 171, 206, 171, 236, 244],
217
+ [48, 149, 220, 130, 61, 11, 9, 178],
204
218
  ],
205
219
  METEORA_DLMM: [
206
220
  [181, 157, 89, 67, 143, 182, 52, 72],
@@ -305,6 +319,10 @@ function parseInnerInstructionUnified(instructionData, accounts, signature, slot
305
319
  const disc = instructionData.subarray(0, 16);
306
320
  const data = instructionData.subarray(16);
307
321
  const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
322
+ const upgradeDisc = eventCpiDiscriminator(disc);
323
+ if (upgradeDisc !== null && (0, pump_upgrade_js_1.pumpUpgradeEventType)(upgradeDisc, programId)) {
324
+ return filterDexEvent((0, pump_upgrade_js_1.parsePumpUpgradeEvent)(upgradeDisc, data, metadata, programId), filter);
325
+ }
308
326
  let ev = null;
309
327
  if (programId === program_ids_js_1.PUMPFUN_PROGRAM_ID) {
310
328
  if (filter && !(0, types_js_1.eventTypeFilterIncludesPumpfun)(filter))
@@ -452,6 +470,15 @@ function parseInnerInstructionUnified(instructionData, accounts, signature, slot
452
470
  return null;
453
471
  ev = (0, meteora_damm_ix_js_1.parseMeteoraDammInstruction)(instructionData, accounts, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
454
472
  }
473
+ else if (programId === program_ids_js_1.METEORA_DBC_PROGRAM_ID) {
474
+ if (filter && !(0, types_js_1.eventTypeFilterIncludesMeteoraDbc)(filter))
475
+ return null;
476
+ if (!discEq(disc, EVENT_CPI_PREFIX))
477
+ return null;
478
+ const dbcDisc = eventCpiDiscriminator(disc);
479
+ if (dbcDisc !== null)
480
+ ev = (0, meteora_dbc_js_1.parseMeteoraDbcFromDiscriminator)(dbcDisc, data, metadata);
481
+ }
455
482
  else if (programId === program_ids_js_1.METEORA_DLMM_PROGRAM_ID) {
456
483
  if (filter && !(0, types_js_1.eventTypeFilterIncludesMeteoraDlmm)(filter))
457
484
  return null;
@@ -11,6 +11,8 @@ function disc8(a) {
11
11
  const CPI = {
12
12
  SWAP_LOG: disc8([27, 60, 21, 213, 138, 170, 187, 147]),
13
13
  SWAP2_LOG: disc8([189, 66, 51, 168, 38, 80, 117, 153]),
14
+ CLAIM_POSITION_FEE_LOG: disc8([198, 182, 183, 52, 97, 12, 49, 56]),
15
+ CLAIM_REWARD_LOG: disc8([218, 86, 147, 200, 235, 188, 215, 231]),
14
16
  CREATE_POSITION_LOG: disc8([156, 15, 119, 198, 29, 181, 221, 55]),
15
17
  CLOSE_POSITION_LOG: disc8([20, 145, 144, 68, 143, 142, 214, 178]),
16
18
  ADD_LIQUIDITY_LOG: disc8([175, 242, 8, 157, 30, 247, 185, 169]),
@@ -18,6 +20,11 @@ const CPI = {
18
20
  LIQUIDITY_CHANGE_LOG: disc8([197, 171, 78, 127, 224, 211, 87, 13]),
19
21
  UPDATE_DELEGATE_PERMISSION_LOG: disc8([66, 188, 75, 151, 150, 232, 87, 93]),
20
22
  WITHDRAW_DEAD_LIQUIDITY_REWARD_LOG: disc8([228, 66, 150, 195, 42, 62, 163, 13]),
23
+ WITHDRAW_INELIGIBLE_REWARD_LOG: disc8([248, 215, 184, 78, 31, 180, 179, 168]),
24
+ UPDATE_REWARD_FUNDER_LOG: disc8([76, 154, 208, 13, 40, 115, 246, 146]),
25
+ UPDATE_REWARD_DURATION_LOG: disc8([149, 135, 65, 231, 129, 153, 65, 57]),
26
+ INITIALIZE_REWARD_LOG: disc8([129, 91, 188, 3, 246, 52, 185, 249]),
27
+ FUND_REWARD_LOG: disc8([104, 233, 237, 122, 199, 191, 121, 85]),
21
28
  CREATE_CONFIG_LOG: disc8([131, 207, 180, 174, 180, 73, 165, 54]),
22
29
  CREATE_DYNAMIC_CONFIG_LOG: disc8([231, 197, 13, 164, 248, 213, 133, 152]),
23
30
  };
@@ -398,6 +405,10 @@ function parseMeteoraDammInstruction(instructionData, accounts, signature, slot,
398
405
  return parseSwapCpi(cpiData, accounts, meta);
399
406
  if (discEq(cpiHead, CPI.SWAP2_LOG))
400
407
  return parseSwap2Cpi(cpiData, accounts, meta);
408
+ if (discEq(cpiHead, CPI.CLAIM_POSITION_FEE_LOG))
409
+ return (0, meteora_damm_js_1.parseClaimPositionFee)(cpiData, meta);
410
+ if (discEq(cpiHead, CPI.CLAIM_REWARD_LOG))
411
+ return (0, meteora_damm_js_1.parseClaimReward)(cpiData, meta);
401
412
  if (discEq(cpiHead, CPI.CREATE_POSITION_LOG)) {
402
413
  let o = 0;
403
414
  const pool = (0, utils_js_1.readPubkeyIx)(cpiData, o);
@@ -553,6 +564,21 @@ function parseMeteoraDammInstruction(instructionData, accounts, signature, slot,
553
564
  if (discEq(cpiHead, CPI.WITHDRAW_DEAD_LIQUIDITY_REWARD_LOG)) {
554
565
  return (0, meteora_damm_js_1.parseWithdrawDeadLiquidityRewardFromData)(cpiData, meta);
555
566
  }
567
+ if (discEq(cpiHead, CPI.WITHDRAW_INELIGIBLE_REWARD_LOG)) {
568
+ return (0, meteora_damm_js_1.parseWithdrawIneligibleRewardFromData)(cpiData, meta);
569
+ }
570
+ if (discEq(cpiHead, CPI.UPDATE_REWARD_FUNDER_LOG)) {
571
+ return (0, meteora_damm_js_1.parseUpdateRewardFunderFromData)(cpiData, meta);
572
+ }
573
+ if (discEq(cpiHead, CPI.UPDATE_REWARD_DURATION_LOG)) {
574
+ return (0, meteora_damm_js_1.parseUpdateRewardDurationFromData)(cpiData, meta);
575
+ }
576
+ if (discEq(cpiHead, CPI.INITIALIZE_REWARD_LOG)) {
577
+ return (0, meteora_damm_js_1.parseInitializeRewardFromData)(cpiData, meta);
578
+ }
579
+ if (discEq(cpiHead, CPI.FUND_REWARD_LOG)) {
580
+ return (0, meteora_damm_js_1.parseFundRewardFromData)(cpiData, meta);
581
+ }
556
582
  if (discEq(cpiHead, CPI.CREATE_CONFIG_LOG)) {
557
583
  return (0, meteora_damm_js_1.parseCreateConfigFromData)(cpiData, meta);
558
584
  }
@@ -10,7 +10,8 @@ const DISC = {
10
10
  SWAP: (0, program_log_discriminators_js_1.u64leDiscriminator)([248, 198, 158, 145, 225, 117, 135, 200]),
11
11
  ADD_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([181, 157, 89, 67, 143, 182, 52, 72]),
12
12
  REMOVE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([80, 85, 209, 72, 24, 206, 177, 108]),
13
- CREATE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([95, 180, 10, 172, 84, 174, 232, 40]),
13
+ CREATE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([7, 166, 138, 171, 206, 171, 236, 244]),
14
+ CREATE_POOL_CONFIG2: (0, program_log_discriminators_js_1.u64leDiscriminator)([48, 149, 220, 130, 61, 11, 9, 178]),
14
15
  };
15
16
  function discEq(data, disc) {
16
17
  if (data.length < 8)
@@ -28,8 +29,10 @@ function parseMeteoraPoolsInstruction(instructionData, accounts, signature, slot
28
29
  return {
29
30
  MeteoraPoolsSwap: {
30
31
  metadata,
31
- in_amount: (0, binary_js_1.readU64LE)(instructionData, 8) ?? 0n,
32
- out_amount: (0, binary_js_1.readU64LE)(instructionData, 16) ?? 0n,
32
+ amount_in: (0, binary_js_1.readU64LE)(instructionData, 8) ?? 0n,
33
+ minimum_out_amount: (0, binary_js_1.readU64LE)(instructionData, 16) ?? 0n,
34
+ in_amount: 0n,
35
+ out_amount: 0n,
33
36
  trade_fee: 0n,
34
37
  admin_fee: 0n,
35
38
  host_fee: 0n,
@@ -60,16 +63,21 @@ function parseMeteoraPoolsInstruction(instructionData, accounts, signature, slot
60
63
  },
61
64
  };
62
65
  }
63
- if (discEq(instructionData, DISC.CREATE_POOL)) {
64
- if (instructionData.length < 8 + 1 + 6 * 8 || accounts.length <= 9)
66
+ if (discEq(instructionData, DISC.CREATE_POOL) || discEq(instructionData, DISC.CREATE_POOL_CONFIG2)) {
67
+ if (instructionData.length < 24 || accounts.length < 5)
65
68
  return null;
69
+ if (discEq(instructionData, DISC.CREATE_POOL_CONFIG2)) {
70
+ const tag = (0, binary_js_1.readU8)(instructionData, 24);
71
+ if (tag === null || (tag !== 0 && tag !== 1) || (tag === 1 && instructionData.length < 33))
72
+ return null;
73
+ }
66
74
  return {
67
75
  MeteoraPoolsPoolCreated: {
68
76
  metadata,
69
- lp_mint: (0, utils_js_1.getAccount)(accounts, 4) ?? Z,
70
- token_a_mint: (0, utils_js_1.getAccount)(accounts, 8) ?? Z,
71
- token_b_mint: (0, utils_js_1.getAccount)(accounts, 9) ?? Z,
72
- pool_type: (0, binary_js_1.readU8)(instructionData, 8) ?? 0,
77
+ lp_mint: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
78
+ token_a_mint: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
79
+ token_b_mint: (0, utils_js_1.getAccount)(accounts, 4) ?? Z,
80
+ pool_type: 1, // PoolType::Permissionless, independent of CurveType.
73
81
  pool: pool ?? Z,
74
82
  },
75
83
  };
@@ -9,6 +9,8 @@ const DISC = {
9
9
  SWAP: (0, program_log_discriminators_js_1.u64leDiscriminator)([248, 198, 158, 145, 225, 117, 135, 200]),
10
10
  SWAP_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([43, 4, 237, 11, 26, 201, 30, 98]),
11
11
  INCREASE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([46, 156, 243, 118, 13, 205, 251, 178]),
12
+ INCREASE_LIQUIDITY_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([133, 29, 89, 223, 69, 238, 176, 10]),
13
+ DECREASE_LIQUIDITY_V2: (0, program_log_discriminators_js_1.u64leDiscriminator)([58, 127, 188, 62, 79, 82, 196, 96]),
12
14
  DECREASE_LIQUIDITY: (0, program_log_discriminators_js_1.u64leDiscriminator)([160, 38, 208, 111, 104, 91, 44, 1]),
13
15
  INITIALIZE_POOL: (0, program_log_discriminators_js_1.u64leDiscriminator)([17, 43, 80, 74, 168, 202, 6, 113]),
14
16
  };
@@ -51,9 +53,10 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
51
53
  },
52
54
  };
53
55
  }
54
- if (discEq(instructionData, DISC.INCREASE_LIQUIDITY)) {
55
- // increase_liquidity_v2:liquidity_amount (u128), token_max_a, token_max_b
56
- if (instructionData.length < 8 + 16 + 8 + 8)
56
+ if (discEq(instructionData, DISC.INCREASE_LIQUIDITY) || discEq(instructionData, DISC.INCREASE_LIQUIDITY_V2)) {
57
+ const v2 = discEq(instructionData, DISC.INCREASE_LIQUIDITY_V2);
58
+ // increase_liquidity:liquidity_amount (u128), token_max_a, token_max_b
59
+ if (instructionData.length < 8 + 16 + 8 + 8 + Number(v2))
57
60
  return null;
58
61
  const liquidity = (0, utils_js_1.readU128LE)(instructionData, 8) ?? 0n;
59
62
  const token_max_a = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
@@ -61,8 +64,8 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
61
64
  return {
62
65
  OrcaWhirlpoolLiquidityIncreased: {
63
66
  metadata: meta,
64
- whirlpool: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
65
- position: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
67
+ whirlpool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
68
+ position: (0, utils_js_1.getAccount)(accounts, v2 ? 5 : 3) ?? Z,
66
69
  tick_lower_index: 0,
67
70
  tick_upper_index: 0,
68
71
  liquidity,
@@ -73,9 +76,10 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
73
76
  },
74
77
  };
75
78
  }
76
- if (discEq(instructionData, DISC.DECREASE_LIQUIDITY)) {
79
+ if (discEq(instructionData, DISC.DECREASE_LIQUIDITY) || discEq(instructionData, DISC.DECREASE_LIQUIDITY_V2)) {
80
+ const v2 = discEq(instructionData, DISC.DECREASE_LIQUIDITY_V2);
77
81
  // decrease_liquidity:liquidity_amount (u128), token_min_a, token_min_b
78
- if (instructionData.length < 8 + 16 + 8 + 8)
82
+ if (instructionData.length < 8 + 16 + 8 + 8 + Number(v2))
79
83
  return null;
80
84
  const liquidity = (0, utils_js_1.readU128LE)(instructionData, 8) ?? 0n;
81
85
  const token_min_a = (0, utils_js_1.readU64LE)(instructionData, 24) ?? 0n;
@@ -83,8 +87,8 @@ function parseOrcaWhirlpoolInstruction(instructionData, accounts, signature, slo
83
87
  return {
84
88
  OrcaWhirlpoolLiquidityDecreased: {
85
89
  metadata: meta,
86
- whirlpool: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
87
- position: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
90
+ whirlpool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
91
+ position: (0, utils_js_1.getAccount)(accounts, v2 ? 5 : 3) ?? Z,
88
92
  tick_lower_index: 0,
89
93
  tick_upper_index: 0,
90
94
  liquidity,
@@ -288,6 +288,90 @@ function parsePumpfunInstruction(instructionData, accounts, signature, slot, txI
288
288
  const outer = instructionData.subarray(0, 8);
289
289
  const data = instructionData.subarray(8);
290
290
  const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
291
+ if (discEq(outer, Uint8Array.from([7, 5, 29, 196, 245, 23, 101, 80]))) {
292
+ if (accounts.length !== 17 || data.length < 16 || data.length > 17 || (data.length === 17 && data[16] > 1))
293
+ return null;
294
+ const mapped = Array(27).fill(Z);
295
+ mapped[0] = accounts[0];
296
+ mapped[1] = accounts[1];
297
+ mapped[2] = accounts[2];
298
+ mapped[3] = accounts[3];
299
+ mapped[4] = accounts[4];
300
+ mapped[8] = accounts[13];
301
+ mapped[10] = accounts[5];
302
+ mapped[11] = accounts[6];
303
+ mapped[12] = accounts[7];
304
+ mapped[13] = accounts[8];
305
+ mapped[14] = accounts[9];
306
+ mapped[15] = accounts[10];
307
+ mapped[20] = accounts[11];
308
+ mapped[22] = accounts[12];
309
+ mapped[24] = accounts[14];
310
+ mapped[25] = accounts[15];
311
+ mapped[26] = accounts[16];
312
+ const ev = parsePumpfunTradeV2Instruction("buy_v2", data, mapped, meta);
313
+ if (ev) {
314
+ const trade = Object.values(ev)[0];
315
+ trade.ix_name = "buy_v3";
316
+ }
317
+ return ev;
318
+ }
319
+ if (discEq(outer, Uint8Array.from([225, 247, 80, 30, 213, 179, 132, 136]))) {
320
+ if (accounts.length !== 17 || data.length < 16 || data.length > 17 || (data.length === 17 && data[16] > 1))
321
+ return null;
322
+ const mapped = Array(27).fill(Z);
323
+ mapped[0] = accounts[0];
324
+ mapped[1] = accounts[1];
325
+ mapped[2] = accounts[2];
326
+ mapped[3] = accounts[3];
327
+ mapped[4] = accounts[4];
328
+ mapped[8] = accounts[13];
329
+ mapped[10] = accounts[5];
330
+ mapped[11] = accounts[6];
331
+ mapped[12] = accounts[7];
332
+ mapped[13] = accounts[8];
333
+ mapped[14] = accounts[9];
334
+ mapped[15] = accounts[10];
335
+ mapped[20] = accounts[11];
336
+ mapped[22] = accounts[12];
337
+ mapped[24] = accounts[14];
338
+ mapped[25] = accounts[15];
339
+ mapped[26] = accounts[16];
340
+ const ev = parsePumpfunTradeV2Instruction("buy_exact_quote_in_v2", data, mapped, meta);
341
+ if (ev) {
342
+ const trade = Object.values(ev)[0];
343
+ trade.ix_name = "buy_exact_quote_in_v3";
344
+ }
345
+ return ev;
346
+ }
347
+ if (discEq(outer, Uint8Array.from([28, 146, 222, 119, 38, 196, 105, 213]))) {
348
+ if (accounts.length !== 17 || data.length < 16 || data.length > 17 || data.length !== 16)
349
+ return null;
350
+ const mapped = Array(27).fill(Z);
351
+ mapped[0] = accounts[0];
352
+ mapped[1] = accounts[1];
353
+ mapped[2] = accounts[2];
354
+ mapped[3] = accounts[3];
355
+ mapped[4] = accounts[4];
356
+ mapped[8] = accounts[13];
357
+ mapped[10] = accounts[5];
358
+ mapped[11] = accounts[6];
359
+ mapped[12] = accounts[7];
360
+ mapped[13] = accounts[8];
361
+ mapped[14] = accounts[9];
362
+ mapped[15] = accounts[10];
363
+ mapped[19] = accounts[11];
364
+ mapped[21] = accounts[12];
365
+ mapped[23] = accounts[14];
366
+ mapped[24] = accounts[15];
367
+ mapped[25] = accounts[16];
368
+ const ev = parsePumpfunTradeV2Instruction("sell_v2", data, mapped, meta);
369
+ if (ev) {
370
+ const trade = Object.values(ev)[0];
371
+ trade.ix_name = "sell_v3";
372
+ }
373
+ return ev;
374
+ }
291
375
  if (discEq(outer, DISC.CREATE_V2)) {
292
376
  if (accounts.length < 16)
293
377
  return null;
@@ -120,6 +120,81 @@ function parsePumpswapInstruction(instructionData, accounts, signature, slot, tx
120
120
  const head = instructionData.subarray(0, 8);
121
121
  const data = instructionData.subarray(8);
122
122
  const meta = (0, utils_js_1.ixMeta)(signature, slot, txIndex, blockTimeUs, grpcRecvUs);
123
+ if (discEq(head, Uint8Array.from([184, 23, 238, 97, 103, 197, 211, 61]))) {
124
+ if (accounts.length !== 17 || data.length !== 16)
125
+ return null;
126
+ const mapped = Array(26).fill(Z);
127
+ mapped[0] = accounts[0];
128
+ mapped[1] = accounts[1];
129
+ mapped[2] = accounts[2];
130
+ mapped[3] = accounts[3];
131
+ mapped[4] = accounts[4];
132
+ mapped[5] = accounts[5];
133
+ mapped[6] = accounts[6];
134
+ mapped[7] = accounts[7];
135
+ mapped[8] = accounts[8];
136
+ mapped[11] = accounts[9];
137
+ mapped[12] = accounts[10];
138
+ mapped[13] = accounts[11];
139
+ mapped[15] = accounts[15];
140
+ mapped[16] = accounts[16];
141
+ mapped[20] = accounts[12];
142
+ mapped[21] = accounts[13];
143
+ mapped[25] = accounts[14];
144
+ const legacy = new Uint8Array(instructionData);
145
+ legacy.set(PS.BUY, 0);
146
+ return parsePumpswapInstruction(legacy, mapped, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
147
+ }
148
+ if (discEq(head, Uint8Array.from([194, 171, 28, 70, 104, 77, 91, 47]))) {
149
+ if (accounts.length !== 17 || data.length !== 16)
150
+ return null;
151
+ const mapped = Array(26).fill(Z);
152
+ mapped[0] = accounts[0];
153
+ mapped[1] = accounts[1];
154
+ mapped[2] = accounts[2];
155
+ mapped[3] = accounts[3];
156
+ mapped[4] = accounts[4];
157
+ mapped[5] = accounts[5];
158
+ mapped[6] = accounts[6];
159
+ mapped[7] = accounts[7];
160
+ mapped[8] = accounts[8];
161
+ mapped[11] = accounts[9];
162
+ mapped[12] = accounts[10];
163
+ mapped[13] = accounts[11];
164
+ mapped[15] = accounts[15];
165
+ mapped[16] = accounts[16];
166
+ mapped[20] = accounts[12];
167
+ mapped[21] = accounts[13];
168
+ mapped[25] = accounts[14];
169
+ const legacy = new Uint8Array(instructionData);
170
+ legacy.set(PS.BUY_EXACT_QUOTE_IN, 0);
171
+ return parsePumpswapInstruction(legacy, mapped, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
172
+ }
173
+ if (discEq(head, Uint8Array.from([93, 246, 130, 60, 231, 233, 64, 178]))) {
174
+ if (accounts.length !== 17 || data.length !== 16)
175
+ return null;
176
+ const mapped = Array(26).fill(Z);
177
+ mapped[0] = accounts[0];
178
+ mapped[1] = accounts[1];
179
+ mapped[2] = accounts[2];
180
+ mapped[3] = accounts[3];
181
+ mapped[4] = accounts[4];
182
+ mapped[5] = accounts[5];
183
+ mapped[6] = accounts[6];
184
+ mapped[7] = accounts[7];
185
+ mapped[8] = accounts[8];
186
+ mapped[11] = accounts[9];
187
+ mapped[12] = accounts[10];
188
+ mapped[13] = accounts[11];
189
+ mapped[15] = accounts[15];
190
+ mapped[16] = accounts[16];
191
+ mapped[20] = accounts[12];
192
+ mapped[21] = accounts[13];
193
+ mapped[25] = accounts[14];
194
+ const legacy = new Uint8Array(instructionData);
195
+ legacy.set(PS.SELL, 0);
196
+ return parsePumpswapInstruction(legacy, mapped, signature, slot, txIndex, blockTimeUs, grpcRecvUs);
197
+ }
123
198
  if (discEq(head, PS.BUY)) {
124
199
  if (accounts.length < 13)
125
200
  return null;
@@ -219,7 +294,7 @@ function parsePumpswapInstruction(instructionData, accounts, signature, slot, tx
219
294
  return { PumpSwapCreatePool: ev };
220
295
  }
221
296
  if (discEq(head, PS.DEPOSIT)) {
222
- if (accounts.length < 8)
297
+ if (accounts.length < 15 || data.length < 24)
223
298
  return null;
224
299
  const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
225
300
  let lp_out = 0n;
@@ -244,15 +319,15 @@ function parsePumpswapInstruction(instructionData, accounts, signature, slot, tx
244
319
  quote_amount_in: 0n,
245
320
  lp_mint_supply: 0n,
246
321
  pool: g(0),
247
- user: g(1),
248
- user_base_token_account: g(4),
249
- user_quote_token_account: g(5),
250
- user_pool_token_account: g(6),
322
+ user: g(2),
323
+ user_base_token_account: g(6),
324
+ user_quote_token_account: g(7),
325
+ user_pool_token_account: g(8),
251
326
  };
252
327
  return { PumpSwapLiquidityAdded: ev };
253
328
  }
254
329
  if (discEq(head, PS.WITHDRAW)) {
255
- if (accounts.length < 8)
330
+ if (accounts.length < 15 || data.length < 24)
256
331
  return null;
257
332
  const g = (i) => (0, utils_js_1.getAccount)(accounts, i) ?? Z;
258
333
  let lp_in = 0n;
@@ -277,10 +352,10 @@ function parsePumpswapInstruction(instructionData, accounts, signature, slot, tx
277
352
  quote_amount_out: 0n,
278
353
  lp_mint_supply: 0n,
279
354
  pool: g(0),
280
- user: g(1),
281
- user_base_token_account: g(4),
282
- user_quote_token_account: g(5),
283
- user_pool_token_account: g(6),
355
+ user: g(2),
356
+ user_base_token_account: g(6),
357
+ user_quote_token_account: g(7),
358
+ user_pool_token_account: g(8),
284
359
  };
285
360
  return { PumpSwapLiquidityRemoved: ev };
286
361
  }
@@ -63,7 +63,8 @@ function parseRaydiumClmmInstruction(instructionData, accounts, signature, slot,
63
63
  RaydiumClmmIncreaseLiquidity: {
64
64
  metadata: meta,
65
65
  pool: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
66
- position_nft_mint: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
66
+ position_nft_mint: Z, // Account 1 is the NFT token account.
67
+ personal_position: (0, utils_js_1.getAccount)(accounts, 4) ?? Z,
67
68
  user: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
68
69
  liquidity,
69
70
  amount_0: 0n,
@@ -85,7 +86,8 @@ function parseRaydiumClmmInstruction(instructionData, accounts, signature, slot,
85
86
  RaydiumClmmDecreaseLiquidity: {
86
87
  metadata: meta,
87
88
  pool: (0, utils_js_1.getAccount)(accounts, 3) ?? Z,
88
- position_nft_mint: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
89
+ position_nft_mint: Z, // Account 1 is the NFT token account.
90
+ personal_position: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
89
91
  user: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
90
92
  liquidity,
91
93
  decrease_amount_0: 0n,
@@ -123,7 +125,7 @@ function parseRaydiumClmmInstruction(instructionData, accounts, signature, slot,
123
125
  };
124
126
  }
125
127
  if (discEq(instructionData, DISC.CREATE_CUSTOMIZABLE_POOL)) {
126
- if (instructionData.length < 8 + 16)
128
+ if (instructionData.length !== 26 || accounts.length < 13 || instructionData[24] > 2 || instructionData[25] > 1)
127
129
  return null;
128
130
  const sqrt_price_x64 = (0, binary_js_1.readU128LE)(instructionData, 8) ?? 0n;
129
131
  return {
@@ -8,6 +8,7 @@ const Z = (0, dex_event_js_1.defaultPubkey)();
8
8
  const DISC = {
9
9
  SWAP_BASE_IN: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_SWAP_BASE_IN,
10
10
  SWAP_BASE_OUT: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_SWAP_BASE_OUT,
11
+ INITIALIZE_PERMISSION: (0, program_log_discriminators_js_1.u64leDiscriminator)([63, 55, 254, 65, 49, 178, 89, 121]),
11
12
  INITIALIZE: (0, program_log_discriminators_js_1.u64leDiscriminator)([175, 175, 109, 31, 13, 152, 155, 237]),
12
13
  DEPOSIT: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_DEPOSIT,
13
14
  WITHDRAW: program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_WITHDRAW,
@@ -56,21 +57,23 @@ function parseRaydiumCpmmInstruction(instructionData, accounts, signature, slot,
56
57
  },
57
58
  };
58
59
  }
59
- if (discEq(instructionData, DISC.INITIALIZE)) {
60
- if (instructionData.length < 8 + 8 + 8 + 8)
60
+ if (discEq(instructionData, DISC.INITIALIZE) || discEq(instructionData, DISC.INITIALIZE_PERMISSION)) {
61
+ const permission = discEq(instructionData, DISC.INITIALIZE_PERMISSION);
62
+ if (instructionData.length < (permission ? 33 : 32) || accounts.length < (permission ? 21 : 20))
61
63
  return null;
62
64
  const init_amount0 = (0, utils_js_1.readU64LE)(instructionData, 8) ?? 0n;
63
65
  const init_amount1 = (0, utils_js_1.readU64LE)(instructionData, 16) ?? 0n;
64
66
  return {
65
67
  RaydiumCpmmInitialize: {
66
68
  metadata: meta,
67
- pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
68
- creator: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
69
+ pool: (0, utils_js_1.getAccount)(accounts, permission ? 4 : 3) ?? Z,
70
+ creator: (0, utils_js_1.getAccount)(accounts, permission ? 1 : 0) ?? Z,
69
71
  init_amount0,
70
72
  init_amount1,
71
73
  },
72
74
  };
73
75
  }
76
+ // Instruction token amounts are deposit maxima / withdrawal minima, not executed fills.
74
77
  if (discEq(instructionData, DISC.DEPOSIT)) {
75
78
  if (instructionData.length < 8 + 8 + 8 + 8)
76
79
  return null;
@@ -80,8 +83,8 @@ function parseRaydiumCpmmInstruction(instructionData, accounts, signature, slot,
80
83
  return {
81
84
  RaydiumCpmmDeposit: {
82
85
  metadata: meta,
83
- pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
84
- user: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
86
+ pool: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
87
+ user: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
85
88
  lp_token_amount,
86
89
  token0_amount,
87
90
  token1_amount,
@@ -97,8 +100,8 @@ function parseRaydiumCpmmInstruction(instructionData, accounts, signature, slot,
97
100
  return {
98
101
  RaydiumCpmmWithdraw: {
99
102
  metadata: meta,
100
- pool: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
101
- user: (0, utils_js_1.getAccount)(accounts, 1) ?? Z,
103
+ pool: (0, utils_js_1.getAccount)(accounts, 2) ?? Z,
104
+ user: (0, utils_js_1.getAccount)(accounts, 0) ?? Z,
102
105
  lp_token_amount,
103
106
  token0_amount,
104
107
  token1_amount,
@@ -13,9 +13,16 @@ export declare function parseRemoveLiquidityFromData(data: Uint8Array, meta: Eve
13
13
  export declare function parseLiquidityChangeFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
14
14
  export declare function parseUpdateDelegatePermissionFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
15
15
  export declare function parseWithdrawDeadLiquidityRewardFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
16
+ export declare function parseWithdrawIneligibleRewardFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
17
+ export declare function parseUpdateRewardFunderFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
18
+ export declare function parseUpdateRewardDurationFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
19
+ export declare function parseInitializeRewardFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
20
+ export declare function parseFundRewardFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
16
21
  export declare function parseCreateConfigFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
17
22
  export declare function parseCreateDynamicConfigFromData(data: Uint8Array, meta: EventMetadata): DexEvent | null;
18
23
  /**
19
24
  * Meteora DAMM Program data 入口;与 Rust `logs/meteora_damm.rs` 一致。
20
25
  */
21
26
  export declare function parseMeteoraDammLog(log: string, signature: string, slot: number | bigint | string, txIndex: number | bigint | string, blockTimeUs: number | bigint | string | undefined, grpcRecvUs: number | bigint | string): DexEvent | null;
27
+ export declare function parseClaimPositionFee(data: Uint8Array, meta: EventMetadata): DexEvent | null;
28
+ export declare function parseClaimReward(data: Uint8Array, meta: EventMetadata): DexEvent | null;