@validators-dao/solana-stream-sdk 0.12.0 → 1.0.1
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/README.md +46 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -27,6 +27,32 @@ Solana Stream SDK by Validators DAO - A TypeScript SDK for streaming Solana bloc
|
|
|
27
27
|
<img src="https://storage.slv.dev/PoweredBySolana.svg" alt="Powered By Solana" width="200px" height="95px">
|
|
28
28
|
</a>
|
|
29
29
|
|
|
30
|
+
## What's New in v1.0.1
|
|
31
|
+
|
|
32
|
+
- Yellowstone Geyser gRPC connection upgraded to an NAPI-RS-powered client for better backpressure
|
|
33
|
+
- NAPI-powered Shreds client/decoder so TypeScript can tap Rust-grade throughput
|
|
34
|
+
- Improved backpressure handling and up to 4x streaming efficiency (400% improvement)
|
|
35
|
+
- Faster real-time Geyser streams for TypeScript clients with lower overhead
|
|
36
|
+
|
|
37
|
+
## Production-Ready Geyser Client (TypeScript Best Practices)
|
|
38
|
+
|
|
39
|
+
- Ping/Pong handling to keep Yellowstone gRPC streams alive
|
|
40
|
+
- Exponential reconnect backoff plus `fromSlot` gap recovery
|
|
41
|
+
- Bounded in-memory queue with drop logging for backpressure safety
|
|
42
|
+
- Hot-swappable subscriptions via a JSON file (no reconnect)
|
|
43
|
+
- Optional runtime metrics logging (rates, queue size, drops)
|
|
44
|
+
- Default filters drop vote/failed transactions to reduce traffic
|
|
45
|
+
|
|
46
|
+
Tip: start with slots, then add filters as needed. When resuming from `fromSlot`,
|
|
47
|
+
duplicates are expected.
|
|
48
|
+
|
|
49
|
+
## Performance Highlights
|
|
50
|
+
|
|
51
|
+
- NAPI-powered Geyser gRPC and Shreds client/decoder for high-throughput streaming
|
|
52
|
+
- TypeScript ergonomics with Rust-grade performance under the hood
|
|
53
|
+
- For the absolute fastest signal path, see Rust UDP Shreds in the repo:
|
|
54
|
+
https://github.com/ValidatorsDAO/solana-stream#shreds-udp-pumpfun-watcher-rust
|
|
55
|
+
|
|
30
56
|
## Installation
|
|
31
57
|
|
|
32
58
|
```bash
|
|
@@ -117,16 +143,15 @@ const geyser = async () => {
|
|
|
117
143
|
const maxRetries = 2000000
|
|
118
144
|
|
|
119
145
|
const createClient = () => {
|
|
120
|
-
const token = process.env.X_TOKEN
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
throw new Error('X_TOKEN environment variable is not set')
|
|
146
|
+
const token = process.env.X_TOKEN?.trim()
|
|
147
|
+
if (!token) {
|
|
148
|
+
console.warn('X_TOKEN not set. Connecting without auth.')
|
|
124
149
|
}
|
|
125
150
|
const endpoint = `https://grpc-ams-3.erpc.global`
|
|
126
151
|
console.log('Connecting to', endpoint)
|
|
127
152
|
|
|
128
153
|
// @ts-ignore ignore
|
|
129
|
-
return new GeyserClient(endpoint, token, undefined)
|
|
154
|
+
return new GeyserClient(endpoint, token || undefined, undefined)
|
|
130
155
|
}
|
|
131
156
|
|
|
132
157
|
const connect = async (retries: number = 0): Promise<void> => {
|
|
@@ -136,6 +161,7 @@ const geyser = async () => {
|
|
|
136
161
|
|
|
137
162
|
try {
|
|
138
163
|
const client = createClient()
|
|
164
|
+
await client.connect()
|
|
139
165
|
const version = await client.getVersion()
|
|
140
166
|
console.log('version: ', version)
|
|
141
167
|
const stream = await client.subscribe()
|
|
@@ -200,7 +226,7 @@ const main = async () => {
|
|
|
200
226
|
main()
|
|
201
227
|
```
|
|
202
228
|
|
|
203
|
-
|
|
229
|
+
If your endpoint requires authentication, set the `X_TOKEN` environment variable with your gRPC token.
|
|
204
230
|
|
|
205
231
|
Please note that the url endpoint in the example is for demonstration purposes. You should replace it with the actual endpoint you are using.
|
|
206
232
|
|
|
@@ -266,7 +292,7 @@ Ensure the environment variable `SHREDS_ENDPOINT` is set correctly.
|
|
|
266
292
|
|
|
267
293
|
## Features
|
|
268
294
|
|
|
269
|
-
- **Geyser Client**: Direct access to
|
|
295
|
+
- **Geyser Client**: Direct access to the Yellowstone gRPC client for real-time Solana data streaming
|
|
270
296
|
- **Shredstream Client**: Real-time entry streaming and decoding from Solana Shreds
|
|
271
297
|
- **TypeScript Types**: Comprehensive TypeScript types for all filter and subscription interfaces
|
|
272
298
|
- **Utilities**: Includes bs58 for Solana address and data encoding/decoding, gRPC utilities, and entry decoding functions
|
|
@@ -298,7 +324,7 @@ Ensure the environment variable `SHREDS_ENDPOINT` is set correctly.
|
|
|
298
324
|
|
|
299
325
|
## Dependencies
|
|
300
326
|
|
|
301
|
-
-
|
|
327
|
+
- Yellowstone gRPC client: For gRPC streaming capabilities
|
|
302
328
|
- `bs58`: For base58 encoding/decoding
|
|
303
329
|
- `@validators-dao/solana-entry-decoder`: Utility for decoding Solana shred entries.
|
|
304
330
|
- `@validators-dao/solana-shreds-client`: Solana Shreds Client for Scale. (NAPI-RS)
|
|
@@ -316,6 +342,18 @@ Other reports and suggestions are also highly appreciated.
|
|
|
316
342
|
You can also join discussions or share feedback on Validators DAO's Discord community:
|
|
317
343
|
https://discord.gg/C7ZQSrCkYR
|
|
318
344
|
|
|
345
|
+
## Shreds UDP configuration (Rust client)
|
|
346
|
+
|
|
347
|
+
- Load base config via `SHREDS_UDP_CONFIG=/path/to/config.{json,toml}`; env vars then override it.
|
|
348
|
+
- Core envs:
|
|
349
|
+
- `SOLANA_RPC_ENDPOINT`
|
|
350
|
+
- Logs: `SHREDS_UDP_LOG_RAW`, `SHREDS_UDP_LOG_SHREDS`, `SHREDS_UDP_LOG_ENTRIES`, `SHREDS_UDP_LOG_WATCH_HITS`, `SHREDS_UDP_LOG_DEFER`
|
|
351
|
+
- Watch lists: `SHREDS_UDP_WATCH_PROGRAM_IDS`, `SHREDS_UDP_WATCH_AUTHORITIES` (defaults to pump.fun program/authority)
|
|
352
|
+
- Hardening: `SHREDS_UDP_REQUIRE_CODE_MATCH`, `SHREDS_UDP_STRICT_FEC`, `SHREDS_UDP_STRICT_NUM_DATA`, `SHREDS_UDP_STRICT_NUM_CODING`
|
|
353
|
+
- Slot window: `SHREDS_UDP_ROOT_SLOT`, `SHREDS_UDP_MAX_FUTURE` (default 512)
|
|
354
|
+
- TTLs: `SHREDS_UDP_COMPLETED_TTL_MS` (default 30s), `SHREDS_UDP_EVICT_COOLDOWN_MS` (default 300ms), `SHREDS_UDP_WARN_ONCE` (default true)
|
|
355
|
+
- Pump.fun: program and mint-authority pubkeys are fixed; token mint addresses are discovered per transaction at runtime (not hardcoded).
|
|
356
|
+
|
|
319
357
|
## Repository
|
|
320
358
|
|
|
321
359
|
This package is part of the [Solana Stream](https://github.com/ValidatorsDAO/solana-stream) monorepo.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@validators-dao/solana-stream-sdk",
|
|
3
3
|
"description": "Solana Stream SDK by Validators DAO",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "1.0.1",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"LICENSE"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@triton-one/yellowstone-grpc": "
|
|
27
|
+
"@triton-one/yellowstone-grpc": "5.0.1",
|
|
28
28
|
"bs58": "6.0.0",
|
|
29
29
|
"@validators-dao/solana-entry-decoder": "2.3.0",
|
|
30
30
|
"@validators-dao/solana-shreds-client": "1.2.0"
|