sol-parser-sdk 0.5.17 → 0.5.19

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 +46 -31
  2. package/README_CN.md +45 -30
  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
@@ -8,6 +8,7 @@ exports.parseLogUnified = parseLogUnified;
8
8
  exports.parseLogOptimizedWithProgramId = parseLogOptimizedWithProgramId;
9
9
  exports.parseInvokeInfo = parseInvokeInfo;
10
10
  exports.parseProgramCompleteInfo = parseProgramCompleteInfo;
11
+ const pump_upgrade_js_1 = require("./pump_upgrade.js");
11
12
  const metadata_js_1 = require("../core/metadata.js");
12
13
  const program_data_js_1 = require("./program_data.js");
13
14
  const clock_js_1 = require("../core/clock.js");
@@ -37,9 +38,15 @@ const DLMM_DISC = {
37
38
  CREATE_POSITION: (0, program_log_discriminators_js_1.u64leDiscriminator)([144, 142, 252, 84, 157, 53, 37, 121]),
38
39
  CLOSE_POSITION: (0, program_log_discriminators_js_1.u64leDiscriminator)([255, 196, 16, 107, 28, 202, 53, 128]),
39
40
  CLAIM_FEE: (0, program_log_discriminators_js_1.u64leDiscriminator)([75, 122, 154, 48, 140, 74, 123, 163]),
41
+ CLAIM_REWARD2: (0, program_log_discriminators_js_1.u64leDiscriminator)([27, 143, 244, 33, 80, 43, 110, 146]),
40
42
  CLAIM_FEE2: (0, program_log_discriminators_js_1.u64leDiscriminator)([232, 171, 242, 97, 58, 77, 35, 45]),
41
43
  };
42
44
  function discriminatorToEventType(disc) {
45
+ if (disc === DLMM_DISC.CLAIM_REWARD2)
46
+ return "MeteoraDlmmClaimReward";
47
+ const upgrade = (0, pump_upgrade_js_1.pumpUpgradeEventType)(disc);
48
+ if (upgrade)
49
+ return upgrade;
43
50
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.PUMPFUN_CREATE)
44
51
  return "PumpFunCreate";
45
52
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.PUMPFUN_TRADE)
@@ -162,6 +169,10 @@ function discriminatorToEventType(disc) {
162
169
  return "MeteoraDammV2InitializePool";
163
170
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION)
164
171
  return "MeteoraDammV2CreatePosition";
172
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_POSITION_FEE)
173
+ return "MeteoraDammV2ClaimPositionFee";
174
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_REWARD)
175
+ return "MeteoraDammV2ClaimReward";
165
176
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION)
166
177
  return "MeteoraDammV2ClosePosition";
167
178
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION) {
@@ -170,6 +181,21 @@ function discriminatorToEventType(disc) {
170
181
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD) {
171
182
  return "MeteoraDammV2WithdrawDeadLiquidityReward";
172
183
  }
184
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_INELIGIBLE_REWARD) {
185
+ return "MeteoraDammV2WithdrawIneligibleReward";
186
+ }
187
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_FUNDER) {
188
+ return "MeteoraDammV2UpdateRewardFunder";
189
+ }
190
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_DURATION) {
191
+ return "MeteoraDammV2UpdateRewardDuration";
192
+ }
193
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_REWARD) {
194
+ return "MeteoraDammV2InitializeReward";
195
+ }
196
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_FUND_REWARD) {
197
+ return "MeteoraDammV2FundReward";
198
+ }
173
199
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG)
174
200
  return "MeteoraDammV2CreateConfig";
175
201
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG)
@@ -177,6 +203,9 @@ function discriminatorToEventType(disc) {
177
203
  return null;
178
204
  }
179
205
  function programScopedDiscriminatorToEventType(programId, disc) {
206
+ const upgrade = (0, pump_upgrade_js_1.pumpUpgradeEventType)(disc, programId);
207
+ if (upgrade)
208
+ return upgrade;
180
209
  if (programId === program_ids_js_1.PUMPFUN_PROGRAM_ID) {
181
210
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.PUMPFUN_CREATE)
182
211
  return "PumpFunCreate";
@@ -326,6 +355,10 @@ function programScopedDiscriminatorToEventType(programId, disc) {
326
355
  return "MeteoraDammV2InitializePool";
327
356
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION)
328
357
  return "MeteoraDammV2CreatePosition";
358
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_POSITION_FEE)
359
+ return "MeteoraDammV2ClaimPositionFee";
360
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_REWARD)
361
+ return "MeteoraDammV2ClaimReward";
329
362
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION)
330
363
  return "MeteoraDammV2ClosePosition";
331
364
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION) {
@@ -334,6 +367,21 @@ function programScopedDiscriminatorToEventType(programId, disc) {
334
367
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD) {
335
368
  return "MeteoraDammV2WithdrawDeadLiquidityReward";
336
369
  }
370
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_INELIGIBLE_REWARD) {
371
+ return "MeteoraDammV2WithdrawIneligibleReward";
372
+ }
373
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_FUNDER) {
374
+ return "MeteoraDammV2UpdateRewardFunder";
375
+ }
376
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_DURATION) {
377
+ return "MeteoraDammV2UpdateRewardDuration";
378
+ }
379
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_REWARD) {
380
+ return "MeteoraDammV2InitializeReward";
381
+ }
382
+ if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_FUND_REWARD) {
383
+ return "MeteoraDammV2FundReward";
384
+ }
337
385
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG)
338
386
  return "MeteoraDammV2CreateConfig";
339
387
  if (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG)
@@ -341,7 +389,7 @@ function programScopedDiscriminatorToEventType(programId, disc) {
341
389
  return null;
342
390
  }
343
391
  if (programId === program_ids_js_1.METEORA_DBC_PROGRAM_ID) {
344
- if (disc === meteora_dbc_js_1.METEORA_DBC_DISC.SWAP)
392
+ if (disc === meteora_dbc_js_1.METEORA_DBC_DISC.SWAP || disc === meteora_dbc_js_1.METEORA_DBC_DISC.SWAP2 || disc === meteora_dbc_js_1.METEORA_DBC_DISC.SWAP2_TRANSFER_HOOK)
345
393
  return "MeteoraDbcSwap";
346
394
  if (disc === meteora_dbc_js_1.METEORA_DBC_DISC.INITIALIZE_POOL)
347
395
  return "MeteoraDbcInitializePool";
@@ -364,6 +412,8 @@ function programScopedDiscriminatorToEventType(programId, disc) {
364
412
  return "MeteoraDlmmCreatePosition";
365
413
  if (disc === DLMM_DISC.CLOSE_POSITION)
366
414
  return "MeteoraDlmmClosePosition";
415
+ if (disc === DLMM_DISC.CLAIM_REWARD2)
416
+ return "MeteoraDlmmClaimReward";
367
417
  if (disc === DLMM_DISC.CLAIM_FEE || disc === DLMM_DISC.CLAIM_FEE2)
368
418
  return "MeteoraDlmmClaimFee";
369
419
  return null;
@@ -503,6 +553,11 @@ function filterIncludesProgram(programId, filter) {
503
553
  "MeteoraDammV2ClosePosition",
504
554
  "MeteoraDammV2UpdateDelegatePermission",
505
555
  "MeteoraDammV2WithdrawDeadLiquidityReward",
556
+ "MeteoraDammV2WithdrawIneligibleReward",
557
+ "MeteoraDammV2UpdateRewardFunder",
558
+ "MeteoraDammV2UpdateRewardDuration",
559
+ "MeteoraDammV2InitializeReward",
560
+ "MeteoraDammV2FundReward",
506
561
  "MeteoraDammV2CreateConfig",
507
562
  "MeteoraDammV2CreateDynamicConfig",
508
563
  ]);
@@ -610,15 +665,27 @@ function parseLogOptimized(log, signature, slot, txIndex, blockTimeUs, grpcRecvU
610
665
  const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs, rb);
611
666
  return (0, raydium_amm_js_1.parseRayLogSwap)(log, metadata);
612
667
  }
613
- const buf = (0, program_data_js_1.decodeProgramDataLine)(log);
614
- if (!buf)
615
- return null;
616
- const disc = (0, binary_js_1.readDiscriminatorU64)(buf);
617
- if (disc === null)
618
- return null;
619
- const data = buf.subarray(8);
620
- const rb = recentBlockhash && recentBlockhash.length > 0 ? bs58_1.default.encode(recentBlockhash) : undefined;
621
- const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs, rb);
668
+ // Canonical base64 exposes eight discriminator bytes in its first twelve characters.
669
+ // Fall back to the original decoder for permissive/noncanonical encodings.
670
+ let buf = null;
671
+ let disc = null;
672
+ if (eventTypeFilter) {
673
+ const start = log.indexOf("Program data: ");
674
+ if (start < 0)
675
+ return null;
676
+ const prefix = log.slice(start + 14, start + 26);
677
+ if (/^[A-Za-z0-9+/]{12}$/.test(prefix)) {
678
+ disc = (0, binary_js_1.readDiscriminatorU64)(Buffer.from(prefix, "base64"));
679
+ }
680
+ }
681
+ if (disc === null) {
682
+ buf = (0, program_data_js_1.decodeProgramDataLine)(log);
683
+ if (!buf)
684
+ return null;
685
+ disc = (0, binary_js_1.readDiscriminatorU64)(buf);
686
+ if (disc === null)
687
+ return null;
688
+ }
622
689
  const isUnscopedSharedDiscriminator = !programId &&
623
690
  (disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.PUMPFUN_TRADE || disc === program_log_discriminators_js_1.PROGRAM_LOG_DISC.RAYDIUM_CPMM_SWAP_BASE_IN);
624
691
  const et = programScopedDiscriminatorToEventType(programId, disc);
@@ -642,6 +709,15 @@ function parseLogOptimized(log, signature, slot, txIndex, blockTimeUs, grpcRecvU
642
709
  else if (!filterAllowsUnscopedDiscriminator(eventTypeFilter, disc))
643
710
  return null;
644
711
  }
712
+ buf ??= (0, program_data_js_1.decodeProgramDataLine)(log);
713
+ if (!buf)
714
+ return null;
715
+ const data = buf.subarray(8);
716
+ const rb = recentBlockhash && recentBlockhash.length > 0 ? bs58_1.default.encode(recentBlockhash) : undefined;
717
+ const metadata = (0, metadata_js_1.makeMetadata)(signature, slot, txIndex, blockTimeUs, grpcRecvUs, rb);
718
+ if ((0, pump_upgrade_js_1.pumpUpgradeEventType)(disc, programId)) {
719
+ return applyActualEventTypeFilter((0, pump_upgrade_js_1.parsePumpUpgradeEvent)(disc, data, metadata, programId), eventTypeFilter);
720
+ }
645
721
  if (programId === program_ids_js_1.RAYDIUM_LAUNCHLAB_PROGRAM_ID) {
646
722
  const ev = (0, raydium_launchlab_js_1.parseRaydiumLaunchlabFromDiscriminator)(disc, data, metadata);
647
723
  return applyActualEventTypeFilter(ev, eventTypeFilter);
@@ -929,9 +1005,16 @@ function parseLogOptimized(log, signature, slot, txIndex, blockTimeUs, grpcRecvU
929
1005
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_LIQUIDITY_CHANGE:
930
1006
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_POOL:
931
1007
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_POSITION:
1008
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_POSITION_FEE:
1009
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLAIM_REWARD:
932
1010
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CLOSE_POSITION:
933
1011
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_DELEGATE_PERMISSION:
934
1012
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD:
1013
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_WITHDRAW_INELIGIBLE_REWARD:
1014
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_FUNDER:
1015
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_UPDATE_REWARD_DURATION:
1016
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_INITIALIZE_REWARD:
1017
+ case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_FUND_REWARD:
935
1018
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_CONFIG:
936
1019
  case program_log_discriminators_js_1.PROGRAM_LOG_DISC.METEORA_DAMM_CREATE_DYNAMIC_CONFIG:
937
1020
  return applyActualEventTypeFilter((0, meteora_damm_js_1.parseMeteoraDammLog)(log, signature, slot, txIndex, blockTimeUs, grpcRecvUs), eventTypeFilter);
@@ -15,6 +15,10 @@ export declare const PUMPSWAP_DISC: {
15
15
  * `parseLogOptimized` 使用的全部分支 discriminator(含 PumpSwap 引用上表)。
16
16
  */
17
17
  export declare const PROGRAM_LOG_DISC: {
18
+ readonly PUMPSWAP_SWEEP_POOL_FEE: bigint;
19
+ readonly PUMPFUN_COMPLETE: bigint;
20
+ readonly PUMPFUN_SWEEP_BONDING_CURVE_FEE: bigint;
21
+ readonly PUMPFUN_POST_COMPLETE_BUY: bigint;
18
22
  readonly PUMPFUN_CREATE: bigint;
19
23
  readonly PUMPFUN_TRADE: bigint;
20
24
  readonly PUMPFUN_MIGRATE: bigint;
@@ -78,8 +82,15 @@ export declare const PROGRAM_LOG_DISC: {
78
82
  readonly METEORA_DAMM_INITIALIZE_POOL: bigint;
79
83
  readonly METEORA_DAMM_CREATE_POSITION: bigint;
80
84
  readonly METEORA_DAMM_CLOSE_POSITION: bigint;
85
+ readonly METEORA_DAMM_CLAIM_POSITION_FEE: bigint;
86
+ readonly METEORA_DAMM_CLAIM_REWARD: bigint;
81
87
  readonly METEORA_DAMM_UPDATE_DELEGATE_PERMISSION: bigint;
82
88
  readonly METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD: bigint;
89
+ readonly METEORA_DAMM_WITHDRAW_INELIGIBLE_REWARD: bigint;
90
+ readonly METEORA_DAMM_UPDATE_REWARD_FUNDER: bigint;
91
+ readonly METEORA_DAMM_UPDATE_REWARD_DURATION: bigint;
92
+ readonly METEORA_DAMM_INITIALIZE_REWARD: bigint;
93
+ readonly METEORA_DAMM_FUND_REWARD: bigint;
83
94
  readonly METEORA_DAMM_CREATE_CONFIG: bigint;
84
95
  readonly METEORA_DAMM_CREATE_DYNAMIC_CONFIG: bigint;
85
96
  };
@@ -24,6 +24,10 @@ exports.PUMPSWAP_DISC = {
24
24
  * `parseLogOptimized` 使用的全部分支 discriminator(含 PumpSwap 引用上表)。
25
25
  */
26
26
  exports.PROGRAM_LOG_DISC = {
27
+ PUMPSWAP_SWEEP_POOL_FEE: u64leDiscriminator([130, 164, 36, 97, 228, 130, 135, 165]),
28
+ PUMPFUN_COMPLETE: u64leDiscriminator([95, 114, 97, 156, 212, 46, 152, 8]),
29
+ PUMPFUN_SWEEP_BONDING_CURVE_FEE: u64leDiscriminator([116, 43, 77, 189, 17, 122, 72, 43]),
30
+ PUMPFUN_POST_COMPLETE_BUY: u64leDiscriminator([111, 176, 109, 139, 49, 108, 213, 251]),
27
31
  PUMPFUN_CREATE: u64leDiscriminator([27, 114, 169, 77, 222, 235, 99, 118]),
28
32
  PUMPFUN_TRADE: u64leDiscriminator([189, 219, 127, 211, 78, 230, 97, 238]),
29
33
  PUMPFUN_MIGRATE: u64leDiscriminator([189, 233, 93, 185, 92, 148, 234, 148]),
@@ -88,8 +92,15 @@ exports.PROGRAM_LOG_DISC = {
88
92
  METEORA_DAMM_INITIALIZE_POOL: u64leDiscriminator([228, 50, 246, 85, 203, 66, 134, 37]),
89
93
  METEORA_DAMM_CREATE_POSITION: u64leDiscriminator([156, 15, 119, 198, 29, 181, 221, 55]),
90
94
  METEORA_DAMM_CLOSE_POSITION: u64leDiscriminator([20, 145, 144, 68, 143, 142, 214, 178]),
95
+ METEORA_DAMM_CLAIM_POSITION_FEE: u64leDiscriminator([198, 182, 183, 52, 97, 12, 49, 56]),
96
+ METEORA_DAMM_CLAIM_REWARD: u64leDiscriminator([218, 86, 147, 200, 235, 188, 215, 231]),
91
97
  METEORA_DAMM_UPDATE_DELEGATE_PERMISSION: u64leDiscriminator([66, 188, 75, 151, 150, 232, 87, 93]),
92
98
  METEORA_DAMM_WITHDRAW_DEAD_LIQUIDITY_REWARD: u64leDiscriminator([228, 66, 150, 195, 42, 62, 163, 13]),
99
+ METEORA_DAMM_WITHDRAW_INELIGIBLE_REWARD: u64leDiscriminator([248, 215, 184, 78, 31, 180, 179, 168]),
100
+ METEORA_DAMM_UPDATE_REWARD_FUNDER: u64leDiscriminator([76, 154, 208, 13, 40, 115, 246, 146]),
101
+ METEORA_DAMM_UPDATE_REWARD_DURATION: u64leDiscriminator([149, 135, 65, 231, 129, 153, 65, 57]),
102
+ METEORA_DAMM_INITIALIZE_REWARD: u64leDiscriminator([129, 91, 188, 3, 246, 52, 185, 249]),
103
+ METEORA_DAMM_FUND_REWARD: u64leDiscriminator([104, 233, 237, 122, 199, 191, 121, 85]),
93
104
  METEORA_DAMM_CREATE_CONFIG: u64leDiscriminator([131, 207, 180, 174, 180, 73, 165, 54]),
94
105
  METEORA_DAMM_CREATE_DYNAMIC_CONFIG: u64leDiscriminator([231, 197, 13, 164, 248, 213, 133, 152]),
95
106
  };
package/dist/logs/pump.js CHANGED
@@ -173,7 +173,9 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
173
173
  const real_quote_reserves = readOptionalU64(data, tail);
174
174
  const holder_rewards_bps = readOptionalU64(data, tail);
175
175
  const holder_rewards = readOptionalU64(data, tail);
176
+ const creator_fee_unclaimed = readOptionalU64(data, tail);
176
177
  const trade = {
178
+ creator_fee_unclaimed,
177
179
  metadata,
178
180
  mint,
179
181
  sol_amount,
@@ -216,14 +218,14 @@ function parseTradeFromData(data, metadata, isCreatedBuy) {
216
218
  token_program: (0, dex_event_js_1.defaultPubkey)(),
217
219
  creator_vault: (0, dex_event_js_1.defaultPubkey)(),
218
220
  };
219
- if (ix_name === "buy")
221
+ if (ix_name === "buy" || ix_name === "buy_v3")
220
222
  return { PumpFunBuy: trade };
221
- if (ix_name === "sell")
223
+ if (ix_name === "sell" || ix_name === "sell_v3")
222
224
  return { PumpFunSell: trade };
223
225
  if (ix_name === "buy_exact_sol_in") {
224
226
  return { PumpFunBuyExactSolIn: trade };
225
227
  }
226
- if (ix_name === "buy_exact_quote_in")
228
+ if (ix_name === "buy_exact_quote_in" || ix_name === "buy_exact_quote_in_v3")
227
229
  return { PumpFunBuy: trade };
228
230
  return { PumpFunTrade: trade };
229
231
  }
@@ -316,6 +318,7 @@ function parseCreateFromData(data, metadata) {
316
318
  virtual_quote_reserves,
317
319
  creator_fee_bps,
318
320
  is_holder_reward,
321
+ depth: data[o + 1] ?? 0,
319
322
  ix_name: "create",
320
323
  };
321
324
  return { PumpFunCreate: ev };
@@ -19,6 +19,7 @@ function bnI64(v) {
19
19
  const ZP = (0, dex_event_js_1.defaultPubkey)();
20
20
  function emptyTradeTail() {
21
21
  return {
22
+ creator_fee_unclaimed: 0n,
22
23
  cashback_fee_basis_points: 0n,
23
24
  cashback: 0n,
24
25
  buyback_fee_basis_points: 0n,
@@ -63,6 +64,9 @@ function parseTradeTail(data) {
63
64
  tail.holder_rewards_bps = bn64((0, binary_js_1.readU64LE)(data, 57));
64
65
  tail.holder_rewards = bn64((0, binary_js_1.readU64LE)(data, 65));
65
66
  }
67
+ if (data.length > 73 && data.length < 81)
68
+ return null;
69
+ tail.creator_fee_unclaimed = bn64((0, binary_js_1.readU64LE)(data, 73));
66
70
  return tail;
67
71
  }
68
72
  function readStrictBorshString(data, offset) {
@@ -198,6 +202,7 @@ function parseBuyFromData(data, metadata) {
198
202
  base_supply: tail.base_supply,
199
203
  holder_rewards_bps: tail.holder_rewards_bps,
200
204
  holder_rewards: tail.holder_rewards,
205
+ creator_fee_unclaimed: tail.creator_fee_unclaimed,
201
206
  is_pump_pool: false,
202
207
  base_mint: ZP,
203
208
  quote_mint: ZP,
@@ -298,6 +303,7 @@ function parseSellFromData(data, metadata) {
298
303
  base_supply: tail.base_supply,
299
304
  holder_rewards_bps: tail.holder_rewards_bps,
300
305
  holder_rewards: tail.holder_rewards,
306
+ creator_fee_unclaimed: tail.creator_fee_unclaimed,
301
307
  is_pump_pool: false,
302
308
  base_mint: ZP,
303
309
  quote_mint: ZP,
@@ -392,7 +398,7 @@ function parseCreatePoolFromData(data, metadata) {
392
398
  return { PumpSwapCreatePool: ev };
393
399
  }
394
400
  function parseAddLiquidityFromData(data, metadata) {
395
- const REQUIRED = 10 * 8 + 5 * 32;
401
+ const REQUIRED = 11 * 8 + 5 * 32;
396
402
  if (data.length < REQUIRED)
397
403
  return null;
398
404
  let o = 0;
@@ -449,7 +455,7 @@ function parseAddLiquidityFromData(data, metadata) {
449
455
  return { PumpSwapLiquidityAdded: ev };
450
456
  }
451
457
  function parseRemoveLiquidityFromData(data, metadata) {
452
- const REQUIRED = 10 * 8 + 5 * 32;
458
+ const REQUIRED = 11 * 8 + 5 * 32;
453
459
  if (data.length < REQUIRED)
454
460
  return null;
455
461
  let o = 0;
@@ -0,0 +1,68 @@
1
+ import type { DexEvent } from "../core/dex_event.js";
2
+ import type { EventMetadata } from "../core/metadata.js";
3
+ export interface PumpFunPostCompleteBuyEvent {
4
+ metadata: EventMetadata;
5
+ user: string;
6
+ mint: string;
7
+ bonding_curve: string;
8
+ quote_mint: string;
9
+ timestamp: bigint;
10
+ base_out: bigint;
11
+ quote_in: bigint;
12
+ fee_basis_points: bigint;
13
+ fee: bigint;
14
+ creator_fee_basis_points: bigint;
15
+ creator_fee: bigint;
16
+ buyback_fee: bigint;
17
+ pool_base_reserves_before: bigint;
18
+ pool_quote_reserves_before: bigint;
19
+ pool_base_reserves_after: bigint;
20
+ pool_quote_reserves_after: bigint;
21
+ }
22
+ export interface PumpFunSweepBondingCurveFeeEvent {
23
+ metadata: EventMetadata;
24
+ timestamp: bigint;
25
+ mint: string;
26
+ bonding_curve: string;
27
+ quote_mint: string;
28
+ recipient: string;
29
+ amount: bigint;
30
+ bucket: number;
31
+ }
32
+ export interface PumpFunCompleteEvent {
33
+ metadata: EventMetadata;
34
+ user: string;
35
+ mint: string;
36
+ bonding_curve: string;
37
+ timestamp: bigint;
38
+ quote_mint: string;
39
+ }
40
+ export interface PumpSwapSweepPoolFeeEvent {
41
+ metadata: EventMetadata;
42
+ timestamp: bigint;
43
+ pool: string;
44
+ base_mint: string;
45
+ quote_mint: string;
46
+ recipient: string;
47
+ payer: string;
48
+ amount: bigint;
49
+ bucket: number;
50
+ }
51
+ export declare function pumpUpgradeEventType(disc: bigint, programId?: string): "PumpFunPostCompleteBuy" | "PumpFunSweepBondingCurveFee" | "PumpFunComplete" | "PumpSwapSweepPoolFee" | null;
52
+ export declare function parsePumpUpgradeEvent(disc: bigint, data: Uint8Array, metadata: EventMetadata, programId?: string): DexEvent | null;
53
+ export interface PumpMultiHopIntent {
54
+ user: string;
55
+ inputAccount: string;
56
+ outputAccount: string;
57
+ amountIn: bigint;
58
+ minAmountOut: bigint;
59
+ hops: {
60
+ baseMint: string;
61
+ quoteMint: string;
62
+ venue: string;
63
+ baseVault: string;
64
+ quoteVault: string;
65
+ }[];
66
+ }
67
+ /** Intent amounts are limits, not execution. Each hop emits its own actual trade. */
68
+ export declare function decodePumpMultiHopIntent(program: string, data: Uint8Array, accounts: readonly string[]): PumpMultiHopIntent | null;
@@ -0,0 +1,128 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.pumpUpgradeEventType = pumpUpgradeEventType;
4
+ exports.parsePumpUpgradeEvent = parsePumpUpgradeEvent;
5
+ exports.decodePumpMultiHopIntent = decodePumpMultiHopIntent;
6
+ const binary_js_1 = require("../util/binary.js");
7
+ function pumpUpgradeEventType(disc, programId) {
8
+ if (disc === 18146529233607700591n &&
9
+ (!programId || programId === "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"))
10
+ return "PumpFunPostCompleteBuy";
11
+ if (disc === 3118876958563052404n &&
12
+ (!programId || programId === "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"))
13
+ return "PumpFunSweepBondingCurveFee";
14
+ if (disc === 619296439455019615n &&
15
+ (!programId || programId === "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"))
16
+ return "PumpFunComplete";
17
+ if (disc === 11927646055507993730n &&
18
+ (!programId || programId === "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA"))
19
+ return "PumpSwapSweepPoolFee";
20
+ return null;
21
+ }
22
+ function parsePumpUpgradeEvent(disc, data, metadata, programId) {
23
+ const type = pumpUpgradeEventType(disc, programId);
24
+ if (type === "PumpFunPostCompleteBuy") {
25
+ if (data.length != 224)
26
+ return null;
27
+ return {
28
+ PumpFunPostCompleteBuy: {
29
+ metadata,
30
+ user: (0, binary_js_1.readPubkey)(data, 0),
31
+ mint: (0, binary_js_1.readPubkey)(data, 32),
32
+ bonding_curve: (0, binary_js_1.readPubkey)(data, 64),
33
+ quote_mint: (0, binary_js_1.readPubkey)(data, 96),
34
+ timestamp: (0, binary_js_1.readI64LE)(data, 128),
35
+ base_out: (0, binary_js_1.readU64LE)(data, 136),
36
+ quote_in: (0, binary_js_1.readU64LE)(data, 144),
37
+ fee_basis_points: (0, binary_js_1.readU64LE)(data, 152),
38
+ fee: (0, binary_js_1.readU64LE)(data, 160),
39
+ creator_fee_basis_points: (0, binary_js_1.readU64LE)(data, 168),
40
+ creator_fee: (0, binary_js_1.readU64LE)(data, 176),
41
+ buyback_fee: (0, binary_js_1.readU64LE)(data, 184),
42
+ pool_base_reserves_before: (0, binary_js_1.readU64LE)(data, 192),
43
+ pool_quote_reserves_before: (0, binary_js_1.readU64LE)(data, 200),
44
+ pool_base_reserves_after: (0, binary_js_1.readU64LE)(data, 208),
45
+ pool_quote_reserves_after: (0, binary_js_1.readU64LE)(data, 216),
46
+ },
47
+ };
48
+ }
49
+ if (type === "PumpFunSweepBondingCurveFee") {
50
+ if (data.length != 145)
51
+ return null;
52
+ return {
53
+ PumpFunSweepBondingCurveFee: {
54
+ metadata,
55
+ timestamp: (0, binary_js_1.readI64LE)(data, 0),
56
+ mint: (0, binary_js_1.readPubkey)(data, 8),
57
+ bonding_curve: (0, binary_js_1.readPubkey)(data, 40),
58
+ quote_mint: (0, binary_js_1.readPubkey)(data, 72),
59
+ recipient: (0, binary_js_1.readPubkey)(data, 104),
60
+ amount: (0, binary_js_1.readU64LE)(data, 136),
61
+ bucket: data[144],
62
+ },
63
+ };
64
+ }
65
+ if (type === "PumpFunComplete") {
66
+ if (data.length != 136 && data.length != 104)
67
+ return null;
68
+ return {
69
+ PumpFunComplete: {
70
+ metadata,
71
+ user: (0, binary_js_1.readPubkey)(data, 0),
72
+ mint: (0, binary_js_1.readPubkey)(data, 32),
73
+ bonding_curve: (0, binary_js_1.readPubkey)(data, 64),
74
+ timestamp: (0, binary_js_1.readI64LE)(data, 96),
75
+ quote_mint: data.length === 104
76
+ ? "So11111111111111111111111111111111111111112"
77
+ : (0, binary_js_1.readPubkey)(data, 104),
78
+ },
79
+ };
80
+ }
81
+ if (type === "PumpSwapSweepPoolFee") {
82
+ if (data.length != 177)
83
+ return null;
84
+ return {
85
+ PumpSwapSweepPoolFee: {
86
+ metadata,
87
+ timestamp: (0, binary_js_1.readI64LE)(data, 0),
88
+ pool: (0, binary_js_1.readPubkey)(data, 8),
89
+ base_mint: (0, binary_js_1.readPubkey)(data, 40),
90
+ quote_mint: (0, binary_js_1.readPubkey)(data, 72),
91
+ recipient: (0, binary_js_1.readPubkey)(data, 104),
92
+ payer: (0, binary_js_1.readPubkey)(data, 136),
93
+ amount: (0, binary_js_1.readU64LE)(data, 168),
94
+ bucket: data[176],
95
+ },
96
+ };
97
+ }
98
+ return null;
99
+ }
100
+ /** Intent amounts are limits, not execution. Each hop emits its own actual trade. */
101
+ function decodePumpMultiHopIntent(program, data, accounts) {
102
+ if (program !== "pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA" ||
103
+ data.length !== 24 ||
104
+ (0, binary_js_1.readU64LE)(data, 0) !== 10696039120939607083n ||
105
+ accounts.length < 21 ||
106
+ (accounts.length - 16) % 5 !== 0)
107
+ return null;
108
+ const amountIn = (0, binary_js_1.readU64LE)(data, 8), minAmountOut = (0, binary_js_1.readU64LE)(data, 16);
109
+ if (!amountIn || !minAmountOut)
110
+ return null;
111
+ const hops = [];
112
+ for (let i = 16; i < accounts.length; i += 5)
113
+ hops.push({
114
+ baseMint: accounts[i],
115
+ quoteMint: accounts[i + 1],
116
+ venue: accounts[i + 2],
117
+ baseVault: accounts[i + 3],
118
+ quoteVault: accounts[i + 4],
119
+ });
120
+ return {
121
+ user: accounts[0],
122
+ inputAccount: accounts[1],
123
+ outputAccount: accounts[2],
124
+ amountIn,
125
+ minAmountOut,
126
+ hops,
127
+ };
128
+ }
@@ -12,9 +12,8 @@ function bn64(v) {
12
12
  }
13
13
  /** Current Anchor `SwapEvent` payload (the 8-byte event discriminator is removed by the caller). */
14
14
  function parseSwapEventFromData(data, metadata) {
15
- // pool_id + six u64 fields + base_input. Newer IDLs append mint/fee fields,
16
- // which remain wire-compatible with this stable prefix.
17
- if (data.length < 32 + (6 * 8) + 1)
15
+ // Accept the complete legacy prefix or the complete current mint/fee suffix.
16
+ if (data.length < 81 || (data.length > 81 && data.length < 162) || data[80] > 1 || (data.length >= 162 && data[161] > 1))
18
17
  return null;
19
18
  let o = 0;
20
19
  const pool_id = (0, binary_js_1.readPubkey)(data, o);
@@ -40,6 +39,11 @@ function parseSwapEventFromData(data, metadata) {
40
39
  base_input == null)
41
40
  return null;
42
41
  const ev = {
42
+ input_mint: data.length >= 162 ? (0, binary_js_1.readPubkey)(data, 81) : undefined,
43
+ output_mint: data.length >= 162 ? (0, binary_js_1.readPubkey)(data, 113) : undefined,
44
+ trade_fee: data.length >= 162 ? (0, binary_js_1.readU64LE)(data, 145) : undefined,
45
+ creator_fee: data.length >= 162 ? (0, binary_js_1.readU64LE)(data, 153) : undefined,
46
+ creator_fee_on_input: data.length >= 162 ? data[161] !== 0 : undefined,
43
47
  metadata,
44
48
  pool_id,
45
49
  input_vault_before,