@lat-murmeldjur/weeb_3 0.0.317001 → 0.0.319002
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 +17 -4
- package/package.json +1 -1
- package/weeb_3.d.ts +21 -13
- package/weeb_3.js +342 -314
- package/weeb_3_bg.wasm +0 -0
- package/weeb_3_bg.wasm.d.ts +17 -13
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,28 @@ await init();
|
|
|
43
44
|
|
|
44
45
|
const weeb3node = new Weeb3No103();
|
|
45
46
|
|
|
46
|
-
// Use the built-in
|
|
47
|
+
// Use the built-in mainnet profile and browser-dialable bootnodes.
|
|
47
48
|
await weeb3node.connect();
|
|
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
61
|
weeb3node.start([
|
|
51
62
|
new BootstrapNode("/ip4/example/tcp/443/wss/p2p/examplePeerId", true),
|
|
52
|
-
], "
|
|
63
|
+
], "1");
|
|
53
64
|
|
|
54
65
|
const ready = await weeb3node.ready(1, 20_000);
|
|
55
66
|
```
|
|
56
67
|
|
|
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.
|
|
68
|
+
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
69
|
|
|
59
70
|
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
71
|
|
|
@@ -176,6 +187,7 @@ The main runtime depends on several focused modules:
|
|
|
176
187
|
- `src/secure_vault.rs` manages sensitive local state such as upload identities, postage-stamp state, feed ownership, and cheque signer material.
|
|
177
188
|
- `src/network_profile.rs` defines the built-in testnet and mainnet profiles, wallet chain ids, token symbols, and bootnodes.
|
|
178
189
|
- `src/on_chain.rs` implements browser wallet and contract interactions for postage batches, price oracle access, chequebook operations, swap token operations, and related state.
|
|
190
|
+
- 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
191
|
- `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
192
|
- `src/library.rs` exposes the Wasm runtime to JavaScript as `Weeb3No103` and `BootstrapNode`.
|
|
181
193
|
- `src/conventions.rs` and `src/interface_conventions.rs` collect common encoding, decoding, hashing, resource, UI, and protocol helper logic.
|
|
@@ -202,7 +214,8 @@ Single files can still be displayed without a Service Worker by creating `Blob`
|
|
|
202
214
|
|
|
203
215
|
The Service Worker solves this by providing deterministic application-scoped routes:
|
|
204
216
|
|
|
205
|
-
- `GET` and `HEAD` requests below `/bzz/<reference>/<path>` are interpreted as canonical BZZ resource requests.
|
|
217
|
+
- `GET` and `HEAD` requests below `/bzz/<reference>/<path>` are interpreted as canonical mainnet BZZ resource requests.
|
|
218
|
+
- 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
219
|
- Raw byte and chunk routes below `/bytes/`, `/chunks/`, and `/chunk/` are forwarded to the Rust runtime.
|
|
207
220
|
- `POST` requests to the scoped `/bzz` endpoint are forwarded as upload requests, including upload headers such as encryption, collection, and index-document hints.
|
|
208
221
|
- Fetch requests are forwarded to the active controlled client through `postMessage` and `MessageChannel`.
|
package/package.json
CHANGED
package/weeb_3.d.ts
CHANGED
|
@@ -91,8 +91,12 @@ export class Weeb3No103 {
|
|
|
91
91
|
retrieve_bytes(address: string): Promise<Uint8Array>;
|
|
92
92
|
retrieve_chunk(address: string): Promise<Uint8Array>;
|
|
93
93
|
start(bootstrap_nodes: BootstrapNode[], network_id: string): void;
|
|
94
|
+
switchMainnet(): Promise<object>;
|
|
94
95
|
switchNetwork(mode: string): Promise<object>;
|
|
96
|
+
switchTestnet(): Promise<object>;
|
|
97
|
+
switch_mainnet(): Promise<object>;
|
|
95
98
|
switch_network(mode: string): Promise<object>;
|
|
99
|
+
switch_testnet(): Promise<object>;
|
|
96
100
|
upload(file: File, encryption: boolean, index_string: string, add_to_feed: boolean, feed_topic: string): Promise<object>;
|
|
97
101
|
uploadPrerequisites(depth: number, validity_days: number): Promise<object>;
|
|
98
102
|
upload_prerequisites(depth: number, validity_days: number): Promise<object>;
|
|
@@ -110,7 +114,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
110
114
|
|
|
111
115
|
export interface InitOutput {
|
|
112
116
|
readonly memory: WebAssembly.Memory;
|
|
113
|
-
readonly interweeb: (a: number, b: number) => any;
|
|
114
117
|
readonly __wbg_bootstrapnode_free: (a: number, b: number) => void;
|
|
115
118
|
readonly __wbg_weeb3no103_free: (a: number, b: number) => void;
|
|
116
119
|
readonly bootstrapnode_multiaddr: (a: number) => [number, number];
|
|
@@ -153,6 +156,7 @@ export interface InitOutput {
|
|
|
153
156
|
readonly weeb3no103_readyState: (a: number, b: number, c: number) => any;
|
|
154
157
|
readonly weeb3no103_ready_state: (a: number, b: number, c: number) => any;
|
|
155
158
|
readonly weeb3no103_renderInterface: (a: number, b: any) => any;
|
|
159
|
+
readonly weeb3no103_render_interface: (a: number, b: any) => any;
|
|
156
160
|
readonly weeb3no103_resetStamp: (a: number) => any;
|
|
157
161
|
readonly weeb3no103_reset_stamp: (a: number) => any;
|
|
158
162
|
readonly weeb3no103_retrieve: (a: number, b: number, c: number) => any;
|
|
@@ -161,13 +165,17 @@ export interface InitOutput {
|
|
|
161
165
|
readonly weeb3no103_retrieve_bytes: (a: number, b: number, c: number) => any;
|
|
162
166
|
readonly weeb3no103_retrieve_chunk: (a: number, b: number, c: number) => any;
|
|
163
167
|
readonly weeb3no103_start: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
168
|
+
readonly weeb3no103_switchMainnet: (a: number) => any;
|
|
164
169
|
readonly weeb3no103_switchNetwork: (a: number, b: number, c: number) => any;
|
|
170
|
+
readonly weeb3no103_switchTestnet: (a: number) => any;
|
|
171
|
+
readonly weeb3no103_switch_mainnet: (a: number) => any;
|
|
165
172
|
readonly weeb3no103_switch_network: (a: number, b: number, c: number) => any;
|
|
173
|
+
readonly weeb3no103_switch_testnet: (a: number) => any;
|
|
166
174
|
readonly weeb3no103_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
|
|
167
175
|
readonly weeb3no103_uploadPrerequisites: (a: number, b: number, c: number) => any;
|
|
168
176
|
readonly weeb3no103_upload_prerequisites: (a: number, b: number, c: number) => any;
|
|
169
177
|
readonly weeb3no103_feed_topic: (a: number, b: number, c: number) => any;
|
|
170
|
-
readonly
|
|
178
|
+
readonly interweeb: (a: number, b: number) => any;
|
|
171
179
|
readonly __wbg_weeb3_free: (a: number, b: number) => void;
|
|
172
180
|
readonly __wbg_wings_free: (a: number, b: number) => void;
|
|
173
181
|
readonly weeb3_acquire: (a: number, b: number, c: number) => any;
|
|
@@ -191,17 +199,17 @@ export interface InitOutput {
|
|
|
191
199
|
readonly __wbg_requestarguments_free: (a: number, b: number) => void;
|
|
192
200
|
readonly requestarguments_method: (a: number) => [number, number];
|
|
193
201
|
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
|
|
202
|
+
readonly wasm_bindgen__convert__closures_____invoke__hd044c415605327d3: (a: number, b: number, c: any) => [number, number];
|
|
203
|
+
readonly wasm_bindgen__convert__closures_____invoke__he561fc60712dccf3: (a: number, b: number, c: any) => [number, number];
|
|
204
|
+
readonly wasm_bindgen__convert__closures_____invoke__h9288ef3fe9915859: (a: number, b: number, c: any, d: any) => void;
|
|
205
|
+
readonly wasm_bindgen__convert__closures_____invoke__h32ae8b24e9ba2070: (a: number, b: number, c: any) => void;
|
|
206
|
+
readonly wasm_bindgen__convert__closures_____invoke__h0a32fbc1945885b3: (a: number, b: number, c: any) => void;
|
|
207
|
+
readonly wasm_bindgen__convert__closures_____invoke__h11c7dfb27aa38104: (a: number, b: number, c: any) => void;
|
|
208
|
+
readonly wasm_bindgen__convert__closures_____invoke__h0a32fbc1945885b3_4: (a: number, b: number, c: any) => void;
|
|
209
|
+
readonly wasm_bindgen__convert__closures_____invoke__h0a32fbc1945885b3_6: (a: number, b: number, c: any) => void;
|
|
210
|
+
readonly wasm_bindgen__convert__closures_____invoke__h8fe36b0e7e1e898d: (a: number, b: number) => void;
|
|
211
|
+
readonly wasm_bindgen__convert__closures_____invoke__h44a7023f2fe3c61c: (a: number, b: number) => void;
|
|
212
|
+
readonly wasm_bindgen__convert__closures_____invoke__hb6b3ef33145d000c: (a: number, b: number) => void;
|
|
205
213
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
206
214
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
207
215
|
readonly __wbindgen_exn_store: (a: number) => void;
|