@net-protocol/storage 0.1.1 → 0.1.3

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 +61 -6
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -1,6 +1,54 @@
1
1
  # @net-protocol/storage
2
2
 
3
- Net Storage SDK for key-value storage on the Net protocol. Supports regular storage, chunked storage, and XML storage patterns.
3
+ **Status: Alpha** - Usable but may have breaking changes over time. Suitable for early adopters and testing.
4
+
5
+ Net Storage SDK for permanent onchain key-value storage built on Net Protocol.
6
+
7
+ ## What is Net Storage?
8
+
9
+ Net Storage provides permanent, versioned key-value storage on the blockchain. Every write creates a new version, preserving complete history. Unlike traditional databases, Storage data is:
10
+
11
+ - **Immutable**: Once stored, data cannot be modified
12
+ - **Versioned**: Complete history of all changes preserved
13
+ - **Transparent**: All data is publicly verifiable
14
+ - **Decentralized**: No central servers or databases
15
+
16
+ ## Storage Types
17
+
18
+ Net Storage supports three storage patterns for different file sizes:
19
+
20
+ ### Regular Storage
21
+
22
+ **Best for**: Small data (< 20KB)
23
+ **How it works**: Stores data directly as Net messages
24
+ **Use cases**: User settings, configuration, small metadata
25
+
26
+ ### Chunked Storage
27
+
28
+ **Best for**: Medium files (20KB-80KB)
29
+ **How it works**: Compresses data (gzip) and splits into 20KB chunks
30
+ **Use cases**: Images, documents, medium-sized data
31
+
32
+ ### XML Storage
33
+
34
+ **Best for**: Large files (multi-MB)
35
+ **How it works**: Splits large files into 80KB pieces, stores each using ChunkedStorage, maintains references as XML metadata
36
+ **Use cases**: Videos, large images, datasets, any large file
37
+
38
+ ## What can you do with this package?
39
+
40
+ - **Store data permanently**: Write key-value pairs that persist forever on the blockchain
41
+ - **Access version history**: Read any historical version of stored data
42
+ - **Store files of any size**: From small settings to multi-MB files
43
+ - **Build storage apps**: Create applications that need permanent, verifiable data storage
44
+
45
+ This package provides both React hooks (for UI) and client classes (for non-React code).
46
+
47
+ ## Learn More
48
+
49
+ - [Net Storage Documentation](https://docs.netprotocol.app/docs/apps/storage/01-overview) - Complete storage documentation
50
+ - [Storage Developer Guide](https://docs.netprotocol.app/docs/apps/storage/03-developer-guide) - Technical implementation details
51
+ - [Net Protocol Documentation](https://docs.netprotocol.app) - Core protocol documentation
4
52
 
5
53
  ## Installation
6
54
 
@@ -23,7 +71,11 @@ yarn add @net-protocol/storage
23
71
  ### React Hooks
24
72
 
25
73
  ```typescript
26
- import { useStorage, useXmlStorage, useStorageFromRouter } from "@net-protocol/storage";
74
+ import {
75
+ useStorage,
76
+ useXmlStorage,
77
+ useStorageFromRouter,
78
+ } from "@net-protocol/storage";
27
79
 
28
80
  // Basic storage read
29
81
  function MyComponent() {
@@ -35,7 +87,7 @@ function MyComponent() {
35
87
 
36
88
  if (isLoading) return <div>Loading...</div>;
37
89
  if (error) return <div>Error: {error.message}</div>;
38
-
90
+
39
91
  const [text, data] = data || [];
40
92
  return <div>{text}</div>;
41
93
  }
@@ -102,7 +154,11 @@ function XmlWithFormats() {
102
154
  });
103
155
 
104
156
  // Return as object format (default)
105
- const { data: objectData, filename, isXml } = useXmlStorage({
157
+ const {
158
+ data: objectData,
159
+ filename,
160
+ isXml,
161
+ } = useXmlStorage({
106
162
  chainId: 8453,
107
163
  key: "my-xml-key",
108
164
  operatorAddress: "0x...",
@@ -180,7 +236,7 @@ const chunks = chunkDataForStorage("large data string");
180
236
  const assembled = assembleChunks(chunks);
181
237
 
182
238
  // Parse XML references
183
- const references = parseNetReferences("<net k=\"hash\" v=\"0.0.1\" />");
239
+ const references = parseNetReferences('<net k="hash" v="0.0.1" />');
184
240
 
185
241
  // Process data for XML storage
186
242
  const result = processDataForStorage(data, operatorAddress);
@@ -229,4 +285,3 @@ Hierarchical storage using XML references. Supports recursive resolution and ope
229
285
  ## License
230
286
 
231
287
  MIT
232
-
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@net-protocol/storage",
3
- "version": "0.1.1",
3
+ "version": "0.1.3",
4
4
  "description": "Net Storage SDK for key-value storage on the Net protocol",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -30,7 +30,7 @@
30
30
  "test:ui": "vitest --ui"
31
31
  },
32
32
  "dependencies": {
33
- "@net-protocol/core": "^0.1.0",
33
+ "@net-protocol/core": "^0.1.3",
34
34
  "pako": "^2.1.0",
35
35
  "use-async-effect": "^2.2.7",
36
36
  "viem": "^2.31.4"
@@ -57,7 +57,7 @@
57
57
  },
58
58
  "repository": {
59
59
  "type": "git",
60
- "url": "https://github.com/<org>/net-public.git",
60
+ "url": "https://github.com/stuckinaboot/net-public.git",
61
61
  "directory": "packages/net-storage"
62
62
  },
63
63
  "keywords": [