lumina-node-wasm 0.7.0 → 0.8.1

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
@@ -3,11 +3,15 @@
3
3
  A compatibility layer for the [`Lumina`](https://github.com/eigerco/lumina) node to
4
4
  work within a browser environment and be operable with javascript.
5
5
 
6
+ # Changelog
7
+
8
+ You can find about the latest changes [here](https://github.com/eigerco/lumina/blob/main/node-wasm/CHANGELOG.md).
9
+
6
10
  # Example
7
11
  Starting lumina inside a dedicated worker
8
12
 
9
13
  ```javascript
10
- import { spawnNode, NodeConfig, Network } from "lumina-node";
14
+ import { spawnNode, Network, NodeConfig } from "lumina-node";
11
15
 
12
16
  const node = await spawnNode();
13
17
  const mainnetConfig = NodeConfig.default(Network.Mainnet);
@@ -20,12 +24,12 @@ await node.requestHeadHeader();
20
24
 
21
25
  ## Manual setup
22
26
 
23
- Note that `spawnNode` implicitly calls wasm initialisation code. If you want to set things up manually, make sure to call the default export before using any of the wasm functionality.
27
+ `spawnNode` sets up a `DedicatedWorker` instance and runs `NodeWorker` there. If you want to set things up manually
28
+ you need to connect client and worker using objects that have `MessagePort` interface.
24
29
 
25
30
  ```javascript
26
- import init, { NodeConfig, Network } from "lumina-node";
31
+ import { Network, NodeClient, NodeConfig, NodeWorker } from "lumina-node";
27
32
 
28
- await init();
29
33
  const config = NodeConfig.default(Network.Mainnet);
30
34
 
31
35
  // client and worker accept any object with MessagePort like interface e.g. Worker
@@ -43,5 +47,8 @@ await client.requestHeadHeader();
43
47
 
44
48
  ## Rust API
45
49
 
46
- For comprehensive and fully typed interface documentation, see [lumina-node](https://docs.rs/lumina-node/latest/lumina_node/) and [celestia-types](https://docs.rs/celestia-types/latest/celestia_types/) documentation on docs.rs. You can see there the exact structure of more complex types, such as [`ExtendedHeader`](https://docs.rs/celestia-types/latest/celestia_types/struct.ExtendedHeader.html). JavaScript API's goal is to provide similar interface to Rust when possible, e.g. `NodeClient` mirrors [`Node`](https://docs.rs/lumina-node/latest/lumina_node/node/struct.Node.html).
50
+ For comprehensive and fully typed interface documentation, see [lumina-node](https://docs.rs/lumina-node/latest/lumina_node/)
51
+ and [celestia-types](https://docs.rs/celestia-types/latest/celestia_types/) documentation on docs.rs.
52
+ You can see there the exact structure of more complex types, such as [`ExtendedHeader`](https://docs.rs/celestia-types/latest/celestia_types/struct.ExtendedHeader.html).
53
+ JavaScript API's goal is to provide similar interface to Rust when possible, e.g. `NodeClient` mirrors [`Node`](https://docs.rs/lumina-node/latest/lumina_node/node/struct.Node.html).
47
54