lumina-node-wasm 0.4.0 → 0.5.0
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 +5 -0
- package/lumina_node_wasm.d.ts +19 -115
- package/lumina_node_wasm.js +5 -2428
- package/lumina_node_wasm_bg.js +2640 -0
- package/lumina_node_wasm_bg.wasm +0 -0
- package/package.json +3 -1
package/README.md
CHANGED
|
@@ -40,3 +40,8 @@ const client = await new NodeClient(channel.port2);
|
|
|
40
40
|
await client.waitConnected();
|
|
41
41
|
await client.requestHeadHeader();
|
|
42
42
|
```
|
|
43
|
+
|
|
44
|
+
## Rust API
|
|
45
|
+
|
|
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).
|
|
47
|
+
|
package/lumina_node_wasm.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ export enum Network {
|
|
|
26
26
|
Private = 3,
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
+
* A range of blocks between `start` and `end` height, inclusive
|
|
29
30
|
*/
|
|
30
31
|
export class BlockRange {
|
|
31
32
|
/**
|
|
@@ -38,9 +39,11 @@ export class BlockRange {
|
|
|
38
39
|
toString(): string;
|
|
39
40
|
free(): void;
|
|
40
41
|
/**
|
|
42
|
+
* Last block height in range
|
|
41
43
|
*/
|
|
42
44
|
end: bigint;
|
|
43
45
|
/**
|
|
46
|
+
* First block height in range
|
|
44
47
|
*/
|
|
45
48
|
start: bigint;
|
|
46
49
|
}
|
|
@@ -57,28 +60,36 @@ export class ConnectionCountersSnapshot {
|
|
|
57
60
|
toString(): string;
|
|
58
61
|
free(): void;
|
|
59
62
|
/**
|
|
63
|
+
* The total number of connections, both pending and established.
|
|
60
64
|
*/
|
|
61
65
|
num_connections: number;
|
|
62
66
|
/**
|
|
67
|
+
* The number of outgoing connections being established.
|
|
63
68
|
*/
|
|
64
69
|
num_established: number;
|
|
65
70
|
/**
|
|
71
|
+
* The number of established incoming connections.
|
|
66
72
|
*/
|
|
67
73
|
num_established_incoming: number;
|
|
68
74
|
/**
|
|
75
|
+
* The number of established outgoing connections.
|
|
69
76
|
*/
|
|
70
77
|
num_established_outgoing: number;
|
|
71
78
|
/**
|
|
79
|
+
* The total number of pending connections, both incoming and outgoing.
|
|
72
80
|
*/
|
|
73
81
|
num_pending: number;
|
|
74
82
|
/**
|
|
83
|
+
* The total number of pending connections, both incoming and outgoing.
|
|
75
84
|
*/
|
|
76
85
|
num_pending_incoming: number;
|
|
77
86
|
/**
|
|
87
|
+
* The number of outgoing connections being established.
|
|
78
88
|
*/
|
|
79
89
|
num_pending_outgoing: number;
|
|
80
90
|
}
|
|
81
91
|
/**
|
|
92
|
+
* Information about the connections
|
|
82
93
|
*/
|
|
83
94
|
export class NetworkInfoSnapshot {
|
|
84
95
|
/**
|
|
@@ -91,9 +102,11 @@ export class NetworkInfoSnapshot {
|
|
|
91
102
|
toString(): string;
|
|
92
103
|
free(): void;
|
|
93
104
|
/**
|
|
105
|
+
* Gets counters for ongoing network connections.
|
|
94
106
|
*/
|
|
95
107
|
connection_counters: ConnectionCountersSnapshot;
|
|
96
108
|
/**
|
|
109
|
+
* The number of connected peers, i.e. peers with whom at least one established connection exists.
|
|
97
110
|
*/
|
|
98
111
|
num_peers: number;
|
|
99
112
|
}
|
|
@@ -326,6 +339,7 @@ export class NodeWorker {
|
|
|
326
339
|
run(): Promise<void>;
|
|
327
340
|
}
|
|
328
341
|
/**
|
|
342
|
+
* Statistics of the connected peers
|
|
329
343
|
*/
|
|
330
344
|
export class PeerTrackerInfoSnapshot {
|
|
331
345
|
/**
|
|
@@ -338,13 +352,16 @@ export class PeerTrackerInfoSnapshot {
|
|
|
338
352
|
toString(): string;
|
|
339
353
|
free(): void;
|
|
340
354
|
/**
|
|
355
|
+
* Number of the connected peers.
|
|
341
356
|
*/
|
|
342
357
|
num_connected_peers: bigint;
|
|
343
358
|
/**
|
|
359
|
+
* Number of the connected trusted peers.
|
|
344
360
|
*/
|
|
345
361
|
num_connected_trusted_peers: bigint;
|
|
346
362
|
}
|
|
347
363
|
/**
|
|
364
|
+
* Status of the synchronization.
|
|
348
365
|
*/
|
|
349
366
|
export class SyncingInfoSnapshot {
|
|
350
367
|
/**
|
|
@@ -357,124 +374,11 @@ export class SyncingInfoSnapshot {
|
|
|
357
374
|
toString(): string;
|
|
358
375
|
free(): void;
|
|
359
376
|
/**
|
|
377
|
+
* Ranges of headers that are already synchronised
|
|
360
378
|
*/
|
|
361
379
|
stored_headers: (BlockRange)[];
|
|
362
380
|
/**
|
|
381
|
+
* Syncing target. The latest height seen in the network that was successfully verified.
|
|
363
382
|
*/
|
|
364
383
|
subjective_head: bigint;
|
|
365
384
|
}
|
|
366
|
-
|
|
367
|
-
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
368
|
-
|
|
369
|
-
export interface InitOutput {
|
|
370
|
-
readonly memory: WebAssembly.Memory;
|
|
371
|
-
readonly __wbg_networkinfosnapshot_free: (a: number, b: number) => void;
|
|
372
|
-
readonly __wbg_get_networkinfosnapshot_connection_counters: (a: number) => number;
|
|
373
|
-
readonly __wbg_set_networkinfosnapshot_connection_counters: (a: number, b: number) => void;
|
|
374
|
-
readonly __wbg_connectioncounterssnapshot_free: (a: number, b: number) => void;
|
|
375
|
-
readonly __wbg_get_connectioncounterssnapshot_num_connections: (a: number) => number;
|
|
376
|
-
readonly __wbg_set_connectioncounterssnapshot_num_connections: (a: number, b: number) => void;
|
|
377
|
-
readonly __wbg_get_connectioncounterssnapshot_num_pending: (a: number) => number;
|
|
378
|
-
readonly __wbg_set_connectioncounterssnapshot_num_pending: (a: number, b: number) => void;
|
|
379
|
-
readonly __wbg_get_connectioncounterssnapshot_num_pending_incoming: (a: number) => number;
|
|
380
|
-
readonly __wbg_set_connectioncounterssnapshot_num_pending_incoming: (a: number, b: number) => void;
|
|
381
|
-
readonly __wbg_get_connectioncounterssnapshot_num_pending_outgoing: (a: number) => number;
|
|
382
|
-
readonly __wbg_set_connectioncounterssnapshot_num_pending_outgoing: (a: number, b: number) => void;
|
|
383
|
-
readonly __wbg_get_connectioncounterssnapshot_num_established: (a: number) => number;
|
|
384
|
-
readonly __wbg_set_connectioncounterssnapshot_num_established: (a: number, b: number) => void;
|
|
385
|
-
readonly __wbg_get_connectioncounterssnapshot_num_established_incoming: (a: number) => number;
|
|
386
|
-
readonly __wbg_set_connectioncounterssnapshot_num_established_incoming: (a: number, b: number) => void;
|
|
387
|
-
readonly __wbg_get_connectioncounterssnapshot_num_established_outgoing: (a: number) => number;
|
|
388
|
-
readonly __wbg_set_connectioncounterssnapshot_num_established_outgoing: (a: number, b: number) => void;
|
|
389
|
-
readonly __wbg_set_networkinfosnapshot_num_peers: (a: number, b: number) => void;
|
|
390
|
-
readonly __wbg_get_networkinfosnapshot_num_peers: (a: number) => number;
|
|
391
|
-
readonly setup_logging: () => void;
|
|
392
|
-
readonly __wbg_blockrange_free: (a: number, b: number) => void;
|
|
393
|
-
readonly __wbg_get_blockrange_start: (a: number) => number;
|
|
394
|
-
readonly __wbg_set_blockrange_start: (a: number, b: number) => void;
|
|
395
|
-
readonly __wbg_get_blockrange_end: (a: number) => number;
|
|
396
|
-
readonly __wbg_set_blockrange_end: (a: number, b: number) => void;
|
|
397
|
-
readonly __wbg_syncinginfosnapshot_free: (a: number, b: number) => void;
|
|
398
|
-
readonly __wbg_get_syncinginfosnapshot_stored_headers: (a: number, b: number) => void;
|
|
399
|
-
readonly __wbg_set_syncinginfosnapshot_stored_headers: (a: number, b: number, c: number) => void;
|
|
400
|
-
readonly __wbg_set_peertrackerinfosnapshot_num_connected_peers: (a: number, b: number) => void;
|
|
401
|
-
readonly __wbg_set_peertrackerinfosnapshot_num_connected_trusted_peers: (a: number, b: number) => void;
|
|
402
|
-
readonly __wbg_set_syncinginfosnapshot_subjective_head: (a: number, b: number) => void;
|
|
403
|
-
readonly __wbg_get_peertrackerinfosnapshot_num_connected_peers: (a: number) => number;
|
|
404
|
-
readonly __wbg_get_peertrackerinfosnapshot_num_connected_trusted_peers: (a: number) => number;
|
|
405
|
-
readonly __wbg_get_syncinginfosnapshot_subjective_head: (a: number) => number;
|
|
406
|
-
readonly __wbg_peertrackerinfosnapshot_free: (a: number, b: number) => void;
|
|
407
|
-
readonly __wbg_nodeconfig_free: (a: number, b: number) => void;
|
|
408
|
-
readonly __wbg_get_nodeconfig_network: (a: number) => number;
|
|
409
|
-
readonly __wbg_set_nodeconfig_network: (a: number, b: number) => void;
|
|
410
|
-
readonly __wbg_get_nodeconfig_bootnodes: (a: number, b: number) => void;
|
|
411
|
-
readonly __wbg_set_nodeconfig_bootnodes: (a: number, b: number, c: number) => void;
|
|
412
|
-
readonly __wbg_nodeclient_free: (a: number, b: number) => void;
|
|
413
|
-
readonly nodeclient_new: (a: number) => number;
|
|
414
|
-
readonly nodeclient_addConnectionToWorker: (a: number, b: number) => number;
|
|
415
|
-
readonly nodeclient_isRunning: (a: number) => number;
|
|
416
|
-
readonly nodeclient_start: (a: number, b: number) => number;
|
|
417
|
-
readonly nodeclient_stop: (a: number) => number;
|
|
418
|
-
readonly nodeclient_localPeerId: (a: number) => number;
|
|
419
|
-
readonly nodeclient_peerTrackerInfo: (a: number) => number;
|
|
420
|
-
readonly nodeclient_waitConnected: (a: number) => number;
|
|
421
|
-
readonly nodeclient_waitConnectedTrusted: (a: number) => number;
|
|
422
|
-
readonly nodeclient_networkInfo: (a: number) => number;
|
|
423
|
-
readonly nodeclient_listeners: (a: number) => number;
|
|
424
|
-
readonly nodeclient_connectedPeers: (a: number) => number;
|
|
425
|
-
readonly nodeclient_setPeerTrust: (a: number, b: number, c: number, d: number) => number;
|
|
426
|
-
readonly nodeclient_requestHeadHeader: (a: number) => number;
|
|
427
|
-
readonly nodeclient_requestHeaderByHash: (a: number, b: number, c: number) => number;
|
|
428
|
-
readonly nodeclient_requestHeaderByHeight: (a: number, b: number) => number;
|
|
429
|
-
readonly nodeclient_requestVerifiedHeaders: (a: number, b: number, c: number) => number;
|
|
430
|
-
readonly nodeclient_syncerInfo: (a: number) => number;
|
|
431
|
-
readonly nodeclient_getNetworkHeadHeader: (a: number) => number;
|
|
432
|
-
readonly nodeclient_getLocalHeadHeader: (a: number) => number;
|
|
433
|
-
readonly nodeclient_getHeaderByHash: (a: number, b: number, c: number) => number;
|
|
434
|
-
readonly nodeclient_getHeaderByHeight: (a: number, b: number) => number;
|
|
435
|
-
readonly nodeclient_getHeaders: (a: number, b: number, c: number, d: number, e: number) => number;
|
|
436
|
-
readonly nodeclient_getSamplingMetadata: (a: number, b: number) => number;
|
|
437
|
-
readonly nodeclient_eventsChannel: (a: number) => number;
|
|
438
|
-
readonly nodeconfig_default: (a: number) => number;
|
|
439
|
-
readonly __wbg_nodeworker_free: (a: number, b: number) => void;
|
|
440
|
-
readonly nodeworker_new: (a: number) => number;
|
|
441
|
-
readonly nodeworker_run: (a: number) => number;
|
|
442
|
-
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
443
|
-
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
444
|
-
readonly __wbindgen_export_2: WebAssembly.Table;
|
|
445
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h7b30f8a760eb9e89: (a: number, b: number, c: number) => void;
|
|
446
|
-
readonly _dyn_core__ops__function__Fn__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h27a0729df05e61c2: (a: number, b: number, c: number) => void;
|
|
447
|
-
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hd779103e89088afd: (a: number, b: number) => void;
|
|
448
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h62ad66d3e9f77ac4: (a: number, b: number, c: number) => void;
|
|
449
|
-
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0a0047be2e37408e: (a: number, b: number) => void;
|
|
450
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h80386b419f109aff: (a: number, b: number, c: number) => void;
|
|
451
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h0ff40ee0b4df5b25: (a: number, b: number, c: number) => void;
|
|
452
|
-
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbfb1f6eb8d7aa58f: (a: number, b: number, c: number) => void;
|
|
453
|
-
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h9503509ad8c78ce2: (a: number, b: number) => void;
|
|
454
|
-
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
455
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
456
|
-
readonly __wbindgen_exn_store: (a: number) => void;
|
|
457
|
-
readonly wasm_bindgen__convert__closures__invoke2_mut__h47e988f82b6e4529: (a: number, b: number, c: number, d: number) => void;
|
|
458
|
-
readonly __wbindgen_start: () => void;
|
|
459
|
-
}
|
|
460
|
-
|
|
461
|
-
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
462
|
-
/**
|
|
463
|
-
* Instantiates the given `module`, which can either be bytes or
|
|
464
|
-
* a precompiled `WebAssembly.Module`.
|
|
465
|
-
*
|
|
466
|
-
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
467
|
-
*
|
|
468
|
-
* @returns {InitOutput}
|
|
469
|
-
*/
|
|
470
|
-
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
471
|
-
|
|
472
|
-
/**
|
|
473
|
-
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
474
|
-
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
475
|
-
*
|
|
476
|
-
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
477
|
-
*
|
|
478
|
-
* @returns {Promise<InitOutput>}
|
|
479
|
-
*/
|
|
480
|
-
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|