@lat-murmeldjur/weeb_3 0.0.317001 → 0.0.320001
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 +26 -7
- package/package.json +1 -1
- package/weeb_3.d.ts +50 -35
- package/weeb_3.js +386 -343
- package/weeb_3_bg.wasm +0 -0
- package/weeb_3_bg.wasm.d.ts +41 -34
package/README.md
CHANGED
|
@@ -33,6 +33,7 @@ The `wasm-pack` build prepares the generated `static/package.json` for publishin
|
|
|
33
33
|
- `static/snippets/web3-0742d85b024bb6f5/inline0.js`
|
|
34
34
|
- `static/weeb_3.js`
|
|
35
35
|
- `static/weeb_3_bg.wasm`
|
|
36
|
+
- `static/weeb_3.d.ts`
|
|
36
37
|
|
|
37
38
|
After publishing, the package can be used with the same API shape as the examples in `static/example.html` and `static/issue-1-json-sync-example.html`:
|
|
38
39
|
|
|
@@ -43,18 +44,34 @@ await init();
|
|
|
43
44
|
|
|
44
45
|
const weeb3node = new Weeb3No103();
|
|
45
46
|
|
|
46
|
-
// Use the built-in
|
|
47
|
-
|
|
47
|
+
// Use the built-in mainnet profile and browser-dialable bootnodes.
|
|
48
|
+
weeb3node.start();
|
|
49
|
+
console.log(await weeb3node.networkState());
|
|
50
|
+
|
|
51
|
+
// Switch explicitly between the built-in profiles.
|
|
52
|
+
await weeb3node.switchTestnet();
|
|
53
|
+
await weeb3node.switchMainnet();
|
|
54
|
+
|
|
55
|
+
// The generic form accepts "mainnet", "gnosis", or "1", and
|
|
56
|
+
// "testnet", "sepolia", or "10".
|
|
57
|
+
await weeb3node.switchNetwork("testnet");
|
|
58
|
+
await weeb3node.switchNetwork("mainnet");
|
|
48
59
|
|
|
49
60
|
// Or start with explicit browser-dialable bootnodes.
|
|
50
|
-
weeb3node.start(
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
weeb3node.start({
|
|
62
|
+
networkId: "1",
|
|
63
|
+
bootstrapNodes: [
|
|
64
|
+
new BootstrapNode("/ip4/example/tcp/443/wss/p2p/examplePeerId", true),
|
|
65
|
+
],
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
// Or start with the built-in testnet profile.
|
|
69
|
+
weeb3node.start({ testnet: true });
|
|
53
70
|
|
|
54
71
|
const ready = await weeb3node.ready(1, 20_000);
|
|
55
72
|
```
|
|
56
73
|
|
|
57
|
-
The wrapper exposes the browser node as `Weeb3No103`. It can start the runtime, connect to network profiles, render the bundled interface into a container, report network and progress state, retrieve BZZ resources, retrieve raw bytes or chunks, upload `File` objects or byte arrays, publish and read feed updates, and expose feed identity helpers.
|
|
74
|
+
The wrapper exposes the browser node as `Weeb3No103`. It can start the runtime, connect to network profiles, switch between mainnet and testnet with `switchMainnet()` / `switchTestnet()` or `switchNetwork(mode)`, render the bundled interface into a container, report network and progress state, retrieve BZZ resources, retrieve raw bytes or chunks, upload `File` objects or byte arrays, publish and read feed updates, and expose feed identity helpers.
|
|
58
75
|
|
|
59
76
|
The publishing workflow defaults to the GitHub repository owner scope. If a different npm scope is needed, set the `NPM_SCOPE` repository variable in GitHub Actions before pushing to `main`.
|
|
60
77
|
|
|
@@ -176,6 +193,7 @@ The main runtime depends on several focused modules:
|
|
|
176
193
|
- `src/secure_vault.rs` manages sensitive local state such as upload identities, postage-stamp state, feed ownership, and cheque signer material.
|
|
177
194
|
- `src/network_profile.rs` defines the built-in testnet and mainnet profiles, wallet chain ids, token symbols, and bootnodes.
|
|
178
195
|
- `src/on_chain.rs` implements browser wallet and contract interactions for postage batches, price oracle access, chequebook operations, swap token operations, and related state.
|
|
196
|
+
- Batch state held by `weeb-3-secure` is requested with the active Swarm network id, so testnet and mainnet use separate batch owners, batch ids, bucket counters, and temp-auth authorization.
|
|
179
197
|
- `src/interface_conventions.rs` and `src/interface_runtime_conventions.rs` contain DOM helpers, UI rendering, route parsing, network controls, and Service Worker runtime integration.
|
|
180
198
|
- `src/library.rs` exposes the Wasm runtime to JavaScript as `Weeb3No103` and `BootstrapNode`.
|
|
181
199
|
- `src/conventions.rs` and `src/interface_conventions.rs` collect common encoding, decoding, hashing, resource, UI, and protocol helper logic.
|
|
@@ -202,7 +220,8 @@ Single files can still be displayed without a Service Worker by creating `Blob`
|
|
|
202
220
|
|
|
203
221
|
The Service Worker solves this by providing deterministic application-scoped routes:
|
|
204
222
|
|
|
205
|
-
- `GET` and `HEAD` requests below `/bzz/<reference>/<path>` are interpreted as canonical BZZ resource requests.
|
|
223
|
+
- `GET` and `HEAD` requests below `/bzz/<reference>/<path>` are interpreted as canonical mainnet BZZ resource requests.
|
|
224
|
+
- Testnet can be selected from routes with `/testnet`, for example `/weeb-3/testnet` to boot the interface in testnet mode or `/weeb-3/testnet/bzz/<reference>/<path>` for a testnet BZZ link.
|
|
206
225
|
- Raw byte and chunk routes below `/bytes/`, `/chunks/`, and `/chunk/` are forwarded to the Rust runtime.
|
|
207
226
|
- `POST` requests to the scoped `/bzz` endpoint are forwarded as upload requests, including upload headers such as encryption, collection, and index-document hints.
|
|
208
227
|
- Fetch requests are forwarded to the active controlled client through `postMessage` and `MessageChannel`.
|
package/package.json
CHANGED
package/weeb_3.d.ts
CHANGED
|
@@ -69,6 +69,8 @@ export class Weeb3No103 {
|
|
|
69
69
|
networkState(): Promise<object>;
|
|
70
70
|
network_state(): Promise<object>;
|
|
71
71
|
constructor();
|
|
72
|
+
openSecureVault(): object;
|
|
73
|
+
open_secure_vault(): object;
|
|
72
74
|
postFeedBytes(topic: string, bytes: Uint8Array, mime: string, filename: string, encryption: boolean): Promise<object>;
|
|
73
75
|
postPushChunk(data: Uint8Array, soc: boolean, chunk_address: Uint8Array, stamp: Uint8Array): Promise<string>;
|
|
74
76
|
postUploadBytes(bytes: Uint8Array, mime: string, filename: string, encryption: boolean, add_to_feed: boolean, feed_topic: string): Promise<object>;
|
|
@@ -90,9 +92,13 @@ export class Weeb3No103 {
|
|
|
90
92
|
retrieveChunk(address: string): Promise<Uint8Array>;
|
|
91
93
|
retrieve_bytes(address: string): Promise<Uint8Array>;
|
|
92
94
|
retrieve_chunk(address: string): Promise<Uint8Array>;
|
|
93
|
-
start(
|
|
95
|
+
start(options?: any | null): void;
|
|
96
|
+
switchMainnet(): Promise<object>;
|
|
94
97
|
switchNetwork(mode: string): Promise<object>;
|
|
98
|
+
switchTestnet(): Promise<object>;
|
|
99
|
+
switch_mainnet(): Promise<object>;
|
|
95
100
|
switch_network(mode: string): Promise<object>;
|
|
101
|
+
switch_testnet(): Promise<object>;
|
|
96
102
|
upload(file: File, encryption: boolean, index_string: string, add_to_feed: boolean, feed_topic: string): Promise<object>;
|
|
97
103
|
uploadPrerequisites(depth: number, validity_days: number): Promise<object>;
|
|
98
104
|
upload_prerequisites(depth: number, validity_days: number): Promise<object>;
|
|
@@ -104,12 +110,35 @@ export class Wings {
|
|
|
104
110
|
[Symbol.dispose](): void;
|
|
105
111
|
}
|
|
106
112
|
|
|
113
|
+
export function init_wasm_runtime(): void;
|
|
114
|
+
|
|
107
115
|
export function interweeb(_st: string): Promise<void>;
|
|
108
116
|
|
|
109
117
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
110
118
|
|
|
111
119
|
export interface InitOutput {
|
|
112
120
|
readonly memory: WebAssembly.Memory;
|
|
121
|
+
readonly __wbg_weeb3_free: (a: number, b: number) => void;
|
|
122
|
+
readonly __wbg_wings_free: (a: number, b: number) => void;
|
|
123
|
+
readonly weeb3_acquire: (a: number, b: number, c: number) => any;
|
|
124
|
+
readonly weeb3_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
125
|
+
readonly weeb3_change_bootnode_address: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
126
|
+
readonly weeb3_get_connections: (a: number) => any;
|
|
127
|
+
readonly weeb3_get_current_logs: (a: number) => any;
|
|
128
|
+
readonly weeb3_get_network_id: (a: number) => any;
|
|
129
|
+
readonly weeb3_get_ongoing_connections: (a: number) => any;
|
|
130
|
+
readonly weeb3_interface_log: (a: number, b: number, c: number) => void;
|
|
131
|
+
readonly weeb3_new: (a: number, b: number) => number;
|
|
132
|
+
readonly weeb3_post_push_chunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
133
|
+
readonly weeb3_post_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
134
|
+
readonly weeb3_reset_stamp: (a: number) => any;
|
|
135
|
+
readonly weeb3_retrieve_bytes: (a: number, b: number, c: number) => any;
|
|
136
|
+
readonly weeb3_retrieve_chunk_bytes: (a: number, b: number, c: number) => any;
|
|
137
|
+
readonly weeb3_run: (a: number, b: number, c: number) => any;
|
|
138
|
+
readonly weeb3_set_network_id: (a: number, b: number, c: number) => any;
|
|
139
|
+
readonly weeb3_toggle_transfer_pause: (a: number) => any;
|
|
140
|
+
readonly weeb3_transfer_paused: (a: number) => number;
|
|
141
|
+
readonly init_wasm_runtime: () => void;
|
|
113
142
|
readonly interweeb: (a: number, b: number) => any;
|
|
114
143
|
readonly __wbg_bootstrapnode_free: (a: number, b: number) => void;
|
|
115
144
|
readonly __wbg_weeb3no103_free: (a: number, b: number) => void;
|
|
@@ -140,6 +169,7 @@ export interface InitOutput {
|
|
|
140
169
|
readonly weeb3no103_networkState: (a: number) => any;
|
|
141
170
|
readonly weeb3no103_network_state: (a: number) => any;
|
|
142
171
|
readonly weeb3no103_new: () => number;
|
|
172
|
+
readonly weeb3no103_openSecureVault: (a: number) => any;
|
|
143
173
|
readonly weeb3no103_postFeedBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => any;
|
|
144
174
|
readonly weeb3no103_postPushChunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
145
175
|
readonly weeb3no103_postUploadBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => any;
|
|
@@ -153,6 +183,7 @@ export interface InitOutput {
|
|
|
153
183
|
readonly weeb3no103_readyState: (a: number, b: number, c: number) => any;
|
|
154
184
|
readonly weeb3no103_ready_state: (a: number, b: number, c: number) => any;
|
|
155
185
|
readonly weeb3no103_renderInterface: (a: number, b: any) => any;
|
|
186
|
+
readonly weeb3no103_render_interface: (a: number, b: any) => any;
|
|
156
187
|
readonly weeb3no103_resetStamp: (a: number) => any;
|
|
157
188
|
readonly weeb3no103_reset_stamp: (a: number) => any;
|
|
158
189
|
readonly weeb3no103_retrieve: (a: number, b: number, c: number) => any;
|
|
@@ -160,56 +191,40 @@ export interface InitOutput {
|
|
|
160
191
|
readonly weeb3no103_retrieveChunk: (a: number, b: number, c: number) => any;
|
|
161
192
|
readonly weeb3no103_retrieve_bytes: (a: number, b: number, c: number) => any;
|
|
162
193
|
readonly weeb3no103_retrieve_chunk: (a: number, b: number, c: number) => any;
|
|
163
|
-
readonly weeb3no103_start: (a: number, b: number
|
|
194
|
+
readonly weeb3no103_start: (a: number, b: number) => void;
|
|
195
|
+
readonly weeb3no103_switchMainnet: (a: number) => any;
|
|
164
196
|
readonly weeb3no103_switchNetwork: (a: number, b: number, c: number) => any;
|
|
197
|
+
readonly weeb3no103_switchTestnet: (a: number) => any;
|
|
198
|
+
readonly weeb3no103_switch_mainnet: (a: number) => any;
|
|
165
199
|
readonly weeb3no103_switch_network: (a: number, b: number, c: number) => any;
|
|
200
|
+
readonly weeb3no103_switch_testnet: (a: number) => any;
|
|
166
201
|
readonly weeb3no103_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
167
202
|
readonly weeb3no103_uploadPrerequisites: (a: number, b: number, c: number) => any;
|
|
168
203
|
readonly weeb3no103_upload_prerequisites: (a: number, b: number, c: number) => any;
|
|
204
|
+
readonly weeb3no103_open_secure_vault: (a: number) => any;
|
|
169
205
|
readonly weeb3no103_feed_topic: (a: number, b: number, c: number) => any;
|
|
170
|
-
readonly weeb3no103_render_interface: (a: number, b: any) => any;
|
|
171
|
-
readonly __wbg_weeb3_free: (a: number, b: number) => void;
|
|
172
|
-
readonly __wbg_wings_free: (a: number, b: number) => void;
|
|
173
|
-
readonly weeb3_acquire: (a: number, b: number, c: number) => any;
|
|
174
|
-
readonly weeb3_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
175
|
-
readonly weeb3_change_bootnode_address: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
176
|
-
readonly weeb3_get_connections: (a: number) => any;
|
|
177
|
-
readonly weeb3_get_current_logs: (a: number) => any;
|
|
178
|
-
readonly weeb3_get_network_id: (a: number) => any;
|
|
179
|
-
readonly weeb3_get_ongoing_connections: (a: number) => any;
|
|
180
|
-
readonly weeb3_interface_log: (a: number, b: number, c: number) => void;
|
|
181
|
-
readonly weeb3_new: (a: number, b: number) => number;
|
|
182
|
-
readonly weeb3_post_push_chunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
183
|
-
readonly weeb3_post_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
184
|
-
readonly weeb3_reset_stamp: (a: number) => any;
|
|
185
|
-
readonly weeb3_retrieve_bytes: (a: number, b: number, c: number) => any;
|
|
186
|
-
readonly weeb3_retrieve_chunk_bytes: (a: number, b: number, c: number) => any;
|
|
187
|
-
readonly weeb3_run: (a: number, b: number, c: number) => any;
|
|
188
|
-
readonly weeb3_set_network_id: (a: number, b: number, c: number) => any;
|
|
189
|
-
readonly weeb3_toggle_transfer_pause: (a: number) => any;
|
|
190
|
-
readonly weeb3_transfer_paused: (a: number) => number;
|
|
191
206
|
readonly __wbg_requestarguments_free: (a: number, b: number) => void;
|
|
192
207
|
readonly requestarguments_method: (a: number) => [number, number];
|
|
193
208
|
readonly requestarguments_params: (a: number) => any;
|
|
194
|
-
readonly
|
|
195
|
-
readonly
|
|
196
|
-
readonly
|
|
197
|
-
readonly
|
|
198
|
-
readonly
|
|
199
|
-
readonly
|
|
200
|
-
readonly
|
|
201
|
-
readonly
|
|
202
|
-
readonly
|
|
203
|
-
readonly
|
|
204
|
-
readonly
|
|
209
|
+
readonly wasm_bindgen__convert__closures_____invoke__hc61cf82ed5539fc0: (a: number, b: number, c: any) => [number, number];
|
|
210
|
+
readonly wasm_bindgen__convert__closures_____invoke__ha3ccbd176587943b: (a: number, b: number, c: any) => [number, number];
|
|
211
|
+
readonly wasm_bindgen__convert__closures_____invoke__h23d607816848205c: (a: number, b: number, c: any, d: any) => void;
|
|
212
|
+
readonly wasm_bindgen__convert__closures_____invoke__h2ba9a57baa99e61c: (a: number, b: number, c: any) => void;
|
|
213
|
+
readonly wasm_bindgen__convert__closures_____invoke__h06a9db7efe4e0c03: (a: number, b: number, c: any) => void;
|
|
214
|
+
readonly wasm_bindgen__convert__closures_____invoke__hce4d7bcafefc2486: (a: number, b: number, c: any) => void;
|
|
215
|
+
readonly wasm_bindgen__convert__closures_____invoke__h06a9db7efe4e0c03_4: (a: number, b: number, c: any) => void;
|
|
216
|
+
readonly wasm_bindgen__convert__closures_____invoke__h06a9db7efe4e0c03_6: (a: number, b: number, c: any) => void;
|
|
217
|
+
readonly wasm_bindgen__convert__closures_____invoke__h376be826f7c7dcad: (a: number, b: number) => void;
|
|
218
|
+
readonly wasm_bindgen__convert__closures_____invoke__hce415dd57ff2f6ce: (a: number, b: number) => void;
|
|
219
|
+
readonly wasm_bindgen__convert__closures_____invoke__h6da4d6df0f6bffeb: (a: number, b: number) => void;
|
|
205
220
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
206
221
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
207
222
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
208
223
|
readonly __externref_table_alloc: () => number;
|
|
209
224
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
225
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
210
226
|
readonly __wbindgen_destroy_closure: (a: number, b: number) => void;
|
|
211
227
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
212
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
213
228
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
214
229
|
readonly __wbindgen_start: () => void;
|
|
215
230
|
}
|