sol-parser-sdk 0.5.9
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.
- package/.env.example +24 -0
- package/LICENSE +21 -0
- package/README.md +236 -0
- package/README_CN.md +236 -0
- package/dist/accounts/mod.d.ts +15 -0
- package/dist/accounts/mod.js +173 -0
- package/dist/accounts/nonce.d.ts +5 -0
- package/dist/accounts/nonce.js +32 -0
- package/dist/accounts/pumpfun.d.ts +16 -0
- package/dist/accounts/pumpfun.js +538 -0
- package/dist/accounts/pumpswap.d.ts +8 -0
- package/dist/accounts/pumpswap.js +192 -0
- package/dist/accounts/raydium_orca.d.ts +26 -0
- package/dist/accounts/raydium_orca.js +453 -0
- package/dist/accounts/rpc_wallet.d.ts +5 -0
- package/dist/accounts/rpc_wallet.js +18 -0
- package/dist/accounts/rust_aliases.d.ts +10 -0
- package/dist/accounts/rust_aliases.js +21 -0
- package/dist/accounts/token.d.ts +5 -0
- package/dist/accounts/token.js +98 -0
- package/dist/accounts/types.d.ts +9 -0
- package/dist/accounts/types.js +2 -0
- package/dist/accounts/utils.d.ts +1 -0
- package/dist/accounts/utils.js +12 -0
- package/dist/accounts/wallet_resolve.d.ts +1 -0
- package/dist/accounts/wallet_resolve.js +28 -0
- package/dist/common/constants.d.ts +10 -0
- package/dist/common/constants.js +13 -0
- package/dist/core/account_dispatcher_rpc.d.ts +11 -0
- package/dist/core/account_dispatcher_rpc.js +155 -0
- package/dist/core/account_fill_bonk.d.ts +4 -0
- package/dist/core/account_fill_bonk.js +20 -0
- package/dist/core/account_fill_meteora.d.ts +15 -0
- package/dist/core/account_fill_meteora.js +27 -0
- package/dist/core/account_fill_orca.d.ts +5 -0
- package/dist/core/account_fill_orca.js +18 -0
- package/dist/core/account_fill_pumpfun.d.ts +7 -0
- package/dist/core/account_fill_pumpfun.js +167 -0
- package/dist/core/account_fill_pumpswap.d.ts +10 -0
- package/dist/core/account_fill_pumpswap.js +128 -0
- package/dist/core/account_fill_raydium.d.ts +20 -0
- package/dist/core/account_fill_raydium.js +104 -0
- package/dist/core/account_fill_raydium_launchlab.d.ts +4 -0
- package/dist/core/account_fill_raydium_launchlab.js +20 -0
- package/dist/core/account_pubkey_cache.d.ts +12 -0
- package/dist/core/account_pubkey_cache.js +26 -0
- package/dist/core/clock.d.ts +8 -0
- package/dist/core/clock.js +20 -0
- package/dist/core/common_filler_rpc.d.ts +6 -0
- package/dist/core/common_filler_rpc.js +21 -0
- package/dist/core/dex_event.d.ts +1704 -0
- package/dist/core/dex_event.js +14 -0
- package/dist/core/error.d.ts +43 -0
- package/dist/core/error.js +16 -0
- package/dist/core/json_utils.d.ts +8 -0
- package/dist/core/json_utils.js +18 -0
- package/dist/core/metadata.d.ts +11 -0
- package/dist/core/metadata.js +13 -0
- package/dist/core/pumpfun_fee_enrich.d.ts +6 -0
- package/dist/core/pumpfun_fee_enrich.js +159 -0
- package/dist/core/rpc_invoke_map.d.ts +23 -0
- package/dist/core/rpc_invoke_map.js +157 -0
- package/dist/core/unified_parser.d.ts +19 -0
- package/dist/core/unified_parser.js +50 -0
- package/dist/grpc/client.d.ts +83 -0
- package/dist/grpc/client.js +645 -0
- package/dist/grpc/client_stub.d.ts +5 -0
- package/dist/grpc/client_stub.js +5 -0
- package/dist/grpc/event_parser.d.ts +6 -0
- package/dist/grpc/event_parser.js +15 -0
- package/dist/grpc/geyser_connect.d.ts +30 -0
- package/dist/grpc/geyser_connect.js +40 -0
- package/dist/grpc/log_instr_dedup.d.ts +2 -0
- package/dist/grpc/log_instr_dedup.js +402 -0
- package/dist/grpc/order_buffer.d.ts +27 -0
- package/dist/grpc/order_buffer.js +166 -0
- package/dist/grpc/program_ids.d.ts +27 -0
- package/dist/grpc/program_ids.js +61 -0
- package/dist/grpc/rpc_to_grpc.d.ts +18 -0
- package/dist/grpc/rpc_to_grpc.js +127 -0
- package/dist/grpc/subscribe_builder.d.ts +13 -0
- package/dist/grpc/subscribe_builder.js +66 -0
- package/dist/grpc/transaction_meta.d.ts +29 -0
- package/dist/grpc/transaction_meta.js +208 -0
- package/dist/grpc/types.d.ts +195 -0
- package/dist/grpc/types.js +551 -0
- package/dist/grpc/yellowstone_parse.d.ts +16 -0
- package/dist/grpc/yellowstone_parse.js +62 -0
- package/dist/index.d.ts +50 -0
- package/dist/index.js +298 -0
- package/dist/instr/bonk_ix.d.ts +8 -0
- package/dist/instr/bonk_ix.js +131 -0
- package/dist/instr/inner.d.ts +4 -0
- package/dist/instr/inner.js +453 -0
- package/dist/instr/meteora_damm_ix.d.ts +8 -0
- package/dist/instr/meteora_damm_ix.js +601 -0
- package/dist/instr/meteora_dlmm_ix.d.ts +2 -0
- package/dist/instr/meteora_dlmm_ix.js +134 -0
- package/dist/instr/meteora_pools_ix.d.ts +2 -0
- package/dist/instr/meteora_pools_ix.js +78 -0
- package/dist/instr/mod.d.ts +18 -0
- package/dist/instr/mod.js +129 -0
- package/dist/instr/orca_whirlpool_ix.d.ts +8 -0
- package/dist/instr/orca_whirlpool_ix.js +119 -0
- package/dist/instr/program_ids.d.ts +4 -0
- package/dist/instr/program_ids.js +20 -0
- package/dist/instr/pump_fees_ix.d.ts +2 -0
- package/dist/instr/pump_fees_ix.js +168 -0
- package/dist/instr/pumpfun_ix.d.ts +6 -0
- package/dist/instr/pumpfun_ix.js +448 -0
- package/dist/instr/pumpswap_ix.d.ts +5 -0
- package/dist/instr/pumpswap_ix.js +270 -0
- package/dist/instr/raydium_amm_v4_ix.d.ts +6 -0
- package/dist/instr/raydium_amm_v4_ix.js +112 -0
- package/dist/instr/raydium_clmm_ix.d.ts +5 -0
- package/dist/instr/raydium_clmm_ix.js +184 -0
- package/dist/instr/raydium_cpmm_ix.d.ts +5 -0
- package/dist/instr/raydium_cpmm_ix.js +109 -0
- package/dist/instr/raydium_launchlab_ix.d.ts +8 -0
- package/dist/instr/raydium_launchlab_ix.js +125 -0
- package/dist/instr/rust_aliases.d.ts +10 -0
- package/dist/instr/rust_aliases.js +20 -0
- package/dist/instr/utils.d.ts +10 -0
- package/dist/instr/utils.js +35 -0
- package/dist/logs/discriminator_lut.d.ts +19 -0
- package/dist/logs/discriminator_lut.js +62 -0
- package/dist/logs/meteora_amm.d.ts +8 -0
- package/dist/logs/meteora_amm.js +113 -0
- package/dist/logs/meteora_damm.d.ts +5 -0
- package/dist/logs/meteora_damm.js +367 -0
- package/dist/logs/meteora_dbc.d.ts +11 -0
- package/dist/logs/meteora_dbc.js +142 -0
- package/dist/logs/meteora_dlmm.d.ts +6 -0
- package/dist/logs/meteora_dlmm.js +201 -0
- package/dist/logs/optimized_matcher.d.ts +11 -0
- package/dist/logs/optimized_matcher.js +941 -0
- package/dist/logs/orca.d.ts +6 -0
- package/dist/logs/orca.js +148 -0
- package/dist/logs/program_data.d.ts +2 -0
- package/dist/logs/program_data.js +20 -0
- package/dist/logs/program_log_discriminators.d.ts +80 -0
- package/dist/logs/program_log_discriminators.js +88 -0
- package/dist/logs/pump.d.ts +14 -0
- package/dist/logs/pump.js +378 -0
- package/dist/logs/pump_amm.d.ts +9 -0
- package/dist/logs/pump_amm.js +418 -0
- package/dist/logs/pump_fees.d.ts +23 -0
- package/dist/logs/pump_fees.js +364 -0
- package/dist/logs/raydium_amm.d.ts +9 -0
- package/dist/logs/raydium_amm.js +224 -0
- package/dist/logs/raydium_clmm.d.ts +17 -0
- package/dist/logs/raydium_clmm.js +624 -0
- package/dist/logs/raydium_cpmm.d.ts +7 -0
- package/dist/logs/raydium_cpmm.js +121 -0
- package/dist/logs/raydium_launchlab.d.ts +10 -0
- package/dist/logs/raydium_launchlab.js +84 -0
- package/dist/logs/raydium_launchpad.d.ts +12 -0
- package/dist/logs/raydium_launchpad.js +92 -0
- package/dist/logs/rust_aliases.d.ts +7 -0
- package/dist/logs/rust_aliases.js +16 -0
- package/dist/parser_alias.d.ts +3 -0
- package/dist/parser_alias.js +2 -0
- package/dist/rpc_parser.d.ts +17 -0
- package/dist/rpc_parser.js +39 -0
- package/dist/rpc_transaction.d.ts +27 -0
- package/dist/rpc_transaction.js +416 -0
- package/dist/shredstream/alt_lookup.d.ts +9 -0
- package/dist/shredstream/alt_lookup.js +70 -0
- package/dist/shredstream/client.d.ts +65 -0
- package/dist/shredstream/client.js +403 -0
- package/dist/shredstream/config.d.ts +30 -0
- package/dist/shredstream/config.js +34 -0
- package/dist/shredstream/entries_decode.d.ts +28 -0
- package/dist/shredstream/entries_decode.js +251 -0
- package/dist/shredstream/index.d.ts +17 -0
- package/dist/shredstream/index.js +33 -0
- package/dist/shredstream/instruction_parse.d.ts +34 -0
- package/dist/shredstream/instruction_parse.js +79 -0
- package/dist/shredstream/proto_types.d.ts +9 -0
- package/dist/shredstream/proto_types.js +2 -0
- package/dist/shredstream/shredstream.proto +15 -0
- package/dist/shredstream/wire_to_shred_tx.d.ts +2 -0
- package/dist/shredstream/wire_to_shred_tx.js +59 -0
- package/dist/util/binary.d.ts +14 -0
- package/dist/util/binary.js +82 -0
- package/dist/util/market.d.ts +18 -0
- package/dist/util/market.js +54 -0
- package/dist/warmup.d.ts +3 -0
- package/dist/warmup.js +23 -0
- package/package.json +61 -0
package/.env.example
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# 复制本文件为 `.env` 并填写真实值(`.env` 已在 .gitignore,勿提交密钥)
|
|
2
|
+
# Copy to `.env` and fill in real values (`.env` is gitignored)
|
|
3
|
+
|
|
4
|
+
# --- Yellowstone gRPC(跑 gRPC 示例、npx tsx scripts/test-grpc-ts.ts / debug-grpc-ts.ts 时必填)---
|
|
5
|
+
GRPC_URL=https://your-yellowstone-host:443
|
|
6
|
+
GRPC_TOKEN=your_x_token_here
|
|
7
|
+
|
|
8
|
+
# --- 可选:仅 npx tsx scripts/test-grpc-ts.ts ---
|
|
9
|
+
# MAX_EVENTS=0
|
|
10
|
+
# TIMEOUT_MS=0
|
|
11
|
+
# JSON_PRETTY=0
|
|
12
|
+
# JSON_MAX_CHARS=
|
|
13
|
+
|
|
14
|
+
# --- 可选:仅 examples/parse_tx_by_signature.ts(HTTP RPC,非 gRPC)---
|
|
15
|
+
# TX_SIGNATURE=
|
|
16
|
+
# RPC_URL=https://api.mainnet-beta.solana.com
|
|
17
|
+
|
|
18
|
+
# --- ShredStream 示例(examples/shredstream_*.ts;亦可 CLI:--url / --rpc)---
|
|
19
|
+
# SHREDSTREAM_URL=http://127.0.0.1:10800
|
|
20
|
+
# 别名: SHRED_URL
|
|
21
|
+
# PumpFun ShredStream 示例拉 ALT 时需 HTTP RPC(可与上栏 RPC_URL 共用):
|
|
22
|
+
# RPC_URL=https://api.mainnet-beta.solana.com
|
|
23
|
+
# MAX_EVENTS=0
|
|
24
|
+
# SHREDSTREAM_STATS_SEC=0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2024 MiracleAI-Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>⚡ Sol Parser SDK - Node.js</h1>
|
|
3
|
+
<h3><em>High-performance Solana DEX event parser for Node.js/TypeScript</em></h3>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/sol-parser-sdk"><img src="https://img.shields.io/badge/npm-sol--parser--sdk-red.svg" alt="npm"></a>
|
|
8
|
+
<a href="https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="./README_CN.md">中文</a> |
|
|
13
|
+
<a href="./README.md">English</a> |
|
|
14
|
+
<a href="https://fnzero.dev/">Website</a> |
|
|
15
|
+
<a href="https://t.me/fnzero_group">Telegram</a> |
|
|
16
|
+
<a href="https://discord.gg/vuazbGkqQE">Discord</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
> ☕ **Support This Project**
|
|
20
|
+
>
|
|
21
|
+
> 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!
|
|
22
|
+
>
|
|
23
|
+
> **Donation Wallet:** `6oW7AXz1yRb57pYSxysuXnMs2aR1ha5rzGzReZ1MjPV8`
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Other language SDKs
|
|
28
|
+
|
|
29
|
+
| Language | Repository |
|
|
30
|
+
|----------|------------|
|
|
31
|
+
| Rust | [sol-parser-sdk](https://github.com/0xfnzero/sol-parser-sdk) |
|
|
32
|
+
| Node.js | [sol-parser-sdk-nodejs](https://github.com/0xfnzero/sol-parser-sdk-nodejs) |
|
|
33
|
+
| Python | [sol-parser-sdk-python](https://github.com/0xfnzero/sol-parser-sdk-python) |
|
|
34
|
+
| Go | [sol-parser-sdk-golang](https://github.com/0xfnzero/sol-parser-sdk-golang) |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## What This SDK Is For
|
|
39
|
+
|
|
40
|
+
`sol-parser-sdk` is the TypeScript/Node.js implementation of the FnZero Solana DEX parser SDK. The GitHub repository is named `sol-parser-sdk-nodejs` to distinguish it from the Rust/Python/Go repositories. It is built for bots, indexers, copy-trading services, sniper pipelines, and backend systems that need typed DEX events from Yellowstone gRPC, Jito ShredStream, RPC transactions, or protocol account data.
|
|
41
|
+
|
|
42
|
+
| Area | Coverage |
|
|
43
|
+
|------|----------|
|
|
44
|
+
| Parser inputs | Yellowstone gRPC, ShredStream, RPC transactions, encoded transactions, protocol account data |
|
|
45
|
+
| DEX protocols | PumpFun, PumpSwap, Pump Fees, Raydium LaunchLab, Raydium CPMM, Raydium CLMM, Raydium AMM V4, Meteora DAMM v2, Meteora DLMM, Meteora DBC, Orca Whirlpool |
|
|
46
|
+
| Use cases | Real-time DEX event parsing, token launch monitoring, copy trading, sniper bots, account filling, JSON event pipelines |
|
|
47
|
+
| Runtime | Node.js 18+, TypeScript, npm/yarn/pnpm projects |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## Release notes
|
|
52
|
+
|
|
53
|
+
### v0.5.8
|
|
54
|
+
|
|
55
|
+
- Syncs parser parity with the Rust SDK event model and program routing.
|
|
56
|
+
- Keeps PumpFun create instruction names and ShredStream quote-mint handling aligned across language SDKs.
|
|
57
|
+
- Maintains low-latency gRPC/RPC/ShredStream parsing paths for supported DEX protocols.
|
|
58
|
+
|
|
59
|
+
### v0.5.6
|
|
60
|
+
|
|
61
|
+
- Adds Meteora DBC log parsing with program-context routing and filter parity.
|
|
62
|
+
- Adds Raydium CLMM/CPMM and Orca account parsers and exports.
|
|
63
|
+
- Preserves RPC block transaction indexes and active program context for log parsing.
|
|
64
|
+
- Skips ShredStream instruction parsing early for account-only or empty include-only filters.
|
|
65
|
+
- Tightens ShredStream/RPC filter behavior to match Rust/Python/Go low-latency paths.
|
|
66
|
+
|
|
67
|
+
### v0.5.5
|
|
68
|
+
|
|
69
|
+
- Aligns ShredStream parsing with Rust/Python/Go for low-latency static-account paths.
|
|
70
|
+
- Uses default pubkey placeholders for V0 ALT-loaded instruction accounts instead of dropping the instruction.
|
|
71
|
+
- Adds discriminator fallback when the ShredStream outer program id is ALT-loaded.
|
|
72
|
+
- Improves Pump.fun v2 short-account parsing, create/create_v2 handling, and event-type filter parity.
|
|
73
|
+
- Refreshes multi-protocol routing for Pump.fun, PumpSwap, Pump Fees, Raydium, Orca, and Meteora paths.
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## How to use
|
|
78
|
+
|
|
79
|
+
### 1. Install
|
|
80
|
+
|
|
81
|
+
**From npm**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install sol-parser-sdk@0.5.9
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**From source** (folder may be named `sol-parser-sdk-ts` in a monorepo)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/0xfnzero/sol-parser-sdk-nodejs
|
|
91
|
+
cd sol-parser-sdk-nodejs
|
|
92
|
+
npm install
|
|
93
|
+
# npm run build # only if you import from dist/ instead of examples/tsx → src
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2. Environment (Yellowstone gRPC examples)
|
|
97
|
+
|
|
98
|
+
At the **package root** (next to `package.json`):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cp .env.example .env
|
|
102
|
+
# Set GRPC_URL and GRPC_TOKEN
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
Run examples from that directory so `.env` is picked up.
|
|
106
|
+
|
|
107
|
+
### 3. Smoke test
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx tsx scripts/test-grpc-ts.ts
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
Requires `GRPC_URL` and `GRPC_TOKEN`. See `.env.example` for optional vars (`MAX_EVENTS`, `TIMEOUT_MS`, etc.).
|
|
114
|
+
|
|
115
|
+
### 4. Minimal gRPC subscribe + parse
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import {
|
|
119
|
+
YellowstoneGrpc,
|
|
120
|
+
parseDexEventsFromGrpcTransactionInfo,
|
|
121
|
+
dexEventToJsonString,
|
|
122
|
+
} from "sol-parser-sdk";
|
|
123
|
+
|
|
124
|
+
const ENDPOINT = process.env.GRPC_URL?.trim() ?? "";
|
|
125
|
+
const X_TOKEN = process.env.GRPC_TOKEN?.trim() ?? "";
|
|
126
|
+
if (!ENDPOINT || !X_TOKEN) throw new Error("GRPC_URL and GRPC_TOKEN are required");
|
|
127
|
+
|
|
128
|
+
const client = new YellowstoneGrpc(ENDPOINT, X_TOKEN);
|
|
129
|
+
|
|
130
|
+
const filter = {
|
|
131
|
+
account_include: [
|
|
132
|
+
"6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", // PumpFun
|
|
133
|
+
"pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", // PumpSwap
|
|
134
|
+
],
|
|
135
|
+
account_exclude: [],
|
|
136
|
+
account_required: [],
|
|
137
|
+
vote: false,
|
|
138
|
+
failed: false,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const sub = await client.subscribeTransactions(filter, {
|
|
142
|
+
onUpdate: (update) => {
|
|
143
|
+
const txInfo = update.transaction?.transaction;
|
|
144
|
+
if (!txInfo?.transactionRaw || !txInfo.metaRaw) return;
|
|
145
|
+
const slot = update.transaction!.slot;
|
|
146
|
+
const events = parseDexEventsFromGrpcTransactionInfo(txInfo, slot, undefined);
|
|
147
|
+
for (const ev of events) console.log(dexEventToJsonString(ev, 2));
|
|
148
|
+
},
|
|
149
|
+
onError: (err) => console.error(err.message),
|
|
150
|
+
onEnd: () => {},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
console.log("subscribed", sub.id);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
**Lighter path:** `parseLogsOnly(logs, signature, slot, …)` — no `transactionRaw`; use `applyAccountFillsToLogEvents` if you need filled accounts without full gRPC meta.
|
|
157
|
+
|
|
158
|
+
### 5. ShredStream (HTTP — not Yellowstone gRPC)
|
|
159
|
+
|
|
160
|
+
Uses **`SHREDSTREAM_URL`** or **`SHRED_URL`** (default `http://127.0.0.1:10800`), or CLI **`--url`**. Not `GRPC_URL`.
|
|
161
|
+
|
|
162
|
+
The client decodes gRPC `entries` bytes in **TypeScript** (same layout as the Go `shredstream/entries_decode` path) and deserializes wire transactions with `@solana/web3.js` — **no WebAssembly or wasm-pack build**.
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Without RPC, V0 ALT-loaded account indexes are represented with default pubkey placeholders and parsed best-effort. `shredstream_pumpfun_json.ts` can also use Solana **`RPC_URL`** (or `--rpc`) to expand ALTs when exact loaded-account fields are required.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## Examples
|
|
173
|
+
|
|
174
|
+
From the **package root** after `npm install`. Examples use `npx tsx` and load `src/` directly — **no `npm run build` required** for examples. **Source** is one file per row (click to open on GitHub or npm).
|
|
175
|
+
|
|
176
|
+
| Description | Run command | Source |
|
|
177
|
+
|-------------|-------------|--------|
|
|
178
|
+
| **Scripts** | | |
|
|
179
|
+
| gRPC integration test (PumpFun + PumpSwap, account-filled `DexEvent`) | `npx tsx scripts/test-grpc-ts.ts` | [test-grpc-ts.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/scripts/test-grpc-ts.ts) |
|
|
180
|
+
| Debug: print `metaRaw` / log structure | `npx tsx scripts/debug-grpc-ts.ts` | [debug-grpc-ts.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/scripts/debug-grpc-ts.ts) |
|
|
181
|
+
| **PumpFun** | | |
|
|
182
|
+
| Pretty-print full JSON `DexEvent` over gRPC | `npx tsx examples/pumpfun_grpc_json.ts` | [pumpfun_grpc_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_grpc_json.ts) |
|
|
183
|
+
| PumpFun events + metrics | `npx tsx examples/pumpfun_with_metrics.ts` | [pumpfun_with_metrics.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_with_metrics.ts) |
|
|
184
|
+
| PumpFun trade filter | `npx tsx examples/pumpfun_trade_filter.ts` | [pumpfun_trade_filter.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_trade_filter.ts) |
|
|
185
|
+
| Quick PumpFun connection test | `npx tsx examples/pumpfun_quick_test.ts` | [pumpfun_quick_test.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_quick_test.ts) |
|
|
186
|
+
| **PumpSwap** | | |
|
|
187
|
+
| Pretty-print full JSON `DexEvent` over gRPC | `npx tsx examples/pumpswap_grpc_json.ts` | [pumpswap_grpc_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_grpc_json.ts) |
|
|
188
|
+
| PumpSwap events + metrics | `npx tsx examples/pumpswap_with_metrics.ts` | [pumpswap_with_metrics.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_with_metrics.ts) |
|
|
189
|
+
| PumpSwap ultra-low latency | `npx tsx examples/pumpswap_low_latency.ts` | [pumpswap_low_latency.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_low_latency.ts) |
|
|
190
|
+
| **Meteora DAMM** | | |
|
|
191
|
+
| Meteora DAMM V2 events | `npx tsx examples/meteora_damm_grpc.ts` | [meteora_damm_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/meteora_damm_grpc.ts) |
|
|
192
|
+
| **ShredStream** (HTTP, not Yellowstone gRPC; see **step 5** above) | | |
|
|
193
|
+
| Ultra-low-latency subscribe + queue / latency stats. URL: `--url` / `SHREDSTREAM_URL` / `.env` (default `http://127.0.0.1:10800`). | `npx tsx examples/shredstream_example.ts` | [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts) |
|
|
194
|
+
| PumpFun `DexEvent` JSON from ShredStream; static ALT fallback works without RPC, and Solana **RPC** (`RPC_URL` or `--rpc`) expands full ALT accounts when needed. | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
|
|
195
|
+
| **Multi-protocol** | | |
|
|
196
|
+
| Subscribe to all DEX protocols | `npx tsx examples/multi_protocol_grpc.ts` | [multi_protocol_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/multi_protocol_grpc.ts) |
|
|
197
|
+
| **Utility** | | |
|
|
198
|
+
| Verify `onUpdate` sync errors do not kill the gRPC stream | `npx tsx examples/grpc_onupdate_error_test.ts` | [grpc_onupdate_error_test.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/grpc_onupdate_error_test.ts) |
|
|
199
|
+
| Parse tx by signature (`parseTransactionFromRpc`; not gRPC). Set `TX_SIGNATURE` in `.env` or env. | `npx tsx examples/parse_tx_by_signature.ts` | [parse_tx_by_signature.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/parse_tx_by_signature.ts) |
|
|
200
|
+
|
|
201
|
+
**`npm run` aliases** (same source files as the ShredStream rows above):
|
|
202
|
+
|
|
203
|
+
- `npm run example:shredstream` → [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts)
|
|
204
|
+
- `npm run example:shredstream:subscribe` → [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts)
|
|
205
|
+
- `npm run example:shredstream:pumpfun-json` → [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts)
|
|
206
|
+
|
|
207
|
+
**Env:** gRPC examples need **`GRPC_URL`** + **`GRPC_TOKEN`**. ShredStream uses **`SHREDSTREAM_URL`** / **`SHRED_URL`** or **`--url`**; `shredstream_pumpfun_json` also needs **`RPC_URL`** / **`--rpc`**. See **`.env.example`**.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Protocols
|
|
212
|
+
|
|
213
|
+
PumpFun, PumpSwap, Raydium AMM V4 / CLMM / CPMM, Orca Whirlpool, Meteora DAMM V2 / DLMM, Raydium LaunchLab (see `src/instr/`).
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Useful exports
|
|
218
|
+
|
|
219
|
+
- `parseDexEventsFromGrpcTransactionInfo` — needs `transactionRaw` + `metaRaw` (Rust gRPC parity).
|
|
220
|
+
- `parseRpcTransaction` / `parseTransactionFromRpc` — HTTP RPC path.
|
|
221
|
+
- `dexEventToJsonString` — BigInt-safe JSON.
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run build
|
|
229
|
+
npm run check:migration # parity checks; needs build
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## License
|
|
235
|
+
|
|
236
|
+
MIT — https://github.com/0xfnzero/sol-parser-sdk-nodejs
|
package/README_CN.md
ADDED
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
<h1>⚡ Sol Parser SDK - Node.js</h1>
|
|
3
|
+
<h3><em>高性能 Solana DEX 事件解析(Node.js / TypeScript)</em></h3>
|
|
4
|
+
</div>
|
|
5
|
+
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://www.npmjs.com/package/sol-parser-sdk"><img src="https://img.shields.io/badge/npm-sol--parser--sdk-red.svg" alt="npm"></a>
|
|
8
|
+
<a href="https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-blue.svg" alt="License"></a>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="./README_CN.md">中文</a> |
|
|
13
|
+
<a href="./README.md">English</a> |
|
|
14
|
+
<a href="https://fnzero.dev/">官网</a> |
|
|
15
|
+
<a href="https://t.me/fnzero_group">Telegram</a> |
|
|
16
|
+
<a href="https://discord.gg/vuazbGkqQE">Discord</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
> ☕ **支持本项目**
|
|
20
|
+
>
|
|
21
|
+
> 本 SDK 完全免费且开源。但维护和持续更新需要消耗大量 AI 算力与 Token。如果这个 SDK 对您的开发有帮助,欢迎每月捐赠任意数量的 SOL,您的支持将帮助这个项目持续运行!
|
|
22
|
+
>
|
|
23
|
+
> **捐赠钱包:** `6oW7AXz1yRb57pYSxysuXnMs2aR1ha5rzGzReZ1MjPV8`
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## 其他语言 SDK
|
|
28
|
+
|
|
29
|
+
| 语言 | 仓库 |
|
|
30
|
+
|------|------|
|
|
31
|
+
| Rust | [sol-parser-sdk](https://github.com/0xfnzero/sol-parser-sdk) |
|
|
32
|
+
| Node.js | [sol-parser-sdk-nodejs](https://github.com/0xfnzero/sol-parser-sdk-nodejs) |
|
|
33
|
+
| Python | [sol-parser-sdk-python](https://github.com/0xfnzero/sol-parser-sdk-python) |
|
|
34
|
+
| Go | [sol-parser-sdk-golang](https://github.com/0xfnzero/sol-parser-sdk-golang) |
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## 这个 SDK 适合什么场景
|
|
39
|
+
|
|
40
|
+
`sol-parser-sdk` 是 FnZero Solana DEX 解析 SDK 的 TypeScript/Node.js 版本。GitHub 仓库名为 `sol-parser-sdk-nodejs`,用于和 Rust/Python/Go 仓库区分。它适合 Bot、索引服务、跟单服务、狙击管道和后端系统,从 Yellowstone gRPC、Jito ShredStream、RPC 交易或协议账户数据中解析强类型 DEX 事件。
|
|
41
|
+
|
|
42
|
+
| 方向 | 覆盖范围 |
|
|
43
|
+
|------|----------|
|
|
44
|
+
| 解析输入 | Yellowstone gRPC、ShredStream、RPC 交易、编码交易、协议账户数据 |
|
|
45
|
+
| DEX 协议 | PumpFun、PumpSwap、Pump Fees、Raydium LaunchLab、Raydium CPMM、Raydium CLMM、Raydium AMM V4、Meteora DAMM v2、Meteora DLMM、Meteora DBC、Orca Whirlpool |
|
|
46
|
+
| 使用场景 | 实时 DEX 事件解析、代币发射监控、跟单交易、狙击机器人、账户填充、JSON 事件管道 |
|
|
47
|
+
| 运行环境 | Node.js 18+、TypeScript、npm/yarn/pnpm 项目 |
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## 发布说明
|
|
52
|
+
|
|
53
|
+
### v0.5.8
|
|
54
|
+
|
|
55
|
+
- 与 Rust SDK 的事件模型和 program 路由保持解析对齐。
|
|
56
|
+
- 保持 PumpFun create 指令名与 ShredStream quote-mint 处理在多语言 SDK 中一致。
|
|
57
|
+
- 继续维护支持 DEX 协议的低延迟 gRPC/RPC/ShredStream 解析路径。
|
|
58
|
+
|
|
59
|
+
### v0.5.6
|
|
60
|
+
|
|
61
|
+
- 新增 Meteora DBC 日志解析,并按当前 program context 做路由与过滤。
|
|
62
|
+
- 新增 Raydium CLMM/CPMM、Orca account parser 与导出。
|
|
63
|
+
- RPC 解析保留区块内交易序号,并在日志解析中维护 active program context。
|
|
64
|
+
- ShredStream 对 account-only 或空 include-only filter 直接跳过指令解析。
|
|
65
|
+
- 收紧 ShredStream/RPC 的过滤行为,与 Rust/Python/Go 低延迟路径保持一致。
|
|
66
|
+
|
|
67
|
+
### v0.5.5
|
|
68
|
+
|
|
69
|
+
- ShredStream 低延迟静态账户路径与 Rust/Python/Go 对齐。
|
|
70
|
+
- V0 ALT-loaded 指令账户不再整条跳过,而是用默认 pubkey 占位继续 best-effort 解析。
|
|
71
|
+
- 当 ShredStream 外层 program id 来自 ALT 时,按 discriminator 做候选 program id fallback。
|
|
72
|
+
- 改进 Pump.fun v2 短账户解析、create/create_v2 处理和事件类型过滤一致性。
|
|
73
|
+
- 更新 Pump.fun、PumpSwap、Pump Fees、Raydium、Orca、Meteora 的多协议路由。
|
|
74
|
+
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
## 怎么用
|
|
78
|
+
|
|
79
|
+
### 1. 安装
|
|
80
|
+
|
|
81
|
+
**npm**
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install sol-parser-sdk@0.5.9
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**源码**(monorepo 里目录可能是 `sol-parser-sdk-ts`)
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
git clone https://github.com/0xfnzero/sol-parser-sdk-nodejs
|
|
91
|
+
cd sol-parser-sdk-nodejs
|
|
92
|
+
npm install
|
|
93
|
+
# npm run build # 若从 dist 引用而非 tsx 跑 examples,再执行
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### 2. 环境变量(Yellowstone gRPC 示例)
|
|
97
|
+
|
|
98
|
+
在**包根目录**(与 `package.json` 同级):
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
cp .env.example .env
|
|
102
|
+
# 填写 GRPC_URL、GRPC_TOKEN
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
在该目录下执行下面的 `npx tsx`,以便加载 `.env`。
|
|
106
|
+
|
|
107
|
+
### 3. 冒烟
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
npx tsx scripts/test-grpc-ts.ts
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
需要 `GRPC_URL`、`GRPC_TOKEN`。更多变量见 `.env.example`(如 `MAX_EVENTS`、`TIMEOUT_MS`)。
|
|
114
|
+
|
|
115
|
+
### 4. 最小 gRPC 订阅示例
|
|
116
|
+
|
|
117
|
+
```typescript
|
|
118
|
+
import {
|
|
119
|
+
YellowstoneGrpc,
|
|
120
|
+
parseDexEventsFromGrpcTransactionInfo,
|
|
121
|
+
dexEventToJsonString,
|
|
122
|
+
} from "sol-parser-sdk";
|
|
123
|
+
|
|
124
|
+
const ENDPOINT = process.env.GRPC_URL?.trim() ?? "";
|
|
125
|
+
const X_TOKEN = process.env.GRPC_TOKEN?.trim() ?? "";
|
|
126
|
+
if (!ENDPOINT || !X_TOKEN) throw new Error("GRPC_URL and GRPC_TOKEN are required");
|
|
127
|
+
|
|
128
|
+
const client = new YellowstoneGrpc(ENDPOINT, X_TOKEN);
|
|
129
|
+
|
|
130
|
+
const filter = {
|
|
131
|
+
account_include: [
|
|
132
|
+
"6EF8rrecthR5Dkzon8Nwu78hRvfCKubJ14M5uBEwF6P", // PumpFun
|
|
133
|
+
"pAMMBay6oceH9fJKBRHGP5D4bD4sWpmSwMn52FMfXEA", // PumpSwap
|
|
134
|
+
],
|
|
135
|
+
account_exclude: [],
|
|
136
|
+
account_required: [],
|
|
137
|
+
vote: false,
|
|
138
|
+
failed: false,
|
|
139
|
+
};
|
|
140
|
+
|
|
141
|
+
const sub = await client.subscribeTransactions(filter, {
|
|
142
|
+
onUpdate: (update) => {
|
|
143
|
+
const txInfo = update.transaction?.transaction;
|
|
144
|
+
if (!txInfo?.transactionRaw || !txInfo.metaRaw) return;
|
|
145
|
+
const slot = update.transaction!.slot;
|
|
146
|
+
const events = parseDexEventsFromGrpcTransactionInfo(txInfo, slot, undefined);
|
|
147
|
+
for (const ev of events) console.log(dexEventToJsonString(ev, 2));
|
|
148
|
+
},
|
|
149
|
+
onError: (err) => console.error(err.message),
|
|
150
|
+
onEnd: () => {},
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
console.log("subscribed", sub.id);
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
更轻量:仅用日志用 `parseLogsOnly`;要补账户可再配合 `applyAccountFillsToLogEvents`。
|
|
157
|
+
|
|
158
|
+
### 5. ShredStream(HTTP,不是 Yellowstone gRPC)
|
|
159
|
+
|
|
160
|
+
使用 **`SHREDSTREAM_URL`** / **`SHRED_URL`**(默认 `http://127.0.0.1:10800`)或命令行 **`--url`**,**不用** `GRPC_URL`。
|
|
161
|
+
|
|
162
|
+
客户端在 **TypeScript** 中解码 gRPC `entries` 负载(布局与 Go `shredstream/entries_decode` 一致),并用 `@solana/web3.js` 反序列化线格式交易,**无需 WebAssembly / wasm-pack**。
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npx tsx examples/shredstream_example.ts -- --url=http://127.0.0.1:10800
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
无 RPC 时,V0 ALT-loaded 账户索引用默认 pubkey 占位并继续 best-effort 解析。若需要精确的 ALT 加载账户字段,`shredstream_pumpfun_json.ts` 也可以使用 Solana **`RPC_URL`**(或 `--rpc`)展开 ALT。
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## 示例列表
|
|
173
|
+
|
|
174
|
+
在**包根目录**执行,`npm install` 后即可。示例用 `npx tsx` 直接加载 **`src/`**,**不必先 `npm run build`**。**源码**列每个文件单独一行,链接指向 GitHub 上的对应源码(GitHub / npm 均可点击)。
|
|
175
|
+
|
|
176
|
+
| 描述 | 运行命令 | 源码 |
|
|
177
|
+
|------|----------|------|
|
|
178
|
+
| **本包脚本** | | |
|
|
179
|
+
| gRPC 集成测试(PumpFun + PumpSwap,账户填充后的 `DexEvent`) | `npx tsx scripts/test-grpc-ts.ts` | [test-grpc-ts.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/scripts/test-grpc-ts.ts) |
|
|
180
|
+
| 调试:打印 `metaRaw` / 日志结构 | `npx tsx scripts/debug-grpc-ts.ts` | [debug-grpc-ts.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/scripts/debug-grpc-ts.ts) |
|
|
181
|
+
| **PumpFun** | | |
|
|
182
|
+
| gRPC 输出完整 JSON `DexEvent` | `npx tsx examples/pumpfun_grpc_json.ts` | [pumpfun_grpc_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_grpc_json.ts) |
|
|
183
|
+
| PumpFun 事件 + 性能指标 | `npx tsx examples/pumpfun_with_metrics.ts` | [pumpfun_with_metrics.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_with_metrics.ts) |
|
|
184
|
+
| PumpFun 交易类型过滤 | `npx tsx examples/pumpfun_trade_filter.ts` | [pumpfun_trade_filter.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_trade_filter.ts) |
|
|
185
|
+
| PumpFun 快速连接测试 | `npx tsx examples/pumpfun_quick_test.ts` | [pumpfun_quick_test.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpfun_quick_test.ts) |
|
|
186
|
+
| **PumpSwap** | | |
|
|
187
|
+
| gRPC 输出完整 JSON `DexEvent` | `npx tsx examples/pumpswap_grpc_json.ts` | [pumpswap_grpc_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_grpc_json.ts) |
|
|
188
|
+
| PumpSwap 事件 + 性能指标 | `npx tsx examples/pumpswap_with_metrics.ts` | [pumpswap_with_metrics.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_with_metrics.ts) |
|
|
189
|
+
| PumpSwap 超低延迟 | `npx tsx examples/pumpswap_low_latency.ts` | [pumpswap_low_latency.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/pumpswap_low_latency.ts) |
|
|
190
|
+
| **Meteora DAMM** | | |
|
|
191
|
+
| Meteora DAMM V2 事件 | `npx tsx examples/meteora_damm_grpc.ts` | [meteora_damm_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/meteora_damm_grpc.ts) |
|
|
192
|
+
| **ShredStream**(HTTP,**非** Yellowstone gRPC;端点见上文步骤 5) | | |
|
|
193
|
+
| 超低延迟订阅、队列与延迟统计。端点:`--url` / `SHREDSTREAM_URL` / `.env`(默认 `http://127.0.0.1:10800`)。 | `npx tsx examples/shredstream_example.ts` | [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts) |
|
|
194
|
+
| ShredStream → PumpFun `DexEvent` JSON;无 RPC 时可静态 ALT fallback,配置 Solana **RPC**(`RPC_URL` 或 `--rpc`)时可展开完整 ALT 账户。 | `npx tsx examples/shredstream_pumpfun_json.ts` | [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts) |
|
|
195
|
+
| **多协议** | | |
|
|
196
|
+
| 同时订阅所有 DEX 协议 | `npx tsx examples/multi_protocol_grpc.ts` | [multi_protocol_grpc.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/multi_protocol_grpc.ts) |
|
|
197
|
+
| **工具** | | |
|
|
198
|
+
| 验证 onUpdate 同步错误不会打断 gRPC 流 | `npx tsx examples/grpc_onupdate_error_test.ts` | [grpc_onupdate_error_test.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/grpc_onupdate_error_test.ts) |
|
|
199
|
+
| 按签名解析交易(`parseTransactionFromRpc`;非 gRPC)。在 `.env` 或环境中设置 `TX_SIGNATURE`。 | `npx tsx examples/parse_tx_by_signature.ts` | [parse_tx_by_signature.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/parse_tx_by_signature.ts) |
|
|
200
|
+
|
|
201
|
+
**`npm run` 别名**(与上表 ShredStream 行同一源码文件,每行一条):
|
|
202
|
+
|
|
203
|
+
- `npm run example:shredstream` → [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts)
|
|
204
|
+
- `npm run example:shredstream:subscribe` → [shredstream_example.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_example.ts)
|
|
205
|
+
- `npm run example:shredstream:pumpfun-json` → [shredstream_pumpfun_json.ts](https://github.com/0xfnzero/sol-parser-sdk-nodejs/blob/main/examples/shredstream_pumpfun_json.ts)
|
|
206
|
+
|
|
207
|
+
**环境变量:** gRPC 示例需要 **`GRPC_URL`**、**`GRPC_TOKEN`**。ShredStream 使用 **`SHREDSTREAM_URL`** / **`SHRED_URL`** 或 **`--url`**;**`shredstream_pumpfun_json`** 另需 **`RPC_URL`** / **`--rpc`**。详见 **`.env.example`**。
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## 协议
|
|
212
|
+
|
|
213
|
+
PumpFun、PumpSwap、Raydium AMM V4 / CLMM / CPMM、Orca Whirlpool、Meteora DAMM V2 / DLMM、Raydium LaunchLab(见 `src/instr/`)。
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## 常用 API
|
|
218
|
+
|
|
219
|
+
- `parseDexEventsFromGrpcTransactionInfo` — 需要 `transactionRaw` + `metaRaw`(与 Rust gRPC 对齐)。
|
|
220
|
+
- `parseRpcTransaction` / `parseTransactionFromRpc` — HTTP RPC 全量解析。
|
|
221
|
+
- `dexEventToJsonString` — 含 BigInt 的安全 JSON 输出。
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## 开发
|
|
226
|
+
|
|
227
|
+
```bash
|
|
228
|
+
npm run build
|
|
229
|
+
npm run check:migration # 对齐与校验,需先 build
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 许可证
|
|
235
|
+
|
|
236
|
+
MIT — https://github.com/0xfnzero/sol-parser-sdk-nodejs
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { EventMetadata } from "../core/metadata.js";
|
|
2
|
+
import type { DexEvent } from "../core/dex_event.js";
|
|
3
|
+
import type { AccountData } from "./types.js";
|
|
4
|
+
import type { EventTypeFilter } from "../grpc/types.js";
|
|
5
|
+
export type { AccountData } from "./types.js";
|
|
6
|
+
export { parseNonceAccount, isNonceAccount } from "./nonce.js";
|
|
7
|
+
export { parseTokenAccount } from "./token.js";
|
|
8
|
+
export { parsePumpfunGlobal, parsePumpfunBondingCurve, parsePumpfunFeeConfig, parsePumpfunSharingConfig, parsePumpfunGlobalVolumeAccumulator, parsePumpfunUserVolumeAccumulator, parsePumpfunAccount, isPumpfunGlobalAccount, isPumpfunBondingCurveAccount, isPumpfunFeeConfigAccount, isPumpfunSharingConfigAccount, isPumpfunGlobalVolumeAccumulatorAccount, isPumpfunUserVolumeAccumulatorAccount, } from "./pumpfun.js";
|
|
9
|
+
export { parsePumpswapGlobalConfig, parsePumpswapPool, parsePumpswapAccount, isGlobalConfigAccount, isPoolAccount, } from "./pumpswap.js";
|
|
10
|
+
export { parseRaydiumClmmAccount, parseRaydiumClmmAmmConfig, parseRaydiumClmmPoolState, parseRaydiumClmmTickArrayState, parseRaydiumCpmmAccount, parseRaydiumCpmmAmmConfig, parseRaydiumCpmmPoolState, parseOrcaWhirlpoolAccount, parseOrcaWhirlpool, parseOrcaPosition, parseOrcaTickArray, parseOrcaFeeTier, parseOrcaWhirlpoolsConfig, isRaydiumClmmAmmConfigAccount, isRaydiumClmmPoolStateAccount, isRaydiumClmmTickArrayStateAccount, isRaydiumCpmmAmmConfigAccount, isRaydiumCpmmPoolStateAccount, isOrcaWhirlpoolAccount, isOrcaPositionAccount, isOrcaTickArrayAccount, isOrcaFeeTierAccount, isOrcaWhirlpoolsConfigAccount, } from "./raydium_orca.js";
|
|
11
|
+
export { hasDiscriminator } from "./utils.js";
|
|
12
|
+
export { userWalletPubkeyForOnchainAccount } from "./wallet_resolve.js";
|
|
13
|
+
export { rpcResolveUserWalletPubkey } from "./rpc_wallet.js";
|
|
14
|
+
/** 账户数据统一解析入口 */
|
|
15
|
+
export declare function parseAccountUnified(account: AccountData, metadata: EventMetadata, eventTypeFilter?: EventTypeFilter): DexEvent | null;
|