sol-parser-sdk-python 0.4.5__py3-none-any.whl → 0.5.5__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 +39 -7
- sol_parser/account_dispatcher.py +6 -6
- sol_parser/account_fillers/__init__.py +2 -2
- sol_parser/account_fillers/pumpfun.py +2 -4
- sol_parser/account_fillers/raydium_launchlab.py +30 -0
- sol_parser/accounts/__init__.py +55 -37
- sol_parser/dex_parsers.py +62 -71
- sol_parser/event_types.py +29 -20
- sol_parser/grpc_types.py +263 -132
- sol_parser/inner_instruction_parser.py +83 -45
- sol_parser/instr/__init__.py +4 -0
- sol_parser/instructions.py +465 -120
- sol_parser/log_instr_dedup.py +13 -11
- sol_parser/market.py +62 -0
- sol_parser/merger.py +4 -2
- sol_parser/pumpfun_fee_enrich.py +55 -2
- sol_parser/shredstream_client.py +94 -20
- sol_parser/shredstream_pumpfun.py +39 -13
- sol_parser_sdk_python-0.5.5.dist-info/METADATA +307 -0
- {sol_parser_sdk_python-0.4.5.dist-info → sol_parser_sdk_python-0.5.5.dist-info}/RECORD +22 -21
- sol_parser/account_fillers/bonk.py +0 -30
- sol_parser_sdk_python-0.4.5.dist-info/METADATA +0 -14
- {sol_parser_sdk_python-0.4.5.dist-info → sol_parser_sdk_python-0.5.5.dist-info}/WHEEL +0 -0
- {sol_parser_sdk_python-0.4.5.dist-info → sol_parser_sdk_python-0.5.5.dist-info}/entry_points.txt +0 -0
sol_parser/__init__.py
CHANGED
|
@@ -16,6 +16,12 @@ from .parser import (
|
|
|
16
16
|
warmup_parser,
|
|
17
17
|
)
|
|
18
18
|
from .clock import now_micros
|
|
19
|
+
from .market import (
|
|
20
|
+
sqrt_price_x64_to_price,
|
|
21
|
+
vault_price_from_balances,
|
|
22
|
+
normalize_buy_sell_from_token_delta,
|
|
23
|
+
normalize_buy_sell_from_input_mint,
|
|
24
|
+
)
|
|
19
25
|
from .grpc_types import (
|
|
20
26
|
OrderMode,
|
|
21
27
|
CommitmentLevel,
|
|
@@ -46,6 +52,14 @@ from .grpc_types import (
|
|
|
46
52
|
event_type_filter_includes_pumpfun,
|
|
47
53
|
event_type_filter_includes_pumpswap,
|
|
48
54
|
event_type_filter_includes_meteora_damm_v2,
|
|
55
|
+
event_type_filter_includes_meteora_dbc,
|
|
56
|
+
event_type_filter_includes_meteora_pools,
|
|
57
|
+
event_type_filter_includes_meteora_dlmm,
|
|
58
|
+
event_type_filter_includes_raydium_clmm,
|
|
59
|
+
event_type_filter_includes_raydium_cpmm,
|
|
60
|
+
event_type_filter_includes_raydium_amm_v4,
|
|
61
|
+
event_type_filter_includes_orca_whirlpool,
|
|
62
|
+
event_type_filter_includes_raydium_launchlab,
|
|
49
63
|
event_type_filter_includes_pump_fees,
|
|
50
64
|
event_type_filter_allows_instruction_parsing,
|
|
51
65
|
all_event_types,
|
|
@@ -128,16 +142,17 @@ from .event_types import (
|
|
|
128
142
|
MeteoraDammV2AddLiquidityEvent,
|
|
129
143
|
MeteoraDammV2RemoveLiquidityEvent,
|
|
130
144
|
MeteoraDammV2InitializePoolEvent,
|
|
131
|
-
#
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
145
|
+
# RaydiumLaunchlab events
|
|
146
|
+
RaydiumLaunchlabTradeEvent,
|
|
147
|
+
RaydiumLaunchlabPoolCreateEvent,
|
|
148
|
+
RaydiumLaunchlabMigrateAmmEvent,
|
|
135
149
|
# Union type and helper
|
|
136
150
|
TypedDexEvent,
|
|
137
151
|
to_typed_event,
|
|
138
152
|
legacy_dict_to_dex_event,
|
|
139
153
|
)
|
|
140
154
|
from .pumpfun_fee_enrich import (
|
|
155
|
+
enrich_create_v2_from_create_events,
|
|
141
156
|
enrich_create_v2_observed_fee_recipient,
|
|
142
157
|
enrich_pumpfun_same_tx_post_merge,
|
|
143
158
|
enrich_pumpfun_trades_from_create_instructions,
|
|
@@ -206,6 +221,8 @@ from .instructions import (
|
|
|
206
221
|
parse_pumpfun_instruction,
|
|
207
222
|
parse_pumpswap_instruction,
|
|
208
223
|
parse_meteora_damm_instruction,
|
|
224
|
+
parse_meteora_pools_instruction,
|
|
225
|
+
parse_meteora_dlmm_instruction,
|
|
209
226
|
parse_pump_fees_instruction,
|
|
210
227
|
)
|
|
211
228
|
|
|
@@ -229,6 +246,10 @@ __all__ = [
|
|
|
229
246
|
"StreamingEventListener",
|
|
230
247
|
"warmup_parser",
|
|
231
248
|
"now_micros",
|
|
249
|
+
"sqrt_price_x64_to_price",
|
|
250
|
+
"vault_price_from_balances",
|
|
251
|
+
"normalize_buy_sell_from_token_delta",
|
|
252
|
+
"normalize_buy_sell_from_input_mint",
|
|
232
253
|
# RPC parser
|
|
233
254
|
"ParseError",
|
|
234
255
|
"RpcClient",
|
|
@@ -264,6 +285,8 @@ __all__ = [
|
|
|
264
285
|
"parse_pumpfun_instruction",
|
|
265
286
|
"parse_pumpswap_instruction",
|
|
266
287
|
"parse_meteora_damm_instruction",
|
|
288
|
+
"parse_meteora_pools_instruction",
|
|
289
|
+
"parse_meteora_dlmm_instruction",
|
|
267
290
|
"parse_pump_fees_instruction",
|
|
268
291
|
# gRPC types
|
|
269
292
|
"OrderMode",
|
|
@@ -296,6 +319,14 @@ __all__ = [
|
|
|
296
319
|
"event_type_filter_includes_pumpfun",
|
|
297
320
|
"event_type_filter_includes_pumpswap",
|
|
298
321
|
"event_type_filter_includes_meteora_damm_v2",
|
|
322
|
+
"event_type_filter_includes_meteora_dbc",
|
|
323
|
+
"event_type_filter_includes_meteora_pools",
|
|
324
|
+
"event_type_filter_includes_meteora_dlmm",
|
|
325
|
+
"event_type_filter_includes_raydium_clmm",
|
|
326
|
+
"event_type_filter_includes_raydium_cpmm",
|
|
327
|
+
"event_type_filter_includes_raydium_amm_v4",
|
|
328
|
+
"event_type_filter_includes_orca_whirlpool",
|
|
329
|
+
"event_type_filter_includes_raydium_launchlab",
|
|
299
330
|
"event_type_filter_includes_pump_fees",
|
|
300
331
|
"event_type_filter_allows_instruction_parsing",
|
|
301
332
|
"all_event_types",
|
|
@@ -378,12 +409,13 @@ __all__ = [
|
|
|
378
409
|
"MeteoraDammV2AddLiquidityEvent",
|
|
379
410
|
"MeteoraDammV2RemoveLiquidityEvent",
|
|
380
411
|
"MeteoraDammV2InitializePoolEvent",
|
|
381
|
-
"
|
|
382
|
-
"
|
|
383
|
-
"
|
|
412
|
+
"RaydiumLaunchlabTradeEvent",
|
|
413
|
+
"RaydiumLaunchlabPoolCreateEvent",
|
|
414
|
+
"RaydiumLaunchlabMigrateAmmEvent",
|
|
384
415
|
"TypedDexEvent",
|
|
385
416
|
"to_typed_event",
|
|
386
417
|
"legacy_dict_to_dex_event",
|
|
418
|
+
"enrich_create_v2_from_create_events",
|
|
387
419
|
"enrich_create_v2_observed_fee_recipient",
|
|
388
420
|
"enrich_pumpfun_same_tx_post_merge",
|
|
389
421
|
"enrich_pumpfun_trades_from_create_instructions",
|
sol_parser/account_dispatcher.py
CHANGED
|
@@ -6,12 +6,12 @@ from typing import Any, Dict, List, Optional, Tuple
|
|
|
6
6
|
|
|
7
7
|
import base58
|
|
8
8
|
|
|
9
|
-
from .account_fillers import
|
|
9
|
+
from .account_fillers import raydium_launchlab, meteora, orca, pumpfun, pumpswap, raydium
|
|
10
10
|
from .event_types import DexEvent
|
|
11
11
|
from .grpc_types import EventType
|
|
12
12
|
from .instr_account_utils import get_instruction_account_getter
|
|
13
13
|
from .instructions import (
|
|
14
|
-
|
|
14
|
+
RAYDIUM_LAUNCHLAB_PROGRAM_ID,
|
|
15
15
|
METEORA_DAMM_V2_PROGRAM_ID,
|
|
16
16
|
METEORA_DLMM_PROGRAM_ID,
|
|
17
17
|
METEORA_POOLS_PROGRAM_ID,
|
|
@@ -179,10 +179,10 @@ def fill_accounts_with_owned_keys(
|
|
|
179
179
|
run(METEORA_DLMM_PROGRAM_ID, lambda g: meteora.fill_dlmm_add_liquidity_accounts(data, g))
|
|
180
180
|
elif et == EventType.METEORA_DLMM_REMOVE_LIQUIDITY:
|
|
181
181
|
run(METEORA_DLMM_PROGRAM_ID, lambda g: meteora.fill_dlmm_remove_liquidity_accounts(data, g))
|
|
182
|
-
elif et == EventType.
|
|
183
|
-
run(
|
|
184
|
-
elif et == EventType.
|
|
185
|
-
run(
|
|
182
|
+
elif et == EventType.RAYDIUM_LAUNCHLAB_TRADE:
|
|
183
|
+
run(RAYDIUM_LAUNCHLAB_PROGRAM_ID, lambda g: raydium_launchlab.fill_trade_accounts(data, g))
|
|
184
|
+
elif et == EventType.RAYDIUM_LAUNCHLAB_POOL_CREATE:
|
|
185
|
+
run(RAYDIUM_LAUNCHLAB_PROGRAM_ID, lambda g: raydium_launchlab.fill_pool_create_accounts(data, g))
|
|
186
186
|
|
|
187
187
|
|
|
188
188
|
def fill_data(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"""账户填充子模块(对齐 Rust ``core/account_fillers``)。"""
|
|
2
2
|
|
|
3
|
-
from . import
|
|
3
|
+
from . import raydium_launchlab, meteora, orca, pumpfun, pumpswap, raydium
|
|
4
4
|
|
|
5
|
-
__all__ = ["
|
|
5
|
+
__all__ = ["raydium_launchlab", "meteora", "orca", "pumpfun", "pumpswap", "raydium"]
|
|
@@ -29,9 +29,7 @@ def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
|
|
|
29
29
|
if _empty(getattr(e, name)):
|
|
30
30
|
setattr(e, name, get(idx))
|
|
31
31
|
|
|
32
|
-
is_v2 = e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2") or (
|
|
33
|
-
e.ix_name == "buy_exact_quote_in" and account_at_matches_mint(1)
|
|
34
|
-
)
|
|
32
|
+
is_v2 = e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2") or account_at_matches_mint(1)
|
|
35
33
|
if is_v2:
|
|
36
34
|
set_attr("global_account", 0)
|
|
37
35
|
set_attr("quote_mint", 2)
|
|
@@ -51,7 +49,7 @@ def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
|
|
|
51
49
|
set_attr("associated_quote_buyback_fee_recipient", 9)
|
|
52
50
|
set_attr("associated_creator_vault", 17)
|
|
53
51
|
set_attr("sharing_config", 18)
|
|
54
|
-
if e.ix_name == "sell_v2":
|
|
52
|
+
if e.ix_name == "sell_v2" or (e.ix_name == "sell" and not e.is_buy):
|
|
55
53
|
set_attr("user_volume_accumulator", 19)
|
|
56
54
|
set_attr("associated_user_volume_accumulator", 20)
|
|
57
55
|
set_attr("fee_config", 21)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"""RaydiumLaunchlab 账户填充(对齐 ``account_fillers/raydium_launchlab.rs``)。"""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Callable
|
|
6
|
+
|
|
7
|
+
from ..event_types import RaydiumLaunchlabPoolCreateEvent, RaydiumLaunchlabTradeEvent
|
|
8
|
+
|
|
9
|
+
Z = "11111111111111111111111111111111"
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _empty(s: str) -> bool:
|
|
13
|
+
return not s or s == Z
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
AccountGetter = Callable[[int], str]
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
def fill_trade_accounts(e: RaydiumLaunchlabTradeEvent, get: AccountGetter) -> None:
|
|
20
|
+
if _empty(e.user):
|
|
21
|
+
e.user = get(0)
|
|
22
|
+
if _empty(e.pool_state):
|
|
23
|
+
e.pool_state = get(4)
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
def fill_pool_create_accounts(e: RaydiumLaunchlabPoolCreateEvent, get: AccountGetter) -> None:
|
|
27
|
+
if _empty(e.pool_state):
|
|
28
|
+
e.pool_state = get(5)
|
|
29
|
+
if _empty(e.creator):
|
|
30
|
+
e.creator = get(1)
|
sol_parser/accounts/__init__.py
CHANGED
|
@@ -151,6 +151,32 @@ def _read_pumpfun_shareholders(data: bytes, offset: int) -> Optional[tuple[list[
|
|
|
151
151
|
return out, offset
|
|
152
152
|
|
|
153
153
|
|
|
154
|
+
def _filter_account_event(
|
|
155
|
+
ev: Optional[DexEvent],
|
|
156
|
+
event_type_filter: Optional[EventTypeFilter],
|
|
157
|
+
) -> Optional[DexEvent]:
|
|
158
|
+
if ev is None or event_type_filter is None:
|
|
159
|
+
return ev
|
|
160
|
+
return ev if event_type_filter.should_include(ev.type) else None
|
|
161
|
+
|
|
162
|
+
|
|
163
|
+
ACCOUNT_EVENT_TYPES = frozenset(
|
|
164
|
+
(
|
|
165
|
+
EventType.TOKEN_ACCOUNT,
|
|
166
|
+
EventType.TOKEN_INFO,
|
|
167
|
+
EventType.NONCE_ACCOUNT,
|
|
168
|
+
EventType.ACCOUNT_PUMP_FUN_GLOBAL,
|
|
169
|
+
EventType.ACCOUNT_PUMP_FUN_BONDING_CURVE,
|
|
170
|
+
EventType.ACCOUNT_PUMP_FUN_FEE_CONFIG,
|
|
171
|
+
EventType.ACCOUNT_PUMP_FUN_SHARING_CONFIG,
|
|
172
|
+
EventType.ACCOUNT_PUMP_FUN_GLOBAL_VOLUME_ACCUMULATOR,
|
|
173
|
+
EventType.ACCOUNT_PUMP_FUN_USER_VOLUME_ACCUMULATOR,
|
|
174
|
+
EventType.ACCOUNT_PUMP_SWAP_GLOBAL_CONFIG,
|
|
175
|
+
EventType.ACCOUNT_PUMP_SWAP_POOL,
|
|
176
|
+
)
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
|
|
154
180
|
def parse_account_unified(
|
|
155
181
|
account: AccountData,
|
|
156
182
|
metadata: EventMetadata,
|
|
@@ -164,47 +190,34 @@ def parse_account_unified(
|
|
|
164
190
|
if event_type_filter is not None:
|
|
165
191
|
inc = getattr(event_type_filter, "include_only", None)
|
|
166
192
|
if inc is not None and len(inc) > 0:
|
|
167
|
-
|
|
168
|
-
EventType.TOKEN_ACCOUNT,
|
|
169
|
-
EventType.TOKEN_INFO,
|
|
170
|
-
EventType.NONCE_ACCOUNT,
|
|
171
|
-
EventType.ACCOUNT_PUMP_FUN_GLOBAL,
|
|
172
|
-
EventType.ACCOUNT_PUMP_FUN_BONDING_CURVE,
|
|
173
|
-
EventType.ACCOUNT_PUMP_FUN_FEE_CONFIG,
|
|
174
|
-
EventType.ACCOUNT_PUMP_FUN_SHARING_CONFIG,
|
|
175
|
-
EventType.ACCOUNT_PUMP_FUN_GLOBAL_VOLUME_ACCUMULATOR,
|
|
176
|
-
EventType.ACCOUNT_PUMP_FUN_USER_VOLUME_ACCUMULATOR,
|
|
177
|
-
EventType.ACCOUNT_PUMP_SWAP_GLOBAL_CONFIG,
|
|
178
|
-
EventType.ACCOUNT_PUMP_SWAP_POOL,
|
|
179
|
-
}
|
|
180
|
-
if not any(t in need for t in inc):
|
|
193
|
+
if not any(t in ACCOUNT_EVENT_TYPES for t in inc):
|
|
181
194
|
return None
|
|
182
195
|
|
|
183
|
-
if account.owner == PUMPSWAP_PROGRAM_ID
|
|
184
|
-
|
|
185
|
-
EventType.ACCOUNT_PUMP_SWAP_GLOBAL_CONFIG
|
|
186
|
-
|
|
196
|
+
if account.owner == PUMPSWAP_PROGRAM_ID:
|
|
197
|
+
should_parse_pumpswap = event_type_filter is None or (
|
|
198
|
+
event_type_filter.should_include(EventType.ACCOUNT_PUMP_SWAP_GLOBAL_CONFIG)
|
|
199
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_SWAP_POOL)
|
|
200
|
+
)
|
|
201
|
+
if should_parse_pumpswap:
|
|
187
202
|
ev = _parse_pumpswap_account(account, metadata)
|
|
188
203
|
if ev is not None:
|
|
189
|
-
return ev
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
EventType.ACCOUNT_PUMP_FUN_BONDING_CURVE
|
|
196
|
-
|
|
197
|
-
EventType.
|
|
198
|
-
|
|
199
|
-
EventType.
|
|
200
|
-
)
|
|
201
|
-
|
|
202
|
-
) or event_type_filter.should_include(
|
|
203
|
-
EventType.ACCOUNT_PUMP_FUN_USER_VOLUME_ACCUMULATOR
|
|
204
|
-
):
|
|
204
|
+
return _filter_account_event(ev, event_type_filter)
|
|
205
|
+
return None
|
|
206
|
+
|
|
207
|
+
if account.owner in (PUMPFUN_PROGRAM_ID, PUMP_FEES_PROGRAM_ID):
|
|
208
|
+
should_parse_pumpfun = event_type_filter is None or (
|
|
209
|
+
event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_GLOBAL)
|
|
210
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_BONDING_CURVE)
|
|
211
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_FEE_CONFIG)
|
|
212
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_SHARING_CONFIG)
|
|
213
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_GLOBAL_VOLUME_ACCUMULATOR)
|
|
214
|
+
or event_type_filter.should_include(EventType.ACCOUNT_PUMP_FUN_USER_VOLUME_ACCUMULATOR)
|
|
215
|
+
)
|
|
216
|
+
if should_parse_pumpfun:
|
|
205
217
|
ev = _parse_pumpfun_account(account, metadata)
|
|
206
218
|
if ev is not None:
|
|
207
|
-
return ev
|
|
219
|
+
return _filter_account_event(ev, event_type_filter)
|
|
220
|
+
return None
|
|
208
221
|
|
|
209
222
|
if acc_utils.is_nonce_account(data):
|
|
210
223
|
if event_type_filter is not None:
|
|
@@ -213,9 +226,11 @@ def parse_account_unified(
|
|
|
213
226
|
return _parse_nonce_fast(account, metadata)
|
|
214
227
|
|
|
215
228
|
if event_type_filter is not None:
|
|
216
|
-
if not event_type_filter.should_include(
|
|
229
|
+
if not event_type_filter.should_include(
|
|
230
|
+
EventType.TOKEN_ACCOUNT
|
|
231
|
+
) and not event_type_filter.should_include(EventType.TOKEN_INFO):
|
|
217
232
|
return None
|
|
218
|
-
return parse_token_account(account, metadata)
|
|
233
|
+
return _filter_account_event(parse_token_account(account, metadata), event_type_filter)
|
|
219
234
|
|
|
220
235
|
|
|
221
236
|
def _parse_pumpswap_account(account: AccountData, metadata: EventMetadata) -> Optional[DexEvent]:
|
|
@@ -706,6 +721,9 @@ def _parse_pumpswap_pool_fast(account: AccountData, metadata: EventMetadata) ->
|
|
|
706
721
|
|
|
707
722
|
|
|
708
723
|
def parse_token_account(account: AccountData, metadata: EventMetadata) -> Optional[DexEvent]:
|
|
724
|
+
if not acc_utils.is_token_program_account(account.owner):
|
|
725
|
+
return None
|
|
726
|
+
|
|
709
727
|
if len(account.data) <= 100:
|
|
710
728
|
event = _parse_mint_fast(account, metadata)
|
|
711
729
|
if event:
|
sol_parser/dex_parsers.py
CHANGED
|
@@ -39,12 +39,22 @@ from .event_types import (
|
|
|
39
39
|
MeteoraDammV2CreatePositionEvent, MeteoraDammV2ClosePositionEvent,
|
|
40
40
|
MeteoraDammV2AddLiquidityEvent, MeteoraDammV2RemoveLiquidityEvent,
|
|
41
41
|
MeteoraDammV2InitializePoolEvent,
|
|
42
|
-
|
|
42
|
+
RaydiumLaunchlabTradeEvent, RaydiumLaunchlabPoolCreateEvent,
|
|
43
43
|
)
|
|
44
44
|
|
|
45
45
|
Z = "11111111111111111111111111111111"
|
|
46
46
|
|
|
47
47
|
|
|
48
|
+
def normalize_pumpfun_ix_name(ix_name: str) -> str:
|
|
49
|
+
if ix_name == "buy_v2":
|
|
50
|
+
return "buy"
|
|
51
|
+
if ix_name == "sell_v2":
|
|
52
|
+
return "sell"
|
|
53
|
+
if ix_name == "buy_exact_quote_in_v2":
|
|
54
|
+
return "buy_exact_quote_in"
|
|
55
|
+
return ix_name
|
|
56
|
+
|
|
57
|
+
|
|
48
58
|
def _u64le(b: bytes, o: int) -> int:
|
|
49
59
|
return struct.unpack_from("<Q", b, o)[0]
|
|
50
60
|
|
|
@@ -218,6 +228,7 @@ def parse_trade_from_data(data: bytes, meta: dict, is_created_buy: bool) -> DexE
|
|
|
218
228
|
ix_name = ""
|
|
219
229
|
if o + 4 <= len(data):
|
|
220
230
|
ix_name, o = _borsh_str(data, o)
|
|
231
|
+
ix_name = normalize_pumpfun_ix_name(ix_name)
|
|
221
232
|
mm = _bool(data, o) if o < len(data) else False
|
|
222
233
|
o += 1
|
|
223
234
|
cb_bps = _u64le(data, o) if o + 8 <= len(data) else 0
|
|
@@ -277,12 +288,14 @@ def parse_trade_from_data(data: bytes, meta: dict, is_created_buy: bool) -> DexE
|
|
|
277
288
|
creator_vault=Z,
|
|
278
289
|
)
|
|
279
290
|
|
|
280
|
-
if ix_name
|
|
291
|
+
if ix_name == "buy":
|
|
281
292
|
return DexEvent(type=EventType.PUMP_FUN_BUY, data=event_data)
|
|
282
|
-
if ix_name
|
|
293
|
+
if ix_name == "sell":
|
|
283
294
|
return DexEvent(type=EventType.PUMP_FUN_SELL, data=event_data)
|
|
284
|
-
if ix_name
|
|
295
|
+
if ix_name == "buy_exact_sol_in":
|
|
285
296
|
return DexEvent(type=EventType.PUMP_FUN_BUY_EXACT_SOL_IN, data=event_data)
|
|
297
|
+
if ix_name == "buy_exact_quote_in":
|
|
298
|
+
return DexEvent(type=EventType.PUMP_FUN_BUY, data=event_data)
|
|
286
299
|
return DexEvent(type=EventType.PUMP_FUN_TRADE, data=event_data)
|
|
287
300
|
|
|
288
301
|
|
|
@@ -319,6 +332,10 @@ def parse_create_from_data(data: bytes, meta: dict) -> DexEvent:
|
|
|
319
332
|
mm = _bool(data, o) if o < len(data) else False
|
|
320
333
|
o += 1
|
|
321
334
|
ice = _bool(data, o) if o < len(data) else False
|
|
335
|
+
o += 1
|
|
336
|
+
quote_mint = _pub(data, o) if o + 32 <= len(data) else Z
|
|
337
|
+
o += 32
|
|
338
|
+
virtual_quote_reserves = _u64le(data, o) if o + 8 <= len(data) else 0
|
|
322
339
|
|
|
323
340
|
return DexEvent(
|
|
324
341
|
type=EventType.PUMP_FUN_CREATE,
|
|
@@ -339,6 +356,8 @@ def parse_create_from_data(data: bytes, meta: dict) -> DexEvent:
|
|
|
339
356
|
token_program=tp,
|
|
340
357
|
is_mayhem_mode=mm,
|
|
341
358
|
is_cashback_enabled=ice,
|
|
359
|
+
quote_mint=quote_mint,
|
|
360
|
+
virtual_quote_reserves=virtual_quote_reserves,
|
|
342
361
|
),
|
|
343
362
|
)
|
|
344
363
|
|
|
@@ -1811,45 +1830,35 @@ def _parse_damm_remove_liquidity(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
|
1811
1830
|
)
|
|
1812
1831
|
|
|
1813
1832
|
|
|
1814
|
-
# ---
|
|
1833
|
+
# --- RaydiumLaunchlab ---
|
|
1815
1834
|
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
DISC_BONK_MIGRATE_AMM = _d(3, 4, 5, 6, 7, 8, 9, 10)
|
|
1835
|
+
DISC_RAYDIUM_LAUNCHLAB_TRADE = _d(189, 219, 127, 211, 78, 230, 97, 238)
|
|
1836
|
+
DISC_RAYDIUM_LAUNCHLAB_POOL_CREATE = _d(151, 215, 226, 9, 118, 161, 115, 174)
|
|
1819
1837
|
|
|
1820
1838
|
|
|
1821
|
-
def
|
|
1822
|
-
if disc ==
|
|
1823
|
-
return
|
|
1824
|
-
if disc ==
|
|
1825
|
-
return
|
|
1826
|
-
if disc == DISC_BONK_MIGRATE_AMM:
|
|
1827
|
-
return _parse_bonk_migrate_amm(data, meta)
|
|
1839
|
+
def parse_raydium_launchlab_from_discriminator(disc: int, data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
1840
|
+
if disc == DISC_RAYDIUM_LAUNCHLAB_TRADE:
|
|
1841
|
+
return _parse_raydium_launchlab_trade(data, meta)
|
|
1842
|
+
if disc == DISC_RAYDIUM_LAUNCHLAB_POOL_CREATE:
|
|
1843
|
+
return _parse_raydium_launchlab_pool_create(data, meta)
|
|
1828
1844
|
return None
|
|
1829
1845
|
|
|
1830
1846
|
|
|
1831
|
-
def
|
|
1832
|
-
if len(data) <
|
|
1847
|
+
def _parse_raydium_launchlab_trade(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
1848
|
+
if len(data) < 139:
|
|
1833
1849
|
return None
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
ai = _u64le(data, o)
|
|
1840
|
-
o += 8
|
|
1841
|
-
ao = _u64le(data, o)
|
|
1842
|
-
o += 8
|
|
1843
|
-
is_buy = _bool(data, o)
|
|
1844
|
-
o += 1
|
|
1845
|
-
ex_in = _bool(data, o)
|
|
1850
|
+
pool = _pub(data, 0)
|
|
1851
|
+
ai = _u64le(data, 88)
|
|
1852
|
+
ao = _u64le(data, 96)
|
|
1853
|
+
is_buy = _u8(data, 136) == 0
|
|
1854
|
+
ex_in = _bool(data, 138)
|
|
1846
1855
|
d = "Buy" if is_buy else "Sell"
|
|
1847
1856
|
return DexEvent(
|
|
1848
|
-
type=EventType.
|
|
1849
|
-
data=
|
|
1857
|
+
type=EventType.RAYDIUM_LAUNCHLAB_TRADE,
|
|
1858
|
+
data=RaydiumLaunchlabTradeEvent(
|
|
1850
1859
|
metadata=_make_meta(meta),
|
|
1851
1860
|
pool_state=pool,
|
|
1852
|
-
user=
|
|
1861
|
+
user=Z,
|
|
1853
1862
|
amount_in=ai,
|
|
1854
1863
|
amount_out=ao,
|
|
1855
1864
|
is_buy=is_buy,
|
|
@@ -1859,52 +1868,36 @@ def _parse_bonk_trade(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
|
1859
1868
|
)
|
|
1860
1869
|
|
|
1861
1870
|
|
|
1862
|
-
def
|
|
1863
|
-
if len(data) <
|
|
1871
|
+
def _parse_raydium_launchlab_pool_create(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
1872
|
+
if len(data) < 97:
|
|
1873
|
+
return None
|
|
1874
|
+
pool = _pub(data, 0)
|
|
1875
|
+
creator = _pub(data, 32)
|
|
1876
|
+
o = 96
|
|
1877
|
+
decimals = _u8(data, o)
|
|
1878
|
+
o += 1
|
|
1879
|
+
try:
|
|
1880
|
+
name, o = _borsh_str(data, o)
|
|
1881
|
+
symbol, o = _borsh_str(data, o)
|
|
1882
|
+
uri, o = _borsh_str(data, o)
|
|
1883
|
+
except (struct.error, UnicodeDecodeError):
|
|
1864
1884
|
return None
|
|
1865
|
-
o = 0
|
|
1866
|
-
pool = _pub(data, o)
|
|
1867
|
-
o += 32 + 32 + 32
|
|
1868
|
-
creator = _pub(data, o)
|
|
1869
1885
|
return DexEvent(
|
|
1870
|
-
type=EventType.
|
|
1871
|
-
data=
|
|
1886
|
+
type=EventType.RAYDIUM_LAUNCHLAB_POOL_CREATE,
|
|
1887
|
+
data=RaydiumLaunchlabPoolCreateEvent(
|
|
1872
1888
|
metadata=_make_meta(meta),
|
|
1873
|
-
base_mint_param={"symbol":
|
|
1889
|
+
base_mint_param={"symbol": symbol, "name": name, "uri": uri, "decimals": decimals},
|
|
1874
1890
|
pool_state=pool,
|
|
1875
1891
|
creator=creator,
|
|
1876
1892
|
),
|
|
1877
1893
|
)
|
|
1878
1894
|
|
|
1879
1895
|
|
|
1880
|
-
def _parse_bonk_migrate_amm(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
1881
|
-
if len(data) < 32 + 32 + 32 + 8:
|
|
1882
|
-
return None
|
|
1883
|
-
o = 0
|
|
1884
|
-
old_p = _pub(data, o)
|
|
1885
|
-
o += 32
|
|
1886
|
-
new_p = _pub(data, o)
|
|
1887
|
-
o += 32
|
|
1888
|
-
user = _pub(data, o)
|
|
1889
|
-
o += 32
|
|
1890
|
-
liq = _u64le(data, o)
|
|
1891
|
-
return DexEvent(
|
|
1892
|
-
type=EventType.BONK_MIGRATE_AMM,
|
|
1893
|
-
data=BonkMigrateAmmEvent(
|
|
1894
|
-
metadata=_make_meta(meta),
|
|
1895
|
-
old_pool=old_p,
|
|
1896
|
-
new_pool=new_p,
|
|
1897
|
-
user=user,
|
|
1898
|
-
liquidity_amount=liq,
|
|
1899
|
-
),
|
|
1900
|
-
)
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
1896
|
# --- PumpSwap ---
|
|
1904
1897
|
|
|
1905
1898
|
|
|
1906
1899
|
def parse_ps_buy_from_data(data: bytes, meta: dict) -> Optional[DexEvent]:
|
|
1907
|
-
min_len =
|
|
1900
|
+
min_len = 16 * 8 + 7 * 32 + 1 + 5 * 8 + 4
|
|
1908
1901
|
if len(data) < min_len:
|
|
1909
1902
|
return None
|
|
1910
1903
|
o = 0
|
|
@@ -2488,9 +2481,7 @@ _LOG_DISCRIMINATOR_EVENT_TYPES = {
|
|
|
2488
2481
|
_d(228, 50, 246, 85, 203, 66, 134, 37): EventType.METEORA_DAMM_V2_INITIALIZE_POOL,
|
|
2489
2482
|
_d(156, 15, 119, 198, 29, 181, 221, 55): EventType.METEORA_DAMM_V2_CREATE_POSITION,
|
|
2490
2483
|
_d(20, 145, 144, 68, 143, 142, 214, 178): EventType.METEORA_DAMM_V2_CLOSE_POSITION,
|
|
2491
|
-
|
|
2492
|
-
DISC_BONK_POOL_CREATE: EventType.BONK_POOL_CREATE,
|
|
2493
|
-
DISC_BONK_MIGRATE_AMM: EventType.BONK_MIGRATE_AMM,
|
|
2484
|
+
DISC_RAYDIUM_LAUNCHLAB_POOL_CREATE: EventType.RAYDIUM_LAUNCHLAB_POOL_CREATE,
|
|
2494
2485
|
DLMM_ADD_LIQ: EventType.METEORA_DLMM_ADD_LIQUIDITY,
|
|
2495
2486
|
DLMM_REMOVE_LIQ: EventType.METEORA_DLMM_REMOVE_LIQUIDITY,
|
|
2496
2487
|
DLMM_INIT_POOL: EventType.METEORA_DLMM_INITIALIZE_POOL,
|
|
@@ -2623,7 +2614,7 @@ def dispatch_program_data(
|
|
|
2623
2614
|
_d(20, 145, 144, 68, 143, 142, 214, 178),
|
|
2624
2615
|
):
|
|
2625
2616
|
return parse_meteora_damm_from_buf(buf, meta)
|
|
2626
|
-
|
|
2627
|
-
if
|
|
2628
|
-
return
|
|
2617
|
+
raydium_launchlab = parse_raydium_launchlab_from_discriminator(disc, data, meta)
|
|
2618
|
+
if raydium_launchlab:
|
|
2619
|
+
return raydium_launchlab
|
|
2629
2620
|
return parse_dlmm_from_program_data(buf, meta)
|