@parity/truapi-provider 0.2.3-dev-20260928.0 → 0.3.1-dev-20260929.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
|
@@ -63,6 +63,13 @@ syncs from the checkpoint in the chain spec on every run.
|
|
|
63
63
|
anything the client would load for it. `saveDatabase(genesisHash)` forces a write
|
|
64
64
|
at a moment the host chooses.
|
|
65
65
|
|
|
66
|
+
The light client dials peers over `wss://`, and over plain `ws://` to localhost
|
|
67
|
+
and to other hosts. A page whose browser blocks some of those can turn them off:
|
|
68
|
+
|
|
69
|
+
```js
|
|
70
|
+
builder.setConnectionTypes({ unsecure: false }); // mixed content on an https page
|
|
71
|
+
```
|
|
72
|
+
|
|
66
73
|
A light-client connection holds its requests until the chain first syncs, then
|
|
67
74
|
sends them in order. Chain-spec queries, statement-store and Bitswap calls are
|
|
68
75
|
answered at once. To show sync
|
|
@@ -13,6 +13,18 @@ export interface ChainLifecycle {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
+
/** Which kinds of connection the light client opens to peers; each defaults to `true`. */
|
|
17
|
+
export interface ConnectionTypes {
|
|
18
|
+
/** Secure `wss://` WebSocket. */
|
|
19
|
+
secure?: boolean;
|
|
20
|
+
/** Plain `ws://` WebSocket to a localhost peer. */
|
|
21
|
+
localhost?: boolean;
|
|
22
|
+
/** Plain `ws://` WebSocket to any other peer. */
|
|
23
|
+
unsecure?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
16
28
|
/**
|
|
17
29
|
* Collects genesis-hash to chain-source registrations from JS.
|
|
18
30
|
*/
|
|
@@ -46,6 +58,11 @@ export class ChainProviderBuilder {
|
|
|
46
58
|
* Create an empty builder.
|
|
47
59
|
*/
|
|
48
60
|
constructor();
|
|
61
|
+
/**
|
|
62
|
+
* Limit the kinds of connection the light client opens to peers. A field
|
|
63
|
+
* left out stays allowed; an unknown field or a non-boolean value throws.
|
|
64
|
+
*/
|
|
65
|
+
setConnectionTypes(types: ConnectionTypes): void;
|
|
49
66
|
/**
|
|
50
67
|
* Seed the chain with the `0x`-prefixed genesis hash from a stored
|
|
51
68
|
* database blob, so its light client resumes from that finalized state
|
|
@@ -221,6 +238,7 @@ export interface InitOutput {
|
|
|
221
238
|
readonly chainproviderbuilder_addRpcChain: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
222
239
|
readonly chainproviderbuilder_build: (a: number, b: number) => void;
|
|
223
240
|
readonly chainproviderbuilder_new: () => number;
|
|
241
|
+
readonly chainproviderbuilder_setConnectionTypes: (a: number, b: number, c: number) => void;
|
|
224
242
|
readonly chainproviderbuilder_setDatabaseContent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
225
243
|
readonly chainproviderbuilder_setStorage: (a: number, b: number, c: number) => void;
|
|
226
244
|
readonly chainproviderhandle_connect: (a: number, b: number, c: number) => number;
|
|
@@ -237,12 +255,12 @@ export interface InitOutput {
|
|
|
237
255
|
readonly networkchains_people: (a: number, b: number) => void;
|
|
238
256
|
readonly networkchains_relay: (a: number, b: number) => void;
|
|
239
257
|
readonly setLogLevel: (a: number, b: number) => void;
|
|
240
|
-
readonly
|
|
241
|
-
readonly
|
|
242
|
-
readonly
|
|
243
|
-
readonly
|
|
244
|
-
readonly
|
|
245
|
-
readonly
|
|
258
|
+
readonly __wasm_bindgen_func_elem_20853: (a: number, b: number, c: number, d: number) => void;
|
|
259
|
+
readonly __wasm_bindgen_func_elem_20855: (a: number, b: number, c: number, d: number) => void;
|
|
260
|
+
readonly __wasm_bindgen_func_elem_3973: (a: number, b: number, c: number) => void;
|
|
261
|
+
readonly __wasm_bindgen_func_elem_3973_2: (a: number, b: number, c: number) => void;
|
|
262
|
+
readonly __wasm_bindgen_func_elem_3973_3: (a: number, b: number, c: number) => void;
|
|
263
|
+
readonly __wasm_bindgen_func_elem_7574: (a: number, b: number) => void;
|
|
246
264
|
readonly __wbindgen_export: (a: number, b: number) => number;
|
|
247
265
|
readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
248
266
|
readonly __wbindgen_export3: (a: number) => void;
|
package/dist/truapi_provider.js
CHANGED
|
@@ -115,6 +115,24 @@ export class ChainProviderBuilder {
|
|
|
115
115
|
ChainProviderBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
116
116
|
return this;
|
|
117
117
|
}
|
|
118
|
+
/**
|
|
119
|
+
* Limit the kinds of connection the light client opens to peers. A field
|
|
120
|
+
* left out stays allowed; an unknown field or a non-boolean value throws.
|
|
121
|
+
* @param {ConnectionTypes} types
|
|
122
|
+
*/
|
|
123
|
+
setConnectionTypes(types) {
|
|
124
|
+
try {
|
|
125
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
126
|
+
wasm.chainproviderbuilder_setConnectionTypes(retptr, this.__wbg_ptr, addHeapObject(types));
|
|
127
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
128
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
129
|
+
if (r1) {
|
|
130
|
+
throw takeObject(r0);
|
|
131
|
+
}
|
|
132
|
+
} finally {
|
|
133
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
118
136
|
/**
|
|
119
137
|
* Seed the chain with the `0x`-prefixed genesis hash from a stored
|
|
120
138
|
* database blob, so its light client resumes from that finalized state
|
|
@@ -495,6 +513,11 @@ function __wbg_get_imports() {
|
|
|
495
513
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
496
514
|
return addHeapObject(ret);
|
|
497
515
|
},
|
|
516
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
517
|
+
const v = getObject(arg0);
|
|
518
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
519
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
520
|
+
},
|
|
498
521
|
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
499
522
|
const ret = debugString(getObject(arg1));
|
|
500
523
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
@@ -571,16 +594,32 @@ function __wbg_get_imports() {
|
|
|
571
594
|
__wbg_debug_87fd9b1a625b7efb: function(arg0) {
|
|
572
595
|
console.debug(getObject(arg0));
|
|
573
596
|
},
|
|
597
|
+
__wbg_entries_015dc610cd81ede0: function(arg0) {
|
|
598
|
+
const ret = Object.entries(getObject(arg0));
|
|
599
|
+
return addHeapObject(ret);
|
|
600
|
+
},
|
|
574
601
|
__wbg_error_744744ff0c9861e6: function(arg0) {
|
|
575
602
|
console.error(getObject(arg0));
|
|
576
603
|
},
|
|
604
|
+
__wbg_from_13e323c65fc8f464: function(arg0) {
|
|
605
|
+
const ret = Array.from(getObject(arg0));
|
|
606
|
+
return addHeapObject(ret);
|
|
607
|
+
},
|
|
577
608
|
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
578
609
|
getObject(arg0).getRandomValues(getObject(arg1));
|
|
579
610
|
}, arguments); },
|
|
611
|
+
__wbg_get_507a50627bffa49b: function(arg0, arg1) {
|
|
612
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
613
|
+
return addHeapObject(ret);
|
|
614
|
+
},
|
|
580
615
|
__wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
|
|
581
616
|
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
582
617
|
return addHeapObject(ret);
|
|
583
618
|
}, arguments); },
|
|
619
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
620
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
621
|
+
return addHeapObject(ret);
|
|
622
|
+
},
|
|
584
623
|
__wbg_info_eadbe775a8e2e9eb: function(arg0) {
|
|
585
624
|
console.info(getObject(arg0));
|
|
586
625
|
},
|
|
@@ -594,10 +633,24 @@ function __wbg_get_imports() {
|
|
|
594
633
|
const ret = result;
|
|
595
634
|
return ret;
|
|
596
635
|
},
|
|
636
|
+
__wbg_instanceof_Object_33f20e6f12439f3e: function(arg0) {
|
|
637
|
+
let result;
|
|
638
|
+
try {
|
|
639
|
+
result = getObject(arg0) instanceof Object;
|
|
640
|
+
} catch (_) {
|
|
641
|
+
result = false;
|
|
642
|
+
}
|
|
643
|
+
const ret = result;
|
|
644
|
+
return ret;
|
|
645
|
+
},
|
|
597
646
|
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
598
647
|
const ret = getObject(arg0).length;
|
|
599
648
|
return ret;
|
|
600
649
|
},
|
|
650
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
651
|
+
const ret = getObject(arg0).length;
|
|
652
|
+
return ret;
|
|
653
|
+
},
|
|
601
654
|
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
602
655
|
const ret = getObject(arg0).msCrypto;
|
|
603
656
|
return addHeapObject(ret);
|
|
@@ -617,7 +670,7 @@ function __wbg_get_imports() {
|
|
|
617
670
|
const a = state0.a;
|
|
618
671
|
state0.a = 0;
|
|
619
672
|
try {
|
|
620
|
-
return
|
|
673
|
+
return __wasm_bindgen_func_elem_20855(a, state0.b, arg0, arg1);
|
|
621
674
|
} finally {
|
|
622
675
|
state0.a = a;
|
|
623
676
|
}
|
|
@@ -742,28 +795,28 @@ function __wbg_get_imports() {
|
|
|
742
795
|
console.warn(getObject(arg0));
|
|
743
796
|
},
|
|
744
797
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
745
|
-
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx:
|
|
746
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
798
|
+
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1907, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
|
|
799
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_20853);
|
|
747
800
|
return addHeapObject(ret);
|
|
748
801
|
},
|
|
749
802
|
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
750
803
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
751
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
804
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3973);
|
|
752
805
|
return addHeapObject(ret);
|
|
753
806
|
},
|
|
754
807
|
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
755
808
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
756
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
809
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3973_2);
|
|
757
810
|
return addHeapObject(ret);
|
|
758
811
|
},
|
|
759
812
|
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
760
813
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
761
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
814
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3973_3);
|
|
762
815
|
return addHeapObject(ret);
|
|
763
816
|
},
|
|
764
817
|
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
765
818
|
// Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 726, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
|
|
766
|
-
const ret = makeMutClosure(arg0, arg1,
|
|
819
|
+
const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7574);
|
|
767
820
|
return addHeapObject(ret);
|
|
768
821
|
},
|
|
769
822
|
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
@@ -790,26 +843,26 @@ function __wbg_get_imports() {
|
|
|
790
843
|
};
|
|
791
844
|
}
|
|
792
845
|
|
|
793
|
-
function
|
|
794
|
-
wasm.
|
|
846
|
+
function __wasm_bindgen_func_elem_7574(arg0, arg1) {
|
|
847
|
+
wasm.__wasm_bindgen_func_elem_7574(arg0, arg1);
|
|
795
848
|
}
|
|
796
849
|
|
|
797
|
-
function
|
|
798
|
-
wasm.
|
|
850
|
+
function __wasm_bindgen_func_elem_3973(arg0, arg1, arg2) {
|
|
851
|
+
wasm.__wasm_bindgen_func_elem_3973(arg0, arg1, addHeapObject(arg2));
|
|
799
852
|
}
|
|
800
853
|
|
|
801
|
-
function
|
|
802
|
-
wasm.
|
|
854
|
+
function __wasm_bindgen_func_elem_3973_2(arg0, arg1, arg2) {
|
|
855
|
+
wasm.__wasm_bindgen_func_elem_3973_2(arg0, arg1, addHeapObject(arg2));
|
|
803
856
|
}
|
|
804
857
|
|
|
805
|
-
function
|
|
806
|
-
wasm.
|
|
858
|
+
function __wasm_bindgen_func_elem_3973_3(arg0, arg1, arg2) {
|
|
859
|
+
wasm.__wasm_bindgen_func_elem_3973_3(arg0, arg1, addHeapObject(arg2));
|
|
807
860
|
}
|
|
808
861
|
|
|
809
|
-
function
|
|
862
|
+
function __wasm_bindgen_func_elem_20853(arg0, arg1, arg2) {
|
|
810
863
|
try {
|
|
811
864
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
812
|
-
wasm.
|
|
865
|
+
wasm.__wasm_bindgen_func_elem_20853(retptr, arg0, arg1, addHeapObject(arg2));
|
|
813
866
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
814
867
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
815
868
|
if (r1) {
|
|
@@ -820,8 +873,8 @@ function __wasm_bindgen_func_elem_20550(arg0, arg1, arg2) {
|
|
|
820
873
|
}
|
|
821
874
|
}
|
|
822
875
|
|
|
823
|
-
function
|
|
824
|
-
wasm.
|
|
876
|
+
function __wasm_bindgen_func_elem_20855(arg0, arg1, arg2, arg3) {
|
|
877
|
+
wasm.__wasm_bindgen_func_elem_20855(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
825
878
|
}
|
|
826
879
|
|
|
827
880
|
|
|
Binary file
|
|
@@ -11,6 +11,7 @@ export const chainproviderbuilder_addNetwork: (a: number, b: number, c: number,
|
|
|
11
11
|
export const chainproviderbuilder_addRpcChain: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
12
|
export const chainproviderbuilder_build: (a: number, b: number) => void;
|
|
13
13
|
export const chainproviderbuilder_new: () => number;
|
|
14
|
+
export const chainproviderbuilder_setConnectionTypes: (a: number, b: number, c: number) => void;
|
|
14
15
|
export const chainproviderbuilder_setDatabaseContent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
15
16
|
export const chainproviderbuilder_setStorage: (a: number, b: number, c: number) => void;
|
|
16
17
|
export const chainproviderhandle_connect: (a: number, b: number, c: number) => number;
|
|
@@ -27,12 +28,12 @@ export const networkchains_bulletin: (a: number, b: number) => void;
|
|
|
27
28
|
export const networkchains_people: (a: number, b: number) => void;
|
|
28
29
|
export const networkchains_relay: (a: number, b: number) => void;
|
|
29
30
|
export const setLogLevel: (a: number, b: number) => void;
|
|
30
|
-
export const
|
|
31
|
-
export const
|
|
32
|
-
export const
|
|
33
|
-
export const
|
|
34
|
-
export const
|
|
35
|
-
export const
|
|
31
|
+
export const __wasm_bindgen_func_elem_20853: (a: number, b: number, c: number, d: number) => void;
|
|
32
|
+
export const __wasm_bindgen_func_elem_20855: (a: number, b: number, c: number, d: number) => void;
|
|
33
|
+
export const __wasm_bindgen_func_elem_3973: (a: number, b: number, c: number) => void;
|
|
34
|
+
export const __wasm_bindgen_func_elem_3973_2: (a: number, b: number, c: number) => void;
|
|
35
|
+
export const __wasm_bindgen_func_elem_3973_3: (a: number, b: number, c: number) => void;
|
|
36
|
+
export const __wasm_bindgen_func_elem_7574: (a: number, b: number) => void;
|
|
36
37
|
export const __wbindgen_export: (a: number, b: number) => number;
|
|
37
38
|
export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
|
|
38
39
|
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.
|
|
3
|
+
"version": "0.3.1-dev-20260929.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>",
|