@parity/truapi-provider 0.3.2 → 0.4.1-dev-20261110.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
@@ -12,7 +12,10 @@ connections, and its synced state is kept between launches, so a launch resumes
12
12
  from finalized state instead of syncing from scratch. It holds at most 32 of them
13
13
  at once and rejects a `connect` past that, so a client that leaks connections
14
14
  fails instead of growing; closing one hands its slot back. Connections to a
15
- remote node you registered with `addRpcChain` are not counted against it.
15
+ remote node you registered with `addRpcChain` are not counted against it. A
16
+ provider with an `addRpcChain` registration connects only to chains registered
17
+ on it. The catalog does not resolve any other genesis hash for it, so a host on
18
+ remote nodes never starts the light client by accident.
16
19
 
17
20
  ## Usage
18
21
 
@@ -27,6 +27,9 @@ export interface ConnectionTypes {
27
27
 
28
28
  /**
29
29
  * Collects genesis-hash to chain-source registrations from JS.
30
+ *
31
+ * The built provider resolves an unregistered genesis from the bundled catalog,
32
+ * unless a remote node was registered with `addRpcChain`.
30
33
  */
31
34
  export class ChainProviderBuilder {
32
35
  free(): void;
@@ -47,7 +50,8 @@ export class ChainProviderBuilder {
47
50
  /**
48
51
  * Register a remote JSON-RPC node for the chain identified by the
49
52
  * `0x`-prefixed genesis hash. A later registration for the same hash
50
- * replaces the earlier one.
53
+ * replaces the earlier one, and the built provider no longer resolves
54
+ * other genesis hashes from the catalog.
51
55
  */
52
56
  addRpcChain(genesis_hash: string, url: string): void;
53
57
  /**
@@ -125,7 +129,8 @@ export class ChainProviderHandle {
125
129
  * chain resumes from it. Resolves with whether a blob is now in hand.
126
130
  *
127
131
  * Call this before connecting. The store is read at most once per chain,
128
- * because only the first add of a chain consumes a blob.
132
+ * because only the first add of a chain consumes a blob. Rejects for a
133
+ * chain this provider cannot connect to, as `connect` does.
129
134
  */
130
135
  loadDatabase(genesis_hash: string): Promise<boolean>;
131
136
  /**
@@ -255,12 +260,12 @@ export interface InitOutput {
255
260
  readonly networkchains_people: (a: number, b: number) => void;
256
261
  readonly networkchains_relay: (a: number, b: number) => void;
257
262
  readonly setLogLevel: (a: number, b: number) => void;
258
- readonly __wasm_bindgen_func_elem_20795: (a: number, b: number, c: number, d: number) => void;
259
- readonly __wasm_bindgen_func_elem_20797: (a: number, b: number, c: number, d: number) => void;
260
- readonly __wasm_bindgen_func_elem_3944: (a: number, b: number, c: number) => void;
261
- readonly __wasm_bindgen_func_elem_3944_2: (a: number, b: number, c: number) => void;
262
- readonly __wasm_bindgen_func_elem_3944_3: (a: number, b: number, c: number) => void;
263
- readonly __wasm_bindgen_func_elem_7520: (a: number, b: number) => void;
263
+ readonly __wasm_bindgen_func_elem_20786: (a: number, b: number, c: number, d: number) => void;
264
+ readonly __wasm_bindgen_func_elem_20788: (a: number, b: number, c: number, d: number) => void;
265
+ readonly __wasm_bindgen_func_elem_3932: (a: number, b: number, c: number) => void;
266
+ readonly __wasm_bindgen_func_elem_3932_2: (a: number, b: number, c: number) => void;
267
+ readonly __wasm_bindgen_func_elem_3932_3: (a: number, b: number, c: number) => void;
268
+ readonly __wasm_bindgen_func_elem_7511: (a: number, b: number) => void;
264
269
  readonly __wbindgen_export: (a: number, b: number) => number;
265
270
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
266
271
  readonly __wbindgen_export3: (a: number) => void;
@@ -2,6 +2,9 @@
2
2
 
3
3
  /**
4
4
  * Collects genesis-hash to chain-source registrations from JS.
5
+ *
6
+ * The built provider resolves an unregistered genesis from the bundled catalog,
7
+ * unless a remote node was registered with `addRpcChain`.
5
8
  */
6
9
  export class ChainProviderBuilder {
7
10
  __destroy_into_raw() {
@@ -66,7 +69,8 @@ export class ChainProviderBuilder {
66
69
  /**
67
70
  * Register a remote JSON-RPC node for the chain identified by the
68
71
  * `0x`-prefixed genesis hash. A later registration for the same hash
69
- * replaces the earlier one.
72
+ * replaces the earlier one, and the built provider no longer resolves
73
+ * other genesis hashes from the catalog.
70
74
  * @param {string} genesis_hash
71
75
  * @param {string} url
72
76
  */
@@ -265,7 +269,8 @@ export class ChainProviderHandle {
265
269
  * chain resumes from it. Resolves with whether a blob is now in hand.
266
270
  *
267
271
  * Call this before connecting. The store is read at most once per chain,
268
- * because only the first add of a chain consumes a blob.
272
+ * because only the first add of a chain consumes a blob. Rejects for a
273
+ * chain this provider cannot connect to, as `connect` does.
269
274
  * @param {string} genesis_hash
270
275
  * @returns {Promise<boolean>}
271
276
  */
@@ -670,7 +675,7 @@ function __wbg_get_imports() {
670
675
  const a = state0.a;
671
676
  state0.a = 0;
672
677
  try {
673
- return __wasm_bindgen_func_elem_20797(a, state0.b, arg0, arg1);
678
+ return __wasm_bindgen_func_elem_20788(a, state0.b, arg0, arg1);
674
679
  } finally {
675
680
  state0.a = a;
676
681
  }
@@ -795,28 +800,28 @@ function __wbg_get_imports() {
795
800
  console.warn(getObject(arg0));
796
801
  },
797
802
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
798
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1898, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
799
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_20795);
803
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1899, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
804
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_20786);
800
805
  return addHeapObject(ret);
801
806
  },
802
807
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
803
808
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
804
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3944);
809
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3932);
805
810
  return addHeapObject(ret);
806
811
  },
807
812
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
808
813
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
809
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3944_2);
814
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3932_2);
810
815
  return addHeapObject(ret);
811
816
  },
812
817
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
813
818
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
814
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3944_3);
819
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3932_3);
815
820
  return addHeapObject(ret);
816
821
  },
817
822
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
818
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 711, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
819
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7520);
823
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 712, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
824
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7511);
820
825
  return addHeapObject(ret);
821
826
  },
822
827
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
@@ -843,26 +848,26 @@ function __wbg_get_imports() {
843
848
  };
844
849
  }
845
850
 
846
- function __wasm_bindgen_func_elem_7520(arg0, arg1) {
847
- wasm.__wasm_bindgen_func_elem_7520(arg0, arg1);
851
+ function __wasm_bindgen_func_elem_7511(arg0, arg1) {
852
+ wasm.__wasm_bindgen_func_elem_7511(arg0, arg1);
848
853
  }
849
854
 
850
- function __wasm_bindgen_func_elem_3944(arg0, arg1, arg2) {
851
- wasm.__wasm_bindgen_func_elem_3944(arg0, arg1, addHeapObject(arg2));
855
+ function __wasm_bindgen_func_elem_3932(arg0, arg1, arg2) {
856
+ wasm.__wasm_bindgen_func_elem_3932(arg0, arg1, addHeapObject(arg2));
852
857
  }
853
858
 
854
- function __wasm_bindgen_func_elem_3944_2(arg0, arg1, arg2) {
855
- wasm.__wasm_bindgen_func_elem_3944_2(arg0, arg1, addHeapObject(arg2));
859
+ function __wasm_bindgen_func_elem_3932_2(arg0, arg1, arg2) {
860
+ wasm.__wasm_bindgen_func_elem_3932_2(arg0, arg1, addHeapObject(arg2));
856
861
  }
857
862
 
858
- function __wasm_bindgen_func_elem_3944_3(arg0, arg1, arg2) {
859
- wasm.__wasm_bindgen_func_elem_3944_3(arg0, arg1, addHeapObject(arg2));
863
+ function __wasm_bindgen_func_elem_3932_3(arg0, arg1, arg2) {
864
+ wasm.__wasm_bindgen_func_elem_3932_3(arg0, arg1, addHeapObject(arg2));
860
865
  }
861
866
 
862
- function __wasm_bindgen_func_elem_20795(arg0, arg1, arg2) {
867
+ function __wasm_bindgen_func_elem_20786(arg0, arg1, arg2) {
863
868
  try {
864
869
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
865
- wasm.__wasm_bindgen_func_elem_20795(retptr, arg0, arg1, addHeapObject(arg2));
870
+ wasm.__wasm_bindgen_func_elem_20786(retptr, arg0, arg1, addHeapObject(arg2));
866
871
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
867
872
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
868
873
  if (r1) {
@@ -873,8 +878,8 @@ function __wasm_bindgen_func_elem_20795(arg0, arg1, arg2) {
873
878
  }
874
879
  }
875
880
 
876
- function __wasm_bindgen_func_elem_20797(arg0, arg1, arg2, arg3) {
877
- wasm.__wasm_bindgen_func_elem_20797(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
881
+ function __wasm_bindgen_func_elem_20788(arg0, arg1, arg2, arg3) {
882
+ wasm.__wasm_bindgen_func_elem_20788(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
878
883
  }
879
884
 
880
885
 
Binary file
@@ -28,12 +28,12 @@ export const networkchains_bulletin: (a: number, b: number) => void;
28
28
  export const networkchains_people: (a: number, b: number) => void;
29
29
  export const networkchains_relay: (a: number, b: number) => void;
30
30
  export const setLogLevel: (a: number, b: number) => void;
31
- export const __wasm_bindgen_func_elem_20795: (a: number, b: number, c: number, d: number) => void;
32
- export const __wasm_bindgen_func_elem_20797: (a: number, b: number, c: number, d: number) => void;
33
- export const __wasm_bindgen_func_elem_3944: (a: number, b: number, c: number) => void;
34
- export const __wasm_bindgen_func_elem_3944_2: (a: number, b: number, c: number) => void;
35
- export const __wasm_bindgen_func_elem_3944_3: (a: number, b: number, c: number) => void;
36
- export const __wasm_bindgen_func_elem_7520: (a: number, b: number) => void;
31
+ export const __wasm_bindgen_func_elem_20786: (a: number, b: number, c: number, d: number) => void;
32
+ export const __wasm_bindgen_func_elem_20788: (a: number, b: number, c: number, d: number) => void;
33
+ export const __wasm_bindgen_func_elem_3932: (a: number, b: number, c: number) => void;
34
+ export const __wasm_bindgen_func_elem_3932_2: (a: number, b: number, c: number) => void;
35
+ export const __wasm_bindgen_func_elem_3932_3: (a: number, b: number, c: number) => void;
36
+ export const __wasm_bindgen_func_elem_7511: (a: number, b: number) => void;
37
37
  export const __wbindgen_export: (a: number, b: number) => number;
38
38
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
39
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.2",
3
+ "version": "0.4.1-dev-20261110.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>",