sol-parser-sdk-python 0.5.6__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 +18 -0
- sol_parser/account_dispatcher.py +2 -0
- sol_parser/account_fillers/meteora.py +15 -0
- sol_parser/account_fillers/pumpfun.py +11 -0
- sol_parser/check_migration.py +3 -0
- sol_parser/dex_parsers.py +881 -64
- sol_parser/event_type_parity.py +129 -0
- sol_parser/event_types.py +252 -0
- sol_parser/grpc_client.py +3 -4
- sol_parser/grpc_instruction_parser.py +14 -3
- sol_parser/grpc_types.py +49 -21
- sol_parser/inner_instruction_parser.py +138 -12
- sol_parser/instructions.py +293 -57
- sol_parser/log_instr_dedup.py +34 -4
- sol_parser/merger.py +115 -41
- sol_parser/parser.py +26 -6
- sol_parser/pumpfun_fee_enrich.py +12 -1
- sol_parser/rpc_parser.py +56 -11
- {sol_parser_sdk_python-0.5.6.dist-info → sol_parser_sdk_python-0.5.7.dist-info}/METADATA +2 -2
- {sol_parser_sdk_python-0.5.6.dist-info → sol_parser_sdk_python-0.5.7.dist-info}/RECORD +22 -21
- {sol_parser_sdk_python-0.5.6.dist-info → sol_parser_sdk_python-0.5.7.dist-info}/WHEEL +1 -1
- {sol_parser_sdk_python-0.5.6.dist-info → sol_parser_sdk_python-0.5.7.dist-info}/entry_points.txt +0 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"""EventType inventory parity with Rust ``sol_parser_sdk::grpc::EventType``."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from .grpc_types import all_event_types
|
|
6
|
+
|
|
7
|
+
RUST_EVENT_TYPES = [
|
|
8
|
+
"BlockMeta",
|
|
9
|
+
"RaydiumLaunchlabTrade",
|
|
10
|
+
"RaydiumLaunchlabPoolCreate",
|
|
11
|
+
"RaydiumLaunchlabMigrateAmm",
|
|
12
|
+
"PumpFunTrade",
|
|
13
|
+
"PumpFunBuy",
|
|
14
|
+
"PumpFunSell",
|
|
15
|
+
"PumpFunBuyExactSolIn",
|
|
16
|
+
"PumpFunCreate",
|
|
17
|
+
"PumpFunCreateV2",
|
|
18
|
+
"PumpFunComplete",
|
|
19
|
+
"PumpFunMigrate",
|
|
20
|
+
"PumpFeesCreateFeeSharingConfig",
|
|
21
|
+
"PumpFeesInitializeFeeConfig",
|
|
22
|
+
"PumpFeesResetFeeSharingConfig",
|
|
23
|
+
"PumpFeesRevokeFeeSharingAuthority",
|
|
24
|
+
"PumpFeesTransferFeeSharingAuthority",
|
|
25
|
+
"PumpFeesUpdateAdmin",
|
|
26
|
+
"PumpFeesUpdateFeeConfig",
|
|
27
|
+
"PumpFeesUpdateFeeShares",
|
|
28
|
+
"PumpFeesUpsertFeeTiers",
|
|
29
|
+
"PumpFunMigrateBondingCurveCreator",
|
|
30
|
+
"PumpSwapTrade",
|
|
31
|
+
"PumpSwapBuy",
|
|
32
|
+
"PumpSwapSell",
|
|
33
|
+
"PumpSwapCreatePool",
|
|
34
|
+
"PumpSwapLiquidityAdded",
|
|
35
|
+
"PumpSwapLiquidityRemoved",
|
|
36
|
+
"RaydiumCpmmSwap",
|
|
37
|
+
"RaydiumCpmmDeposit",
|
|
38
|
+
"RaydiumCpmmWithdraw",
|
|
39
|
+
"RaydiumCpmmInitialize",
|
|
40
|
+
"RaydiumClmmSwap",
|
|
41
|
+
"RaydiumClmmCreatePool",
|
|
42
|
+
"RaydiumClmmOpenPosition",
|
|
43
|
+
"RaydiumClmmClosePosition",
|
|
44
|
+
"RaydiumClmmIncreaseLiquidity",
|
|
45
|
+
"RaydiumClmmDecreaseLiquidity",
|
|
46
|
+
"RaydiumClmmLiquidityChange",
|
|
47
|
+
"RaydiumClmmConfigChange",
|
|
48
|
+
"RaydiumClmmCreatePersonalPosition",
|
|
49
|
+
"RaydiumClmmLiquidityCalculate",
|
|
50
|
+
"RaydiumClmmOpenLimitOrder",
|
|
51
|
+
"RaydiumClmmIncreaseLimitOrder",
|
|
52
|
+
"RaydiumClmmDecreaseLimitOrder",
|
|
53
|
+
"RaydiumClmmSettleLimitOrder",
|
|
54
|
+
"RaydiumClmmUpdateRewardInfos",
|
|
55
|
+
"RaydiumClmmOpenPositionWithTokenExtNft",
|
|
56
|
+
"RaydiumClmmCollectFee",
|
|
57
|
+
"RaydiumAmmV4Swap",
|
|
58
|
+
"RaydiumAmmV4Deposit",
|
|
59
|
+
"RaydiumAmmV4Withdraw",
|
|
60
|
+
"RaydiumAmmV4Initialize2",
|
|
61
|
+
"RaydiumAmmV4WithdrawPnl",
|
|
62
|
+
"OrcaWhirlpoolSwap",
|
|
63
|
+
"OrcaWhirlpoolLiquidityIncreased",
|
|
64
|
+
"OrcaWhirlpoolLiquidityDecreased",
|
|
65
|
+
"OrcaWhirlpoolPoolInitialized",
|
|
66
|
+
"MeteoraPoolsSwap",
|
|
67
|
+
"MeteoraPoolsAddLiquidity",
|
|
68
|
+
"MeteoraPoolsRemoveLiquidity",
|
|
69
|
+
"MeteoraPoolsBootstrapLiquidity",
|
|
70
|
+
"MeteoraPoolsPoolCreated",
|
|
71
|
+
"MeteoraPoolsSetPoolFees",
|
|
72
|
+
"MeteoraDammV2Swap",
|
|
73
|
+
"MeteoraDammV2AddLiquidity",
|
|
74
|
+
"MeteoraDammV2RemoveLiquidity",
|
|
75
|
+
"MeteoraDammV2InitializePool",
|
|
76
|
+
"MeteoraDammV2CreatePosition",
|
|
77
|
+
"MeteoraDammV2ClosePosition",
|
|
78
|
+
"MeteoraDbcSwap",
|
|
79
|
+
"MeteoraDbcInitializePool",
|
|
80
|
+
"MeteoraDbcCurveComplete",
|
|
81
|
+
"MeteoraDlmmSwap",
|
|
82
|
+
"MeteoraDlmmAddLiquidity",
|
|
83
|
+
"MeteoraDlmmRemoveLiquidity",
|
|
84
|
+
"MeteoraDlmmInitializePool",
|
|
85
|
+
"MeteoraDlmmInitializeBinArray",
|
|
86
|
+
"MeteoraDlmmCreatePosition",
|
|
87
|
+
"MeteoraDlmmClosePosition",
|
|
88
|
+
"MeteoraDlmmClaimFee",
|
|
89
|
+
"TokenAccount",
|
|
90
|
+
"TokenInfo",
|
|
91
|
+
"NonceAccount",
|
|
92
|
+
"AccountPumpFunGlobal",
|
|
93
|
+
"AccountPumpFunBondingCurve",
|
|
94
|
+
"AccountPumpFunFeeConfig",
|
|
95
|
+
"AccountPumpFunSharingConfig",
|
|
96
|
+
"AccountPumpFunGlobalVolumeAccumulator",
|
|
97
|
+
"AccountPumpFunUserVolumeAccumulator",
|
|
98
|
+
"AccountPumpSwapGlobalConfig",
|
|
99
|
+
"AccountPumpSwapPool",
|
|
100
|
+
"AccountRaydiumClmmAmmConfig",
|
|
101
|
+
"AccountRaydiumClmmPoolState",
|
|
102
|
+
"AccountRaydiumClmmTickArrayState",
|
|
103
|
+
"AccountRaydiumCpmmAmmConfig",
|
|
104
|
+
"AccountRaydiumCpmmPoolState",
|
|
105
|
+
"AccountOrcaWhirlpool",
|
|
106
|
+
"AccountOrcaPosition",
|
|
107
|
+
"AccountOrcaTickArray",
|
|
108
|
+
"AccountOrcaFeeTier",
|
|
109
|
+
"AccountOrcaWhirlpoolsConfig",
|
|
110
|
+
]
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
def run_event_type_parity_check() -> int:
|
|
114
|
+
actual = [event_type.value for event_type in all_event_types()]
|
|
115
|
+
if actual == RUST_EVENT_TYPES:
|
|
116
|
+
print(f"[event-type-parity] OK:EventType 与 Rust 清单一致(共 {len(actual)} 个)")
|
|
117
|
+
return 0
|
|
118
|
+
only_expected = [x for x in RUST_EVENT_TYPES if x not in actual]
|
|
119
|
+
only_actual = [x for x in actual if x not in RUST_EVENT_TYPES]
|
|
120
|
+
print("[event-type-parity] EventType 与 Rust 清单不一致")
|
|
121
|
+
if only_expected:
|
|
122
|
+
print(" Python 缺:", ", ".join(only_expected))
|
|
123
|
+
if only_actual:
|
|
124
|
+
print(" Python 多:", ", ".join(only_actual))
|
|
125
|
+
return 1
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
if __name__ == "__main__":
|
|
129
|
+
raise SystemExit(run_event_type_parity_check())
|
sol_parser/event_types.py
CHANGED
|
@@ -207,6 +207,8 @@ class PumpFunCreateEvent(DexEventBase):
|
|
|
207
207
|
is_mayhem_mode: bool = False
|
|
208
208
|
is_cashback_enabled: bool = False
|
|
209
209
|
quote_mint: str = ""
|
|
210
|
+
quote_vault: str = ""
|
|
211
|
+
quote_token_program: str = ""
|
|
210
212
|
virtual_quote_reserves: int = 0
|
|
211
213
|
|
|
212
214
|
|
|
@@ -233,6 +235,8 @@ class PumpFunCreateV2TokenEvent(DexEventBase):
|
|
|
233
235
|
is_mayhem_mode: bool = False
|
|
234
236
|
is_cashback_enabled: bool = False
|
|
235
237
|
quote_mint: str = ""
|
|
238
|
+
quote_vault: str = ""
|
|
239
|
+
quote_token_program: str = ""
|
|
236
240
|
virtual_quote_reserves: int = 0
|
|
237
241
|
mint_authority: str = ""
|
|
238
242
|
associated_bonding_curve: str = ""
|
|
@@ -698,6 +702,10 @@ class RaydiumClmmIncreaseLiquidityEvent(DexEventBase):
|
|
|
698
702
|
position_nft_mint: str = ""
|
|
699
703
|
user: str = ""
|
|
700
704
|
liquidity: str = ""
|
|
705
|
+
amount_0: int = 0
|
|
706
|
+
amount_1: int = 0
|
|
707
|
+
amount_0_transfer_fee: int = 0
|
|
708
|
+
amount_1_transfer_fee: int = 0
|
|
701
709
|
amount0_max: int = 0
|
|
702
710
|
amount1_max: int = 0
|
|
703
711
|
|
|
@@ -709,6 +717,13 @@ class RaydiumClmmDecreaseLiquidityEvent(DexEventBase):
|
|
|
709
717
|
position_nft_mint: str = ""
|
|
710
718
|
user: str = ""
|
|
711
719
|
liquidity: str = ""
|
|
720
|
+
decrease_amount_0: int = 0
|
|
721
|
+
decrease_amount_1: int = 0
|
|
722
|
+
fee_amount_0: int = 0
|
|
723
|
+
fee_amount_1: int = 0
|
|
724
|
+
reward_amounts: List[int] = field(default_factory=list)
|
|
725
|
+
transfer_fee_0: int = 0
|
|
726
|
+
transfer_fee_1: int = 0
|
|
712
727
|
amount0_min: int = 0
|
|
713
728
|
amount1_min: int = 0
|
|
714
729
|
|
|
@@ -753,6 +768,9 @@ class RaydiumClmmCreatePoolEvent(DexEventBase):
|
|
|
753
768
|
tick_spacing: int = 0
|
|
754
769
|
fee_rate: int = 0
|
|
755
770
|
sqrt_price_x64: str = ""
|
|
771
|
+
tick: int = 0
|
|
772
|
+
token_vault_0: str = ""
|
|
773
|
+
token_vault_1: str = ""
|
|
756
774
|
open_time: int = 0
|
|
757
775
|
|
|
758
776
|
|
|
@@ -761,10 +779,109 @@ class RaydiumClmmCollectFeeEvent(DexEventBase):
|
|
|
761
779
|
"""Raydium CLMM 收取费用事件"""
|
|
762
780
|
pool_state: str = ""
|
|
763
781
|
position_nft_mint: str = ""
|
|
782
|
+
recipient_token_account_0: str = ""
|
|
783
|
+
recipient_token_account_1: str = ""
|
|
764
784
|
amount_0: int = 0
|
|
765
785
|
amount_1: int = 0
|
|
766
786
|
|
|
767
787
|
|
|
788
|
+
@dataclass
|
|
789
|
+
class RaydiumClmmLiquidityChangeEvent(DexEventBase):
|
|
790
|
+
pool_state: str = ""
|
|
791
|
+
tick: int = 0
|
|
792
|
+
tick_lower: int = 0
|
|
793
|
+
tick_upper: int = 0
|
|
794
|
+
liquidity_before: str = ""
|
|
795
|
+
liquidity_after: str = ""
|
|
796
|
+
|
|
797
|
+
|
|
798
|
+
@dataclass
|
|
799
|
+
class RaydiumClmmConfigChangeEvent(DexEventBase):
|
|
800
|
+
index: int = 0
|
|
801
|
+
owner: str = ""
|
|
802
|
+
protocol_fee_rate: int = 0
|
|
803
|
+
trade_fee_rate: int = 0
|
|
804
|
+
tick_spacing: int = 0
|
|
805
|
+
fund_fee_rate: int = 0
|
|
806
|
+
fund_owner: str = ""
|
|
807
|
+
|
|
808
|
+
|
|
809
|
+
@dataclass
|
|
810
|
+
class RaydiumClmmCreatePersonalPositionEvent(DexEventBase):
|
|
811
|
+
pool_state: str = ""
|
|
812
|
+
minter: str = ""
|
|
813
|
+
nft_owner: str = ""
|
|
814
|
+
tick_lower_index: int = 0
|
|
815
|
+
tick_upper_index: int = 0
|
|
816
|
+
liquidity: str = ""
|
|
817
|
+
deposit_amount_0: int = 0
|
|
818
|
+
deposit_amount_1: int = 0
|
|
819
|
+
deposit_amount_0_transfer_fee: int = 0
|
|
820
|
+
deposit_amount_1_transfer_fee: int = 0
|
|
821
|
+
|
|
822
|
+
|
|
823
|
+
@dataclass
|
|
824
|
+
class RaydiumClmmLiquidityCalculateEvent(DexEventBase):
|
|
825
|
+
pool_liquidity: str = ""
|
|
826
|
+
pool_sqrt_price_x64: str = ""
|
|
827
|
+
pool_tick: int = 0
|
|
828
|
+
calc_amount_0: int = 0
|
|
829
|
+
calc_amount_1: int = 0
|
|
830
|
+
trade_fee_owed_0: int = 0
|
|
831
|
+
trade_fee_owed_1: int = 0
|
|
832
|
+
transfer_fee_0: int = 0
|
|
833
|
+
transfer_fee_1: int = 0
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
@dataclass
|
|
837
|
+
class RaydiumClmmOpenLimitOrderEvent(DexEventBase):
|
|
838
|
+
pool_id: str = ""
|
|
839
|
+
limit_order: str = ""
|
|
840
|
+
zero_for_one: bool = False
|
|
841
|
+
tick_index: int = 0
|
|
842
|
+
total_amount: int = 0
|
|
843
|
+
transfer_fee: int = 0
|
|
844
|
+
|
|
845
|
+
|
|
846
|
+
@dataclass
|
|
847
|
+
class RaydiumClmmIncreaseLimitOrderEvent(DexEventBase):
|
|
848
|
+
pool_id: str = ""
|
|
849
|
+
limit_order: str = ""
|
|
850
|
+
zero_for_one: bool = False
|
|
851
|
+
tick_index: int = 0
|
|
852
|
+
total_amount: int = 0
|
|
853
|
+
increased_amount: int = 0
|
|
854
|
+
transfer_fee: int = 0
|
|
855
|
+
|
|
856
|
+
|
|
857
|
+
@dataclass
|
|
858
|
+
class RaydiumClmmDecreaseLimitOrderEvent(DexEventBase):
|
|
859
|
+
pool_id: str = ""
|
|
860
|
+
limit_order: str = ""
|
|
861
|
+
zero_for_one: bool = False
|
|
862
|
+
tick_index: int = 0
|
|
863
|
+
total_amount: int = 0
|
|
864
|
+
filled_amount: int = 0
|
|
865
|
+
settled_output_amount: int = 0
|
|
866
|
+
decreased_amount: int = 0
|
|
867
|
+
|
|
868
|
+
|
|
869
|
+
@dataclass
|
|
870
|
+
class RaydiumClmmSettleLimitOrderEvent(DexEventBase):
|
|
871
|
+
pool_id: str = ""
|
|
872
|
+
limit_order: str = ""
|
|
873
|
+
zero_for_one: bool = False
|
|
874
|
+
tick_index: int = 0
|
|
875
|
+
total_amount: int = 0
|
|
876
|
+
filled_amount: int = 0
|
|
877
|
+
settled_amount_out: int = 0
|
|
878
|
+
|
|
879
|
+
|
|
880
|
+
@dataclass
|
|
881
|
+
class RaydiumClmmUpdateRewardInfosEvent(DexEventBase):
|
|
882
|
+
reward_growth_global_x64: List[str] = field(default_factory=list)
|
|
883
|
+
|
|
884
|
+
|
|
768
885
|
# ============================================================
|
|
769
886
|
# Raydium CPMM 事件
|
|
770
887
|
# ============================================================
|
|
@@ -1096,6 +1213,8 @@ class MeteoraDammV2RemoveLiquidityEvent(DexEventBase):
|
|
|
1096
1213
|
class MeteoraDammV2InitializePoolEvent(DexEventBase):
|
|
1097
1214
|
"""Meteora DAMM v2 初始化池子事件"""
|
|
1098
1215
|
pool: str = ""
|
|
1216
|
+
position: str = ""
|
|
1217
|
+
position_nft_mint: str = ""
|
|
1099
1218
|
token_a_mint: str = ""
|
|
1100
1219
|
token_b_mint: str = ""
|
|
1101
1220
|
creator: str = ""
|
|
@@ -1451,6 +1570,8 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1451
1570
|
is_mayhem_mode=_get_bool(data, "is_mayhem_mode"),
|
|
1452
1571
|
is_cashback_enabled=_get_bool(data, "is_cashback_enabled"),
|
|
1453
1572
|
quote_mint=_get_str(data, "quote_mint"),
|
|
1573
|
+
quote_vault=_get_str(data, "quote_vault"),
|
|
1574
|
+
quote_token_program=_get_str(data, "quote_token_program"),
|
|
1454
1575
|
virtual_quote_reserves=_get_int(data, "virtual_quote_reserves"),
|
|
1455
1576
|
)
|
|
1456
1577
|
|
|
@@ -1474,6 +1595,8 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1474
1595
|
is_mayhem_mode=_get_bool(data, "is_mayhem_mode"),
|
|
1475
1596
|
is_cashback_enabled=_get_bool(data, "is_cashback_enabled"),
|
|
1476
1597
|
quote_mint=_get_str(data, "quote_mint"),
|
|
1598
|
+
quote_vault=_get_str(data, "quote_vault"),
|
|
1599
|
+
quote_token_program=_get_str(data, "quote_token_program"),
|
|
1477
1600
|
virtual_quote_reserves=_get_int(data, "virtual_quote_reserves"),
|
|
1478
1601
|
mint_authority=_get_str(data, "mint_authority"),
|
|
1479
1602
|
associated_bonding_curve=_get_str(data, "associated_bonding_curve"),
|
|
@@ -1702,6 +1825,10 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1702
1825
|
position_nft_mint=_get_str(data, "position_nft_mint"),
|
|
1703
1826
|
user=_get_str(data, "user"),
|
|
1704
1827
|
liquidity=_get_str(data, "liquidity"),
|
|
1828
|
+
amount_0=_get_int(data, "amount_0"),
|
|
1829
|
+
amount_1=_get_int(data, "amount_1"),
|
|
1830
|
+
amount_0_transfer_fee=_get_int(data, "amount_0_transfer_fee"),
|
|
1831
|
+
amount_1_transfer_fee=_get_int(data, "amount_1_transfer_fee"),
|
|
1705
1832
|
amount0_max=_get_int(data, "amount0_max"),
|
|
1706
1833
|
amount1_max=_get_int(data, "amount1_max"),
|
|
1707
1834
|
)
|
|
@@ -1712,6 +1839,13 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1712
1839
|
position_nft_mint=_get_str(data, "position_nft_mint"),
|
|
1713
1840
|
user=_get_str(data, "user"),
|
|
1714
1841
|
liquidity=_get_str(data, "liquidity"),
|
|
1842
|
+
decrease_amount_0=_get_int(data, "decrease_amount_0"),
|
|
1843
|
+
decrease_amount_1=_get_int(data, "decrease_amount_1"),
|
|
1844
|
+
fee_amount_0=_get_int(data, "fee_amount_0"),
|
|
1845
|
+
fee_amount_1=_get_int(data, "fee_amount_1"),
|
|
1846
|
+
reward_amounts=list(data.get("reward_amounts", [])) if isinstance(data, dict) else [],
|
|
1847
|
+
transfer_fee_0=_get_int(data, "transfer_fee_0"),
|
|
1848
|
+
transfer_fee_1=_get_int(data, "transfer_fee_1"),
|
|
1715
1849
|
amount0_min=_get_int(data, "amount0_min"),
|
|
1716
1850
|
amount1_min=_get_int(data, "amount1_min"),
|
|
1717
1851
|
)
|
|
@@ -1725,6 +1859,9 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1725
1859
|
tick_spacing=_get_int(data, "tick_spacing"),
|
|
1726
1860
|
fee_rate=_get_int(data, "fee_rate"),
|
|
1727
1861
|
sqrt_price_x64=_get_str(data, "sqrt_price_x64"),
|
|
1862
|
+
tick=_get_int(data, "tick"),
|
|
1863
|
+
token_vault_0=_get_str(data, "token_vault_0"),
|
|
1864
|
+
token_vault_1=_get_str(data, "token_vault_1"),
|
|
1728
1865
|
open_time=_get_int(data, "open_time"),
|
|
1729
1866
|
)
|
|
1730
1867
|
if event_type == EventType.RAYDIUM_CLMM_OPEN_POSITION:
|
|
@@ -1759,9 +1896,110 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1759
1896
|
metadata=meta,
|
|
1760
1897
|
pool_state=_get_str(data, "pool_state"),
|
|
1761
1898
|
position_nft_mint=_get_str(data, "position_nft_mint"),
|
|
1899
|
+
recipient_token_account_0=_get_str(data, "recipient_token_account_0"),
|
|
1900
|
+
recipient_token_account_1=_get_str(data, "recipient_token_account_1"),
|
|
1762
1901
|
amount_0=_get_int(data, "amount_0"),
|
|
1763
1902
|
amount_1=_get_int(data, "amount_1"),
|
|
1764
1903
|
)
|
|
1904
|
+
if event_type == EventType.RAYDIUM_CLMM_LIQUIDITY_CHANGE:
|
|
1905
|
+
return RaydiumClmmLiquidityChangeEvent(
|
|
1906
|
+
metadata=meta,
|
|
1907
|
+
pool_state=_get_str(data, "pool_state"),
|
|
1908
|
+
tick=_get_int(data, "tick"),
|
|
1909
|
+
tick_lower=_get_int(data, "tick_lower"),
|
|
1910
|
+
tick_upper=_get_int(data, "tick_upper"),
|
|
1911
|
+
liquidity_before=_get_str(data, "liquidity_before"),
|
|
1912
|
+
liquidity_after=_get_str(data, "liquidity_after"),
|
|
1913
|
+
)
|
|
1914
|
+
if event_type == EventType.RAYDIUM_CLMM_CONFIG_CHANGE:
|
|
1915
|
+
return RaydiumClmmConfigChangeEvent(
|
|
1916
|
+
metadata=meta,
|
|
1917
|
+
index=_get_int(data, "index"),
|
|
1918
|
+
owner=_get_str(data, "owner"),
|
|
1919
|
+
protocol_fee_rate=_get_int(data, "protocol_fee_rate"),
|
|
1920
|
+
trade_fee_rate=_get_int(data, "trade_fee_rate"),
|
|
1921
|
+
tick_spacing=_get_int(data, "tick_spacing"),
|
|
1922
|
+
fund_fee_rate=_get_int(data, "fund_fee_rate"),
|
|
1923
|
+
fund_owner=_get_str(data, "fund_owner"),
|
|
1924
|
+
)
|
|
1925
|
+
if event_type == EventType.RAYDIUM_CLMM_CREATE_PERSONAL_POSITION:
|
|
1926
|
+
return RaydiumClmmCreatePersonalPositionEvent(
|
|
1927
|
+
metadata=meta,
|
|
1928
|
+
pool_state=_get_str(data, "pool_state"),
|
|
1929
|
+
minter=_get_str(data, "minter"),
|
|
1930
|
+
nft_owner=_get_str(data, "nft_owner"),
|
|
1931
|
+
tick_lower_index=_get_int(data, "tick_lower_index"),
|
|
1932
|
+
tick_upper_index=_get_int(data, "tick_upper_index"),
|
|
1933
|
+
liquidity=_get_str(data, "liquidity"),
|
|
1934
|
+
deposit_amount_0=_get_int(data, "deposit_amount_0"),
|
|
1935
|
+
deposit_amount_1=_get_int(data, "deposit_amount_1"),
|
|
1936
|
+
deposit_amount_0_transfer_fee=_get_int(data, "deposit_amount_0_transfer_fee"),
|
|
1937
|
+
deposit_amount_1_transfer_fee=_get_int(data, "deposit_amount_1_transfer_fee"),
|
|
1938
|
+
)
|
|
1939
|
+
if event_type == EventType.RAYDIUM_CLMM_LIQUIDITY_CALCULATE:
|
|
1940
|
+
return RaydiumClmmLiquidityCalculateEvent(
|
|
1941
|
+
metadata=meta,
|
|
1942
|
+
pool_liquidity=_get_str(data, "pool_liquidity"),
|
|
1943
|
+
pool_sqrt_price_x64=_get_str(data, "pool_sqrt_price_x64"),
|
|
1944
|
+
pool_tick=_get_int(data, "pool_tick"),
|
|
1945
|
+
calc_amount_0=_get_int(data, "calc_amount_0"),
|
|
1946
|
+
calc_amount_1=_get_int(data, "calc_amount_1"),
|
|
1947
|
+
trade_fee_owed_0=_get_int(data, "trade_fee_owed_0"),
|
|
1948
|
+
trade_fee_owed_1=_get_int(data, "trade_fee_owed_1"),
|
|
1949
|
+
transfer_fee_0=_get_int(data, "transfer_fee_0"),
|
|
1950
|
+
transfer_fee_1=_get_int(data, "transfer_fee_1"),
|
|
1951
|
+
)
|
|
1952
|
+
if event_type == EventType.RAYDIUM_CLMM_OPEN_LIMIT_ORDER:
|
|
1953
|
+
return RaydiumClmmOpenLimitOrderEvent(
|
|
1954
|
+
metadata=meta,
|
|
1955
|
+
pool_id=_get_str(data, "pool_id"),
|
|
1956
|
+
limit_order=_get_str(data, "limit_order"),
|
|
1957
|
+
zero_for_one=_get_bool(data, "zero_for_one"),
|
|
1958
|
+
tick_index=_get_int(data, "tick_index"),
|
|
1959
|
+
total_amount=_get_int(data, "total_amount"),
|
|
1960
|
+
transfer_fee=_get_int(data, "transfer_fee"),
|
|
1961
|
+
)
|
|
1962
|
+
if event_type == EventType.RAYDIUM_CLMM_INCREASE_LIMIT_ORDER:
|
|
1963
|
+
return RaydiumClmmIncreaseLimitOrderEvent(
|
|
1964
|
+
metadata=meta,
|
|
1965
|
+
pool_id=_get_str(data, "pool_id"),
|
|
1966
|
+
limit_order=_get_str(data, "limit_order"),
|
|
1967
|
+
zero_for_one=_get_bool(data, "zero_for_one"),
|
|
1968
|
+
tick_index=_get_int(data, "tick_index"),
|
|
1969
|
+
total_amount=_get_int(data, "total_amount"),
|
|
1970
|
+
increased_amount=_get_int(data, "increased_amount"),
|
|
1971
|
+
transfer_fee=_get_int(data, "transfer_fee"),
|
|
1972
|
+
)
|
|
1973
|
+
if event_type == EventType.RAYDIUM_CLMM_DECREASE_LIMIT_ORDER:
|
|
1974
|
+
return RaydiumClmmDecreaseLimitOrderEvent(
|
|
1975
|
+
metadata=meta,
|
|
1976
|
+
pool_id=_get_str(data, "pool_id"),
|
|
1977
|
+
limit_order=_get_str(data, "limit_order"),
|
|
1978
|
+
zero_for_one=_get_bool(data, "zero_for_one"),
|
|
1979
|
+
tick_index=_get_int(data, "tick_index"),
|
|
1980
|
+
total_amount=_get_int(data, "total_amount"),
|
|
1981
|
+
filled_amount=_get_int(data, "filled_amount"),
|
|
1982
|
+
settled_output_amount=_get_int(data, "settled_output_amount"),
|
|
1983
|
+
decreased_amount=_get_int(data, "decreased_amount"),
|
|
1984
|
+
)
|
|
1985
|
+
if event_type == EventType.RAYDIUM_CLMM_SETTLE_LIMIT_ORDER:
|
|
1986
|
+
return RaydiumClmmSettleLimitOrderEvent(
|
|
1987
|
+
metadata=meta,
|
|
1988
|
+
pool_id=_get_str(data, "pool_id"),
|
|
1989
|
+
limit_order=_get_str(data, "limit_order"),
|
|
1990
|
+
zero_for_one=_get_bool(data, "zero_for_one"),
|
|
1991
|
+
tick_index=_get_int(data, "tick_index"),
|
|
1992
|
+
total_amount=_get_int(data, "total_amount"),
|
|
1993
|
+
filled_amount=_get_int(data, "filled_amount"),
|
|
1994
|
+
settled_amount_out=_get_int(data, "settled_amount_out"),
|
|
1995
|
+
)
|
|
1996
|
+
if event_type == EventType.RAYDIUM_CLMM_UPDATE_REWARD_INFOS:
|
|
1997
|
+
raw = data.get("reward_growth_global_x64", [])
|
|
1998
|
+
rewards = [str(v) for v in raw] if isinstance(raw, list) else []
|
|
1999
|
+
return RaydiumClmmUpdateRewardInfosEvent(
|
|
2000
|
+
metadata=meta,
|
|
2001
|
+
reward_growth_global_x64=rewards,
|
|
2002
|
+
)
|
|
1765
2003
|
|
|
1766
2004
|
if event_type == EventType.RAYDIUM_CPMM_SWAP:
|
|
1767
2005
|
return RaydiumCpmmSwapEvent(
|
|
@@ -1860,6 +2098,20 @@ def to_typed_event(event: dict) -> Optional[TypedDexEvent]:
|
|
|
1860
2098
|
token_a_transfer_fee=_get_int(data, "token_a_transfer_fee"),
|
|
1861
2099
|
token_b_transfer_fee=_get_int(data, "token_b_transfer_fee"),
|
|
1862
2100
|
)
|
|
2101
|
+
if event_type == EventType.ORCA_WHIRLPOOL_POOL_INITIALIZED:
|
|
2102
|
+
return OrcaWhirlpoolPoolInitializedEvent(
|
|
2103
|
+
metadata=meta,
|
|
2104
|
+
whirlpool=_get_str(data, "whirlpool"),
|
|
2105
|
+
whirlpools_config=_get_str(data, "whirlpools_config"),
|
|
2106
|
+
token_mint_a=_get_str(data, "token_mint_a"),
|
|
2107
|
+
token_mint_b=_get_str(data, "token_mint_b"),
|
|
2108
|
+
tick_spacing=_get_int(data, "tick_spacing"),
|
|
2109
|
+
token_program_a=_get_str(data, "token_program_a"),
|
|
2110
|
+
token_program_b=_get_str(data, "token_program_b"),
|
|
2111
|
+
decimals_a=_get_int(data, "decimals_a"),
|
|
2112
|
+
decimals_b=_get_int(data, "decimals_b"),
|
|
2113
|
+
initial_sqrt_price=_get_str(data, "initial_sqrt_price"),
|
|
2114
|
+
)
|
|
1863
2115
|
|
|
1864
2116
|
# RaydiumLaunchlab events
|
|
1865
2117
|
if event_type == EventType.RAYDIUM_LAUNCHLAB_TRADE:
|
sol_parser/grpc_client.py
CHANGED
|
@@ -449,6 +449,7 @@ class YellowstoneGrpc:
|
|
|
449
449
|
signature = base58.b58encode(bytes(info.signature)).decode("ascii") if info.signature else ""
|
|
450
450
|
|
|
451
451
|
from .grpc_instruction_parser import (
|
|
452
|
+
detect_pumpfun_create_from_logs,
|
|
452
453
|
enrich_dex_events_with_subscribe_tx_info,
|
|
453
454
|
parse_instructions_enhanced_from_subscribe_tx_info,
|
|
454
455
|
)
|
|
@@ -466,7 +467,7 @@ class YellowstoneGrpc:
|
|
|
466
467
|
)
|
|
467
468
|
|
|
468
469
|
log_events = []
|
|
469
|
-
|
|
470
|
+
has_pumpfun_create_log = detect_pumpfun_create_from_logs(list(info.log_messages))
|
|
470
471
|
active_program_stack = []
|
|
471
472
|
for log in info.log_messages:
|
|
472
473
|
invoke = parse_invoke_info(log)
|
|
@@ -483,7 +484,7 @@ class YellowstoneGrpc:
|
|
|
483
484
|
block_time_us,
|
|
484
485
|
grpc_recv_us,
|
|
485
486
|
event_type_filter,
|
|
486
|
-
|
|
487
|
+
has_pumpfun_create_log,
|
|
487
488
|
"",
|
|
488
489
|
active_program_stack[-1] if active_program_stack else None,
|
|
489
490
|
)
|
|
@@ -495,8 +496,6 @@ class YellowstoneGrpc:
|
|
|
495
496
|
del active_program_stack[i:]
|
|
496
497
|
break
|
|
497
498
|
continue
|
|
498
|
-
if ev.type in (EventType.PUMP_FUN_CREATE, EventType.PUMP_FUN_CREATE_V2):
|
|
499
|
-
is_created_buy = True
|
|
500
499
|
log_events.append(ev)
|
|
501
500
|
completed = parse_program_complete_info(log)
|
|
502
501
|
if completed is not None:
|
|
@@ -16,7 +16,7 @@ from .grpc_types import (
|
|
|
16
16
|
event_type_filter_allows_instruction_parsing,
|
|
17
17
|
)
|
|
18
18
|
from .inner_instruction_parser import parse_inner_instruction
|
|
19
|
-
from .instructions import parse_instruction_unified
|
|
19
|
+
from .instructions import parse_inner_compiled_instruction_if_supported, parse_instruction_unified
|
|
20
20
|
from .merger import merge_dex_events
|
|
21
21
|
from .pumpfun_fee_enrich import enrich_pumpfun_same_tx_post_merge
|
|
22
22
|
|
|
@@ -145,7 +145,7 @@ def merge_instruction_events(
|
|
|
145
145
|
pending_outer = None
|
|
146
146
|
if po_idx == outer_idx:
|
|
147
147
|
merge_dex_events(mut_outer, event)
|
|
148
|
-
|
|
148
|
+
pending_outer = (outer_idx, mut_outer)
|
|
149
149
|
else:
|
|
150
150
|
result.append(mut_outer)
|
|
151
151
|
result.append(event)
|
|
@@ -279,7 +279,18 @@ def parse_instructions_enhanced_from_parsed(
|
|
|
279
279
|
for j, inner_ix in enumerate(inner.instructions):
|
|
280
280
|
pid = get_key_b58(inner_ix.program_id_index)
|
|
281
281
|
data = bytes(inner_ix.data)
|
|
282
|
-
|
|
282
|
+
accounts = [get_key_b58(b) for b in bytes(inner_ix.accounts)]
|
|
283
|
+
ev = parse_inner_compiled_instruction_if_supported(
|
|
284
|
+
data,
|
|
285
|
+
accounts,
|
|
286
|
+
signature,
|
|
287
|
+
slot,
|
|
288
|
+
tx_index,
|
|
289
|
+
block_time_us,
|
|
290
|
+
grpc_us,
|
|
291
|
+
filter,
|
|
292
|
+
pid,
|
|
293
|
+
) or parse_inner_instruction(
|
|
283
294
|
data,
|
|
284
295
|
pid,
|
|
285
296
|
_meta_dict(signature, slot, tx_index, block_time_us, grpc_us, recent_bh),
|