sol-parser-sdk-python 0.5.5__py3-none-any.whl → 0.5.7__py3-none-any.whl

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.
sol_parser/__init__.py CHANGED
@@ -6,6 +6,7 @@ from .parser import (
6
6
  StreamingEventListener,
7
7
  parse_log,
8
8
  parse_log_optimized,
9
+ parse_log_optimized_with_program_id,
9
10
  parse_log_unified,
10
11
  parse_logs_only,
11
12
  parse_logs_streaming,
@@ -103,6 +104,15 @@ from .event_types import (
103
104
  RaydiumClmmOpenPositionWithTokenExtNftEvent,
104
105
  RaydiumClmmClosePositionEvent,
105
106
  RaydiumClmmCollectFeeEvent,
107
+ RaydiumClmmLiquidityChangeEvent,
108
+ RaydiumClmmConfigChangeEvent,
109
+ RaydiumClmmCreatePersonalPositionEvent,
110
+ RaydiumClmmLiquidityCalculateEvent,
111
+ RaydiumClmmOpenLimitOrderEvent,
112
+ RaydiumClmmIncreaseLimitOrderEvent,
113
+ RaydiumClmmDecreaseLimitOrderEvent,
114
+ RaydiumClmmSettleLimitOrderEvent,
115
+ RaydiumClmmUpdateRewardInfosEvent,
106
116
  # Raydium AMM V4 (legacy)
107
117
  RaydiumAmmV4SwapEvent,
108
118
  RaydiumAmmV4DepositEvent,
@@ -142,6 +152,9 @@ from .event_types import (
142
152
  MeteoraDammV2AddLiquidityEvent,
143
153
  MeteoraDammV2RemoveLiquidityEvent,
144
154
  MeteoraDammV2InitializePoolEvent,
155
+ MeteoraDbcCurveCompleteEvent,
156
+ MeteoraDbcInitializePoolEvent,
157
+ MeteoraDbcSwapEvent,
145
158
  # RaydiumLaunchlab events
146
159
  RaydiumLaunchlabTradeEvent,
147
160
  RaydiumLaunchlabPoolCreateEvent,
@@ -235,6 +248,7 @@ __all__ = [
235
248
  "enrich_dex_events_with_subscribe_tx_info",
236
249
  "parse_log_unified",
237
250
  "parse_log_optimized",
251
+ "parse_log_optimized_with_program_id",
238
252
  "parse_log",
239
253
  "parse_logs_only",
240
254
  "parse_logs_streaming",
@@ -376,6 +390,15 @@ __all__ = [
376
390
  "RaydiumClmmOpenPositionWithTokenExtNftEvent",
377
391
  "RaydiumClmmClosePositionEvent",
378
392
  "RaydiumClmmCollectFeeEvent",
393
+ "RaydiumClmmLiquidityChangeEvent",
394
+ "RaydiumClmmConfigChangeEvent",
395
+ "RaydiumClmmCreatePersonalPositionEvent",
396
+ "RaydiumClmmLiquidityCalculateEvent",
397
+ "RaydiumClmmOpenLimitOrderEvent",
398
+ "RaydiumClmmIncreaseLimitOrderEvent",
399
+ "RaydiumClmmDecreaseLimitOrderEvent",
400
+ "RaydiumClmmSettleLimitOrderEvent",
401
+ "RaydiumClmmUpdateRewardInfosEvent",
379
402
  "RaydiumAmmV4SwapEvent",
380
403
  "RaydiumAmmV4DepositEvent",
381
404
  "RaydiumAmmV4WithdrawEvent",
@@ -409,6 +432,9 @@ __all__ = [
409
432
  "MeteoraDammV2AddLiquidityEvent",
410
433
  "MeteoraDammV2RemoveLiquidityEvent",
411
434
  "MeteoraDammV2InitializePoolEvent",
435
+ "MeteoraDbcCurveCompleteEvent",
436
+ "MeteoraDbcInitializePoolEvent",
437
+ "MeteoraDbcSwapEvent",
412
438
  "RaydiumLaunchlabTradeEvent",
413
439
  "RaydiumLaunchlabPoolCreateEvent",
414
440
  "RaydiumLaunchlabMigrateAmmEvent",
@@ -167,6 +167,8 @@ def fill_accounts_with_owned_keys(
167
167
  run(METEORA_DAMM_V2_PROGRAM_ID, lambda g: meteora.fill_damm_v2_add_liquidity_accounts(data, g))
168
168
  elif et == EventType.METEORA_DAMM_V2_REMOVE_LIQUIDITY:
169
169
  run(METEORA_DAMM_V2_PROGRAM_ID, lambda g: meteora.fill_damm_v2_remove_liquidity_accounts(data, g))
170
+ elif et == EventType.METEORA_DAMM_V2_INITIALIZE_POOL:
171
+ run(METEORA_DAMM_V2_PROGRAM_ID, lambda g: meteora.fill_damm_v2_initialize_pool_accounts(data, g))
170
172
  elif et == EventType.METEORA_POOLS_SWAP:
171
173
  run(METEORA_POOLS_PROGRAM_ID, lambda g: meteora.fill_pools_swap_accounts(data, g))
172
174
  elif et == EventType.METEORA_POOLS_ADD_LIQUIDITY:
@@ -27,6 +27,21 @@ def fill_damm_v2_remove_liquidity_accounts(_e: Any, _get: AccountGetter) -> None
27
27
  pass
28
28
 
29
29
 
30
+ def fill_damm_v2_initialize_pool_accounts(e: Any, get: AccountGetter) -> None:
31
+ if getattr(e, "creator", "") == "":
32
+ e.creator = get(0)
33
+ if getattr(e, "position_nft_mint", "") == "":
34
+ e.position_nft_mint = get(1)
35
+ if getattr(e, "pool", "") == "":
36
+ e.pool = get(6)
37
+ if getattr(e, "position", "") == "":
38
+ e.position = get(7)
39
+ if getattr(e, "token_a_mint", "") == "":
40
+ e.token_a_mint = get(8)
41
+ if getattr(e, "token_b_mint", "") == "":
42
+ e.token_b_mint = get(9)
43
+
44
+
30
45
  def fill_pools_swap_accounts(_e: Any, _get: AccountGetter) -> None:
31
46
  pass
32
47
 
@@ -113,6 +113,9 @@ def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
113
113
 
114
114
 
115
115
  def fill_create_accounts(e: PumpFunCreateEvent, get: AccountGetter) -> None:
116
+ if get(15) == "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P":
117
+ fill_create_v2_accounts(e, get) # type: ignore[arg-type]
118
+ return
116
119
  if _empty(e.mint):
117
120
  e.mint = get(0)
118
121
  if _empty(e.bonding_curve):
@@ -154,6 +157,14 @@ def fill_create_v2_accounts(e: PumpFunCreateV2TokenEvent, get: AccountGetter) ->
154
157
  e.event_authority = get(14)
155
158
  if _empty(e.program):
156
159
  e.program = get(15)
160
+ if _empty(e.quote_mint) or e.quote_mint == "So11111111111111111111111111111111111111111":
161
+ e.quote_mint = get(16)
162
+ if _empty(e.quote_vault):
163
+ e.quote_vault = get(17)
164
+ if _empty(e.quote_token_program):
165
+ e.quote_token_program = get(18)
166
+ if getattr(e, "ix_name", "") in ("", "create"):
167
+ e.ix_name = "create_v2"
157
168
 
158
169
 
159
170
  def fill_migrate_accounts(_e: PumpFunMigrateEvent, _get: AccountGetter) -> None:
@@ -13,6 +13,14 @@ from ..dex_parsers import DexEvent
13
13
 
14
14
  from . import rpc_wallet
15
15
  from . import utils as acc_utils
16
+ from .raydium_orca import (
17
+ ORCA_WHIRLPOOL_PROGRAM_ID,
18
+ RAYDIUM_CLMM_PROGRAM_ID,
19
+ RAYDIUM_CPMM_PROGRAM_ID,
20
+ parse_orca_whirlpool_account,
21
+ parse_raydium_clmm_account,
22
+ parse_raydium_cpmm_account,
23
+ )
16
24
 
17
25
  # 程序 ID(与 Rust ``accounts/program_ids`` / ``instr/program_ids`` 一致)
18
26
  PUMPFUN_PROGRAM_ID = "6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P"
@@ -173,6 +181,16 @@ ACCOUNT_EVENT_TYPES = frozenset(
173
181
  EventType.ACCOUNT_PUMP_FUN_USER_VOLUME_ACCUMULATOR,
174
182
  EventType.ACCOUNT_PUMP_SWAP_GLOBAL_CONFIG,
175
183
  EventType.ACCOUNT_PUMP_SWAP_POOL,
184
+ EventType.ACCOUNT_RAYDIUM_CLMM_AMM_CONFIG,
185
+ EventType.ACCOUNT_RAYDIUM_CLMM_POOL_STATE,
186
+ EventType.ACCOUNT_RAYDIUM_CLMM_TICK_ARRAY_STATE,
187
+ EventType.ACCOUNT_RAYDIUM_CPMM_AMM_CONFIG,
188
+ EventType.ACCOUNT_RAYDIUM_CPMM_POOL_STATE,
189
+ EventType.ACCOUNT_ORCA_WHIRLPOOL,
190
+ EventType.ACCOUNT_ORCA_POSITION,
191
+ EventType.ACCOUNT_ORCA_TICK_ARRAY,
192
+ EventType.ACCOUNT_ORCA_FEE_TIER,
193
+ EventType.ACCOUNT_ORCA_WHIRLPOOLS_CONFIG,
176
194
  )
177
195
  )
178
196
 
@@ -219,6 +237,43 @@ def parse_account_unified(
219
237
  return _filter_account_event(ev, event_type_filter)
220
238
  return None
221
239
 
240
+ if account.owner == RAYDIUM_CLMM_PROGRAM_ID:
241
+ should_parse_clmm = event_type_filter is None or (
242
+ event_type_filter.should_include(EventType.ACCOUNT_RAYDIUM_CLMM_AMM_CONFIG)
243
+ or event_type_filter.should_include(EventType.ACCOUNT_RAYDIUM_CLMM_POOL_STATE)
244
+ or event_type_filter.should_include(EventType.ACCOUNT_RAYDIUM_CLMM_TICK_ARRAY_STATE)
245
+ )
246
+ if should_parse_clmm:
247
+ ev = parse_raydium_clmm_account(account, metadata)
248
+ if ev is not None:
249
+ return _filter_account_event(ev, event_type_filter)
250
+ return None
251
+
252
+ if account.owner == RAYDIUM_CPMM_PROGRAM_ID:
253
+ should_parse_cpmm = event_type_filter is None or (
254
+ event_type_filter.should_include(EventType.ACCOUNT_RAYDIUM_CPMM_AMM_CONFIG)
255
+ or event_type_filter.should_include(EventType.ACCOUNT_RAYDIUM_CPMM_POOL_STATE)
256
+ )
257
+ if should_parse_cpmm:
258
+ ev = parse_raydium_cpmm_account(account, metadata)
259
+ if ev is not None:
260
+ return _filter_account_event(ev, event_type_filter)
261
+ return None
262
+
263
+ if account.owner == ORCA_WHIRLPOOL_PROGRAM_ID:
264
+ should_parse_orca = event_type_filter is None or (
265
+ event_type_filter.should_include(EventType.ACCOUNT_ORCA_WHIRLPOOL)
266
+ or event_type_filter.should_include(EventType.ACCOUNT_ORCA_POSITION)
267
+ or event_type_filter.should_include(EventType.ACCOUNT_ORCA_TICK_ARRAY)
268
+ or event_type_filter.should_include(EventType.ACCOUNT_ORCA_FEE_TIER)
269
+ or event_type_filter.should_include(EventType.ACCOUNT_ORCA_WHIRLPOOLS_CONFIG)
270
+ )
271
+ if should_parse_orca:
272
+ ev = parse_orca_whirlpool_account(account, metadata)
273
+ if ev is not None:
274
+ return _filter_account_event(ev, event_type_filter)
275
+ return None
276
+
222
277
  if acc_utils.is_nonce_account(data):
223
278
  if event_type_filter is not None:
224
279
  if not event_type_filter.should_include(EventType.NONCE_ACCOUNT):
@@ -848,12 +903,18 @@ __all__ = [
848
903
  "is_pumpfun_global_account",
849
904
  "parse_pumpswap_global_config",
850
905
  "parse_pumpswap_pool",
906
+ "parse_raydium_clmm_account",
907
+ "parse_raydium_cpmm_account",
908
+ "parse_orca_whirlpool_account",
851
909
  "is_global_config_account",
852
910
  "is_pool_account",
853
911
  "has_discriminator",
854
912
  "PUMPFUN_PROGRAM_ID",
855
913
  "PUMP_FEES_PROGRAM_ID",
856
914
  "PUMPSWAP_PROGRAM_ID",
915
+ "RAYDIUM_CLMM_PROGRAM_ID",
916
+ "RAYDIUM_CPMM_PROGRAM_ID",
917
+ "ORCA_WHIRLPOOL_PROGRAM_ID",
857
918
  "rpc_resolve_user_wallet_pubkey",
858
919
  "user_wallet_pubkey_for_onchain_account",
859
920
  "rpc_wallet",