sol-parser-sdk-python 0.4.5__tar.gz → 0.5.5__tar.gz
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_sdk_python-0.5.5/PKG-INFO +307 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/README.md +17 -3
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/README_CN.md +17 -3
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/multi_protocol_grpc.py +1 -1
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/pyproject.toml +2 -1
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/__init__.py +39 -7
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_dispatcher.py +6 -6
- sol_parser_sdk_python-0.5.5/sol_parser/account_fillers/__init__.py +5 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/pumpfun.py +2 -4
- sol_parser_sdk_python-0.5.5/sol_parser/account_fillers/raydium_launchlab.py +30 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/accounts/__init__.py +55 -37
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/dex_parsers.py +62 -71
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/event_types.py +29 -20
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc_types.py +263 -132
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/inner_instruction_parser.py +83 -45
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/instr/__init__.py +4 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/instructions.py +465 -120
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/log_instr_dedup.py +13 -11
- sol_parser_sdk_python-0.5.5/sol_parser/market.py +62 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/merger.py +4 -2
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/pumpfun_fee_enrich.py +55 -2
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/shredstream_client.py +94 -20
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/shredstream_pumpfun.py +39 -13
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_filter_and_account_parity.py +149 -1
- sol_parser_sdk_python-0.5.5/tests/test_imports_and_inner.py +150 -0
- sol_parser_sdk_python-0.5.5/tests/test_market_helpers.py +19 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_pumpfun_trade_tail.py +81 -3
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_pumpfun_v2_parity.py +5 -5
- sol_parser_sdk_python-0.5.5/tests/test_raydium_clmm_instruction_parity.py +235 -0
- sol_parser_sdk_python-0.5.5/tests/test_shredstream.py +109 -0
- sol_parser_sdk_python-0.4.5/PKG-INFO +0 -14
- sol_parser_sdk_python-0.4.5/sol_parser/account_fillers/__init__.py +0 -5
- sol_parser_sdk_python-0.4.5/sol_parser/account_fillers/bonk.py +0 -30
- sol_parser_sdk_python-0.4.5/tests/test_imports_and_inner.py +0 -37
- sol_parser_sdk_python-0.4.5/tests/test_raydium_clmm_instruction_parity.py +0 -107
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/.env.example +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/.gitignore +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/meteora_damm_grpc.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/parse_tx_by_signature.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/pumpfun_quick_test.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/pumpfun_trade_filter.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/pumpfun_with_metrics.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/pumpswap_low_latency.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/pumpswap_with_metrics.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/examples/rust_example_utils.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/scripts/bench_parser.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/scripts/gen_golden_rust.sh +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/meteora.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/orca.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/pumpswap.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/raydium.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/accounts/rpc_wallet.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/accounts/utils.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/check_migration.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/clock.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/common/__init__.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/entries_decode.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/env_config.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/geyser_pb2.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/geyser_pb2_grpc.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc/__init__.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc/geyser_connect.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc/subscribe_builder.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc/transaction_meta.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc_client.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/grpc_instruction_parser.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/instr_account_utils.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/json_util.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/logs/__init__.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/order_buffer.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/parser.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/rpc_parser.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/rust_api_inventory.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/rust_event_json.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/shredstream_pb2.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/shredstream_pb2_grpc.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/solana_storage_pb2.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/solana_storage_pb2_grpc.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/u128_parity.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/verify_discriminators.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/fixtures/golden_parse_log.json +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_golden.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_log_instr_dedup.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_order_buffer.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_pumpfun_account_fill.py +0 -0
- {sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/tests/test_pumpswap_instruction.py +0 -0
|
@@ -0,0 +1,307 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: sol-parser-sdk-python
|
|
3
|
+
Version: 0.5.5
|
|
4
|
+
Summary: Solana DEX program log parsing (pure Python, API aligned with sol-parser-sdk)
|
|
5
|
+
Requires-Python: >=3.10
|
|
6
|
+
Requires-Dist: base58>=2.0
|
|
7
|
+
Requires-Dist: grpcio-tools>=1.64.0
|
|
8
|
+
Requires-Dist: grpcio>=1.64.0
|
|
9
|
+
Requires-Dist: python-dotenv>=1.0.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest-benchmark>=4.0; extra == 'dev'
|
|
12
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
13
|
+
Provides-Extra: shredstream
|
|
14
|
+
Requires-Dist: solders>=0.21.0; extra == 'shredstream'
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
|
|
17
|
+
<div align="center">
|
|
18
|
+
<h1>⚡ Sol Parser SDK - Python</h1>
|
|
19
|
+
<h3><em>High-performance Solana DEX event parser for Python</em></h3>
|
|
20
|
+
</div>
|
|
21
|
+
|
|
22
|
+
<p align="center">
|
|
23
|
+
<strong>High-performance Python library for parsing Solana DEX events in real-time via Yellowstone gRPC</strong>
|
|
24
|
+
</p>
|
|
25
|
+
|
|
26
|
+
<p align="center">
|
|
27
|
+
<a href="https://pypi.org/project/sol-parser-sdk-python/">
|
|
28
|
+
<img src="https://img.shields.io/pypi/v/sol-parser-sdk-python.svg" alt="PyPI">
|
|
29
|
+
</a>
|
|
30
|
+
<a href="https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/LICENSE">
|
|
31
|
+
<img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License">
|
|
32
|
+
</a>
|
|
33
|
+
</p>
|
|
34
|
+
|
|
35
|
+
<p align="center">
|
|
36
|
+
<img src="https://img.shields.io/badge/Python-3776AB?style=for-the-badge&logo=python&logoColor=white" alt="Python">
|
|
37
|
+
<img src="https://img.shields.io/badge/Solana-9945FF?style=for-the-badge&logo=solana&logoColor=white" alt="Solana">
|
|
38
|
+
<img src="https://img.shields.io/badge/gRPC-4285F4?style=for-the-badge&logo=grpc&logoColor=white" alt="gRPC">
|
|
39
|
+
</p>
|
|
40
|
+
|
|
41
|
+
<p align="center">
|
|
42
|
+
<a href="./README_CN.md">中文</a> |
|
|
43
|
+
<a href="./README.md">English</a> |
|
|
44
|
+
<a href="https://fnzero.dev/">Website</a> |
|
|
45
|
+
<a href="https://t.me/fnzero_group">Telegram</a> |
|
|
46
|
+
<a href="https://discord.gg/vuazbGkqQE">Discord</a>
|
|
47
|
+
</p>
|
|
48
|
+
|
|
49
|
+
> ☕ **Support This Project**
|
|
50
|
+
>
|
|
51
|
+
> This SDK is completely free and open source. However, maintaining and continuously updating it requires significant AI computing resources and token consumption. If this SDK helps with your development, consider making a monthly SOL donation — any amount is appreciated and helps keep this project alive!
|
|
52
|
+
>
|
|
53
|
+
> **Donation Wallet:** `6oW7AXz1yRb57pYSxysuXnMs2aR1ha5rzGzReZ1MjPV8`
|
|
54
|
+
|
|
55
|
+
---
|
|
56
|
+
|
|
57
|
+
## Other language SDKs
|
|
58
|
+
|
|
59
|
+
| Language | Repository |
|
|
60
|
+
|----------|------------|
|
|
61
|
+
| Rust | [sol-parser-sdk](https://github.com/0xfnzero/sol-parser-sdk) |
|
|
62
|
+
| Node.js | [sol-parser-sdk-nodejs](https://github.com/0xfnzero/sol-parser-sdk-nodejs) |
|
|
63
|
+
| Python | [sol-parser-sdk-python](https://github.com/0xfnzero/sol-parser-sdk-python) |
|
|
64
|
+
| Go | [sol-parser-sdk-golang](https://github.com/0xfnzero/sol-parser-sdk-golang) |
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Release notes
|
|
69
|
+
|
|
70
|
+
### v0.5.5
|
|
71
|
+
|
|
72
|
+
- Aligns ShredStream parsing with Rust/Node.js/Go for low-latency static-account paths.
|
|
73
|
+
- Uses default pubkey placeholders for V0 ALT-loaded instruction accounts instead of dropping the instruction.
|
|
74
|
+
- Adds discriminator fallback when the ShredStream outer program id is ALT-loaded.
|
|
75
|
+
- Fixes Pump.fun ShredStream create/create_v2 fallback to use instruction-order accounts.
|
|
76
|
+
- Improves Pump.fun v2 short-account parsing, event-type filtering, and multi-protocol routing parity.
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## How to use
|
|
81
|
+
|
|
82
|
+
### 1. Install
|
|
83
|
+
|
|
84
|
+
**From PyPI**
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
pip install sol-parser-sdk-python==0.5.5
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
**From source**
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
git clone https://github.com/0xfnzero/sol-parser-sdk-python
|
|
94
|
+
cd sol-parser-sdk-python
|
|
95
|
+
pip install -e .
|
|
96
|
+
pip install grpcio grpcio-tools protobuf base58 python-dotenv
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### 2. Environment (Yellowstone gRPC examples)
|
|
100
|
+
|
|
101
|
+
At the **package root** (next to `pyproject.toml`):
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
cp .env.example .env
|
|
105
|
+
# Set GRPC_URL (or GRPC_ENDPOINT) and GRPC_AUTH_TOKEN or GRPC_TOKEN
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
Run examples from that directory so `.env` is picked up (same idea as the Node.js package).
|
|
109
|
+
|
|
110
|
+
**CLI overrides:** `--grpc-url` / `-g`, `--grpc-token` / `--token` (also `--grpc-url=https://host:443`). **Rust-compatible names:** `GRPC_AUTH_TOKEN` (same as [sol-parser-sdk](https://github.com/0xfnzero/sol-parser-sdk) examples), `GRPC_ENDPOINT` (alias for URL). **Legacy env:** `GEYSER_ENDPOINT` / `GEYSER_API_TOKEN`. **Precedence:** CLI > `GRPC_URL` / `GRPC_ENDPOINT` > `GEYSER_*` > defaults; token: CLI > `GRPC_AUTH_TOKEN` > `GRPC_TOKEN` > `GEYSER_API_TOKEN`. Explicit shell `export` wins over `.env`; `python-dotenv` does not overwrite existing variables.
|
|
111
|
+
|
|
112
|
+
Helpers: `sol_parser.env_config` (`parse_grpc_credentials`, `require_grpc_env`, `parse_shredstream_url`, …), re-exported from `sol_parser`.
|
|
113
|
+
|
|
114
|
+
### 3. Smoke test
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
python examples/pumpfun_quick_test.py
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
Requires `GRPC_URL` (or `GRPC_ENDPOINT`) and (for most providers) `GRPC_AUTH_TOKEN` or `GRPC_TOKEN` in `.env` or the environment. You can pass credentials on the command line instead; see step 2.
|
|
121
|
+
|
|
122
|
+
### 4. Minimal gRPC subscribe + parse
|
|
123
|
+
|
|
124
|
+
```python
|
|
125
|
+
import asyncio
|
|
126
|
+
import os
|
|
127
|
+
|
|
128
|
+
import base58
|
|
129
|
+
|
|
130
|
+
from sol_parser import parse_logs_only
|
|
131
|
+
from sol_parser.grpc_client import YellowstoneGrpc
|
|
132
|
+
from sol_parser.grpc_types import Protocol, SubscribeCallbacks, transaction_filter_for_protocols
|
|
133
|
+
|
|
134
|
+
async def main():
|
|
135
|
+
endpoint = (
|
|
136
|
+
os.environ.get("GRPC_URL", "").strip()
|
|
137
|
+
or os.environ.get("GRPC_ENDPOINT", "").strip()
|
|
138
|
+
or os.environ.get("GEYSER_ENDPOINT", "solana-yellowstone-grpc.publicnode.com:443")
|
|
139
|
+
)
|
|
140
|
+
token = (
|
|
141
|
+
os.environ.get("GRPC_AUTH_TOKEN", "").strip()
|
|
142
|
+
or os.environ.get("GRPC_TOKEN", "").strip()
|
|
143
|
+
or os.environ.get("GEYSER_API_TOKEN", "")
|
|
144
|
+
)
|
|
145
|
+
|
|
146
|
+
client = YellowstoneGrpc(endpoint)
|
|
147
|
+
if token:
|
|
148
|
+
client.set_x_token(token)
|
|
149
|
+
await client.connect()
|
|
150
|
+
|
|
151
|
+
filter_ = transaction_filter_for_protocols([Protocol.PUMP_FUN, Protocol.PUMP_SWAP])
|
|
152
|
+
filter_.vote = False
|
|
153
|
+
filter_.failed = False
|
|
154
|
+
|
|
155
|
+
def on_update(update):
|
|
156
|
+
if update.transaction is None or update.transaction.transaction is None:
|
|
157
|
+
return
|
|
158
|
+
tx_info = update.transaction.transaction
|
|
159
|
+
slot = update.transaction.slot
|
|
160
|
+
logs = tx_info.log_messages
|
|
161
|
+
if not logs:
|
|
162
|
+
return
|
|
163
|
+
sb = bytes(tx_info.signature) if tx_info.signature else b""
|
|
164
|
+
sig = base58.b58encode(sb).decode("ascii") if len(sb) == 64 else ""
|
|
165
|
+
events = parse_logs_only(
|
|
166
|
+
logs, sig, slot, None, subscribe_tx_info=tx_info
|
|
167
|
+
) # tx_info from gRPC update — fills accounts from instruction keys
|
|
168
|
+
for ev in events:
|
|
169
|
+
print(ev)
|
|
170
|
+
|
|
171
|
+
sub = await client.subscribe_transactions(
|
|
172
|
+
filter_,
|
|
173
|
+
SubscribeCallbacks(on_update=on_update, on_error=print, on_end=lambda: None),
|
|
174
|
+
)
|
|
175
|
+
print("subscribed", sub.id)
|
|
176
|
+
|
|
177
|
+
try:
|
|
178
|
+
await asyncio.Event().wait()
|
|
179
|
+
except KeyboardInterrupt:
|
|
180
|
+
pass
|
|
181
|
+
await client.disconnect()
|
|
182
|
+
|
|
183
|
+
asyncio.run(main())
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
**Lighter path:** `parse_logs_only(logs, …)` only needs log messages from the update (no full wire transaction).
|
|
187
|
+
|
|
188
|
+
### 5. ShredStream (HTTP — not Yellowstone gRPC)
|
|
189
|
+
|
|
190
|
+
Python includes a native ShredStream client (`ShredStreamClient`, `ShredStreamConfig`) plus the same env/CLI helpers as Node (`parse_shredstream_url`: `SHREDSTREAM_URL` / `SHRED_URL`, `--url` / `-u` / `--endpoint=`). Install the optional extra with `pip install 'sol-parser-sdk-python[shredstream]'`. ShredStream uses its own endpoint, **not** `GRPC_URL`.
|
|
191
|
+
|
|
192
|
+
The Python ShredStream hot path uses static account keys only. V0 ALT-loaded instruction accounts are represented with default pubkey placeholders, and ALT-loaded outer program ids are parsed best-effort by discriminator. Inner CPI/log-only events still require the Yellowstone/RPC paths.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
## Examples
|
|
197
|
+
|
|
198
|
+
From the **package root** after `pip install -e .`. Run with `python examples/<file>.py`. Scripts are written to mirror the **output layout and env names** of [sol-parser-sdk/examples](https://github.com/0xfnzero/sol-parser-sdk/tree/main/examples) (Rust); streaming uses `subscribe_transactions` + `parse_logs_only` with the same program IDs as `TransactionFilter::for_protocols` in Rust.
|
|
199
|
+
|
|
200
|
+
| Description | Run command | Source |
|
|
201
|
+
|-------------|-------------|--------|
|
|
202
|
+
| **PumpFun** | | |
|
|
203
|
+
| PumpFun trade filtering | `python examples/pumpfun_trade_filter.py` | [pumpfun_trade_filter.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/pumpfun_trade_filter.py) |
|
|
204
|
+
| PumpFun events + metrics | `python examples/pumpfun_with_metrics.py` | [pumpfun_with_metrics.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/pumpfun_with_metrics.py) |
|
|
205
|
+
| Quick PumpFun connection test | `python examples/pumpfun_quick_test.py` | [pumpfun_quick_test.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/pumpfun_quick_test.py) |
|
|
206
|
+
| **PumpSwap** | | |
|
|
207
|
+
| PumpSwap ultra-low latency | `python examples/pumpswap_low_latency.py` | [pumpswap_low_latency.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/pumpswap_low_latency.py) |
|
|
208
|
+
| PumpSwap events + metrics | `python examples/pumpswap_with_metrics.py` | [pumpswap_with_metrics.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/pumpswap_with_metrics.py) |
|
|
209
|
+
| **Meteora DAMM** | | |
|
|
210
|
+
| Meteora DAMM V2 events | `python examples/meteora_damm_grpc.py` | [meteora_damm_grpc.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/meteora_damm_grpc.py) |
|
|
211
|
+
| **Multi-protocol** | | |
|
|
212
|
+
| Subscribe to every program in Rust `Protocol` / `program_ids` | `python examples/multi_protocol_grpc.py` | [multi_protocol_grpc.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/multi_protocol_grpc.py) |
|
|
213
|
+
| **Utility** | | |
|
|
214
|
+
| Parse tx by signature (HTTP RPC; not gRPC). `TX_SIGNATURE` / `RPC_URL` or `SOLANA_RPC_URL` in `.env` or `--sig` / `--rpc`. | `python examples/parse_tx_by_signature.py` | [parse_tx_by_signature.py](https://github.com/0xfnzero/sol-parser-sdk-python/blob/main/examples/parse_tx_by_signature.py) |
|
|
215
|
+
|
|
216
|
+
**Env:** gRPC examples need **`GRPC_URL`** or **`GRPC_ENDPOINT`**, plus **`GRPC_AUTH_TOKEN`** or **`GRPC_TOKEN`** (or legacy `GEYSER_*`). See **`.env.example`**.
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Protocols
|
|
221
|
+
|
|
222
|
+
PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM, Raydium LaunchLab (see `sol_parser/`).
|
|
223
|
+
|
|
224
|
+
---
|
|
225
|
+
|
|
226
|
+
## Useful exports
|
|
227
|
+
|
|
228
|
+
- `parse_logs_only` — log-based DEX events from gRPC log messages.
|
|
229
|
+
- `format_dex_event_json` / `dex_event_to_jsonable` — pretty-print `DexEvent` as indented JSON (one field per line); `repr(ev)` is the default dataclass single-line form, not JSON.
|
|
230
|
+
- `YellowstoneGrpc` — async Yellowstone gRPC client (`connect`, `subscribe_transactions`, `disconnect`).
|
|
231
|
+
- `now_micros` — microsecond clock (same role as Rust `sol_parser_sdk::core::now_micros`).
|
|
232
|
+
- `transaction_filter_for_protocols` / `program_ids_for_protocols` / `account_filter_for_protocols` — same program IDs as Rust `Protocol` + `for_protocols` in `grpc/filter.rs`.
|
|
233
|
+
- `parse_grpc_credentials` / `require_grpc_env` — load `.env` + env + CLI (aligned with [sol-parser-sdk-nodejs](https://github.com/0xfnzero/sol-parser-sdk-nodejs) `grpc_env`).
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Advanced
|
|
238
|
+
|
|
239
|
+
### Custom gRPC endpoint
|
|
240
|
+
|
|
241
|
+
```python
|
|
242
|
+
import os
|
|
243
|
+
|
|
244
|
+
from sol_parser.grpc_client import YellowstoneGrpc
|
|
245
|
+
|
|
246
|
+
endpoint = os.environ.get("GRPC_URL") or os.environ.get("GRPC_ENDPOINT") or os.environ.get(
|
|
247
|
+
"GEYSER_ENDPOINT", "solana-yellowstone-grpc.publicnode.com:443"
|
|
248
|
+
)
|
|
249
|
+
token = (
|
|
250
|
+
os.environ.get("GRPC_AUTH_TOKEN")
|
|
251
|
+
or os.environ.get("GRPC_TOKEN")
|
|
252
|
+
or os.environ.get("GEYSER_API_TOKEN", "")
|
|
253
|
+
)
|
|
254
|
+
client = YellowstoneGrpc(endpoint)
|
|
255
|
+
if token:
|
|
256
|
+
client.set_x_token(token)
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
### Create + buy detection
|
|
260
|
+
|
|
261
|
+
`parse_logs_only` can detect create-and-buy patterns from program logs; see the PumpFun examples.
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Project structure
|
|
266
|
+
|
|
267
|
+
```
|
|
268
|
+
sol-parser-sdk-python/
|
|
269
|
+
├── sol_parser/
|
|
270
|
+
│ ├── grpc_client.py # YellowstoneGrpc (async connect / subscribe)
|
|
271
|
+
│ ├── env_config.py # GRPC_URL, .env, CLI helpers (Node parity)
|
|
272
|
+
│ ├── clock.py # now_micros()
|
|
273
|
+
│ ├── grpc_types.py # TransactionFilter, SubscribeCallbacks, for_protocols helpers, …
|
|
274
|
+
│ ├── parser.py # parse_logs_only, …
|
|
275
|
+
│ ├── geyser_pb2.py # Generated proto (Yellowstone)
|
|
276
|
+
│ └── …
|
|
277
|
+
├── examples/
|
|
278
|
+
│ ├── pumpfun_trade_filter.py
|
|
279
|
+
│ ├── pumpfun_quick_test.py
|
|
280
|
+
│ └── …
|
|
281
|
+
├── .env.example
|
|
282
|
+
└── pyproject.toml
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
---
|
|
286
|
+
|
|
287
|
+
## Development
|
|
288
|
+
|
|
289
|
+
```bash
|
|
290
|
+
pip install -e ".[dev]"
|
|
291
|
+
pytest tests/
|
|
292
|
+
```
|
|
293
|
+
|
|
294
|
+
---
|
|
295
|
+
|
|
296
|
+
## License
|
|
297
|
+
|
|
298
|
+
MIT — https://github.com/0xfnzero/sol-parser-sdk-python
|
|
299
|
+
|
|
300
|
+
---
|
|
301
|
+
|
|
302
|
+
## Contact
|
|
303
|
+
|
|
304
|
+
- **Repository**: https://github.com/0xfnzero/sol-parser-sdk-python
|
|
305
|
+
- **Website**: https://fnzero.dev/
|
|
306
|
+
- **Telegram**: https://t.me/fnzero_group
|
|
307
|
+
- **Discord**: https://discord.gg/vuazbGkqQE
|
|
@@ -49,6 +49,18 @@
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
|
+
## Release notes
|
|
53
|
+
|
|
54
|
+
### v0.5.5
|
|
55
|
+
|
|
56
|
+
- Aligns ShredStream parsing with Rust/Node.js/Go for low-latency static-account paths.
|
|
57
|
+
- Uses default pubkey placeholders for V0 ALT-loaded instruction accounts instead of dropping the instruction.
|
|
58
|
+
- Adds discriminator fallback when the ShredStream outer program id is ALT-loaded.
|
|
59
|
+
- Fixes Pump.fun ShredStream create/create_v2 fallback to use instruction-order accounts.
|
|
60
|
+
- Improves Pump.fun v2 short-account parsing, event-type filtering, and multi-protocol routing parity.
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
52
64
|
## How to use
|
|
53
65
|
|
|
54
66
|
### 1. Install
|
|
@@ -56,7 +68,7 @@
|
|
|
56
68
|
**From PyPI**
|
|
57
69
|
|
|
58
70
|
```bash
|
|
59
|
-
pip install sol-parser-sdk-python==0.
|
|
71
|
+
pip install sol-parser-sdk-python==0.5.5
|
|
60
72
|
```
|
|
61
73
|
|
|
62
74
|
**From source**
|
|
@@ -159,7 +171,9 @@ asyncio.run(main())
|
|
|
159
171
|
|
|
160
172
|
### 5. ShredStream (HTTP — not Yellowstone gRPC)
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
Python includes a native ShredStream client (`ShredStreamClient`, `ShredStreamConfig`) plus the same env/CLI helpers as Node (`parse_shredstream_url`: `SHREDSTREAM_URL` / `SHRED_URL`, `--url` / `-u` / `--endpoint=`). Install the optional extra with `pip install 'sol-parser-sdk-python[shredstream]'`. ShredStream uses its own endpoint, **not** `GRPC_URL`.
|
|
175
|
+
|
|
176
|
+
The Python ShredStream hot path uses static account keys only. V0 ALT-loaded instruction accounts are represented with default pubkey placeholders, and ALT-loaded outer program ids are parsed best-effort by discriminator. Inner CPI/log-only events still require the Yellowstone/RPC paths.
|
|
163
177
|
|
|
164
178
|
---
|
|
165
179
|
|
|
@@ -189,7 +203,7 @@ From the **package root** after `pip install -e .`. Run with `python examples/<f
|
|
|
189
203
|
|
|
190
204
|
## Protocols
|
|
191
205
|
|
|
192
|
-
PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM,
|
|
206
|
+
PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM, Raydium LaunchLab (see `sol_parser/`).
|
|
193
207
|
|
|
194
208
|
---
|
|
195
209
|
|
|
@@ -49,6 +49,18 @@
|
|
|
49
49
|
|
|
50
50
|
---
|
|
51
51
|
|
|
52
|
+
## 发布说明
|
|
53
|
+
|
|
54
|
+
### v0.5.5
|
|
55
|
+
|
|
56
|
+
- ShredStream 低延迟静态账户路径与 Rust/Node.js/Go 对齐。
|
|
57
|
+
- V0 ALT-loaded 指令账户不再整条跳过,而是用默认 pubkey 占位继续 best-effort 解析。
|
|
58
|
+
- 当 ShredStream 外层 program id 来自 ALT 时,按 discriminator 做候选 program id fallback。
|
|
59
|
+
- 修复 Pump.fun ShredStream create/create_v2 fallback,确保按 instruction-order 账户解析。
|
|
60
|
+
- 改进 Pump.fun v2 短账户解析、事件类型过滤和多协议路由一致性。
|
|
61
|
+
|
|
62
|
+
---
|
|
63
|
+
|
|
52
64
|
## 怎么用
|
|
53
65
|
|
|
54
66
|
### 1. 安装
|
|
@@ -56,7 +68,7 @@
|
|
|
56
68
|
**PyPI**
|
|
57
69
|
|
|
58
70
|
```bash
|
|
59
|
-
pip install sol-parser-sdk-python==0.
|
|
71
|
+
pip install sol-parser-sdk-python==0.5.5
|
|
60
72
|
```
|
|
61
73
|
|
|
62
74
|
**源码**
|
|
@@ -159,7 +171,9 @@ asyncio.run(main())
|
|
|
159
171
|
|
|
160
172
|
### 5. ShredStream(HTTP,不是 Yellowstone gRPC)
|
|
161
173
|
|
|
162
|
-
|
|
174
|
+
Python 已提供原生 ShredStream 客户端(`ShredStreamClient`、`ShredStreamConfig`),并保留与 Node 相同的配置方式(`parse_shredstream_url`:`SHREDSTREAM_URL` / `SHRED_URL`,`--url` / `-u` / `--endpoint=`)。安装可选依赖:`pip install 'sol-parser-sdk-python[shredstream]'`。ShredStream 使用独立端点,**不要**用 `GRPC_URL`。
|
|
175
|
+
|
|
176
|
+
Python ShredStream 热路径只使用静态账户表。V0 ALT-loaded 指令账户会用默认 pubkey 占位,外层 program id 若来自 ALT 会按 discriminator best-effort 解析。Inner CPI / 仅日志事件仍需 Yellowstone/RPC 路径。
|
|
163
177
|
|
|
164
178
|
---
|
|
165
179
|
|
|
@@ -189,7 +203,7 @@ Node 版提供 ShredStream HTTP 客户端。**Python** 侧提供与 Node 相同
|
|
|
189
203
|
|
|
190
204
|
## 协议
|
|
191
205
|
|
|
192
|
-
PumpFun、PumpSwap、Raydium AMM V4 / CLMM / CPMM、Orca Whirlpool、Meteora DAMM V2 / DLMM、
|
|
206
|
+
PumpFun、PumpSwap、Raydium AMM V4 / CLMM / CPMM、Orca Whirlpool、Meteora DAMM V2 / DLMM、Raydium LaunchLab(见 `sol_parser/`)。
|
|
193
207
|
|
|
194
208
|
---
|
|
195
209
|
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "sol-parser-sdk-python"
|
|
3
|
-
version = "0.
|
|
3
|
+
version = "0.5.5"
|
|
4
4
|
description = "Solana DEX program log parsing (pure Python, API aligned with sol-parser-sdk)"
|
|
5
|
+
readme = "README.md"
|
|
5
6
|
requires-python = ">=3.10"
|
|
6
7
|
dependencies = [
|
|
7
8
|
"base58>=2.0",
|
|
@@ -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_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_dispatcher.py
RENAMED
|
@@ -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(
|
{sol_parser_sdk_python-0.4.5 → sol_parser_sdk_python-0.5.5}/sol_parser/account_fillers/pumpfun.py
RENAMED
|
@@ -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)
|