@validators-dao/solana-entry-decoder 1.0.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 +98 -1
- package/package.json +5 -1
package/README.md
CHANGED
|
@@ -1,7 +1,104 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<a href="https://slv.dev/" target="_blank">
|
|
3
|
+
<img src="https://storage.validators.solutions/SolanaStreamSDK.jpg" alt="SolanaStreamSDK" />
|
|
4
|
+
</a>
|
|
5
|
+
<a href="https://twitter.com/intent/follow?screen_name=ValidatorsDAO" target="_blank">
|
|
6
|
+
<img src="https://img.shields.io/twitter/follow/ValidatorsDAO.svg?label=Follow%20@ValidatorsDAO" alt="Follow @ValidatorsDAO" />
|
|
7
|
+
</a>
|
|
8
|
+
<a href="https://www.npmjs.com/package/@validators-dao/solana-stream-sdk">
|
|
9
|
+
<img alt="NPM Version" src="https://img.shields.io/npm/v/@validators-dao/solana-stream-sdk?color=268bd2&label=version&logo=npm">
|
|
10
|
+
</a>
|
|
11
|
+
<a href="https://www.npmjs.com/package/@validators-dao/solana-stream-sdk">
|
|
12
|
+
<img alt="NPM Downloads" src="https://img.shields.io/npm/dt/@validators-dao/solana-stream-sdk?color=cb4b16&label=npm%20downloads">
|
|
13
|
+
</a>
|
|
14
|
+
<a aria-label="License" href="https://github.com/ValidatorsDAO/solana-stream/blob/main/LICENSE.txt">
|
|
15
|
+
<img alt="" src="https://badgen.net/badge/license/Apache/blue">
|
|
16
|
+
</a>
|
|
17
|
+
<a aria-label="Code of Conduct" href="https://github.com/ValidatorsDAO/solana-stream/blob/main/CODE_OF_CONDUCT.md">
|
|
18
|
+
<img alt="" src="https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg">
|
|
19
|
+
</a>
|
|
20
|
+
</p>
|
|
21
|
+
|
|
22
|
+
# @validators-dao/solana-entry-decoder
|
|
23
|
+
|
|
24
|
+
A TypeScript utility provided by Validators DAO for decoding Solana shred entry data.
|
|
25
|
+
|
|
26
|
+
<a href="https://solana.com/">
|
|
27
|
+
<img src="https://storage.slv.dev/PoweredBySolana.svg" alt="Powered By Solana" width="200px" height="95px">
|
|
28
|
+
</a>
|
|
29
|
+
|
|
30
|
+
This package is designed to decode Solana entries from shreds, making it easier to work with real-time data streams from the Solana blockchain.
|
|
31
|
+
|
|
32
|
+
## Why Rust?
|
|
33
|
+
|
|
34
|
+
TypeScript alone cannot decode Solana shreds effectively. Therefore, Rust is utilized for efficient decoding, converting the data into JSON format suitable for handling in TypeScript environments.
|
|
35
|
+
|
|
36
|
+
## Leveraging NAPI instead of WASM
|
|
37
|
+
|
|
38
|
+
This utility leverages **NAPI (Node.js API)** instead of WebAssembly (WASM) to decode Solana shred entry data, providing significant practical advantages.
|
|
39
|
+
|
|
40
|
+
### Benefits of Using NAPI:
|
|
41
|
+
|
|
42
|
+
- **Performance**: NAPI delivers near-native performance by directly interfacing with Rust code through bindings, minimizing overhead compared to WebAssembly.
|
|
43
|
+
|
|
44
|
+
- **Seamless Integration**: NAPI simplifies the interoperation between Node.js and Rust, enabling straightforward calls and efficient memory management without extensive tooling or additional complexity.
|
|
45
|
+
|
|
46
|
+
- **Memory Efficiency**: Efficient memory handling with NAPI significantly reduces risks associated with memory leaks or unnecessary garbage collection, common pitfalls when using WASM.
|
|
47
|
+
|
|
48
|
+
- **Enhanced Debugging and Maintainability**: Debugging native modules built with NAPI offers clearer stack traces and robust debugging capabilities, overcoming the opaque debugging difficulties often encountered with WASM.
|
|
49
|
+
|
|
50
|
+
- **Wide Compatibility**: Modules built with NAPI are natively compatible across various Node.js versions without requiring extra compilation steps or environment-specific adjustments.
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
npm install @validators-dao/solana-entry-decoder
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Or using pnpm:
|
|
59
|
+
|
|
60
|
+
```bash
|
|
61
|
+
pnpm add @validators-dao/solana-entry-decoder
|
|
62
|
+
```
|
|
63
|
+
|
|
1
64
|
## Usage
|
|
2
65
|
|
|
3
|
-
|
|
66
|
+
### Direct Usage (Node.js ES Modules)
|
|
67
|
+
|
|
68
|
+
To directly import this package, you'll need to use the Node.js `require` function:
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
4
71
|
import { createRequire } from 'node:module'
|
|
5
72
|
const require = createRequire(import.meta.url)
|
|
6
73
|
const { decodeSolanaEntries } = require('@validators-dao/solana-entry-decoder')
|
|
7
74
|
```
|
|
75
|
+
|
|
76
|
+
### Recommended Usage
|
|
77
|
+
|
|
78
|
+
For TypeScript projects, it's recommended to import directly from [Solana Stream SDK](https://www.npmjs.com/package/@validators-dao/solana-stream-sdk), which exports the decoder in a more convenient way:
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
pnpm add @validators-dao/solana-stream-sdk
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
```typescript
|
|
85
|
+
import { decodeSolanaEntries } from '@validators-dao/solana-stream-sdk'
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
You can find comprehensive usage examples [here](https://github.com/ValidatorsDAO/solana-stream/tree/main/client/shreds-ts).
|
|
89
|
+
|
|
90
|
+
## Repository
|
|
91
|
+
|
|
92
|
+
This utility is part of the [Solana Stream Monorepo](https://github.com/ValidatorsDAO/solana-stream).
|
|
93
|
+
|
|
94
|
+
## Support
|
|
95
|
+
|
|
96
|
+
For support and further questions, please join our [Discord server](https://discord.gg/C7ZQSrCkYR).
|
|
97
|
+
|
|
98
|
+
## License
|
|
99
|
+
|
|
100
|
+
Apache-2.0 License. Refer to the [license document](https://www.apache.org/licenses/LICENSE-2.0).
|
|
101
|
+
|
|
102
|
+
## Code of Conduct
|
|
103
|
+
|
|
104
|
+
All contributors must adhere to our [Contributor Covenant](https://github.com/ValidatorsDAO/solana-stream/blob/main/CODE_OF_CONDUCT.md).
|
package/package.json
CHANGED
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@validators-dao/solana-entry-decoder",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"types": "index.d.ts",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "https://github.com/ValidatorsDAO/solana-stream.git"
|
|
9
|
+
},
|
|
6
10
|
"devDependencies": {
|
|
7
11
|
"@napi-rs/cli": "2.18.4"
|
|
8
12
|
},
|