@net-protocol/storage 0.1.9 → 0.1.10

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/dist/index.d.mts CHANGED
@@ -1,158 +1,7 @@
1
- import * as viem from 'viem';
2
- import { Abi, PublicClient } from 'viem';
1
+ import { S as StorageClientOptions, a as StorageData, B as BulkStorageKey, b as BulkStorageResult } from './types-BnOI6cJS.mjs';
2
+ export { C as ChunkedMetadata, U as UseStorageOptions, c as UseXmlStorageOptions, X as XmlReference } from './types-BnOI6cJS.mjs';
3
3
  import { WriteTransactionConfig } from '@net-protocol/core';
4
-
5
- /**
6
- * Storage data object: { text, value }
7
- */
8
- type StorageData = {
9
- text: string;
10
- value: string;
11
- };
12
- /**
13
- * Bulk storage key for batch operations
14
- */
15
- type BulkStorageKey = {
16
- key: string;
17
- operator: string;
18
- keyFormat?: "raw" | "bytes32";
19
- };
20
- /**
21
- * Bulk storage result
22
- */
23
- type BulkStorageResult = {
24
- text: string;
25
- value: string;
26
- };
27
- /**
28
- * Options for useStorage hook
29
- */
30
- type UseStorageOptions = {
31
- chainId: number;
32
- key?: string;
33
- operatorAddress?: string;
34
- enabled?: boolean;
35
- index?: number;
36
- keyFormat?: "raw" | "bytes32";
37
- useRouter?: boolean;
38
- outputFormat?: "hex" | "string";
39
- };
40
- /**
41
- * Options for StorageClient
42
- */
43
- type StorageClientOptions = {
44
- chainId: number;
45
- overrides?: {
46
- rpcUrls: string[];
47
- };
48
- };
49
- /**
50
- * XML reference structure
51
- */
52
- interface XmlReference$1 {
53
- hash: string;
54
- version: string;
55
- index?: number;
56
- operator?: string;
57
- source?: string;
58
- }
59
- /**
60
- * Chunked storage metadata
61
- */
62
- type ChunkedMetadata = {
63
- chunkCount: number;
64
- originalText: string;
65
- };
66
- /**
67
- * Options for useXmlStorage hook
68
- */
69
- type UseXmlStorageOptions = {
70
- chainId: number;
71
- key?: string;
72
- operatorAddress: string;
73
- skipXmlParsing?: boolean;
74
- enabled?: boolean;
75
- content?: string;
76
- index?: number;
77
- keyFormat?: "raw" | "bytes32";
78
- useRouter?: boolean;
79
- outputFormat?: "hex" | "string";
80
- };
81
- /**
82
- * Options for useStorageFromRouter hook
83
- */
84
- type UseStorageFromRouterOptions = {
85
- chainId: number;
86
- storageKey: `0x${string}`;
87
- operatorAddress: string;
88
- enabled?: boolean;
89
- };
90
-
91
- declare function useStorage({ chainId, key, operatorAddress, enabled, index, keyFormat, useRouter, outputFormat, }: UseStorageOptions): {
92
- data: StorageData | undefined;
93
- isLoading: boolean;
94
- error: Error | undefined;
95
- };
96
- declare function useStorageForOperator({ chainId, operatorAddress, }: UseStorageOptions): {
97
- data: any[][];
98
- isLoading: boolean;
99
- error: undefined;
100
- };
101
- declare function useStorageForOperatorAndKey({ chainId, key, operatorAddress, keyFormat, outputFormat, }: UseStorageOptions): {
102
- data: {
103
- text: string;
104
- value: string;
105
- } | undefined;
106
- isLoading: boolean;
107
- error: Error | undefined;
108
- };
109
- declare function useBulkStorage({ chainId, keys, safe, keyFormat, }: {
110
- chainId: number;
111
- keys: BulkStorageKey[];
112
- safe?: boolean;
113
- keyFormat?: "raw" | "bytes32";
114
- }): {
115
- data: {
116
- text: string;
117
- value: string;
118
- }[] | undefined;
119
- isLoading: boolean;
120
- error: Error | undefined;
121
- };
122
- /**
123
- * Get total number of versions (writes) for a storage key
124
- * Tries both chunked storage and regular storage
125
- */
126
- declare function useStorageTotalWrites({ chainId, key, operatorAddress, enabled, keyFormat, }: {
127
- chainId: number;
128
- key?: string;
129
- operatorAddress?: string;
130
- enabled?: boolean;
131
- keyFormat?: "raw" | "bytes32";
132
- }): {
133
- data: number | undefined;
134
- isLoading: boolean;
135
- error: viem.ReadContractErrorType | null | undefined;
136
- };
137
-
138
- declare function useXmlStorage({ chainId, key, operatorAddress, skipXmlParsing, enabled, content, index, keyFormat, useRouter, outputFormat, }: UseXmlStorageOptions): {
139
- text: string;
140
- value: string;
141
- isLoading: boolean;
142
- error: Error | undefined;
143
- isXml: boolean;
144
- };
145
-
146
- /**
147
- * Generic hook to fetch storage content from StorageRouter
148
- * Handles both regular storage and chunked storage seamlessly
149
- * Works for any storage key (not just canvases)
150
- */
151
- declare function useStorageFromRouter({ chainId, storageKey, operatorAddress, enabled, }: UseStorageFromRouterOptions): {
152
- data: StorageData | undefined;
153
- isLoading: boolean;
154
- error: Error | undefined;
155
- };
4
+ import { Abi, PublicClient } from 'viem';
156
5
 
157
6
  /**
158
7
  * StorageClient - Client for interacting with Net protocol storage
@@ -663,4 +512,4 @@ declare const CONCURRENT_XML_FETCHES = 3;
663
512
  */
664
513
  declare function resolveXmlRecursive(content: string, defaultOperator: string, client: PublicClient, maxDepth: number, visited?: Set<string>, inheritedOperator?: string): Promise<string>;
665
514
 
666
- export { type BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, type ChunkedMetadata, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, type StorageClientOptions, type StorageData, type StreamingChunkResult, type StreamingProcessResult, type UseStorageOptions, type UseXmlStorageOptions, type XmlReference$1 as XmlReference, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, useBulkStorage, useStorage, useStorageForOperator, useStorageForOperatorAndKey, useStorageFromRouter, useStorageTotalWrites, useXmlStorage, validateDataSize };
515
+ export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };
package/dist/index.d.ts CHANGED
@@ -1,158 +1,7 @@
1
- import * as viem from 'viem';
2
- import { Abi, PublicClient } from 'viem';
1
+ import { S as StorageClientOptions, a as StorageData, B as BulkStorageKey, b as BulkStorageResult } from './types-BnOI6cJS.js';
2
+ export { C as ChunkedMetadata, U as UseStorageOptions, c as UseXmlStorageOptions, X as XmlReference } from './types-BnOI6cJS.js';
3
3
  import { WriteTransactionConfig } from '@net-protocol/core';
4
-
5
- /**
6
- * Storage data object: { text, value }
7
- */
8
- type StorageData = {
9
- text: string;
10
- value: string;
11
- };
12
- /**
13
- * Bulk storage key for batch operations
14
- */
15
- type BulkStorageKey = {
16
- key: string;
17
- operator: string;
18
- keyFormat?: "raw" | "bytes32";
19
- };
20
- /**
21
- * Bulk storage result
22
- */
23
- type BulkStorageResult = {
24
- text: string;
25
- value: string;
26
- };
27
- /**
28
- * Options for useStorage hook
29
- */
30
- type UseStorageOptions = {
31
- chainId: number;
32
- key?: string;
33
- operatorAddress?: string;
34
- enabled?: boolean;
35
- index?: number;
36
- keyFormat?: "raw" | "bytes32";
37
- useRouter?: boolean;
38
- outputFormat?: "hex" | "string";
39
- };
40
- /**
41
- * Options for StorageClient
42
- */
43
- type StorageClientOptions = {
44
- chainId: number;
45
- overrides?: {
46
- rpcUrls: string[];
47
- };
48
- };
49
- /**
50
- * XML reference structure
51
- */
52
- interface XmlReference$1 {
53
- hash: string;
54
- version: string;
55
- index?: number;
56
- operator?: string;
57
- source?: string;
58
- }
59
- /**
60
- * Chunked storage metadata
61
- */
62
- type ChunkedMetadata = {
63
- chunkCount: number;
64
- originalText: string;
65
- };
66
- /**
67
- * Options for useXmlStorage hook
68
- */
69
- type UseXmlStorageOptions = {
70
- chainId: number;
71
- key?: string;
72
- operatorAddress: string;
73
- skipXmlParsing?: boolean;
74
- enabled?: boolean;
75
- content?: string;
76
- index?: number;
77
- keyFormat?: "raw" | "bytes32";
78
- useRouter?: boolean;
79
- outputFormat?: "hex" | "string";
80
- };
81
- /**
82
- * Options for useStorageFromRouter hook
83
- */
84
- type UseStorageFromRouterOptions = {
85
- chainId: number;
86
- storageKey: `0x${string}`;
87
- operatorAddress: string;
88
- enabled?: boolean;
89
- };
90
-
91
- declare function useStorage({ chainId, key, operatorAddress, enabled, index, keyFormat, useRouter, outputFormat, }: UseStorageOptions): {
92
- data: StorageData | undefined;
93
- isLoading: boolean;
94
- error: Error | undefined;
95
- };
96
- declare function useStorageForOperator({ chainId, operatorAddress, }: UseStorageOptions): {
97
- data: any[][];
98
- isLoading: boolean;
99
- error: undefined;
100
- };
101
- declare function useStorageForOperatorAndKey({ chainId, key, operatorAddress, keyFormat, outputFormat, }: UseStorageOptions): {
102
- data: {
103
- text: string;
104
- value: string;
105
- } | undefined;
106
- isLoading: boolean;
107
- error: Error | undefined;
108
- };
109
- declare function useBulkStorage({ chainId, keys, safe, keyFormat, }: {
110
- chainId: number;
111
- keys: BulkStorageKey[];
112
- safe?: boolean;
113
- keyFormat?: "raw" | "bytes32";
114
- }): {
115
- data: {
116
- text: string;
117
- value: string;
118
- }[] | undefined;
119
- isLoading: boolean;
120
- error: Error | undefined;
121
- };
122
- /**
123
- * Get total number of versions (writes) for a storage key
124
- * Tries both chunked storage and regular storage
125
- */
126
- declare function useStorageTotalWrites({ chainId, key, operatorAddress, enabled, keyFormat, }: {
127
- chainId: number;
128
- key?: string;
129
- operatorAddress?: string;
130
- enabled?: boolean;
131
- keyFormat?: "raw" | "bytes32";
132
- }): {
133
- data: number | undefined;
134
- isLoading: boolean;
135
- error: viem.ReadContractErrorType | null | undefined;
136
- };
137
-
138
- declare function useXmlStorage({ chainId, key, operatorAddress, skipXmlParsing, enabled, content, index, keyFormat, useRouter, outputFormat, }: UseXmlStorageOptions): {
139
- text: string;
140
- value: string;
141
- isLoading: boolean;
142
- error: Error | undefined;
143
- isXml: boolean;
144
- };
145
-
146
- /**
147
- * Generic hook to fetch storage content from StorageRouter
148
- * Handles both regular storage and chunked storage seamlessly
149
- * Works for any storage key (not just canvases)
150
- */
151
- declare function useStorageFromRouter({ chainId, storageKey, operatorAddress, enabled, }: UseStorageFromRouterOptions): {
152
- data: StorageData | undefined;
153
- isLoading: boolean;
154
- error: Error | undefined;
155
- };
4
+ import { Abi, PublicClient } from 'viem';
156
5
 
157
6
  /**
158
7
  * StorageClient - Client for interacting with Net protocol storage
@@ -663,4 +512,4 @@ declare const CONCURRENT_XML_FETCHES = 3;
663
512
  */
664
513
  declare function resolveXmlRecursive(content: string, defaultOperator: string, client: PublicClient, maxDepth: number, visited?: Set<string>, inheritedOperator?: string): Promise<string>;
665
514
 
666
- export { type BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, type ChunkedMetadata, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, type StorageClientOptions, type StorageData, type StreamingChunkResult, type StreamingProcessResult, type UseStorageOptions, type UseXmlStorageOptions, type XmlReference$1 as XmlReference, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, useBulkStorage, useStorage, useStorageForOperator, useStorageForOperatorAndKey, useStorageFromRouter, useStorageTotalWrites, useXmlStorage, validateDataSize };
515
+ export { BulkStorageKey, CHUNKED_STORAGE_CONTRACT, CHUNKED_STORAGE_READER_CONTRACT, CONCURRENT_XML_FETCHES, MAX_XML_DEPTH, SAFE_STORAGE_READER_CONTRACT, STORAGE_CONTRACT, STORAGE_ROUTER_CONTRACT, StorageClient, StorageClientOptions, StorageData, type StreamingChunkResult, type StreamingProcessResult, assembleChunks, base64ToDataUri, chunkData, chunkDataForStorage, computeTopLevelHash, containsXmlReferences, detectFileTypeFromBase64, detectStorageType, encodeStorageKeyForUrl, estimateChunkCount, fileToDataUri, formatStorageKeyForDisplay, generateStorageEmbedTag, generateXmlMetadata, generateXmlMetadataWithSource, getChunkCount, getReferenceKey, getStorageKeyBytes, isBinaryFile, parseNetReferences, processDataForStorage, processFileStreaming, processFileStreamingComplete, readFileSlice, resolveOperator, resolveXmlRecursive, shouldSuggestXmlStorage, validateDataSize };