sol-parser-sdk-python 0.4.4__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 +81 -18
- sol_parser/account_fillers/pumpswap.py +40 -0
- sol_parser/account_fillers/raydium_launchlab.py +30 -0
- sol_parser/accounts/__init__.py +421 -21
- sol_parser/dex_parsers.py +115 -71
- sol_parser/event_types.py +143 -21
- sol_parser/grpc_types.py +273 -122
- sol_parser/inner_instruction_parser.py +83 -45
- sol_parser/instr/__init__.py +4 -0
- sol_parser/instructions.py +720 -136
- sol_parser/log_instr_dedup.py +52 -13
- sol_parser/market.py +62 -0
- sol_parser/merger.py +78 -4
- sol_parser/pumpfun_fee_enrich.py +55 -2
- sol_parser/shredstream_client.py +94 -20
- sol_parser/shredstream_pumpfun.py +45 -13
- sol_parser_sdk_python-0.5.5.dist-info/METADATA +307 -0
- {sol_parser_sdk_python-0.4.4.dist-info → sol_parser_sdk_python-0.5.5.dist-info}/RECORD +23 -22
- sol_parser/account_fillers/bonk.py +0 -30
- sol_parser_sdk_python-0.4.4.dist-info/METADATA +0 -14
- {sol_parser_sdk_python-0.4.4.dist-info → sol_parser_sdk_python-0.5.5.dist-info}/WHEEL +0 -0
- {sol_parser_sdk_python-0.4.4.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"]
|
|
@@ -22,31 +22,94 @@ AccountGetter = Callable[[int], str]
|
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
25
|
+
def account_at_matches_mint(idx: int) -> bool:
|
|
26
|
+
return not _empty(e.mint) and get(idx) == e.mint
|
|
27
|
+
|
|
28
|
+
def set_attr(name: str, idx: int) -> None:
|
|
29
|
+
if _empty(getattr(e, name)):
|
|
30
|
+
setattr(e, name, get(idx))
|
|
31
|
+
|
|
32
|
+
is_v2 = e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2") or account_at_matches_mint(1)
|
|
33
|
+
if is_v2:
|
|
34
|
+
set_attr("global_account", 0)
|
|
35
|
+
set_attr("quote_mint", 2)
|
|
36
|
+
set_attr("fee_recipient", 6)
|
|
37
|
+
set_attr("bonding_curve", 10)
|
|
38
|
+
set_attr("associated_bonding_curve", 11)
|
|
39
|
+
set_attr("associated_quote_bonding_curve", 12)
|
|
40
|
+
set_attr("user", 13)
|
|
41
|
+
set_attr("associated_user", 14)
|
|
42
|
+
set_attr("associated_quote_user", 15)
|
|
43
|
+
set_attr("token_program", 3)
|
|
44
|
+
set_attr("quote_token_program", 4)
|
|
45
|
+
set_attr("associated_token_program", 5)
|
|
46
|
+
set_attr("creator_vault", 16)
|
|
47
|
+
set_attr("associated_quote_fee_recipient", 7)
|
|
48
|
+
set_attr("buyback_fee_recipient", 8)
|
|
49
|
+
set_attr("associated_quote_buyback_fee_recipient", 9)
|
|
50
|
+
set_attr("associated_creator_vault", 17)
|
|
51
|
+
set_attr("sharing_config", 18)
|
|
52
|
+
if e.ix_name == "sell_v2" or (e.ix_name == "sell" and not e.is_buy):
|
|
53
|
+
set_attr("user_volume_accumulator", 19)
|
|
54
|
+
set_attr("associated_user_volume_accumulator", 20)
|
|
55
|
+
set_attr("fee_config", 21)
|
|
56
|
+
set_attr("fee_program", 22)
|
|
57
|
+
set_attr("system_program", 23)
|
|
58
|
+
set_attr("event_authority", 24)
|
|
59
|
+
set_attr("program", 25)
|
|
60
|
+
else:
|
|
61
|
+
set_attr("global_volume_accumulator", 19)
|
|
62
|
+
set_attr("user_volume_accumulator", 20)
|
|
63
|
+
set_attr("associated_user_volume_accumulator", 21)
|
|
64
|
+
set_attr("fee_config", 22)
|
|
65
|
+
set_attr("fee_program", 23)
|
|
66
|
+
set_attr("system_program", 24)
|
|
67
|
+
set_attr("event_authority", 25)
|
|
68
|
+
set_attr("program", 26)
|
|
36
69
|
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
70
|
+
set_attr("global_account", 0)
|
|
71
|
+
set_attr("fee_recipient", 1)
|
|
72
|
+
set_attr("bonding_curve", 3)
|
|
73
|
+
set_attr("associated_bonding_curve", 4)
|
|
74
|
+
set_attr("associated_user", 5)
|
|
75
|
+
set_attr("user", 6)
|
|
76
|
+
set_attr("system_program", 7)
|
|
43
77
|
if _empty(e.creator_vault):
|
|
44
78
|
e.creator_vault = get(9) if e.is_buy else get(8)
|
|
45
79
|
if _empty(e.token_program):
|
|
46
80
|
e.token_program = get(8) if e.is_buy else get(9)
|
|
81
|
+
set_attr("event_authority", 10)
|
|
82
|
+
set_attr("program", 11)
|
|
83
|
+
if e.is_buy:
|
|
84
|
+
set_attr("global_volume_accumulator", 12)
|
|
85
|
+
set_attr("user_volume_accumulator", 13)
|
|
86
|
+
set_attr("fee_config", 14)
|
|
87
|
+
set_attr("fee_program", 15)
|
|
88
|
+
set_attr("bonding_curve_v2", 16)
|
|
89
|
+
set_attr("buyback_fee_recipient", 17)
|
|
90
|
+
a17 = get(17)
|
|
91
|
+
if not _empty(a17) and _empty(e.extra_instruction_account):
|
|
92
|
+
e.extra_instruction_account = a17
|
|
93
|
+
return
|
|
94
|
+
set_attr("fee_config", 12)
|
|
95
|
+
set_attr("fee_program", 13)
|
|
47
96
|
a16 = get(16)
|
|
48
97
|
if not _empty(a16):
|
|
49
|
-
|
|
98
|
+
set_attr("user_volume_accumulator", 14)
|
|
99
|
+
set_attr("bonding_curve_v2", 15)
|
|
100
|
+
set_attr("buyback_fee_recipient", 16)
|
|
101
|
+
if _empty(e.extra_instruction_account):
|
|
102
|
+
e.extra_instruction_account = a16
|
|
103
|
+
return
|
|
104
|
+
if e.is_cashback_coin:
|
|
105
|
+
set_attr("user_volume_accumulator", 14)
|
|
106
|
+
set_attr("bonding_curve_v2", 15)
|
|
107
|
+
return
|
|
108
|
+
set_attr("bonding_curve_v2", 14)
|
|
109
|
+
set_attr("buyback_fee_recipient", 15)
|
|
110
|
+
a15 = get(15)
|
|
111
|
+
if not _empty(a15) and _empty(e.extra_instruction_account):
|
|
112
|
+
e.extra_instruction_account = a15
|
|
50
113
|
|
|
51
114
|
|
|
52
115
|
def fill_create_accounts(e: PumpFunCreateEvent, get: AccountGetter) -> None:
|
|
@@ -58,10 +58,50 @@ def _fill_trade_common(
|
|
|
58
58
|
|
|
59
59
|
def fill_buy_accounts(e: PumpSwapBuyEvent, get: AccountGetter) -> None:
|
|
60
60
|
_fill_trade_common(e, get)
|
|
61
|
+
a26 = get(26)
|
|
62
|
+
if not _empty(a26):
|
|
63
|
+
if _empty(e.pool_v2):
|
|
64
|
+
e.pool_v2 = get(24)
|
|
65
|
+
if _empty(e.fee_recipient):
|
|
66
|
+
e.fee_recipient = get(25)
|
|
67
|
+
if _empty(e.fee_recipient_quote_token_account):
|
|
68
|
+
e.fee_recipient_quote_token_account = a26
|
|
69
|
+
return
|
|
70
|
+
a25 = get(25)
|
|
71
|
+
if not _empty(a25):
|
|
72
|
+
if _empty(e.pool_v2):
|
|
73
|
+
e.pool_v2 = get(23)
|
|
74
|
+
if _empty(e.fee_recipient):
|
|
75
|
+
e.fee_recipient = get(24)
|
|
76
|
+
if _empty(e.fee_recipient_quote_token_account):
|
|
77
|
+
e.fee_recipient_quote_token_account = a25
|
|
78
|
+
return
|
|
79
|
+
if _empty(e.pool_v2):
|
|
80
|
+
e.pool_v2 = get(23)
|
|
61
81
|
|
|
62
82
|
|
|
63
83
|
def fill_sell_accounts(e: PumpSwapSellEvent, get: AccountGetter) -> None:
|
|
64
84
|
_fill_trade_common(e, get)
|
|
85
|
+
a25 = get(25)
|
|
86
|
+
if not _empty(a25):
|
|
87
|
+
if _empty(e.pool_v2):
|
|
88
|
+
e.pool_v2 = get(23)
|
|
89
|
+
if _empty(e.fee_recipient):
|
|
90
|
+
e.fee_recipient = get(24)
|
|
91
|
+
if _empty(e.fee_recipient_quote_token_account):
|
|
92
|
+
e.fee_recipient_quote_token_account = a25
|
|
93
|
+
return
|
|
94
|
+
a23 = get(23)
|
|
95
|
+
if not _empty(a23):
|
|
96
|
+
if _empty(e.pool_v2):
|
|
97
|
+
e.pool_v2 = get(21)
|
|
98
|
+
if _empty(e.fee_recipient):
|
|
99
|
+
e.fee_recipient = get(22)
|
|
100
|
+
if _empty(e.fee_recipient_quote_token_account):
|
|
101
|
+
e.fee_recipient_quote_token_account = a23
|
|
102
|
+
return
|
|
103
|
+
if _empty(e.pool_v2):
|
|
104
|
+
e.pool_v2 = get(21)
|
|
65
105
|
|
|
66
106
|
|
|
67
107
|
def fill_trade_accounts(_e: Any, _get: AccountGetter) -> None:
|
|
@@ -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)
|