@parity/truapi-provider 0.1.1-dev-20260731.0 → 0.1.1-dev-20260806.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
CHANGED
|
@@ -9,8 +9,8 @@ crate natively over UniFFI, so network access works the same everywhere.
|
|
|
9
9
|
You connect to a network by its genesis hash, and everything else is handled for
|
|
10
10
|
you: the bundled catalog provides the spec and relay wiring, so clients never
|
|
11
11
|
ship or refresh specs of their own. One light client is shared across all
|
|
12
|
-
connections
|
|
13
|
-
|
|
12
|
+
connections. Its synced state can be captured and restored, so a launch resumes
|
|
13
|
+
from finalized state instead of syncing from scratch.
|
|
14
14
|
|
|
15
15
|
## Usage
|
|
16
16
|
|
|
@@ -29,14 +29,28 @@ import wasmUrl from "@parity/truapi-provider/truapi_provider_bg.wasm?url";
|
|
|
29
29
|
|
|
30
30
|
await init({ module_or_path: wasmUrl });
|
|
31
31
|
|
|
32
|
-
const
|
|
33
|
-
const
|
|
32
|
+
const genesis = "0x77af…";
|
|
33
|
+
const builder = new ChainProviderBuilder();
|
|
34
|
+
|
|
35
|
+
// Resume from the state saved by the previous run, when there is one.
|
|
36
|
+
const saved = localStorage.getItem(`chain-db:${genesis}`);
|
|
37
|
+
if (saved) builder.setDatabase(genesis, saved);
|
|
38
|
+
|
|
39
|
+
const provider = builder.build();
|
|
40
|
+
const connection = await provider.connect(genesis);
|
|
34
41
|
|
|
35
42
|
connection.send('{"jsonrpc":"2.0","id":1,"method":"chainSpec_v1_genesisHash","params":[]}');
|
|
36
43
|
const response = await connection.nextResponse(); // undefined once closed
|
|
37
44
|
connection.close();
|
|
45
|
+
|
|
46
|
+
// Later, once the light client has synced, save state for the next launch.
|
|
47
|
+
localStorage.setItem(`chain-db:${genesis}`, await provider.snapshot(genesis));
|
|
38
48
|
```
|
|
39
49
|
|
|
50
|
+
Warm start is yours to drive: call `snapshot()` once the light client has synced,
|
|
51
|
+
persist the string wherever you like, and hand it back through `setDatabase()`
|
|
52
|
+
before `build()` on the next launch.
|
|
53
|
+
|
|
40
54
|
#### Android (Kotlin)
|
|
41
55
|
|
|
42
56
|
Native targets deliver responses to a listener instead of a pull loop, and take
|
|
@@ -144,12 +144,12 @@ export interface InitOutput {
|
|
|
144
144
|
readonly networkchains_people: (a: number, b: number) => void;
|
|
145
145
|
readonly networkchains_relay: (a: number, b: number) => void;
|
|
146
146
|
readonly setLogLevel: (a: number, b: number) => void;
|
|
147
|
-
readonly
|
|
148
|
-
readonly
|
|
149
|
-
readonly
|
|
150
|
-
readonly
|
|
151
|
-
readonly
|
|
152
|
-
readonly
|
|
147
|
+
readonly __wasm_bindgen_func_elem_12921: (a: number, b: number, c: number, d: number) => void;
|
|
148
|
+
readonly __wasm_bindgen_func_elem_12923: (a: number, b: number, c: number, d: number) => void;
|
|
149
|
+
readonly __wasm_bindgen_func_elem_3701: (a: number, b: number, c: number) => void;
|
|
150
|
+
readonly __wasm_bindgen_func_elem_3701_2: (a: number, b: number, c: number) => void;
|
|
151
|
+
readonly __wasm_bindgen_func_elem_3701_3: (a: number, b: number, c: number) => void;
|
|
152
|
+
readonly __wasm_bindgen_func_elem_7079: (a: number, b: number) => void;
|
|
153
153
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
154
154
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
155
155
|
readonly __wbindgen_export3: (a: number) => void;
|
package/dist/truapi_provider.js
CHANGED
|
@@ -472,7 +472,7 @@ function __wbg_get_imports() {
|
|
|
472
472
|
const a = state0.a;
|
|
473
473
|
state0.a = 0;
|
|
474
474
|
try {
|
|
475
|
-
return
|
|
475
|
+
return __wasm_bindgen_func_elem_12923(a, state0.b, arg0, arg1);
|
|
476
476
|
} finally {
|
|
477
477
|
state0.a = a;
|
|
478
478
|
}
|
|
@@ -590,27 +590,27 @@ function __wbg_get_imports() {
|
|
|
590
590
|
},
|
|
591
591
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
592
592
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 979, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
593
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
593
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_12921);
|
|
594
594
|
return addHeapObject(ret);
|
|
595
595
|
},
|
|
596
596
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
597
597
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
598
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
598
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3701);
|
|
599
599
|
return addHeapObject(ret);
|
|
600
600
|
},
|
|
601
601
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
602
602
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
603
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
603
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3701_2);
|
|
604
604
|
return addHeapObject(ret);
|
|
605
605
|
},
|
|
606
606
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
607
607
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
608
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
608
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3701_3);
|
|
609
609
|
return addHeapObject(ret);
|
|
610
610
|
},
|
|
611
611
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
612
612
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 672, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
613
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
613
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7079);
|
|
614
614
|
return addHeapObject(ret);
|
|
615
615
|
},
|
|
616
616
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
@@ -637,26 +637,26 @@ function __wbg_get_imports() {
|
|
|
637
637
|
};
|
|
638
638
|
}
|
|
639
639
|
|
|
640
|
-
function
|
|
641
|
-
wasm.
|
|
640
|
+
function __wasm_bindgen_func_elem_7079(arg0, arg1) {
|
|
641
|
+
wasm.__wasm_bindgen_func_elem_7079(arg0, arg1);
|
|
642
642
|
}
|
|
643
643
|
|
|
644
|
-
function
|
|
645
|
-
wasm.
|
|
644
|
+
function __wasm_bindgen_func_elem_3701(arg0, arg1, arg2) {
|
|
645
|
+
wasm.__wasm_bindgen_func_elem_3701(arg0, arg1, addHeapObject(arg2));
|
|
646
646
|
}
|
|
647
647
|
|
|
648
|
-
function
|
|
649
|
-
wasm.
|
|
648
|
+
function __wasm_bindgen_func_elem_3701_2(arg0, arg1, arg2) {
|
|
649
|
+
wasm.__wasm_bindgen_func_elem_3701_2(arg0, arg1, addHeapObject(arg2));
|
|
650
650
|
}
|
|
651
651
|
|
|
652
|
-
function
|
|
653
|
-
wasm.
|
|
652
|
+
function __wasm_bindgen_func_elem_3701_3(arg0, arg1, arg2) {
|
|
653
|
+
wasm.__wasm_bindgen_func_elem_3701_3(arg0, arg1, addHeapObject(arg2));
|
|
654
654
|
}
|
|
655
655
|
|
|
656
|
-
function
|
|
656
|
+
function __wasm_bindgen_func_elem_12921(arg0, arg1, arg2) {
|
|
657
657
|
try {
|
|
658
658
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
659
|
-
wasm.
|
|
659
|
+
wasm.__wasm_bindgen_func_elem_12921(retptr, arg0, arg1, addHeapObject(arg2));
|
|
660
660
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
661
661
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
662
662
|
if (r1) {
|
|
@@ -667,8 +667,8 @@ function __wasm_bindgen_func_elem_12915(arg0, arg1, arg2) {
|
|
|
667
667
|
}
|
|
668
668
|
}
|
|
669
669
|
|
|
670
|
-
function
|
|
671
|
-
wasm.
|
|
670
|
+
function __wasm_bindgen_func_elem_12923(arg0, arg1, arg2, arg3) {
|
|
671
|
+
wasm.__wasm_bindgen_func_elem_12923(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
672
672
|
}
|
|
673
673
|
|
|
674
674
|
|
|
Binary file
|
|
@@ -21,12 +21,12 @@ export const networkchains_bulletin: (a: number, b: number) => void;
|
|
|
21
21
|
export const networkchains_people: (a: number, b: number) => void;
|
|
22
22
|
export const networkchains_relay: (a: number, b: number) => void;
|
|
23
23
|
export const setLogLevel: (a: number, b: number) => void;
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
26
|
-
export const
|
|
27
|
-
export const
|
|
28
|
-
export const
|
|
29
|
-
export const
|
|
24
|
+
export const __wasm_bindgen_func_elem_12921: (a: number, b: number, c: number, d: number) => void;
|
|
25
|
+
export const __wasm_bindgen_func_elem_12923: (a: number, b: number, c: number, d: number) => void;
|
|
26
|
+
export const __wasm_bindgen_func_elem_3701: (a: number, b: number, c: number) => void;
|
|
27
|
+
export const __wasm_bindgen_func_elem_3701_2: (a: number, b: number, c: number) => void;
|
|
28
|
+
export const __wasm_bindgen_func_elem_3701_3: (a: number, b: number, c: number) => void;
|
|
29
|
+
export const __wasm_bindgen_func_elem_7079: (a: number, b: number) => void;
|
|
30
30
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
31
31
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
32
32
|
export const __wbindgen_export3: (a: number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parity/truapi-provider",
|
|
3
|
-
"version": "0.1.1-dev-
|
|
3
|
+
"version": "0.1.1-dev-20260806.0",
|
|
4
4
|
"description": "Network provider backends for the TrUAPI ChainProvider: an embedded smoldot light client and remote WebSocket JSON-RPC nodes, compiled to WebAssembly for browser hosts",
|
|
5
5
|
"license": "MIT AND Apache-2.0",
|
|
6
6
|
"author": "Parity Technologies <admin@parity.io>",
|