@parity/truapi-provider 0.1.1-dev-20260825.0 → 0.1.1-dev-20260908.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
@@ -8,15 +8,11 @@ for browser and desktop (webview) hosts.
8
8
  You connect to a network by its genesis hash, and everything else is handled for
9
9
  you: the bundled catalog provides the spec and relay wiring, so clients never
10
10
  ship or refresh specs of their own. One light client is shared across all
11
- connections. Its synced state can be captured and restored, so a launch resumes
11
+ connections, and its synced state is kept between launches, so a launch resumes
12
12
  from finalized state instead of syncing from scratch.
13
13
 
14
14
  ## Usage
15
15
 
16
- Build a provider, connect to a network by its genesis hash, and exchange JSON-RPC
17
- request and response strings over the connection. Every connection shares the one
18
- embedded light client.
19
-
20
16
  #### Web (JavaScript)
21
17
 
22
18
  The published package is `wasm-bindgen` glue plus a `.wasm` binary. Instantiate
@@ -28,28 +24,19 @@ import wasmUrl from "@parity/truapi-provider/truapi_provider_bg.wasm?url";
28
24
 
29
25
  await init({ module_or_path: wasmUrl });
30
26
 
31
- const genesis = "0x3740…";
32
27
  const builder = new ChainProviderBuilder();
33
-
34
- // Resume from the state saved by the previous run, when there is one.
35
- const saved = localStorage.getItem(`chain-db:${genesis}`);
36
- if (saved) builder.setDatabase(genesis, saved);
28
+ const chains = builder.addNetwork("paseo-next-v2");
37
29
 
38
30
  const provider = builder.build();
39
- const connection = await provider.connect(genesis);
31
+ const connection = await provider.connect(chains.relay);
40
32
 
41
- connection.send('{"jsonrpc":"2.0","id":1,"method":"chainSpec_v1_genesisHash","params":[]}');
33
+ connection.send(
34
+ '{"jsonrpc":"2.0","id":1,"method":"chainSpec_v1_genesisHash","params":[]}',
35
+ );
42
36
  const response = await connection.nextResponse(); // undefined once closed
43
37
  connection.close();
44
-
45
- // Later, once the light client has synced, save state for the next launch.
46
- localStorage.setItem(`chain-db:${genesis}`, await provider.snapshot(genesis));
47
38
  ```
48
39
 
49
- Warm start is driven by the host: call `snapshot()` once the light client has
50
- synced, persist the string, and hand it back through `setDatabase()` before
51
- `build()` on the next launch.
52
-
53
40
  ## Native hosts
54
41
 
55
42
  Android and iOS do not consume this package. The same `truapi-provider` crate is
@@ -62,7 +49,7 @@ contract with the same bundled catalog, so the wiring differs only in language.
62
49
  The `dist/` bundle is generated and gitignored. Rebuild it from the Rust crate:
63
50
 
64
51
  ```bash
65
- npm run build:wasm # wasm-pack --target web, features "js networks"
52
+ npm run build # wasm-pack --target web, features "js networks"
66
53
  ```
67
54
 
68
55
  `wasm-pack` is required (`cargo install wasm-pack`). Set `TRUAPI_WASM_PROFILE=dev`
@@ -0,0 +1,50 @@
1
+
2
+ const STORE = "chain-databases";
3
+ const VERSION = 1;
4
+
5
+ function open(name) {
6
+ return new Promise((resolve, reject) => {
7
+ const request = indexedDB.open(name, VERSION);
8
+ request.onupgradeneeded = () => {
9
+ const db = request.result;
10
+ if (!db.objectStoreNames.contains(STORE)) db.createObjectStore(STORE);
11
+ };
12
+ // An upgrade held open by another tab would otherwise never settle.
13
+ request.onblocked = () =>
14
+ reject(new Error(`another connection is holding "${name}" open`));
15
+ request.onerror = () =>
16
+ reject(request.error ?? new Error(`could not open "${name}"`));
17
+ request.onsuccess = () => resolve(request.result);
18
+ });
19
+ }
20
+
21
+ export async function warmStoreLoad(name, key) {
22
+ const db = await open(name);
23
+ try {
24
+ return await new Promise((resolve, reject) => {
25
+ const tx = db.transaction(STORE, "readonly");
26
+ const request = tx.objectStore(STORE).get(key);
27
+ request.onsuccess = () =>
28
+ resolve(typeof request.result === "string" ? request.result : null);
29
+ tx.onerror = () => reject(tx.error ?? new Error("read failed"));
30
+ tx.onabort = () => reject(tx.error ?? new Error("read aborted"));
31
+ });
32
+ } finally {
33
+ db.close();
34
+ }
35
+ }
36
+
37
+ export async function warmStoreSave(name, key, blob) {
38
+ const db = await open(name);
39
+ try {
40
+ await new Promise((resolve, reject) => {
41
+ const tx = db.transaction(STORE, "readwrite");
42
+ tx.objectStore(STORE).put(blob, key);
43
+ tx.oncomplete = () => resolve();
44
+ tx.onerror = () => reject(tx.error ?? new Error("write failed"));
45
+ tx.onabort = () => reject(tx.error ?? new Error("write aborted"));
46
+ });
47
+ } finally {
48
+ db.close();
49
+ }
50
+ }
@@ -28,6 +28,10 @@ export class ChainProviderBuilder {
28
28
  addRpcChain(genesis_hash: string, url: string): void;
29
29
  /**
30
30
  * Build the provider, consuming the builder.
31
+ *
32
+ * Unless the host chose otherwise through
33
+ * [`set_warm_store`](Self::set_warm_store), chains resume from state kept
34
+ * in the browser's own database.
31
35
  */
32
36
  build(): ChainProviderHandle;
33
37
  /**
@@ -41,6 +45,26 @@ export class ChainProviderBuilder {
41
45
  * instead of re-syncing from the checkpoint.
42
46
  */
43
47
  setDatabase(genesis_hash: string, blob: string): void;
48
+ /**
49
+ * Keep warm-start blobs somewhere other than the browser's own database,
50
+ * or nowhere at all.
51
+ *
52
+ * Warm start needs no setup: without this call the provider keeps blobs in
53
+ * IndexedDB for the origin. Pass a JS object with `load(genesisHash)`
54
+ * resolving to the stored string or `null` and `save(genesisHash, blob)`
55
+ * to store them elsewhere, or `null` to turn warm start off and have every
56
+ * chain sync from the chain-spec checkpoint.
57
+ *
58
+ * A store that cannot answer must reject rather than resolve empty: an
59
+ * empty read is taken as nothing stored yet, and would let a later
60
+ * snapshot overwrite good state.
61
+ *
62
+ * A loaded blob is trusted input: it becomes the finalized state the light
63
+ * client resumes from, so whatever can write to the store can steer the
64
+ * client's view of the chain. Origin-scoped storage satisfies that; a
65
+ * store fed by another page or a server does not.
66
+ */
67
+ setWarmStore(store: any): void;
44
68
  }
45
69
 
46
70
  /**
@@ -55,12 +79,32 @@ export class ChainProviderHandle {
55
79
  * hash. Rejects when the chain is not registered or the transport fails.
56
80
  */
57
81
  connect(genesis_hash: string): Promise<Connection>;
82
+ /**
83
+ * Snapshot the chain's finalized state and write it to the warm store.
84
+ * Resolves with whether a blob was stored.
85
+ *
86
+ * A chain that has finalized nothing yet is skipped rather than stored,
87
+ * since that blob would be discarded on the next run. This is a full round
88
+ * trip against the light client, so drive it while the page or worker is
89
+ * alive; neither `pagehide` nor a hidden tab is guaranteed to stay
90
+ * scheduled long enough to finish one, and a Worker sees neither event.
91
+ */
92
+ persist(genesis_hash: string): Promise<boolean>;
58
93
  /**
59
94
  * Produce a warm-start database blob for the `0x`-prefixed genesis hash.
60
95
  * Persist it and feed it back via
61
96
  * [`setDatabase`](ChainProviderBuilder::set_database) on a later run.
62
97
  */
63
98
  snapshot(genesis_hash: string): Promise<string>;
99
+ /**
100
+ * Read the warm store's blob for the `0x`-prefixed genesis hash into this
101
+ * provider, so the next [`connect`](ChainProviderHandle::connect) to that
102
+ * chain resumes from it. Resolves with whether a blob is now in hand.
103
+ *
104
+ * Call this before connecting. The store is read at most once per chain,
105
+ * because only a chain's first add consumes a blob.
106
+ */
107
+ warmUp(genesis_hash: string): Promise<boolean>;
64
108
  }
65
109
 
66
110
  /**
@@ -140,8 +184,11 @@ export interface InitOutput {
140
184
  readonly chainproviderbuilder_build: (a: number, b: number) => void;
141
185
  readonly chainproviderbuilder_new: () => number;
142
186
  readonly chainproviderbuilder_setDatabase: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
187
+ readonly chainproviderbuilder_setWarmStore: (a: number, b: number, c: number) => void;
143
188
  readonly chainproviderhandle_connect: (a: number, b: number, c: number) => number;
189
+ readonly chainproviderhandle_persist: (a: number, b: number, c: number) => number;
144
190
  readonly chainproviderhandle_snapshot: (a: number, b: number, c: number) => number;
191
+ readonly chainproviderhandle_warmUp: (a: number, b: number, c: number) => number;
145
192
  readonly connection_close: (a: number) => void;
146
193
  readonly connection_nextResponse: (a: number) => number;
147
194
  readonly connection_send: (a: number, b: number, c: number) => void;
@@ -150,18 +197,18 @@ export interface InitOutput {
150
197
  readonly networkchains_people: (a: number, b: number) => void;
151
198
  readonly networkchains_relay: (a: number, b: number) => void;
152
199
  readonly setLogLevel: (a: number, b: number) => void;
153
- readonly __wasm_bindgen_func_elem_19126: (a: number, b: number, c: number, d: number) => void;
154
- readonly __wasm_bindgen_func_elem_19128: (a: number, b: number, c: number, d: number) => void;
155
- readonly __wasm_bindgen_func_elem_3731: (a: number, b: number, c: number) => void;
156
- readonly __wasm_bindgen_func_elem_3731_2: (a: number, b: number, c: number) => void;
157
- readonly __wasm_bindgen_func_elem_3731_3: (a: number, b: number, c: number) => void;
158
- readonly __wasm_bindgen_func_elem_7146: (a: number, b: number) => void;
200
+ readonly __wasm_bindgen_func_elem_19314: (a: number, b: number, c: number, d: number) => void;
201
+ readonly __wasm_bindgen_func_elem_19316: (a: number, b: number, c: number, d: number) => void;
202
+ readonly __wasm_bindgen_func_elem_3817: (a: number, b: number, c: number) => void;
203
+ readonly __wasm_bindgen_func_elem_3817_2: (a: number, b: number, c: number) => void;
204
+ readonly __wasm_bindgen_func_elem_3817_3: (a: number, b: number, c: number) => void;
205
+ readonly __wasm_bindgen_func_elem_7341: (a: number, b: number) => void;
159
206
  readonly __wbindgen_export: (a: number, b: number) => number;
160
207
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
161
208
  readonly __wbindgen_export3: (a: number) => void;
162
- readonly __wbindgen_export4: (a: number, b: number) => void;
209
+ readonly __wbindgen_export4: (a: number, b: number, c: number) => void;
210
+ readonly __wbindgen_export5: (a: number, b: number) => void;
163
211
  readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
164
- readonly __wbindgen_export5: (a: number, b: number, c: number) => void;
165
212
  }
166
213
 
167
214
  export type SyncInitInput = BufferSource | WebAssembly.Module;
@@ -1,4 +1,6 @@
1
1
  /* @ts-self-types="./truapi_provider.d.ts" */
2
+ import { warmStoreLoad, warmStoreSave } from './snippets/truapi-provider-33b01a9e5797ba85/inline0.js';
3
+
2
4
 
3
5
  /**
4
6
  * Collects genesis-hash to chain-source registrations from JS.
@@ -89,6 +91,10 @@ export class ChainProviderBuilder {
89
91
  }
90
92
  /**
91
93
  * Build the provider, consuming the builder.
94
+ *
95
+ * Unless the host chose otherwise through
96
+ * [`set_warm_store`](Self::set_warm_store), chains resume from state kept
97
+ * in the browser's own database.
92
98
  * @returns {ChainProviderHandle}
93
99
  */
94
100
  build() {
@@ -140,6 +146,39 @@ export class ChainProviderBuilder {
140
146
  wasm.__wbindgen_add_to_stack_pointer(16);
141
147
  }
142
148
  }
149
+ /**
150
+ * Keep warm-start blobs somewhere other than the browser's own database,
151
+ * or nowhere at all.
152
+ *
153
+ * Warm start needs no setup: without this call the provider keeps blobs in
154
+ * IndexedDB for the origin. Pass a JS object with `load(genesisHash)`
155
+ * resolving to the stored string or `null` and `save(genesisHash, blob)`
156
+ * to store them elsewhere, or `null` to turn warm start off and have every
157
+ * chain sync from the chain-spec checkpoint.
158
+ *
159
+ * A store that cannot answer must reject rather than resolve empty: an
160
+ * empty read is taken as nothing stored yet, and would let a later
161
+ * snapshot overwrite good state.
162
+ *
163
+ * A loaded blob is trusted input: it becomes the finalized state the light
164
+ * client resumes from, so whatever can write to the store can steer the
165
+ * client's view of the chain. Origin-scoped storage satisfies that; a
166
+ * store fed by another page or a server does not.
167
+ * @param {any} store
168
+ */
169
+ setWarmStore(store) {
170
+ try {
171
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
172
+ wasm.chainproviderbuilder_setWarmStore(retptr, this.__wbg_ptr, addHeapObject(store));
173
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
174
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
175
+ if (r1) {
176
+ throw takeObject(r0);
177
+ }
178
+ } finally {
179
+ wasm.__wbindgen_add_to_stack_pointer(16);
180
+ }
181
+ }
143
182
  }
144
183
  if (Symbol.dispose) ChainProviderBuilder.prototype[Symbol.dispose] = ChainProviderBuilder.prototype.free;
145
184
 
@@ -175,6 +214,24 @@ export class ChainProviderHandle {
175
214
  const ret = wasm.chainproviderhandle_connect(this.__wbg_ptr, ptr0, len0);
176
215
  return takeObject(ret);
177
216
  }
217
+ /**
218
+ * Snapshot the chain's finalized state and write it to the warm store.
219
+ * Resolves with whether a blob was stored.
220
+ *
221
+ * A chain that has finalized nothing yet is skipped rather than stored,
222
+ * since that blob would be discarded on the next run. This is a full round
223
+ * trip against the light client, so drive it while the page or worker is
224
+ * alive; neither `pagehide` nor a hidden tab is guaranteed to stay
225
+ * scheduled long enough to finish one, and a Worker sees neither event.
226
+ * @param {string} genesis_hash
227
+ * @returns {Promise<boolean>}
228
+ */
229
+ persist(genesis_hash) {
230
+ const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
231
+ const len0 = WASM_VECTOR_LEN;
232
+ const ret = wasm.chainproviderhandle_persist(this.__wbg_ptr, ptr0, len0);
233
+ return takeObject(ret);
234
+ }
178
235
  /**
179
236
  * Produce a warm-start database blob for the `0x`-prefixed genesis hash.
180
237
  * Persist it and feed it back via
@@ -188,6 +245,22 @@ export class ChainProviderHandle {
188
245
  const ret = wasm.chainproviderhandle_snapshot(this.__wbg_ptr, ptr0, len0);
189
246
  return takeObject(ret);
190
247
  }
248
+ /**
249
+ * Read the warm store's blob for the `0x`-prefixed genesis hash into this
250
+ * provider, so the next [`connect`](ChainProviderHandle::connect) to that
251
+ * chain resumes from it. Resolves with whether a blob is now in hand.
252
+ *
253
+ * Call this before connecting. The store is read at most once per chain,
254
+ * because only a chain's first add consumes a blob.
255
+ * @param {string} genesis_hash
256
+ * @returns {Promise<boolean>}
257
+ */
258
+ warmUp(genesis_hash) {
259
+ const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
260
+ const len0 = WASM_VECTOR_LEN;
261
+ const ret = wasm.chainproviderhandle_warmUp(this.__wbg_ptr, ptr0, len0);
262
+ return takeObject(ret);
263
+ }
191
264
  }
192
265
  if (Symbol.dispose) ChainProviderHandle.prototype[Symbol.dispose] = ChainProviderHandle.prototype.free;
193
266
 
@@ -283,7 +356,7 @@ export class NetworkChains {
283
356
  return getStringFromWasm0(r0, r1);
284
357
  } finally {
285
358
  wasm.__wbindgen_add_to_stack_pointer(16);
286
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
359
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
287
360
  }
288
361
  }
289
362
  /**
@@ -303,7 +376,7 @@ export class NetworkChains {
303
376
  return getStringFromWasm0(r0, r1);
304
377
  } finally {
305
378
  wasm.__wbindgen_add_to_stack_pointer(16);
306
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
379
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
307
380
  }
308
381
  }
309
382
  /**
@@ -323,7 +396,7 @@ export class NetworkChains {
323
396
  return getStringFromWasm0(r0, r1);
324
397
  } finally {
325
398
  wasm.__wbindgen_add_to_stack_pointer(16);
326
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
399
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
327
400
  }
328
401
  }
329
402
  /**
@@ -343,7 +416,7 @@ export class NetworkChains {
343
416
  return getStringFromWasm0(r0, r1);
344
417
  } finally {
345
418
  wasm.__wbindgen_add_to_stack_pointer(16);
346
- wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
419
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
347
420
  }
348
421
  }
349
422
  }
@@ -379,6 +452,10 @@ function __wbg_get_imports() {
379
452
  const ret = typeof(getObject(arg0)) === 'function';
380
453
  return ret;
381
454
  },
455
+ __wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
456
+ const ret = getObject(arg0) === null;
457
+ return ret;
458
+ },
382
459
  __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
383
460
  const val = getObject(arg0);
384
461
  const ret = typeof(val) === 'object' && val !== null;
@@ -410,6 +487,10 @@ function __wbg_get_imports() {
410
487
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
411
488
  return addHeapObject(ret);
412
489
  }, arguments); },
490
+ __wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
491
+ const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
492
+ return addHeapObject(ret);
493
+ }, arguments); },
413
494
  __wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
414
495
  const ret = clearTimeout(takeObject(arg0));
415
496
  return addHeapObject(ret);
@@ -442,6 +523,10 @@ function __wbg_get_imports() {
442
523
  __wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
443
524
  getObject(arg0).getRandomValues(getObject(arg1));
444
525
  }, arguments); },
526
+ __wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
527
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
528
+ return addHeapObject(ret);
529
+ }, arguments); },
445
530
  __wbg_info_eadbe775a8e2e9eb: function(arg0) {
446
531
  console.info(getObject(arg0));
447
532
  },
@@ -478,7 +563,7 @@ function __wbg_get_imports() {
478
563
  const a = state0.a;
479
564
  state0.a = 0;
480
565
  try {
481
- return __wasm_bindgen_func_elem_19128(a, state0.b, arg0, arg1);
566
+ return __wasm_bindgen_func_elem_19316(a, state0.b, arg0, arg1);
482
567
  } finally {
483
568
  state0.a = a;
484
569
  }
@@ -583,6 +668,10 @@ function __wbg_get_imports() {
583
668
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
584
669
  return addHeapObject(ret);
585
670
  },
671
+ __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
672
+ const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
673
+ return addHeapObject(ret);
674
+ },
586
675
  __wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
587
676
  const ret = getObject(arg0).then(getObject(arg1));
588
677
  return addHeapObject(ret);
@@ -591,32 +680,71 @@ function __wbg_get_imports() {
591
680
  const ret = getObject(arg0).versions;
592
681
  return addHeapObject(ret);
593
682
  },
683
+ __wbg_warmStoreLoad_b2d6e9e9494ec393: function() { return handleError(function (arg0, arg1, arg2, arg3) {
684
+ let deferred0_0;
685
+ let deferred0_1;
686
+ let deferred1_0;
687
+ let deferred1_1;
688
+ try {
689
+ deferred0_0 = arg0;
690
+ deferred0_1 = arg1;
691
+ deferred1_0 = arg2;
692
+ deferred1_1 = arg3;
693
+ const ret = warmStoreLoad(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3));
694
+ return addHeapObject(ret);
695
+ } finally {
696
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
697
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
698
+ }
699
+ }, arguments); },
700
+ __wbg_warmStoreSave_31f6536d3a5ab89d: function() { return handleError(function (arg0, arg1, arg2, arg3, arg4, arg5) {
701
+ let deferred0_0;
702
+ let deferred0_1;
703
+ let deferred1_0;
704
+ let deferred1_1;
705
+ let deferred2_0;
706
+ let deferred2_1;
707
+ try {
708
+ deferred0_0 = arg0;
709
+ deferred0_1 = arg1;
710
+ deferred1_0 = arg2;
711
+ deferred1_1 = arg3;
712
+ deferred2_0 = arg4;
713
+ deferred2_1 = arg5;
714
+ const ret = warmStoreSave(getStringFromWasm0(arg0, arg1), getStringFromWasm0(arg2, arg3), getStringFromWasm0(arg4, arg5));
715
+ return addHeapObject(ret);
716
+ } finally {
717
+ wasm.__wbindgen_export4(deferred0_0, deferred0_1, 1);
718
+ wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
719
+ wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
720
+ }
721
+ }, arguments); },
594
722
  __wbg_warn_b1370d804fa3e259: function(arg0) {
595
723
  console.warn(getObject(arg0));
596
724
  },
597
725
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
598
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1830, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
599
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19126);
726
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1866, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
727
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19314);
600
728
  return addHeapObject(ret);
601
729
  },
602
730
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
603
731
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
604
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3731);
732
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3817);
605
733
  return addHeapObject(ret);
606
734
  },
607
735
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
608
736
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
609
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3731_2);
737
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3817_2);
610
738
  return addHeapObject(ret);
611
739
  },
612
740
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
613
741
  // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
614
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3731_3);
742
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3817_3);
615
743
  return addHeapObject(ret);
616
744
  },
617
745
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
618
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 668, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
619
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7146);
746
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 714, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
747
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7341);
620
748
  return addHeapObject(ret);
621
749
  },
622
750
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
@@ -643,26 +771,26 @@ function __wbg_get_imports() {
643
771
  };
644
772
  }
645
773
 
646
- function __wasm_bindgen_func_elem_7146(arg0, arg1) {
647
- wasm.__wasm_bindgen_func_elem_7146(arg0, arg1);
774
+ function __wasm_bindgen_func_elem_7341(arg0, arg1) {
775
+ wasm.__wasm_bindgen_func_elem_7341(arg0, arg1);
648
776
  }
649
777
 
650
- function __wasm_bindgen_func_elem_3731(arg0, arg1, arg2) {
651
- wasm.__wasm_bindgen_func_elem_3731(arg0, arg1, addHeapObject(arg2));
778
+ function __wasm_bindgen_func_elem_3817(arg0, arg1, arg2) {
779
+ wasm.__wasm_bindgen_func_elem_3817(arg0, arg1, addHeapObject(arg2));
652
780
  }
653
781
 
654
- function __wasm_bindgen_func_elem_3731_2(arg0, arg1, arg2) {
655
- wasm.__wasm_bindgen_func_elem_3731_2(arg0, arg1, addHeapObject(arg2));
782
+ function __wasm_bindgen_func_elem_3817_2(arg0, arg1, arg2) {
783
+ wasm.__wasm_bindgen_func_elem_3817_2(arg0, arg1, addHeapObject(arg2));
656
784
  }
657
785
 
658
- function __wasm_bindgen_func_elem_3731_3(arg0, arg1, arg2) {
659
- wasm.__wasm_bindgen_func_elem_3731_3(arg0, arg1, addHeapObject(arg2));
786
+ function __wasm_bindgen_func_elem_3817_3(arg0, arg1, arg2) {
787
+ wasm.__wasm_bindgen_func_elem_3817_3(arg0, arg1, addHeapObject(arg2));
660
788
  }
661
789
 
662
- function __wasm_bindgen_func_elem_19126(arg0, arg1, arg2) {
790
+ function __wasm_bindgen_func_elem_19314(arg0, arg1, arg2) {
663
791
  try {
664
792
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
665
- wasm.__wasm_bindgen_func_elem_19126(retptr, arg0, arg1, addHeapObject(arg2));
793
+ wasm.__wasm_bindgen_func_elem_19314(retptr, arg0, arg1, addHeapObject(arg2));
666
794
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
667
795
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
668
796
  if (r1) {
@@ -673,8 +801,8 @@ function __wasm_bindgen_func_elem_19126(arg0, arg1, arg2) {
673
801
  }
674
802
  }
675
803
 
676
- function __wasm_bindgen_func_elem_19128(arg0, arg1, arg2, arg3) {
677
- wasm.__wasm_bindgen_func_elem_19128(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
804
+ function __wasm_bindgen_func_elem_19316(arg0, arg1, arg2, arg3) {
805
+ wasm.__wasm_bindgen_func_elem_19316(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
678
806
  }
679
807
 
680
808
 
@@ -703,7 +831,7 @@ function addHeapObject(obj) {
703
831
 
704
832
  const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
705
833
  ? { register: () => {}, unregister: () => {} }
706
- : new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
834
+ : new FinalizationRegistry(state => wasm.__wbindgen_export5(state.a, state.b));
707
835
 
708
836
  function debugString(val) {
709
837
  // primitive types
@@ -839,7 +967,7 @@ function makeMutClosure(arg0, arg1, f) {
839
967
  };
840
968
  real._wbg_cb_unref = () => {
841
969
  if (--state.cnt === 0) {
842
- wasm.__wbindgen_export4(state.a, state.b);
970
+ wasm.__wbindgen_export5(state.a, state.b);
843
971
  state.a = 0;
844
972
  CLOSURE_DTORS.unregister(state);
845
973
  }
Binary file
@@ -11,8 +11,11 @@ export const chainproviderbuilder_addRpcChain: (a: number, b: number, c: number,
11
11
  export const chainproviderbuilder_build: (a: number, b: number) => void;
12
12
  export const chainproviderbuilder_new: () => number;
13
13
  export const chainproviderbuilder_setDatabase: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
+ export const chainproviderbuilder_setWarmStore: (a: number, b: number, c: number) => void;
14
15
  export const chainproviderhandle_connect: (a: number, b: number, c: number) => number;
16
+ export const chainproviderhandle_persist: (a: number, b: number, c: number) => number;
15
17
  export const chainproviderhandle_snapshot: (a: number, b: number, c: number) => number;
18
+ export const chainproviderhandle_warmUp: (a: number, b: number, c: number) => number;
16
19
  export const connection_close: (a: number) => void;
17
20
  export const connection_nextResponse: (a: number) => number;
18
21
  export const connection_send: (a: number, b: number, c: number) => void;
@@ -21,15 +24,15 @@ export const networkchains_bulletin: (a: number, b: number) => void;
21
24
  export const networkchains_people: (a: number, b: number) => void;
22
25
  export const networkchains_relay: (a: number, b: number) => void;
23
26
  export const setLogLevel: (a: number, b: number) => void;
24
- export const __wasm_bindgen_func_elem_19126: (a: number, b: number, c: number, d: number) => void;
25
- export const __wasm_bindgen_func_elem_19128: (a: number, b: number, c: number, d: number) => void;
26
- export const __wasm_bindgen_func_elem_3731: (a: number, b: number, c: number) => void;
27
- export const __wasm_bindgen_func_elem_3731_2: (a: number, b: number, c: number) => void;
28
- export const __wasm_bindgen_func_elem_3731_3: (a: number, b: number, c: number) => void;
29
- export const __wasm_bindgen_func_elem_7146: (a: number, b: number) => void;
27
+ export const __wasm_bindgen_func_elem_19314: (a: number, b: number, c: number, d: number) => void;
28
+ export const __wasm_bindgen_func_elem_19316: (a: number, b: number, c: number, d: number) => void;
29
+ export const __wasm_bindgen_func_elem_3817: (a: number, b: number, c: number) => void;
30
+ export const __wasm_bindgen_func_elem_3817_2: (a: number, b: number, c: number) => void;
31
+ export const __wasm_bindgen_func_elem_3817_3: (a: number, b: number, c: number) => void;
32
+ export const __wasm_bindgen_func_elem_7341: (a: number, b: number) => void;
30
33
  export const __wbindgen_export: (a: number, b: number) => number;
31
34
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
32
35
  export const __wbindgen_export3: (a: number) => void;
33
- export const __wbindgen_export4: (a: number, b: number) => void;
36
+ export const __wbindgen_export4: (a: number, b: number, c: number) => void;
37
+ export const __wbindgen_export5: (a: number, b: number) => void;
34
38
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
35
- export const __wbindgen_export5: (a: number, b: number, c: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parity/truapi-provider",
3
- "version": "0.1.1-dev-20260825.0",
3
+ "version": "0.1.1-dev-20260908.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>",