@lat-murmeldjur/weeb_3 0.0.314001 → 0.0.317001

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 CHANGED
@@ -1,35 +1,40 @@
1
1
  # Weeb-3 - A Swarm client for browsers
2
2
 
3
- This project is a work in progress swarm client implementation relying solely on browser side technologies.
4
- It uses [wasm-pack](https://rustwasm.github.io/docs/wasm-pack/) to build the project for use in the browser.
3
+ This project is a work-in-progress Swarm client implementation that relies solely on browser-side technologies. It uses [wasm-pack](https://rustwasm.github.io/wasm-pack/) to build the Rust client to WebAssembly and runs the Swarm networking, retrieval, upload, persistence, service-worker integration, and UI logic inside the browser.
4
+
5
+ The codebase is still experimental. APIs, persistence formats, supported networks, and browser behavior may change while the implementation is being hardened.
5
6
 
6
7
  ## Building the code
7
8
 
8
- Ensure you have [`wasm-pack`](https://rustwasm.github.io/wasm-pack/), [`protoc`](https://grpc.io/docs/protoc-installation/), and [`clang`](https://clang.llvm.org/) installed.
9
+ Ensure you have [wasm-pack](https://rustwasm.github.io/wasm-pack/), [protoc](https://grpc.io/docs/protoc-installation/), and [clang](https://clang.llvm.org/) installed.
9
10
 
10
11
  1. Build the client library:
11
- ```shell
12
12
 
13
- RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --target web --out-dir static --out-name weeb_3
14
- ```
13
+ ```bash
14
+ RUSTFLAGS='--cfg getrandom_backend="wasm_js"' wasm-pack build --target web --out-dir static --out-name weeb_3
15
+ ```
15
16
 
16
- 2. Start the local server to serve html, js and wasm files:
17
- ```shell
18
- cargo run
19
- ```
20
- Note this server uses an unsecure self-signed certificate to provide https, which is not sufficient to enable Service Workers in chrome etc. This enables displaying single files from swarm, however to display websites a service worker is necessary, which requires a certificate deemed safe by the browser. You can however get your own safe certificate from - for example - github pages by forking the repository and setting the github pages to 'docs', and copying your latest version of the files from the static folder to the docs folder.
17
+ 2. Start the local server to serve the HTML, JavaScript, and Wasm files:
18
+
19
+ ```bash
20
+ cargo run
21
+ ```
22
+
23
+ The local server uses an insecure self-signed certificate to provide HTTPS. This is enough for loading the local application in many development flows, but it is not necessarily sufficient for enabling Service Workers in browsers such as Chrome. Single-file Swarm resources can still be displayed without the Service Worker, but rendering full Swarm websites requires a Service Worker and therefore a certificate that the browser treats as trusted.
24
+
25
+ For a trusted deployment, one option is to serve the static build from GitHub Pages or another HTTPS host with a browser-trusted certificate. A simple workflow is to fork the repository, enable GitHub Pages for the `docs` folder, and copy the latest files from `static` to `docs` after building.
21
26
 
22
- 3. Open the URL (https://localhost:8080/weeb-3 or for the github pages hosted version https://lat-murmeldjur.github.io/weeb-3)
27
+ 3. Open the application URL, for example [`https://localhost:8080/weeb-3`](https://localhost:8080/weeb-3), or the GitHub Pages hosted version at [`https://lat-murmeldjur.github.io/weeb-3`](https://lat-murmeldjur.github.io/weeb-3).
23
28
 
24
29
  ## Using the npm package
25
30
 
26
- The wasm-pack build now prepares the generated `static/package.json` for publishing to npm together with the assets required by the wrapper:
31
+ The `wasm-pack` build prepares the generated `static/package.json` for publishing to npm together with the wrapper assets required by the browser package:
27
32
 
28
33
  - `static/snippets/web3-0742d85b024bb6f5/inline0.js`
29
34
  - `static/weeb_3.js`
30
35
  - `static/weeb_3_bg.wasm`
31
36
 
32
- After publishing, the package can be used with the same API shape as `static/example.html`:
37
+ 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`:
33
38
 
34
39
  ```js
35
40
  import init, { Weeb3No103, BootstrapNode } from "@lat-murmeldjur/weeb_3";
@@ -37,9 +42,21 @@ import init, { Weeb3No103, BootstrapNode } from "@lat-murmeldjur/weeb_3";
37
42
  await init();
38
43
 
39
44
  const weeb3node = new Weeb3No103();
45
+
46
+ // Use the built-in network profile and bootnodes.
47
+ await weeb3node.connect();
48
+
49
+ // Or start with explicit browser-dialable bootnodes.
50
+ weeb3node.start([
51
+ new BootstrapNode("/ip4/example/tcp/443/wss/p2p/examplePeerId", true),
52
+ ], "10");
53
+
54
+ const ready = await weeb3node.ready(1, 20_000);
40
55
  ```
41
56
 
42
- The workflow defaults to publishing under the GitHub repository owner scope. If you need a different npm scope, set the `NPM_SCOPE` repository variable in GitHub Actions before pushing to `main`.
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.
58
+
59
+ 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`.
43
60
 
44
61
  ## [Notes]
45
62
 
@@ -48,148 +65,184 @@ The workflow defaults to publishing under the GitHub repository owner scope. If
48
65
  - Chrome (on Windows 11)
49
66
  - Chrome (Android)
50
67
  - Brave (on Windows 11)
51
- - Edge
68
+ - Edge
52
69
  - Firefox (on Windows 11)
53
70
  - Firefox (on Android)
54
71
 
55
- Testing and modifying for other browsers is planned.
72
+ Testing and improving support for other browsers is planned.
56
73
 
57
74
  ### How it works (architectural overview)
58
75
 
59
76
  The weeb-3 client consists of several logical components:
60
- - The web interface (implemented by src/interface.rs & of course static/index.html) that creates with the main weeb process and loads the service worker
61
- - The libp2p/swarm client (with main entry point in src/lib.rs)
62
- - A service worker, that enables hot-loading assets on relative paths for websites loaded from swarm (found in static/service.js)
63
77
 
64
- Below is a piece by piece overview of the current logic of components
78
+ - The browser interface, implemented primarily by `static/index.html`, `src/interface.rs`, `src/interface_conventions.rs`, and `src/interface_runtime_conventions.rs`.
79
+ - The libp2p / Swarm node, whose main entry point is `src/lib.rs`.
80
+ - The Swarm protocol handlers and data pipelines for handshake, peer discovery, pricing, accounting, retrieval, pushsync, pseudosettle, swap, manifests, feeds, streaming, and uploads.
81
+ - The Service Worker in `static/service.js`, which provides deterministic browser routes for Swarm content and forwards canonical requests into the Rust runtime.
82
+ - The npm / library facade in `src/library.rs`, which wraps the same runtime for embedding in other browser applications.
83
+ - Browser persistence, secure local state, network profiles, and on-chain integration implemented by `src/persistence.rs`, `src/secure_vault.rs`, `src/network_profile.rs`, and `src/on_chain.rs`.
84
+
85
+ Below is a piece-by-piece overview of the current component logic.
65
86
 
66
87
  #### The interface
67
88
 
68
- As of "commit number 189" the instantiator of all components is the index.html that starts the interface (by calling the function "interweeb" from src/interface.rs).
89
+ The default browser application is instantiated by `static/index.html`, which loads the generated Wasm module and calls `interweeb` from `src/interface.rs`.
90
+
91
+ `interweeb` creates a `Weeb3` node, clears legacy hash-based paths through `src/nav.rs`, and delegates the rest of the UI setup to `mount_interface`. `mount_interface` can either start the runtime itself or attach the interface to a runtime that has already been started by the package wrapper.
69
92
 
70
- The interweeb function has the following roles (in order of appearing in the code):
71
- - Starting the libp2p/swarm client in an async block
72
- - Setting a listener on the settings text input fields, triggering changing bootnode and connection settings to the weeb process on a button based event
73
- - Setting a listener on the navigation text input field, triggering requests to the shared worker on content change of the navigation text input field
74
- - Setting a listener on the create storage input fields, triggering connecting metamask and buying a batch with provided parameters
75
- - Setting a listener on the reuse space button, triggering resetting an already existing batch to clean slate
76
- - Setting a listener on the upload input fields, triggering uploading with the existing batch if there is one
77
- - Listening to logs sent back by the weeb process, as well as resources and responses of triggered requests and displaying them
78
- - Starting connection to bootnode after 600 milliseconds
93
+ The interface layer currently has the following roles:
94
+
95
+ - Starting the libp2p / Swarm runtime in an async browser task when requested.
96
+ - Installing UI conventions and rendering the interface shell.
97
+ - Preloading the secure vault module before sensitive upload, feed, stamp, or cheque operations are requested.
98
+ - Registering the Service Worker and routing Service Worker messages back to the Rust runtime.
99
+ - Reading the configured network profile, network id, and browser-dialable bootnodes, then passing bootnode connection requests to the `Weeb3` node.
100
+ - Wiring the navigation input so BZZ references, raw byte routes, and chunk routes can be opened from the UI.
101
+ - Wiring upload controls for single files, tar-based collections, optional encryption, index document selection, optional feed publishing, and postage-stamp reuse or reset.
102
+ - Wiring on-chain controls for upload prerequisites, postage batch acquisition, chequebook deployment, cheque signer persistence, and chequebook deposits through the browser wallet.
103
+ - Providing runtime controls such as pausing and resuming transfers.
104
+ - Rendering retrieved resources, website iframes, streaming media, raw downloads, logs, connection status, network state, and progress rows.
105
+
106
+ The current interface no longer assumes that requests are handled by a shared worker. The tab owns the `Weeb3` runtime, while the Service Worker acts as a request forwarder between browser fetch events and the active controlled client.
79
107
 
80
108
  #### The weeb process
81
109
 
82
- Originally implemented in a shared web worker, the main weeb process was intended to function as a common resource for multiple tabs of the same origin.
83
- This design would have enabled having one swarm client serving multiple open tabs, however, at the cost of giving up on the possibility of being able to open webrtc connections. However, chrome on android does not support shared workers, so for the time being, the main weeb process was transfered back into the tab.
84
-
85
- The high level architecture of the client resides in src/lib.rs, which (in order of appearing in the code) implements the following functions:
86
-
87
- - Defining and importing the swarm protocols generated by the protoc compiler
88
- - Defining the client (as the class Weeb3), it's in-memory registry of peers and their accounting (as the struct Wings)
89
- - Defining the 6 main functions of the client, namely
90
- 1) Changing the bootnode address and network id
91
- 2) Uploading a file or a tar based collection, optionally to a feed as well
92
- 3) A function that enables using the running client to retreive resources (the function "acquire")
93
- 4) A function to reset a postage stamp to original state
94
- 5) Instantiation (the "new" function), that starts the libp2p client
95
- 6) A function that continues running the client, asynchronously maintains/establishes connections, serves requests from the interface, and engages in protocols with the swarm (the "run" function)
96
- 7) Helper functions for the interface to get new log lines, connection numbers, and to submit new logs meant to be shown on the interface
97
-
98
- In slightly more detail, the new function does the following (in order of appearing in the code):
99
- - Randomises a new secret keypair
100
- - Starts a libp2p client with the stream libp2p behaviour enabled using webrtc transport
101
- - Creates a registry of peers (connected_peers, overlay_peers) and peer accounting (accounting_peers, ongoing_refreshments)
102
- - Creates a message port (to be listened to by the client and to be used by the acquire function)
103
- This message port can receive the writing end of a channel of bytes along with an address, so that it can write back the results of looking up the address to the channel received.
104
-
105
- The run function of the client implements an asynchronous architecture that does the following functions (in order of appearance in the code):
106
- - Creating channels for swarm specific functions
107
- 1) Receiving new peers to connect from the gossip protocol (peers_instructions_chan, connections_instructions_chan)
108
- 2) Accounting related functions (accounting_peer_chan, pricing_chan, refreshment_instructions_chan, refreshment_chan)
109
- 3) Receiving new bootnode address to connect to
110
- - Setting up listening to gossip protocol messages (information about existing peers) and pricing protocol messages (for receiving connected peers payment threshold updates)
111
- - An async routine to continously establish new libp2p-connections (dial) and consume libp2p-swarm events (swarm_event_handle) as well as dialing to bootnode
112
- - An async routine that wraps a number of further async routines for the following functions (event_handle):
113
- 1) Accounting connecting newly established peer connections (k1)
114
- 2) Setting payment thresholds for peers after successfully receiving payment threshold updates in the pricing protocol (k2)
115
- 3) Initiating refreshments/pseudosettle protocol for peers when triggered by accounting actions (k3)
116
- 4) Registering the results of successful refreshments towards peers (k4)
117
- - Two async routines that listens to high level download / upload requests
118
- - Two async routines that listens to data object level download / upload requests enabling joining and splitting of chunks
119
- - Two async routines that enable concurrent chunk level pushsync and retrieval requests
120
- - An async routine that attempts to conduct handshakes with dialed connections
121
-
122
- Currently - due to the blocking - non-blocking nature of the async framework, and to avoid a waiting thread hogging the single execution thread, the aforementioned routines intermittently try progressing every 600ms with non cpu intensive async sleeps happening in-between.
110
+ The main Swarm client is implemented in `src/lib.rs`. It is compiled only for the `wasm32` target and is designed to run in the browser event loop.
111
+
112
+ At a high level, `src/lib.rs` does the following:
113
+
114
+ - Imports the generated protobuf protocol modules from `etiquette_0` through `etiquette_8`.
115
+ - Defines the Swarm protocol names used by the client, including handshake, pricing, hive peer discovery, pseudosettle, retrieval, pushsync, and swap.
116
+ - Defines network mode helpers for testnet and mainnet. The built-in profiles currently map Swarm network id `10` to the Sepolia-based testnet profile and Swarm network id `1` to the Gnosis / xDAI mainnet profile.
117
+ - Defines the `Weeb3` client, which owns the libp2p `Swarm`, runtime channels, connection state, network id, progress store, transfer pause flag, and peer registry.
118
+ - Defines `Wings`, the in-memory peer and accounting registry used to track connected peers, overlay addresses, bootnodes, accounting peers, settlement state, known underlays, and self-observed ephemeral addresses.
119
+ - Exposes the runtime functions used by the interface and library wrapper.
120
+
121
+ The most important public `Weeb3` operations are:
122
+
123
+ 1. Changing the network id and bootnode address.
124
+ 2. Disconnecting and clearing peer state when the active network profile changes.
125
+ 3. Uploading a `File` or tar collection, optionally encrypted, optionally with an index document, and optionally as a feed update.
126
+ 4. Pushing a raw chunk through pushsync.
127
+ 5. Resolving and acquiring BZZ resources.
128
+ 6. Retrieving raw bytes or individual chunks.
129
+ 7. Reading feed envelopes and feed content.
130
+ 8. Resetting the active postage stamp state.
131
+ 9. Reporting logs, connection counts, active network id, and progress snapshots.
132
+ 10. Pausing or resuming transfers.
133
+ 11. Running the asynchronous protocol loop.
134
+
135
+ The `new` function constructs the browser node. In the current implementation it:
136
+
137
+ - Generates a fresh libp2p identity key for the browser runtime.
138
+ - Builds a libp2p `Swarm` with the browser WebSocket / WebSys transport.
139
+ - Uses authenticated Noise and Yamux multiplexing for libp2p connections.
140
+ - Enables the stream behavior used by the Swarm protocol handlers.
141
+ - Creates the peer registry, connection registry, progress store, transfer control flag, and runtime channels.
142
+ - Initializes the default Swarm network id to `10`.
143
+
144
+ The `run` function is the long-running runtime loop. It builds a channel-based asynchronous task graph for the browser runtime and coordinates the major subsystems:
145
+
146
+ - Peer discovery, bootnode dialing, connection retry, and connection cleanup.
147
+ - Incoming and outgoing libp2p stream handling.
148
+ - Handshake, identify, pricing, and peer promotion.
149
+ - Accounting, pseudosettle refreshes, cheque sending, and swap-related settlement messages.
150
+ - High-level BZZ resolution, range preparation, and BZZ range retrieval.
151
+ - Data-level retrieval and upload requests.
152
+ - Chunk-level retrieval and pushsync with bounded concurrency.
153
+ - Upload progress reporting.
154
+ - Transfer pause and cancellation checks.
155
+ - Log forwarding to the interface.
156
+
157
+ The runtime is heavily asynchronous, but it is still running inside the browser's Wasm execution environment. It uses `spawn_local`, async channels, short queue polling, and protocol-specific retry delays rather than OS threads.
123
158
 
124
159
  #### The Swarm Client Subcomponents
125
160
 
126
- The aforementioned architecture further depends on the following code modules:
127
- - The protocol handlers for handshake, hive, pricing, pseudosettle and retrieval (src/handlers.rs)
128
- - The accounting functions, such as calculating chunk prices, reserving, crediting, refreshing (src/accounting.rs)
129
- - The retrieval logic such as selecting peers to retrieve chunks from, decrypting chunks, joining files and triggering manifest interpretations (src/retrieval.rs)
130
- - The pushsync logic such as selecting peers to push chunks to, encrypting chunks, splitting files, triggering manifest and soc creation (src/upload.rs)
131
- - The manifest creation logic (src/manifest_upload.rs)
132
- - The manifest interpretation logic (src/manifest.rs)
133
- - The ENS contenthash resolution logic (src/ens.rs)
134
- - The indexeddb in-browser storage solution (src/persistence.rs)
135
- - Common methods and struct declarations including DOM manipulation, calculating proximity orders, validating content addressed and single owner chunks, calculating feed addresses, and encoding/decoding resource groups to communicate through byte channels e.g. towards the interface (src/conventions.rs)
161
+ The main runtime depends on several focused modules:
162
+
163
+ - `src/handlers.rs` implements the libp2p stream handlers for Swarm protocol traffic such as handshake, hive, pricing, pseudosettle, retrieval, pushsync, and swap.
164
+ - `src/accounting.rs` implements local accounting, price calculations, reservations, peer credit / debit tracking, refresh triggers, and settlement coordination.
165
+ - `src/addresses.rs` normalizes and validates browser-dialable underlays, including WebSocket and secure WebSocket multiaddresses.
166
+ - `src/retrieval.rs` implements chunk retrieval, peer selection, validation, decryption, data joining, and request coordination.
167
+ - `src/upload.rs` implements file splitting, optional encryption, chunk creation, postage stamp use, pushsync, manifest creation, SOC creation, and feed upload support.
168
+ - `src/manifest.rs` interprets Swarm manifests.
169
+ - `src/manifest_upload.rs` creates manifests for uploads and collections.
170
+ - `src/bzz_stream.rs` parses canonical BZZ resources, resolves manifests and paths, prepares range trees, and retrieves byte ranges for BZZ resources.
171
+ - `src/streaming_player.rs` integrates range retrieval with browser fetch requests and streaming media playback.
172
+ - `src/nav.rs` normalizes browser paths and extracts BZZ route references from the location bar.
173
+ - `src/ens.rs` resolves ENS content hashes to Swarm references.
174
+ - `src/events.rs` stores progress rows and progress revisions for the UI and package wrapper.
175
+ - `src/persistence.rs` stores browser-side data in IndexedDB.
176
+ - `src/secure_vault.rs` manages sensitive local state such as upload identities, postage-stamp state, feed ownership, and cheque signer material.
177
+ - `src/network_profile.rs` defines the built-in testnet and mainnet profiles, wallet chain ids, token symbols, and bootnodes.
178
+ - `src/on_chain.rs` implements browser wallet and contract interactions for postage batches, price oracle access, chequebook operations, swap token operations, and related state.
179
+ - `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
+ - `src/library.rs` exposes the Wasm runtime to JavaScript as `Weeb3No103` and `BootstrapNode`.
181
+ - `src/conventions.rs` and `src/interface_conventions.rs` collect common encoding, decoding, hashing, resource, UI, and protocol helper logic.
182
+
183
+ The ABI files in `src/*.json` are consumed by the on-chain module and cover contracts such as the postage stamp contract, price oracle, factory, sBZZ token, and simple swap contract.
136
184
 
137
185
  #### Persistence and identity
138
186
 
139
- The weeb process persists 3 types of data:
140
- - Caching chunks retrieved previously
141
- - Identity related keys and identifiers used for uploads and creating feeds
142
- 1) Batch ID
143
- 2) Private key of Batch Owner
144
- 3) Batch Bucket Limit
145
- 4) Private key of Feed Owner
146
- - Saturation of individual Batch Buckets
187
+ The browser runtime maintains a mix of ephemeral and persistent state.
147
188
 
148
- The indexeddb access is denied to loaded websites by opening websites from swarm in iframes marked with the sandbox attribute.
149
- The private keys are not used for blockchain purposes, the wallet responsible for buying a batch can only be connected through metamask currently.
150
- The libp2p node keys are chosen randomly each time the tab is reloaded, resulting in a unique overlay every time
189
+ The libp2p identity used by a `Weeb3` runtime is generated when the node is created. That makes the live peer identity tab-local and runtime-local. Peer maps, connection attempts, active streams, and accounting state are kept in memory by the `Weeb3` and `Wings` structures.
151
190
 
152
- ### The Service Worker
191
+ Browser persistence is used for state that should survive page reloads or browser sessions, such as retrieved chunks, chequebook data, signer material, postage-stamp state, and other runtime settings. Sensitive state is routed through the secure vault module instead of being handled directly by ordinary UI code.
153
192
 
154
- Quoting from the [MDN documentation](https://developer.mozilla.org/en-US/docs/Web/API/Service_Worker_API), "Service workers essentially act as proxy servers that sit between web applications, the browser, and the network (when available). They are intended, among other things, to enable the creation of effective offline experiences, intercept network requests, and take appropriate action based on whether the network is available, and update assets residing on the server. They will also allow access to push notifications and background sync APIs.".
193
+ Wallet access is requested only for on-chain operations. The browser wallet is used for chain switching, account access, postage purchase flows, chequebook deployment, and deposits. Upload/feed identities and cheque signer keys are managed separately from the wallet account so that Swarm protocol operations do not require signing every action with the injected wallet.
155
194
 
156
- The weeb-3 interface functions can display single files, for example pictures, documents, and other single files without relying on the service worker through dynamically creating blobs with associated mime types from the data retrieved from swarm, and making them available on [virtual urls](https://developer.mozilla.org/en-US/docs/Web/API/URL/createObjectURL_static). These resources are displayed in embed tags prepended to the content of the resultField html tag.
195
+ When the network profile changes, the runtime clears the current peer state and increments its connection generation so stale dialing, handshake, and connection events do not leak into the new network session.
157
196
 
158
- However, this createObjectUrl method inserts random strings into the virtual urls assigned to individual resources, which makes it unfeasible to be used to render complete websites, as relative paths of assets embedded in the site would be broken by such random strings. This necessitates the use of a service worker, which can intercept the http requests aimed towards the de facto server (for example github pages) and is able to create objects with deterministic url paths to be served in response to these requests, making serving relative assets possible.
197
+ ### The Service Worker
159
198
 
160
- To enable this, upon detecting a website manifest, the interface sends each retrieved resource complete with relative path and mime type to the service worker (the message event listener in static/service.js), which injects it into a named cache ('default0'), before prepending the website index document as an iframe to the resultField html tag of the weeb-3 browser tab.
199
+ The Service Worker in `static/service.js` sits between the browser fetch layer and the active weeb-3 page. Its role has expanded beyond the original static cache approach.
161
200
 
162
- This service worker is only enabled by the browser if the browser detects that the site is served through a secure https connection based on a trusted certificate, as this functionality is clearly a security sensitive asset that can be used to intercept http requests and inject arbitrary resources. The use of this functionality also creates new surfaces of attack such as creating malicious websites that could load a malevolent service worker at runtime, to enable further malicious injections. Disableing such attacks is part of the security development topic of the planned developments section.
201
+ Single files can still be displayed without a Service Worker by creating `Blob` object URLs with the correct MIME type. This is enough for images, documents, and other standalone files. It is not enough for full websites, because browser-generated object URLs contain random identifiers and therefore cannot reliably satisfy relative paths for scripts, stylesheets, images, and other website assets.
163
202
 
164
- ### Main dependencies
203
+ The Service Worker solves this by providing deterministic application-scoped routes:
165
204
 
166
- The weeb-3 project uses the following main rust crates:
167
- - libp2p
168
- - alloy
169
- - ethers
170
- - web3-rs
171
- - async-std
172
- - wasm-bindgen
173
- - js-sys
174
- - web-sys
175
- - indexed_db_futures
205
+ - `GET` and `HEAD` requests below `/bzz/<reference>/<path>` are interpreted as canonical BZZ resource requests.
206
+ - Raw byte and chunk routes below `/bytes/`, `/chunks/`, and `/chunk/` are forwarded to the Rust runtime.
207
+ - `POST` requests to the scoped `/bzz` endpoint are forwarded as upload requests, including upload headers such as encryption, collection, and index-document hints.
208
+ - Fetch requests are forwarded to the active controlled client through `postMessage` and `MessageChannel`.
209
+ - BZZ resources can be answered as full responses, byte-range responses, or streaming responses depending on MIME type, request headers, and resource size.
210
+ - The app shell is cached with a network-first strategy so that the interface can continue to load when a cached shell is available.
176
211
 
177
- ### Concurrency and memory limitations
212
+ This design means that rendered Swarm websites can request their own relative assets through ordinary browser fetch/navigation behavior, while the active Rust runtime resolves and retrieves the underlying Swarm data.
178
213
 
179
- The architecture of the weeb process enables a high level of concurrency between different tasks, sending a high number of different types of protocol messages parallelly. The webassembly architecture currently does not support threads or utilizing multiple CPUs, and the 32bit memory addressing scheme limits the usable memory to 4 GBs. Offloading the work to multiple non-specialized web-workers would increase this limit in both dimensions as each web worker has a separate memory address space and a separate physical thread.
214
+ The Service Worker is security-sensitive. Browsers only enable it for secure origins, and a trusted certificate is required for normal deployment. Because a Service Worker can intercept requests for its scope, production deployments should treat Service Worker replacement, injected pages, and malicious Swarm-hosted websites as important security boundaries. The current architecture reduces some risk by rendering Swarm websites in iframes and by keeping sensitive state behind the secure vault layer, but security hardening remains an active development area.
180
215
 
181
- ## [Planned development]
216
+ ### Main dependencies
217
+
218
+ The weeb-3 project uses the following main Rust crates and browser bindings:
182
219
 
183
- - Adding functionality to the service worker to enable triggering requests towards the shared worker, to retrieve resources when swarm references are present in a website, alternatively, achieving the same by overwriting navigation bar contents when an onclick event is detected to be a swarm reference
184
- - Simultaneous manifest fork lookups
185
- - Multi-threading through web-workers
186
- - Adding the swarm ACT feature
187
- - Wallet related functionality such as using cheques
188
- - Penetration testing against service worker replacement and other injection types of attacks
189
- - Penetration testing loaded websites access to keys in indexeddb / loading single executable files
190
- - Refinements in error propagation, reliability, robustness, status updates in ongoing processes
220
+ - `libp2p` and `libp2p-stream` for peer identity, transport, multiplexing, stream protocols, identify, ping, autonat / dcutr support, and browser WebSocket transport.
221
+ - `async-std` and `async-lock` for async runtime primitives that work in the browser Wasm target.
222
+ - `wasm-bindgen`, `wasm-bindgen-futures`, `js-sys`, and `web-sys` for JavaScript, DOM, Service Worker, browser API, and Promise integration.
223
+ - `web3`, `alloy`, `alloy-signer-local`, and `ethers` for wallet, signing, ABI, and on-chain contract interaction.
224
+ - `indexed_db_futures` for browser IndexedDB persistence.
225
+ - `tar` and `mime_guess` for collection upload handling and MIME inference.
226
+ - `getrandom` with the `wasm_js` backend for browser-compatible randomness.
227
+ - `base64`, `hex`, `byteorder`, and numeric / cryptographic helper crates for protocol encoding and Swarm data structures.
228
+ - `tokio` and `tower-http` for the local development server used outside the Wasm target.
191
229
 
230
+ ### Concurrency and memory limitations
231
+
232
+ The browser runtime enables a high level of concurrency between Swarm tasks by combining libp2p streams, async channels, local futures, bounded upload and retrieval concurrency, and protocol-specific retry loops. This allows many protocol messages and chunk operations to be in flight at the same time even though the Wasm runtime itself is not using native threads.
192
233
 
234
+ The current browser architecture is still constrained by the WebAssembly execution environment. A tab-local runtime shares the browser's single-threaded Wasm event loop unless browser and build settings enable more advanced worker-based execution. Memory is also constrained by the WebAssembly address space and by practical browser limits.
193
235
 
236
+ Moving parts of the runtime into dedicated workers could improve isolation, memory headroom, and CPU parallelism in the future. That change would need to preserve browser transport support, Service Worker communication, secure vault boundaries, and compatibility with mobile browsers.
194
237
 
238
+ ## [Planned development]
195
239
 
240
+ - Further hardening of Service Worker replacement, iframe boundaries, route handling, and injected-content attack surfaces.
241
+ - Additional security review around loaded websites, IndexedDB access, secure vault access, upload identities, postage state, and cheque signer material.
242
+ - Better reliability, error propagation, status reporting, and recovery for long-running retrieval, upload, settlement, and connection processes.
243
+ - Improved network profile management, bootnode handling, peer quality tracking, and dial retry behavior.
244
+ - More complete and stable JavaScript package documentation and examples for the `Weeb3No103` wrapper.
245
+ - Continued improvements to BZZ path handling, streaming media retrieval, byte-range serving, and manifest fork lookup performance.
246
+ - Worker-based partitioning or multithreading where browser support and the project architecture make it practical.
247
+ - Additional Swarm feature coverage, including ACT and other protocol features not yet fully implemented.
248
+ - Continued wallet, postage, chequebook, and swap UX refinements.
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@lat-murmeldjur/weeb_3",
3
3
  "type": "module",
4
4
  "description": "A Swarm client for browsers",
5
- "version": "0.0.314001",
5
+ "version": "0.0.317001",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",
package/weeb_3.d.ts CHANGED
@@ -110,31 +110,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
110
110
 
111
111
  export interface InitOutput {
112
112
  readonly memory: WebAssembly.Memory;
113
+ readonly interweeb: (a: number, b: number) => any;
113
114
  readonly __wbg_bootstrapnode_free: (a: number, b: number) => void;
114
- readonly __wbg_weeb3_free: (a: number, b: number) => void;
115
115
  readonly __wbg_weeb3no103_free: (a: number, b: number) => void;
116
- readonly __wbg_wings_free: (a: number, b: number) => void;
117
116
  readonly bootstrapnode_multiaddr: (a: number) => [number, number];
118
117
  readonly bootstrapnode_new: (a: number, b: number, c: number) => number;
119
118
  readonly bootstrapnode_usable: (a: number) => number;
120
- readonly weeb3_acquire: (a: number, b: number, c: number) => any;
121
- readonly weeb3_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
122
- readonly weeb3_change_bootnode_address: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
123
- readonly weeb3_get_connections: (a: number) => any;
124
- readonly weeb3_get_current_logs: (a: number) => any;
125
- readonly weeb3_get_network_id: (a: number) => any;
126
- readonly weeb3_get_ongoing_connections: (a: number) => any;
127
- readonly weeb3_interface_log: (a: number, b: number, c: number) => void;
128
- readonly weeb3_new: (a: number, b: number) => number;
129
- readonly weeb3_post_push_chunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
130
- readonly weeb3_post_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
131
- readonly weeb3_reset_stamp: (a: number) => any;
132
- readonly weeb3_retrieve_bytes: (a: number, b: number, c: number) => any;
133
- readonly weeb3_retrieve_chunk_bytes: (a: number, b: number, c: number) => any;
134
- readonly weeb3_run: (a: number, b: number, c: number) => any;
135
- readonly weeb3_set_network_id: (a: number, b: number, c: number) => any;
136
- readonly weeb3_toggle_transfer_pause: (a: number) => any;
137
- readonly weeb3_transfer_paused: (a: number) => number;
138
119
  readonly weeb3no103_acquireFeed: (a: number, b: number, c: number, d: number, e: number) => any;
139
120
  readonly weeb3no103_acquireFeedBytes: (a: number, b: number, c: number, d: number, e: number) => any;
140
121
  readonly weeb3no103_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
@@ -187,19 +168,38 @@ export interface InitOutput {
187
168
  readonly weeb3no103_upload_prerequisites: (a: number, b: number, c: number) => any;
188
169
  readonly weeb3no103_feed_topic: (a: number, b: number, c: number) => any;
189
170
  readonly weeb3no103_render_interface: (a: number, b: any) => any;
190
- readonly interweeb: (a: number, b: number) => 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
191
  readonly __wbg_requestarguments_free: (a: number, b: number) => void;
192
192
  readonly requestarguments_method: (a: number) => [number, number];
193
193
  readonly requestarguments_params: (a: number) => any;
194
194
  readonly wasm_bindgen__convert__closures_____invoke__h39453673aeb618ab: (a: number, b: number, c: any) => [number, number];
195
- readonly wasm_bindgen__convert__closures_____invoke__h53c06beeaa986888: (a: number, b: number, c: any) => [number, number];
195
+ readonly wasm_bindgen__convert__closures_____invoke__h2d6c650cac09b0b2: (a: number, b: number, c: any) => [number, number];
196
196
  readonly wasm_bindgen__convert__closures_____invoke__h38bb2d7626f4cfa1: (a: number, b: number, c: any, d: any) => void;
197
- readonly wasm_bindgen__convert__closures_____invoke__h3a390d488cf131e0: (a: number, b: number, c: any) => void;
198
- readonly wasm_bindgen__convert__closures_____invoke__h131b691509b372cd: (a: number, b: number, c: any) => void;
199
- readonly wasm_bindgen__convert__closures_____invoke__hd4aa016cef2e7803: (a: number, b: number, c: any) => void;
200
- readonly wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_4: (a: number, b: number, c: any) => void;
201
- readonly wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_6: (a: number, b: number, c: any) => void;
202
- readonly wasm_bindgen__convert__closures_____invoke__haa3261c3001c7603: (a: number, b: number) => void;
197
+ readonly wasm_bindgen__convert__closures_____invoke__h6a22690fdc0e9d3a: (a: number, b: number, c: any) => void;
198
+ readonly wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e: (a: number, b: number, c: any) => void;
199
+ readonly wasm_bindgen__convert__closures_____invoke__h7595764d8075eff9: (a: number, b: number, c: any) => void;
200
+ readonly wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_4: (a: number, b: number, c: any) => void;
201
+ readonly wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_6: (a: number, b: number, c: any) => void;
202
+ readonly wasm_bindgen__convert__closures_____invoke__h096c301d37cdbb45: (a: number, b: number) => void;
203
203
  readonly wasm_bindgen__convert__closures_____invoke__h6f4ab657709ae694: (a: number, b: number) => void;
204
204
  readonly wasm_bindgen__convert__closures_____invoke__hbc64d0ffa7547e63: (a: number, b: number) => void;
205
205
  readonly __wbindgen_malloc: (a: number, b: number) => number;
package/weeb_3.js CHANGED
@@ -1023,6 +1023,9 @@ function __wbg_get_imports() {
1023
1023
  const ret = arg0.arrayBuffer();
1024
1024
  return ret;
1025
1025
  },
1026
+ __wbg_assign_551ec2d000f70c24: function() { return handleError(function (arg0, arg1, arg2) {
1027
+ arg0.assign(getStringFromWasm0(arg1, arg2));
1028
+ }, arguments); },
1026
1029
  __wbg_body_7d5b1a2ac7f2c821: function(arg0) {
1027
1030
  const ret = arg0.body;
1028
1031
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1101,6 +1104,10 @@ function __wbg_get_imports() {
1101
1104
  const ret = arg0.data;
1102
1105
  return ret;
1103
1106
  },
1107
+ __wbg_decodeURIComponent_b3ca91f9662a251a: function() { return handleError(function (arg0, arg1) {
1108
+ const ret = decodeURIComponent(getStringFromWasm0(arg0, arg1));
1109
+ return ret;
1110
+ }, arguments); },
1104
1111
  __wbg_document_aceb08cd6489baf5: function(arg0) {
1105
1112
  const ret = arg0.document;
1106
1113
  return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
@@ -1406,6 +1413,16 @@ function __wbg_get_imports() {
1406
1413
  const ret = result;
1407
1414
  return ret;
1408
1415
  },
1416
+ __wbg_instanceof_ServiceWorkerContainer_359999b02d00251f: function(arg0) {
1417
+ let result;
1418
+ try {
1419
+ result = arg0 instanceof ServiceWorkerContainer;
1420
+ } catch (_) {
1421
+ result = false;
1422
+ }
1423
+ const ret = result;
1424
+ return ret;
1425
+ },
1409
1426
  __wbg_instanceof_ServiceWorkerRegistration_6cce0130f3af08c5: function(arg0) {
1410
1427
  let result;
1411
1428
  try {
@@ -1555,6 +1572,10 @@ function __wbg_get_imports() {
1555
1572
  state0.a = 0;
1556
1573
  }
1557
1574
  },
1575
+ __wbg_new_b733f187b7a8b317: function() { return handleError(function (arg0, arg1) {
1576
+ const ret = new URL(getStringFromWasm0(arg0, arg1));
1577
+ return ret;
1578
+ }, arguments); },
1558
1579
  __wbg_new_ce1ab61c1c2b300d: function() {
1559
1580
  const ret = new Object();
1560
1581
  return ret;
@@ -1674,6 +1695,13 @@ function __wbg_get_imports() {
1674
1695
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1675
1696
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1676
1697
  }, arguments); },
1698
+ __wbg_pathname_970b828999d759fb: function(arg0, arg1) {
1699
+ const ret = arg1.pathname;
1700
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
1701
+ const len1 = WASM_VECTOR_LEN;
1702
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1703
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
1704
+ },
1677
1705
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
1678
1706
  const ret = arg0.performance;
1679
1707
  return ret;
@@ -2004,52 +2032,52 @@ function __wbg_get_imports() {
2004
2032
  console.warn(arg0);
2005
2033
  },
2006
2034
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
2007
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1445, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2008
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h3a390d488cf131e0);
2035
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1492, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2036
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6a22690fdc0e9d3a);
2009
2037
  return ret;
2010
2038
  },
2011
2039
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
2012
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2605, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2040
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 2645, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2013
2041
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h39453673aeb618ab);
2014
2042
  return ret;
2015
2043
  },
2016
2044
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
2017
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1643, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2018
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h131b691509b372cd);
2045
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 1672, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2046
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e);
2019
2047
  return ret;
2020
2048
  },
2021
2049
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
2022
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1263, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2023
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hd4aa016cef2e7803);
2050
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1290, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2051
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h7595764d8075eff9);
2024
2052
  return ret;
2025
2053
  },
2026
2054
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
2027
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1643, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2028
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_4);
2055
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 1672, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2056
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_4);
2029
2057
  return ret;
2030
2058
  },
2031
2059
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
2032
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 846, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2033
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h53c06beeaa986888);
2060
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 477, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
2061
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h2d6c650cac09b0b2);
2034
2062
  return ret;
2035
2063
  },
2036
2064
  __wbindgen_cast_0000000000000007: function(arg0, arg1) {
2037
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1643, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2038
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_6);
2065
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 1672, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2066
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_6);
2039
2067
  return ret;
2040
2068
  },
2041
2069
  __wbindgen_cast_0000000000000008: function(arg0, arg1) {
2042
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1261, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2043
- const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__haa3261c3001c7603);
2070
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 1292, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2071
+ const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h096c301d37cdbb45);
2044
2072
  return ret;
2045
2073
  },
2046
2074
  __wbindgen_cast_0000000000000009: function(arg0, arg1) {
2047
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2181, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2075
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2212, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2048
2076
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__h6f4ab657709ae694);
2049
2077
  return ret;
2050
2078
  },
2051
2079
  __wbindgen_cast_000000000000000a: function(arg0, arg1) {
2052
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2582, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2080
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 2622, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
2053
2081
  const ret = makeMutClosure(arg0, arg1, wasm_bindgen__convert__closures_____invoke__hbc64d0ffa7547e63);
2054
2082
  return ret;
2055
2083
  },
@@ -2108,8 +2136,8 @@ function __wbg_get_imports() {
2108
2136
  };
2109
2137
  }
2110
2138
 
2111
- function wasm_bindgen__convert__closures_____invoke__haa3261c3001c7603(arg0, arg1) {
2112
- wasm.wasm_bindgen__convert__closures_____invoke__haa3261c3001c7603(arg0, arg1);
2139
+ function wasm_bindgen__convert__closures_____invoke__h096c301d37cdbb45(arg0, arg1) {
2140
+ wasm.wasm_bindgen__convert__closures_____invoke__h096c301d37cdbb45(arg0, arg1);
2113
2141
  }
2114
2142
 
2115
2143
  function wasm_bindgen__convert__closures_____invoke__h6f4ab657709ae694(arg0, arg1) {
@@ -2120,24 +2148,24 @@ function wasm_bindgen__convert__closures_____invoke__hbc64d0ffa7547e63(arg0, arg
2120
2148
  wasm.wasm_bindgen__convert__closures_____invoke__hbc64d0ffa7547e63(arg0, arg1);
2121
2149
  }
2122
2150
 
2123
- function wasm_bindgen__convert__closures_____invoke__h3a390d488cf131e0(arg0, arg1, arg2) {
2124
- wasm.wasm_bindgen__convert__closures_____invoke__h3a390d488cf131e0(arg0, arg1, arg2);
2151
+ function wasm_bindgen__convert__closures_____invoke__h6a22690fdc0e9d3a(arg0, arg1, arg2) {
2152
+ wasm.wasm_bindgen__convert__closures_____invoke__h6a22690fdc0e9d3a(arg0, arg1, arg2);
2125
2153
  }
2126
2154
 
2127
- function wasm_bindgen__convert__closures_____invoke__h131b691509b372cd(arg0, arg1, arg2) {
2128
- wasm.wasm_bindgen__convert__closures_____invoke__h131b691509b372cd(arg0, arg1, arg2);
2155
+ function wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e(arg0, arg1, arg2) {
2156
+ wasm.wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e(arg0, arg1, arg2);
2129
2157
  }
2130
2158
 
2131
- function wasm_bindgen__convert__closures_____invoke__hd4aa016cef2e7803(arg0, arg1, arg2) {
2132
- wasm.wasm_bindgen__convert__closures_____invoke__hd4aa016cef2e7803(arg0, arg1, arg2);
2159
+ function wasm_bindgen__convert__closures_____invoke__h7595764d8075eff9(arg0, arg1, arg2) {
2160
+ wasm.wasm_bindgen__convert__closures_____invoke__h7595764d8075eff9(arg0, arg1, arg2);
2133
2161
  }
2134
2162
 
2135
- function wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_4(arg0, arg1, arg2) {
2136
- wasm.wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_4(arg0, arg1, arg2);
2163
+ function wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_4(arg0, arg1, arg2) {
2164
+ wasm.wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_4(arg0, arg1, arg2);
2137
2165
  }
2138
2166
 
2139
- function wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_6(arg0, arg1, arg2) {
2140
- wasm.wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_6(arg0, arg1, arg2);
2167
+ function wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_6(arg0, arg1, arg2) {
2168
+ wasm.wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_6(arg0, arg1, arg2);
2141
2169
  }
2142
2170
 
2143
2171
  function wasm_bindgen__convert__closures_____invoke__h39453673aeb618ab(arg0, arg1, arg2) {
@@ -2147,8 +2175,8 @@ function wasm_bindgen__convert__closures_____invoke__h39453673aeb618ab(arg0, arg
2147
2175
  }
2148
2176
  }
2149
2177
 
2150
- function wasm_bindgen__convert__closures_____invoke__h53c06beeaa986888(arg0, arg1, arg2) {
2151
- const ret = wasm.wasm_bindgen__convert__closures_____invoke__h53c06beeaa986888(arg0, arg1, arg2);
2178
+ function wasm_bindgen__convert__closures_____invoke__h2d6c650cac09b0b2(arg0, arg1, arg2) {
2179
+ const ret = wasm.wasm_bindgen__convert__closures_____invoke__h2d6c650cac09b0b2(arg0, arg1, arg2);
2152
2180
  if (ret[1]) {
2153
2181
  throw takeFromExternrefTable0(ret[0]);
2154
2182
  }
package/weeb_3_bg.wasm CHANGED
Binary file
@@ -1,31 +1,12 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const interweeb: (a: number, b: number) => any;
4
5
  export const __wbg_bootstrapnode_free: (a: number, b: number) => void;
5
- export const __wbg_weeb3_free: (a: number, b: number) => void;
6
6
  export const __wbg_weeb3no103_free: (a: number, b: number) => void;
7
- export const __wbg_wings_free: (a: number, b: number) => void;
8
7
  export const bootstrapnode_multiaddr: (a: number) => [number, number];
9
8
  export const bootstrapnode_new: (a: number, b: number, c: number) => number;
10
9
  export const bootstrapnode_usable: (a: number) => number;
11
- export const weeb3_acquire: (a: number, b: number, c: number) => any;
12
- export const weeb3_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
13
- export const weeb3_change_bootnode_address: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
14
- export const weeb3_get_connections: (a: number) => any;
15
- export const weeb3_get_current_logs: (a: number) => any;
16
- export const weeb3_get_network_id: (a: number) => any;
17
- export const weeb3_get_ongoing_connections: (a: number) => any;
18
- export const weeb3_interface_log: (a: number, b: number, c: number) => void;
19
- export const weeb3_new: (a: number, b: number) => number;
20
- export const weeb3_post_push_chunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
21
- export const weeb3_post_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
22
- export const weeb3_reset_stamp: (a: number) => any;
23
- export const weeb3_retrieve_bytes: (a: number, b: number, c: number) => any;
24
- export const weeb3_retrieve_chunk_bytes: (a: number, b: number, c: number) => any;
25
- export const weeb3_run: (a: number, b: number, c: number) => any;
26
- export const weeb3_set_network_id: (a: number, b: number, c: number) => any;
27
- export const weeb3_toggle_transfer_pause: (a: number) => any;
28
- export const weeb3_transfer_paused: (a: number) => number;
29
10
  export const weeb3no103_acquireFeed: (a: number, b: number, c: number, d: number, e: number) => any;
30
11
  export const weeb3no103_acquireFeedBytes: (a: number, b: number, c: number, d: number, e: number) => any;
31
12
  export const weeb3no103_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
@@ -78,19 +59,38 @@ export const weeb3no103_uploadPrerequisites: (a: number, b: number, c: number) =
78
59
  export const weeb3no103_upload_prerequisites: (a: number, b: number, c: number) => any;
79
60
  export const weeb3no103_feed_topic: (a: number, b: number, c: number) => any;
80
61
  export const weeb3no103_render_interface: (a: number, b: any) => any;
81
- export const interweeb: (a: number, b: number) => any;
62
+ export const __wbg_weeb3_free: (a: number, b: number) => void;
63
+ export const __wbg_wings_free: (a: number, b: number) => void;
64
+ export const weeb3_acquire: (a: number, b: number, c: number) => any;
65
+ export const weeb3_acquire_feed: (a: number, b: number, c: number, d: number, e: number) => any;
66
+ export const weeb3_change_bootnode_address: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
67
+ export const weeb3_get_connections: (a: number) => any;
68
+ export const weeb3_get_current_logs: (a: number) => any;
69
+ export const weeb3_get_network_id: (a: number) => any;
70
+ export const weeb3_get_ongoing_connections: (a: number) => any;
71
+ export const weeb3_interface_log: (a: number, b: number, c: number) => void;
72
+ export const weeb3_new: (a: number, b: number) => number;
73
+ export const weeb3_post_push_chunk: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => any;
74
+ export const weeb3_post_upload: (a: number, b: any, c: number, d: number, e: number, f: number, g: number, h: number) => any;
75
+ export const weeb3_reset_stamp: (a: number) => any;
76
+ export const weeb3_retrieve_bytes: (a: number, b: number, c: number) => any;
77
+ export const weeb3_retrieve_chunk_bytes: (a: number, b: number, c: number) => any;
78
+ export const weeb3_run: (a: number, b: number, c: number) => any;
79
+ export const weeb3_set_network_id: (a: number, b: number, c: number) => any;
80
+ export const weeb3_toggle_transfer_pause: (a: number) => any;
81
+ export const weeb3_transfer_paused: (a: number) => number;
82
82
  export const __wbg_requestarguments_free: (a: number, b: number) => void;
83
83
  export const requestarguments_method: (a: number) => [number, number];
84
84
  export const requestarguments_params: (a: number) => any;
85
85
  export const wasm_bindgen__convert__closures_____invoke__h39453673aeb618ab: (a: number, b: number, c: any) => [number, number];
86
- export const wasm_bindgen__convert__closures_____invoke__h53c06beeaa986888: (a: number, b: number, c: any) => [number, number];
86
+ export const wasm_bindgen__convert__closures_____invoke__h2d6c650cac09b0b2: (a: number, b: number, c: any) => [number, number];
87
87
  export const wasm_bindgen__convert__closures_____invoke__h38bb2d7626f4cfa1: (a: number, b: number, c: any, d: any) => void;
88
- export const wasm_bindgen__convert__closures_____invoke__h3a390d488cf131e0: (a: number, b: number, c: any) => void;
89
- export const wasm_bindgen__convert__closures_____invoke__h131b691509b372cd: (a: number, b: number, c: any) => void;
90
- export const wasm_bindgen__convert__closures_____invoke__hd4aa016cef2e7803: (a: number, b: number, c: any) => void;
91
- export const wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_4: (a: number, b: number, c: any) => void;
92
- export const wasm_bindgen__convert__closures_____invoke__h131b691509b372cd_6: (a: number, b: number, c: any) => void;
93
- export const wasm_bindgen__convert__closures_____invoke__haa3261c3001c7603: (a: number, b: number) => void;
88
+ export const wasm_bindgen__convert__closures_____invoke__h6a22690fdc0e9d3a: (a: number, b: number, c: any) => void;
89
+ export const wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e: (a: number, b: number, c: any) => void;
90
+ export const wasm_bindgen__convert__closures_____invoke__h7595764d8075eff9: (a: number, b: number, c: any) => void;
91
+ export const wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_4: (a: number, b: number, c: any) => void;
92
+ export const wasm_bindgen__convert__closures_____invoke__h82048516b933eb0e_6: (a: number, b: number, c: any) => void;
93
+ export const wasm_bindgen__convert__closures_____invoke__h096c301d37cdbb45: (a: number, b: number) => void;
94
94
  export const wasm_bindgen__convert__closures_____invoke__h6f4ab657709ae694: (a: number, b: number) => void;
95
95
  export const wasm_bindgen__convert__closures_____invoke__hbc64d0ffa7547e63: (a: number, b: number) => void;
96
96
  export const __wbindgen_malloc: (a: number, b: number) => number;