sol-parser-sdk-python 0.4.4__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.
Files changed (54) hide show
  1. sol_parser/__init__.py +400 -0
  2. sol_parser/account_dispatcher.py +209 -0
  3. sol_parser/account_fillers/__init__.py +5 -0
  4. sol_parser/account_fillers/bonk.py +30 -0
  5. sol_parser/account_fillers/meteora.py +51 -0
  6. sol_parser/account_fillers/orca.py +40 -0
  7. sol_parser/account_fillers/pumpfun.py +97 -0
  8. sol_parser/account_fillers/pumpswap.py +93 -0
  9. sol_parser/account_fillers/raydium.py +119 -0
  10. sol_parser/accounts/__init__.py +461 -0
  11. sol_parser/accounts/rpc_wallet.py +64 -0
  12. sol_parser/accounts/utils.py +71 -0
  13. sol_parser/check_migration.py +18 -0
  14. sol_parser/clock.py +10 -0
  15. sol_parser/common/__init__.py +27 -0
  16. sol_parser/dex_parsers.py +2576 -0
  17. sol_parser/entries_decode.py +186 -0
  18. sol_parser/env_config.py +215 -0
  19. sol_parser/event_types.py +1750 -0
  20. sol_parser/geyser_pb2.py +148 -0
  21. sol_parser/geyser_pb2_grpc.py +398 -0
  22. sol_parser/grpc/__init__.py +61 -0
  23. sol_parser/grpc/geyser_connect.py +42 -0
  24. sol_parser/grpc/subscribe_builder.py +133 -0
  25. sol_parser/grpc/transaction_meta.py +183 -0
  26. sol_parser/grpc_client.py +870 -0
  27. sol_parser/grpc_instruction_parser.py +318 -0
  28. sol_parser/grpc_types.py +919 -0
  29. sol_parser/inner_instruction_parser.py +281 -0
  30. sol_parser/instr/__init__.py +15 -0
  31. sol_parser/instr_account_utils.py +58 -0
  32. sol_parser/instructions.py +1026 -0
  33. sol_parser/json_util.py +41 -0
  34. sol_parser/log_instr_dedup.py +284 -0
  35. sol_parser/logs/__init__.py +15 -0
  36. sol_parser/merger.py +233 -0
  37. sol_parser/order_buffer.py +171 -0
  38. sol_parser/parser.py +300 -0
  39. sol_parser/pumpfun_fee_enrich.py +75 -0
  40. sol_parser/rpc_parser.py +655 -0
  41. sol_parser/rust_api_inventory.py +42 -0
  42. sol_parser/rust_event_json.py +50 -0
  43. sol_parser/shredstream_client.py +191 -0
  44. sol_parser/shredstream_pb2.py +40 -0
  45. sol_parser/shredstream_pb2_grpc.py +81 -0
  46. sol_parser/shredstream_pumpfun.py +296 -0
  47. sol_parser/solana_storage_pb2.py +75 -0
  48. sol_parser/solana_storage_pb2_grpc.py +24 -0
  49. sol_parser/u128_parity.py +115 -0
  50. sol_parser/verify_discriminators.py +85 -0
  51. sol_parser_sdk_python-0.4.4.dist-info/METADATA +14 -0
  52. sol_parser_sdk_python-0.4.4.dist-info/RECORD +54 -0
  53. sol_parser_sdk_python-0.4.4.dist-info/WHEEL +4 -0
  54. sol_parser_sdk_python-0.4.4.dist-info/entry_points.txt +4 -0
@@ -0,0 +1,40 @@
1
+ """Orca Whirlpool 账户填充(对齐 ``account_fillers/orca.rs``)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Callable
6
+
7
+ from ..event_types import (
8
+ OrcaWhirlpoolLiquidityDecreasedEvent,
9
+ OrcaWhirlpoolLiquidityIncreasedEvent,
10
+ OrcaWhirlpoolSwapEvent,
11
+ )
12
+
13
+ Z = "11111111111111111111111111111111"
14
+
15
+
16
+ def _empty(s: str) -> bool:
17
+ return not s or s == Z
18
+
19
+
20
+ AccountGetter = Callable[[int], str]
21
+
22
+
23
+ def fill_whirlpool_swap_accounts(_e: OrcaWhirlpoolSwapEvent, _get: AccountGetter) -> None:
24
+ pass
25
+
26
+
27
+ def fill_whirlpool_liquidity_increased_accounts(
28
+ e: OrcaWhirlpoolLiquidityIncreasedEvent,
29
+ get: AccountGetter,
30
+ ) -> None:
31
+ if _empty(e.position):
32
+ e.position = get(3)
33
+
34
+
35
+ def fill_whirlpool_liquidity_decreased_accounts(
36
+ e: OrcaWhirlpoolLiquidityDecreasedEvent,
37
+ get: AccountGetter,
38
+ ) -> None:
39
+ if _empty(e.position):
40
+ e.position = get(3)
@@ -0,0 +1,97 @@
1
+ """PumpFun 账户填充(对齐 ``account_fillers/pumpfun.rs``)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Callable
6
+
7
+ from ..event_types import (
8
+ PumpFunCreateEvent,
9
+ PumpFunCreateV2TokenEvent,
10
+ PumpFunMigrateEvent,
11
+ PumpFunTradeEvent,
12
+ )
13
+
14
+ Z = "11111111111111111111111111111111"
15
+
16
+
17
+ def _empty(s: str) -> bool:
18
+ return not s or s == Z
19
+
20
+
21
+ AccountGetter = Callable[[int], str]
22
+
23
+
24
+ def fill_trade_accounts(e: PumpFunTradeEvent, get: AccountGetter) -> None:
25
+ if e.ix_name in ("buy_v2", "sell_v2", "buy_exact_quote_in_v2"):
26
+ if _empty(e.user):
27
+ e.user = get(13)
28
+ if _empty(e.bonding_curve):
29
+ e.bonding_curve = get(10)
30
+ if _empty(e.associated_bonding_curve):
31
+ e.associated_bonding_curve = get(11)
32
+ if _empty(e.creator_vault):
33
+ e.creator_vault = get(16)
34
+ if _empty(e.token_program):
35
+ e.token_program = get(3)
36
+ return
37
+ if _empty(e.user):
38
+ e.user = get(6)
39
+ if _empty(e.bonding_curve):
40
+ e.bonding_curve = get(3)
41
+ if _empty(e.associated_bonding_curve):
42
+ e.associated_bonding_curve = get(4)
43
+ if _empty(e.creator_vault):
44
+ e.creator_vault = get(9) if e.is_buy else get(8)
45
+ if _empty(e.token_program):
46
+ e.token_program = get(8) if e.is_buy else get(9)
47
+ a16 = get(16)
48
+ if not _empty(a16):
49
+ e.extra_instruction_account = a16
50
+
51
+
52
+ def fill_create_accounts(e: PumpFunCreateEvent, get: AccountGetter) -> None:
53
+ if _empty(e.mint):
54
+ e.mint = get(0)
55
+ if _empty(e.bonding_curve):
56
+ e.bonding_curve = get(2)
57
+ if _empty(e.user):
58
+ e.user = get(7)
59
+
60
+
61
+ def fill_create_v2_accounts(e: PumpFunCreateV2TokenEvent, get: AccountGetter) -> None:
62
+ if _empty(e.mint):
63
+ e.mint = get(0)
64
+ if _empty(e.bonding_curve):
65
+ e.bonding_curve = get(2)
66
+ if _empty(e.user):
67
+ e.user = get(5)
68
+ if _empty(e.mint_authority):
69
+ e.mint_authority = get(1)
70
+ if _empty(e.associated_bonding_curve):
71
+ e.associated_bonding_curve = get(3)
72
+ if _empty(e.global_account):
73
+ e.global_account = get(4)
74
+ if _empty(e.system_program):
75
+ e.system_program = get(6)
76
+ if _empty(e.token_program):
77
+ e.token_program = get(7)
78
+ if _empty(e.associated_token_program):
79
+ e.associated_token_program = get(8)
80
+ if _empty(e.mayhem_program_id):
81
+ e.mayhem_program_id = get(9)
82
+ if _empty(e.global_params):
83
+ e.global_params = get(10)
84
+ if _empty(e.sol_vault):
85
+ e.sol_vault = get(11)
86
+ if _empty(e.mayhem_state):
87
+ e.mayhem_state = get(12)
88
+ if _empty(e.mayhem_token_vault):
89
+ e.mayhem_token_vault = get(13)
90
+ if _empty(e.event_authority):
91
+ e.event_authority = get(14)
92
+ if _empty(e.program):
93
+ e.program = get(15)
94
+
95
+
96
+ def fill_migrate_accounts(_e: PumpFunMigrateEvent, _get: AccountGetter) -> None:
97
+ pass
@@ -0,0 +1,93 @@
1
+ """PumpSwap 账户填充(对齐 ``account_fillers/pumpswap.rs`` 子集,字段与 Python dataclass 一致)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Any, Callable
6
+
7
+ from ..event_types import (
8
+ PumpSwapBuyEvent,
9
+ PumpSwapCreatePoolEvent,
10
+ PumpSwapLiquidityAddedEvent,
11
+ PumpSwapLiquidityRemovedEvent,
12
+ PumpSwapSellEvent,
13
+ )
14
+
15
+ Z = "11111111111111111111111111111111"
16
+
17
+
18
+ def _empty(s: str) -> bool:
19
+ return not s or s == Z
20
+
21
+
22
+ AccountGetter = Callable[[int], str]
23
+
24
+
25
+ def _fill_trade_common(
26
+ e: PumpSwapBuyEvent | PumpSwapSellEvent,
27
+ get: AccountGetter,
28
+ ) -> None:
29
+ if _empty(e.pool):
30
+ e.pool = get(0)
31
+ if _empty(e.user):
32
+ e.user = get(1)
33
+ if _empty(e.base_mint):
34
+ e.base_mint = get(3)
35
+ if _empty(e.quote_mint):
36
+ e.quote_mint = get(4)
37
+ if _empty(e.user_base_token_account):
38
+ e.user_base_token_account = get(5)
39
+ if _empty(e.user_quote_token_account):
40
+ e.user_quote_token_account = get(6)
41
+ if _empty(e.pool_base_token_account):
42
+ e.pool_base_token_account = get(7)
43
+ if _empty(e.pool_quote_token_account):
44
+ e.pool_quote_token_account = get(8)
45
+ if _empty(e.protocol_fee_recipient):
46
+ e.protocol_fee_recipient = get(9)
47
+ if _empty(e.protocol_fee_recipient_token_account):
48
+ e.protocol_fee_recipient_token_account = get(10)
49
+ if _empty(e.base_token_program):
50
+ e.base_token_program = get(11)
51
+ if _empty(e.quote_token_program):
52
+ e.quote_token_program = get(12)
53
+ if _empty(e.coin_creator_vault_ata):
54
+ e.coin_creator_vault_ata = get(17)
55
+ if _empty(e.coin_creator_vault_authority):
56
+ e.coin_creator_vault_authority = get(18)
57
+
58
+
59
+ def fill_buy_accounts(e: PumpSwapBuyEvent, get: AccountGetter) -> None:
60
+ _fill_trade_common(e, get)
61
+
62
+
63
+ def fill_sell_accounts(e: PumpSwapSellEvent, get: AccountGetter) -> None:
64
+ _fill_trade_common(e, get)
65
+
66
+
67
+ def fill_trade_accounts(_e: Any, _get: AccountGetter) -> None:
68
+ pass
69
+
70
+
71
+ def fill_create_pool_accounts(e: PumpSwapCreatePoolEvent, get: AccountGetter) -> None:
72
+ if _empty(e.pool):
73
+ e.pool = get(0)
74
+ if _empty(e.creator):
75
+ e.creator = get(2)
76
+ if _empty(e.base_mint):
77
+ e.base_mint = get(3)
78
+ if _empty(e.quote_mint):
79
+ e.quote_mint = get(4)
80
+ if _empty(e.lp_mint):
81
+ e.lp_mint = get(5)
82
+ if _empty(e.user_base_token_account):
83
+ e.user_base_token_account = get(6)
84
+ if _empty(e.user_quote_token_account):
85
+ e.user_quote_token_account = get(7)
86
+
87
+
88
+ def fill_liquidity_added_accounts(_e: PumpSwapLiquidityAddedEvent, _get: AccountGetter) -> None:
89
+ pass
90
+
91
+
92
+ def fill_liquidity_removed_accounts(_e: PumpSwapLiquidityRemovedEvent, _get: AccountGetter) -> None:
93
+ pass
@@ -0,0 +1,119 @@
1
+ """Raydium 账户填充(对齐 ``account_fillers/raydium.rs``)。"""
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Callable
6
+
7
+ from ..event_types import (
8
+ RaydiumAmmV4DepositEvent,
9
+ RaydiumAmmV4SwapEvent,
10
+ RaydiumAmmV4WithdrawEvent,
11
+ RaydiumClmmCreatePoolEvent,
12
+ RaydiumClmmDecreaseLiquidityEvent,
13
+ RaydiumClmmIncreaseLiquidityEvent,
14
+ RaydiumClmmClosePositionEvent,
15
+ RaydiumClmmOpenPositionEvent,
16
+ RaydiumClmmOpenPositionWithTokenExtNftEvent,
17
+ RaydiumClmmSwapEvent,
18
+ RaydiumCpmmDepositEvent,
19
+ RaydiumCpmmInitializeEvent,
20
+ RaydiumCpmmSwapEvent,
21
+ RaydiumCpmmWithdrawEvent,
22
+ )
23
+
24
+ Z = "11111111111111111111111111111111"
25
+
26
+
27
+ def _empty(s: str) -> bool:
28
+ return not s or s == Z
29
+
30
+
31
+ AccountGetter = Callable[[int], str]
32
+
33
+
34
+ def fill_clmm_swap_accounts(e: RaydiumClmmSwapEvent, get: AccountGetter) -> None:
35
+ if _empty(e.pool_state):
36
+ e.pool_state = get(2)
37
+ if _empty(e.sender):
38
+ e.sender = get(0)
39
+
40
+
41
+ def fill_clmm_create_pool_accounts(e: RaydiumClmmCreatePoolEvent, get: AccountGetter) -> None:
42
+ if _empty(e.creator):
43
+ e.creator = get(0)
44
+
45
+
46
+ def fill_clmm_increase_liquidity_accounts(e: RaydiumClmmIncreaseLiquidityEvent, get: AccountGetter) -> None:
47
+ if _empty(e.user):
48
+ e.user = get(0)
49
+
50
+
51
+ def fill_clmm_decrease_liquidity_accounts(e: RaydiumClmmDecreaseLiquidityEvent, get: AccountGetter) -> None:
52
+ if _empty(e.user):
53
+ e.user = get(0)
54
+
55
+
56
+ def fill_clmm_open_position_accounts(e: RaydiumClmmOpenPositionEvent, get: AccountGetter) -> None:
57
+ if _empty(e.user):
58
+ e.user = get(0)
59
+ if _empty(e.position_nft_mint):
60
+ e.position_nft_mint = get(2)
61
+
62
+
63
+ def fill_clmm_open_position_with_token_ext_nft_accounts(
64
+ e: RaydiumClmmOpenPositionWithTokenExtNftEvent,
65
+ get: AccountGetter,
66
+ ) -> None:
67
+ if _empty(e.user):
68
+ e.user = get(0)
69
+ if _empty(e.position_nft_mint):
70
+ e.position_nft_mint = get(2)
71
+
72
+
73
+ def fill_clmm_close_position_accounts(e: RaydiumClmmClosePositionEvent, get: AccountGetter) -> None:
74
+ if _empty(e.user):
75
+ e.user = get(0)
76
+ if _empty(e.position_nft_mint):
77
+ e.position_nft_mint = get(1)
78
+
79
+
80
+ def fill_cpmm_swap_accounts(_e: RaydiumCpmmSwapEvent, _get: AccountGetter) -> None:
81
+ pass
82
+
83
+
84
+ def fill_cpmm_deposit_accounts(e: RaydiumCpmmDepositEvent, get: AccountGetter) -> None:
85
+ if _empty(e.user):
86
+ e.user = get(0)
87
+
88
+
89
+ def fill_cpmm_withdraw_accounts(e: RaydiumCpmmWithdrawEvent, get: AccountGetter) -> None:
90
+ if _empty(e.user):
91
+ e.user = get(0)
92
+
93
+
94
+ def fill_cpmm_initialize_accounts(e: RaydiumCpmmInitializeEvent, get: AccountGetter) -> None:
95
+ if _empty(e.creator):
96
+ e.creator = get(0)
97
+ if _empty(e.pool):
98
+ e.pool = get(3)
99
+
100
+
101
+ def fill_amm_v4_swap_accounts(e: RaydiumAmmV4SwapEvent, get: AccountGetter) -> None:
102
+ if _empty(e.amm):
103
+ e.amm = get(1)
104
+
105
+
106
+ def fill_amm_v4_deposit_accounts(e: RaydiumAmmV4DepositEvent, get: AccountGetter) -> None:
107
+ if _empty(e.token_program):
108
+ e.token_program = get(0)
109
+ if _empty(e.amm_authority):
110
+ e.amm_authority = get(2)
111
+
112
+
113
+ def fill_amm_v4_withdraw_accounts(e: RaydiumAmmV4WithdrawEvent, get: AccountGetter) -> None:
114
+ if _empty(e.token_program):
115
+ e.token_program = get(0)
116
+ if _empty(e.amm_authority):
117
+ e.amm_authority = get(2)
118
+ if _empty(e.amm_open_orders):
119
+ e.amm_open_orders = get(3)