@validators-dao/solana-entry-decoder 1.0.0 → 1.0.2

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.
Files changed (2) hide show
  1. package/README.md +100 -1
  2. package/package.json +5 -1
package/README.md CHANGED
@@ -1,7 +1,106 @@
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-API)** instead of WebAssembly (WASM) to decode Solana shred entry data, providing significant practical advantages.
39
+
40
+ Node-API - Node.js: https://nodejs.org/api/n-api.html#node-api
41
+
42
+ ### Benefits of Using NAPI:
43
+
44
+ - **Performance**: NAPI delivers near-native performance by directly interfacing with Rust code through bindings, minimizing overhead compared to WebAssembly.
45
+
46
+ - **Seamless Integration**: NAPI simplifies the interoperation between Node.js and Rust, enabling straightforward calls and efficient memory management without extensive tooling or additional complexity.
47
+
48
+ - **Memory Efficiency**: Efficient memory handling with NAPI significantly reduces risks associated with memory leaks or unnecessary garbage collection, common pitfalls when using WASM.
49
+
50
+ - **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.
51
+
52
+ - **Wide Compatibility**: Modules built with NAPI are natively compatible across various Node.js versions without requiring extra compilation steps or environment-specific adjustments.
53
+
54
+ ## Installation
55
+
56
+ ```bash
57
+ npm install @validators-dao/solana-entry-decoder
58
+ ```
59
+
60
+ Or using pnpm:
61
+
62
+ ```bash
63
+ pnpm add @validators-dao/solana-entry-decoder
64
+ ```
65
+
1
66
  ## Usage
2
67
 
3
- ```TypeScript
68
+ ### Direct Usage (Node.js ES Modules)
69
+
70
+ To directly import this package, you'll need to use the Node.js `require` function:
71
+
72
+ ```typescript
4
73
  import { createRequire } from 'node:module'
5
74
  const require = createRequire(import.meta.url)
6
75
  const { decodeSolanaEntries } = require('@validators-dao/solana-entry-decoder')
7
76
  ```
77
+
78
+ ### Recommended Usage
79
+
80
+ 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:
81
+
82
+ ```bash
83
+ pnpm add @validators-dao/solana-stream-sdk
84
+ ```
85
+
86
+ ```typescript
87
+ import { decodeSolanaEntries } from '@validators-dao/solana-stream-sdk'
88
+ ```
89
+
90
+ You can find comprehensive usage examples [here](https://github.com/ValidatorsDAO/solana-stream/tree/main/client/shreds-ts).
91
+
92
+ ## Repository
93
+
94
+ This utility is part of the [Solana Stream Monorepo](https://github.com/ValidatorsDAO/solana-stream).
95
+
96
+ ## Support
97
+
98
+ For support and further questions, please join our [Discord server](https://discord.gg/C7ZQSrCkYR).
99
+
100
+ ## License
101
+
102
+ Apache-2.0 License. Refer to the [license document](https://www.apache.org/licenses/LICENSE-2.0).
103
+
104
+ ## Code of Conduct
105
+
106
+ 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.0",
3
+ "version": "1.0.2",
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
  },