@parity/truapi-provider 0.1.1-dev-20260908.1 → 0.1.1-dev-20260908.3

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
@@ -37,6 +37,29 @@ const response = await connection.nextResponse(); // undefined once closed
37
37
  connection.close();
38
38
  ```
39
39
 
40
+ Warm start is opt-in, because this package stores nothing itself. Hand
41
+ `setStorage` a client to storage you already own:
42
+
43
+ ```js
44
+ builder.setStorage({
45
+ async load(genesisHash) {
46
+ return (await myStore.get(genesisHash)) ?? null;
47
+ },
48
+ async save(genesisHash, blob) {
49
+ await myStore.put(genesisHash, blob);
50
+ },
51
+ });
52
+ ```
53
+
54
+ Both are called with a `0x`-prefixed lowercase genesis hash. A client that cannot
55
+ answer must reject rather than resolve `null`, which means "nothing stored yet"
56
+ and would let the next write replace good state. Without a client every chain
57
+ syncs from the chain spec's checkpoint on every run.
58
+
59
+ `setDatabaseContent(genesisHash, blob)` seeds one chain for this run and beats
60
+ anything the client would load for it. `saveDatabase(genesisHash)` forces a write
61
+ at a moment of the host's choosing.
62
+
40
63
  ## Native hosts
41
64
 
42
65
  Android and iOS do not consume this package. The same `truapi-provider` crate is
@@ -28,10 +28,6 @@ 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.
35
31
  */
36
32
  build(): ChainProviderHandle;
37
33
  /**
@@ -39,21 +35,27 @@ export class ChainProviderBuilder {
39
35
  */
40
36
  constructor();
41
37
  /**
42
- * Seed a warm-start database blob (from
43
- * [`snapshot`](ChainProviderHandle::snapshot)) for the `0x`-prefixed
44
- * genesis hash, so its light client resumes from that finalized state
45
- * instead of re-syncing from the checkpoint.
38
+ * Seed the chain with the `0x`-prefixed genesis hash from a stored
39
+ * database blob, so its light client resumes from that finalized state
40
+ * instead of syncing from the chain-spec checkpoint.
41
+ *
42
+ * The blob is the string the `chainHead_unstable_finalizedDatabase` function in smoldot
43
+ * produces. It seeds this run only, and beats anything
44
+ * [`set_storage`](Self::set_storage) would load for the same chain.
46
45
  */
47
- setDatabase(genesis_hash: string, blob: string): void;
46
+ setDatabaseContent(genesis_hash: string, blob: string): void;
48
47
  /**
49
- * Keep warm-start blobs somewhere other than the browser's own database,
50
- * or nowhere at all.
48
+ * Keep database blobs in storage the host owns.
49
+ *
50
+ * The crate stores nothing itself, so without this call every chain syncs
51
+ * from the chain-spec checkpoint on every run. Pass a JS object with
52
+ * `load(genesisHash)` resolving to the stored string or `null`, and
53
+ * `save(genesisHash, blob)`. Both are called with a `0x`-prefixed hex
54
+ * genesis hash and may return a promise. Passing `null` does nothing.
51
55
  *
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.
56
+ * A blob seeded through
57
+ * [`set_database_content`](Self::set_database_content) beats one loaded
58
+ * here for the same chain.
57
59
  *
58
60
  * A store that cannot answer must reject rather than resolve empty: an
59
61
  * empty read is taken as nothing stored yet, and would let a later
@@ -61,10 +63,10 @@ export class ChainProviderBuilder {
61
63
  *
62
64
  * A loaded blob is trusted input: it becomes the finalized state the light
63
65
  * 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
+ * view of the chain. Origin-scoped storage satisfies that. A store fed by
67
+ * another page or a server does not.
66
68
  */
67
- setWarmStore(store: any): void;
69
+ setStorage(client: any): void;
68
70
  }
69
71
 
70
72
  /**
@@ -80,31 +82,25 @@ export class ChainProviderHandle {
80
82
  */
81
83
  connect(genesis_hash: string): Promise<Connection>;
82
84
  /**
83
- * Snapshot the chain's finalized state and write it to the warm store.
85
+ * Read the stored blob for the `0x`-prefixed genesis hash into this
86
+ * provider, so the next [`connect`](ChainProviderHandle::connect) to that
87
+ * chain resumes from it. Resolves with whether a blob is now in hand.
88
+ *
89
+ * Call this before connecting. The store is read at most once per chain,
90
+ * because only the first add of a chain consumes a blob.
91
+ */
92
+ loadDatabase(genesis_hash: string): Promise<boolean>;
93
+ /**
94
+ * Snapshot the finalized state of the chain and write it to the warm store.
84
95
  * Resolves with whether a blob was stored.
85
96
  *
86
97
  * A chain that has finalized nothing yet is skipped rather than stored,
87
98
  * since that blob would be discarded on the next run. This is a full round
88
99
  * 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
100
+ * alive. Neither `pagehide` nor a hidden tab is guaranteed to stay
90
101
  * scheduled long enough to finish one, and a Worker sees neither event.
91
102
  */
92
- persist(genesis_hash: string): Promise<boolean>;
93
- /**
94
- * Produce a warm-start database blob for the `0x`-prefixed genesis hash.
95
- * Persist it and feed it back via
96
- * [`setDatabase`](ChainProviderBuilder::set_database) on a later run.
97
- */
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>;
103
+ save_database(genesis_hash: string): Promise<boolean>;
108
104
  }
109
105
 
110
106
  /**
@@ -125,7 +121,7 @@ export class Connection {
125
121
  *
126
122
  * Calling this in a loop is not optional: it is the only thing that drains
127
123
  * the connection. Frames queue until they are taken, and once the backlog
128
- * reaches the connection's budget further [`send`](Connection::send) calls
124
+ * reaches the budget for the connection further [`send`](Connection::send) calls
129
125
  * come back as JSON-RPC errors instead of being queued, so a caller that
130
126
  * sends without reading eventually gets nothing but errors.
131
127
  */
@@ -183,12 +179,11 @@ export interface InitOutput {
183
179
  readonly chainproviderbuilder_addRpcChain: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
184
180
  readonly chainproviderbuilder_build: (a: number, b: number) => void;
185
181
  readonly chainproviderbuilder_new: () => number;
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;
182
+ readonly chainproviderbuilder_setDatabaseContent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
183
+ readonly chainproviderbuilder_setStorage: (a: number, b: number, c: number) => void;
188
184
  readonly chainproviderhandle_connect: (a: number, b: number, c: number) => number;
189
- readonly chainproviderhandle_persist: (a: number, b: number, c: number) => number;
190
- readonly chainproviderhandle_snapshot: (a: number, b: number, c: number) => number;
191
- readonly chainproviderhandle_warmUp: (a: number, b: number, c: number) => number;
185
+ readonly chainproviderhandle_loadDatabase: (a: number, b: number, c: number) => number;
186
+ readonly chainproviderhandle_save_database: (a: number, b: number, c: number) => number;
192
187
  readonly connection_close: (a: number) => void;
193
188
  readonly connection_nextResponse: (a: number) => number;
194
189
  readonly connection_send: (a: number, b: number, c: number) => void;
@@ -197,13 +192,12 @@ export interface InitOutput {
197
192
  readonly networkchains_people: (a: number, b: number) => void;
198
193
  readonly networkchains_relay: (a: number, b: number) => void;
199
194
  readonly setLogLevel: (a: number, b: number) => void;
200
- readonly __wasm_bindgen_func_elem_19487: (a: number, b: number, c: number, d: number) => void;
201
- readonly __wasm_bindgen_func_elem_19489: (a: number, b: number, c: number, d: number) => void;
202
- readonly __wasm_bindgen_func_elem_3887: (a: number, b: number, c: number) => void;
203
- readonly __wasm_bindgen_func_elem_3887_2: (a: number, b: number, c: number) => void;
204
- readonly __wasm_bindgen_func_elem_3887_3: (a: number, b: number, c: number) => void;
205
- readonly __wasm_bindgen_func_elem_3887_4: (a: number, b: number, c: number) => void;
206
- readonly __wasm_bindgen_func_elem_7441: (a: number, b: number) => void;
195
+ readonly __wasm_bindgen_func_elem_19274: (a: number, b: number, c: number, d: number) => void;
196
+ readonly __wasm_bindgen_func_elem_19276: (a: number, b: number, c: number, d: number) => void;
197
+ readonly __wasm_bindgen_func_elem_3803: (a: number, b: number, c: number) => void;
198
+ readonly __wasm_bindgen_func_elem_3803_2: (a: number, b: number, c: number) => void;
199
+ readonly __wasm_bindgen_func_elem_3803_3: (a: number, b: number, c: number) => void;
200
+ readonly __wasm_bindgen_func_elem_7302: (a: number, b: number) => void;
207
201
  readonly __wbindgen_export: (a: number, b: number) => number;
208
202
  readonly __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
209
203
  readonly __wbindgen_export3: (a: number) => void;
@@ -89,10 +89,6 @@ export class ChainProviderBuilder {
89
89
  }
90
90
  /**
91
91
  * Build the provider, consuming the builder.
92
- *
93
- * Unless the host chose otherwise through
94
- * [`set_warm_store`](Self::set_warm_store), chains resume from state kept
95
- * in the browser's own database.
96
92
  * @returns {ChainProviderHandle}
97
93
  */
98
94
  build() {
@@ -120,21 +116,24 @@ export class ChainProviderBuilder {
120
116
  return this;
121
117
  }
122
118
  /**
123
- * Seed a warm-start database blob (from
124
- * [`snapshot`](ChainProviderHandle::snapshot)) for the `0x`-prefixed
125
- * genesis hash, so its light client resumes from that finalized state
126
- * instead of re-syncing from the checkpoint.
119
+ * Seed the chain with the `0x`-prefixed genesis hash from a stored
120
+ * database blob, so its light client resumes from that finalized state
121
+ * instead of syncing from the chain-spec checkpoint.
122
+ *
123
+ * The blob is the string the `chainHead_unstable_finalizedDatabase` function in smoldot
124
+ * produces. It seeds this run only, and beats anything
125
+ * [`set_storage`](Self::set_storage) would load for the same chain.
127
126
  * @param {string} genesis_hash
128
127
  * @param {string} blob
129
128
  */
130
- setDatabase(genesis_hash, blob) {
129
+ setDatabaseContent(genesis_hash, blob) {
131
130
  try {
132
131
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
133
132
  const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
134
133
  const len0 = WASM_VECTOR_LEN;
135
134
  const ptr1 = passStringToWasm0(blob, wasm.__wbindgen_export, wasm.__wbindgen_export2);
136
135
  const len1 = WASM_VECTOR_LEN;
137
- wasm.chainproviderbuilder_setDatabase(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
136
+ wasm.chainproviderbuilder_setDatabaseContent(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
138
137
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
139
138
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
140
139
  if (r1) {
@@ -145,14 +144,17 @@ export class ChainProviderBuilder {
145
144
  }
146
145
  }
147
146
  /**
148
- * Keep warm-start blobs somewhere other than the browser's own database,
149
- * or nowhere at all.
147
+ * Keep database blobs in storage the host owns.
148
+ *
149
+ * The crate stores nothing itself, so without this call every chain syncs
150
+ * from the chain-spec checkpoint on every run. Pass a JS object with
151
+ * `load(genesisHash)` resolving to the stored string or `null`, and
152
+ * `save(genesisHash, blob)`. Both are called with a `0x`-prefixed hex
153
+ * genesis hash and may return a promise. Passing `null` does nothing.
150
154
  *
151
- * Warm start needs no setup: without this call the provider keeps blobs in
152
- * IndexedDB for the origin. Pass a JS object with `load(genesisHash)`
153
- * resolving to the stored string or `null` and `save(genesisHash, blob)`
154
- * to store them elsewhere, or `null` to turn warm start off and have every
155
- * chain sync from the chain-spec checkpoint.
155
+ * A blob seeded through
156
+ * [`set_database_content`](Self::set_database_content) beats one loaded
157
+ * here for the same chain.
156
158
  *
157
159
  * A store that cannot answer must reject rather than resolve empty: an
158
160
  * empty read is taken as nothing stored yet, and would let a later
@@ -160,14 +162,14 @@ export class ChainProviderBuilder {
160
162
  *
161
163
  * A loaded blob is trusted input: it becomes the finalized state the light
162
164
  * client resumes from, so whatever can write to the store can steer the
163
- * client's view of the chain. Origin-scoped storage satisfies that; a
164
- * store fed by another page or a server does not.
165
- * @param {any} store
165
+ * view of the chain. Origin-scoped storage satisfies that. A store fed by
166
+ * another page or a server does not.
167
+ * @param {any} client
166
168
  */
167
- setWarmStore(store) {
169
+ setStorage(client) {
168
170
  try {
169
171
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
170
- wasm.chainproviderbuilder_setWarmStore(retptr, this.__wbg_ptr, addHeapObject(store));
172
+ wasm.chainproviderbuilder_setStorage(retptr, this.__wbg_ptr, addHeapObject(client));
171
173
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
172
174
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
173
175
  if (r1) {
@@ -213,50 +215,37 @@ export class ChainProviderHandle {
213
215
  return takeObject(ret);
214
216
  }
215
217
  /**
216
- * Snapshot the chain's finalized state and write it to the warm store.
217
- * Resolves with whether a blob was stored.
218
+ * Read the stored blob for the `0x`-prefixed genesis hash into this
219
+ * provider, so the next [`connect`](ChainProviderHandle::connect) to that
220
+ * chain resumes from it. Resolves with whether a blob is now in hand.
218
221
  *
219
- * A chain that has finalized nothing yet is skipped rather than stored,
220
- * since that blob would be discarded on the next run. This is a full round
221
- * trip against the light client, so drive it while the page or worker is
222
- * alive; neither `pagehide` nor a hidden tab is guaranteed to stay
223
- * scheduled long enough to finish one, and a Worker sees neither event.
222
+ * Call this before connecting. The store is read at most once per chain,
223
+ * because only the first add of a chain consumes a blob.
224
224
  * @param {string} genesis_hash
225
225
  * @returns {Promise<boolean>}
226
226
  */
227
- persist(genesis_hash) {
228
- const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
229
- const len0 = WASM_VECTOR_LEN;
230
- const ret = wasm.chainproviderhandle_persist(this.__wbg_ptr, ptr0, len0);
231
- return takeObject(ret);
232
- }
233
- /**
234
- * Produce a warm-start database blob for the `0x`-prefixed genesis hash.
235
- * Persist it and feed it back via
236
- * [`setDatabase`](ChainProviderBuilder::set_database) on a later run.
237
- * @param {string} genesis_hash
238
- * @returns {Promise<string>}
239
- */
240
- snapshot(genesis_hash) {
227
+ loadDatabase(genesis_hash) {
241
228
  const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
229
  const len0 = WASM_VECTOR_LEN;
243
- const ret = wasm.chainproviderhandle_snapshot(this.__wbg_ptr, ptr0, len0);
230
+ const ret = wasm.chainproviderhandle_loadDatabase(this.__wbg_ptr, ptr0, len0);
244
231
  return takeObject(ret);
245
232
  }
246
233
  /**
247
- * Read the warm store's blob for the `0x`-prefixed genesis hash into this
248
- * provider, so the next [`connect`](ChainProviderHandle::connect) to that
249
- * chain resumes from it. Resolves with whether a blob is now in hand.
234
+ * Snapshot the finalized state of the chain and write it to the warm store.
235
+ * Resolves with whether a blob was stored.
250
236
  *
251
- * Call this before connecting. The store is read at most once per chain,
252
- * because only a chain's first add consumes a blob.
237
+ * A chain that has finalized nothing yet is skipped rather than stored,
238
+ * since that blob would be discarded on the next run. This is a full round
239
+ * trip against the light client, so drive it while the page or worker is
240
+ * alive. Neither `pagehide` nor a hidden tab is guaranteed to stay
241
+ * scheduled long enough to finish one, and a Worker sees neither event.
253
242
  * @param {string} genesis_hash
254
243
  * @returns {Promise<boolean>}
255
244
  */
256
- warmUp(genesis_hash) {
245
+ save_database(genesis_hash) {
257
246
  const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
258
247
  const len0 = WASM_VECTOR_LEN;
259
- const ret = wasm.chainproviderhandle_warmUp(this.__wbg_ptr, ptr0, len0);
248
+ const ret = wasm.chainproviderhandle_save_database(this.__wbg_ptr, ptr0, len0);
260
249
  return takeObject(ret);
261
250
  }
262
251
  }
@@ -295,7 +284,7 @@ export class Connection {
295
284
  *
296
285
  * Calling this in a loop is not optional: it is the only thing that drains
297
286
  * the connection. Frames queue until they are taken, and once the backlog
298
- * reaches the connection's budget further [`send`](Connection::send) calls
287
+ * reaches the budget for the connection further [`send`](Connection::send) calls
299
288
  * come back as JSON-RPC errors instead of being queued, so a caller that
300
289
  * sends without reading eventually gets nothing but errors.
301
290
  * @returns {Promise<string | undefined>}
@@ -493,9 +482,6 @@ function __wbg_get_imports() {
493
482
  const ret = clearTimeout(takeObject(arg0));
494
483
  return addHeapObject(ret);
495
484
  },
496
- __wbg_close_4c3686e8e8c6d353: function(arg0) {
497
- getObject(arg0).close();
498
- },
499
485
  __wbg_close_c65ca0257e895318: function() { return handleError(function (arg0) {
500
486
  getObject(arg0).close();
501
487
  }, arguments); },
@@ -507,10 +493,6 @@ function __wbg_get_imports() {
507
493
  const ret = Connection.__wrap(arg0);
508
494
  return addHeapObject(ret);
509
495
  },
510
- __wbg_createObjectStore_ff668af6e79f0433: function() { return handleError(function (arg0, arg1, arg2) {
511
- const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
512
- return addHeapObject(ret);
513
- }, arguments); },
514
496
  __wbg_crypto_38df2bab126b63dc: function(arg0) {
515
497
  const ret = getObject(arg0).crypto;
516
498
  return addHeapObject(ret);
@@ -532,10 +514,6 @@ function __wbg_get_imports() {
532
514
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
533
515
  return addHeapObject(ret);
534
516
  }, arguments); },
535
- __wbg_get_cefddcaffca4fbb7: function() { return handleError(function (arg0, arg1) {
536
- const ret = getObject(arg0).get(getObject(arg1));
537
- return addHeapObject(ret);
538
- }, arguments); },
539
517
  __wbg_info_eadbe775a8e2e9eb: function(arg0) {
540
518
  console.info(getObject(arg0));
541
519
  },
@@ -549,36 +527,6 @@ function __wbg_get_imports() {
549
527
  const ret = result;
550
528
  return ret;
551
529
  },
552
- __wbg_instanceof_IdbDatabase_1cc734ba1b040dd7: function(arg0) {
553
- let result;
554
- try {
555
- result = getObject(arg0) instanceof IDBDatabase;
556
- } catch (_) {
557
- result = false;
558
- }
559
- const ret = result;
560
- return ret;
561
- },
562
- __wbg_instanceof_IdbFactory_85ccbbe95ef25434: function(arg0) {
563
- let result;
564
- try {
565
- result = getObject(arg0) instanceof IDBFactory;
566
- } catch (_) {
567
- result = false;
568
- }
569
- const ret = result;
570
- return ret;
571
- },
572
- __wbg_instanceof_IdbRequest_fe7a4cb10800af5b: function(arg0) {
573
- let result;
574
- try {
575
- result = getObject(arg0) instanceof IDBRequest;
576
- } catch (_) {
577
- result = false;
578
- }
579
- const ret = result;
580
- return ret;
581
- },
582
530
  __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
583
531
  const ret = getObject(arg0).length;
584
532
  return ret;
@@ -602,7 +550,7 @@ function __wbg_get_imports() {
602
550
  const a = state0.a;
603
551
  state0.a = 0;
604
552
  try {
605
- return __wasm_bindgen_func_elem_19489(a, state0.b, arg0, arg1);
553
+ return __wasm_bindgen_func_elem_19276(a, state0.b, arg0, arg1);
606
554
  } finally {
607
555
  state0.a = a;
608
556
  }
@@ -629,14 +577,6 @@ function __wbg_get_imports() {
629
577
  const ret = getObject(arg0).now();
630
578
  return ret;
631
579
  },
632
- __wbg_objectStore_d5f47956b6c741e3: function() { return handleError(function (arg0, arg1, arg2) {
633
- const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
634
- return addHeapObject(ret);
635
- }, arguments); },
636
- __wbg_open_72e5234a49d5f85d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
637
- const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
638
- return addHeapObject(ret);
639
- }, arguments); },
640
580
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
641
581
  const ret = getObject(arg0).performance;
642
582
  return addHeapObject(ret);
@@ -648,10 +588,6 @@ function __wbg_get_imports() {
648
588
  __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
649
589
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
650
590
  },
651
- __wbg_put_a368805e3dcab3a7: function() { return handleError(function (arg0, arg1, arg2) {
652
- const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
653
- return addHeapObject(ret);
654
- }, arguments); },
655
591
  __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
656
592
  const ret = getObject(arg0).queueMicrotask;
657
593
  return addHeapObject(ret);
@@ -674,10 +610,6 @@ function __wbg_get_imports() {
674
610
  const ret = Promise.resolve(getObject(arg0));
675
611
  return addHeapObject(ret);
676
612
  },
677
- __wbg_result_2b1294a2bf8dc773: function() { return handleError(function (arg0) {
678
- const ret = getObject(arg0).result;
679
- return addHeapObject(ret);
680
- }, arguments); },
681
613
  __wbg_send_a321b376d40ec867: function() { return handleError(function (arg0, arg1, arg2) {
682
614
  getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
683
615
  }, arguments); },
@@ -694,9 +626,6 @@ function __wbg_get_imports() {
694
626
  __wbg_set_onclose_f706475385ecce07: function(arg0, arg1) {
695
627
  getObject(arg0).onclose = getObject(arg1);
696
628
  },
697
- __wbg_set_onerror_3488a474171ed56d: function(arg0, arg1) {
698
- getObject(arg0).onerror = getObject(arg1);
699
- },
700
629
  __wbg_set_onerror_9f5773fd31512333: function(arg0, arg1) {
701
630
  getObject(arg0).onerror = getObject(arg1);
702
631
  },
@@ -706,12 +635,6 @@ function __wbg_get_imports() {
706
635
  __wbg_set_onopen_4f65470ae522a61a: function(arg0, arg1) {
707
636
  getObject(arg0).onopen = getObject(arg1);
708
637
  },
709
- __wbg_set_onsuccess_cd0c3642a2873e66: function(arg0, arg1) {
710
- getObject(arg0).onsuccess = getObject(arg1);
711
- },
712
- __wbg_set_onupgradeneeded_7b2cf4ba1c57e655: function(arg0, arg1) {
713
- getObject(arg0).onupgradeneeded = getObject(arg1);
714
- },
715
638
  __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
716
639
  const ret = typeof global === 'undefined' ? null : global;
717
640
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -732,10 +655,6 @@ function __wbg_get_imports() {
732
655
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
733
656
  return addHeapObject(ret);
734
657
  },
735
- __wbg_target_e759594a8d965ed7: function(arg0) {
736
- const ret = getObject(arg0).target;
737
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
738
- },
739
658
  __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
740
659
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
741
660
  return addHeapObject(ret);
@@ -744,10 +663,6 @@ function __wbg_get_imports() {
744
663
  const ret = getObject(arg0).then(getObject(arg1));
745
664
  return addHeapObject(ret);
746
665
  },
747
- __wbg_transaction_d911d96b4b0af154: function() { return handleError(function (arg0, arg1, arg2, arg3) {
748
- const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
749
- return addHeapObject(ret);
750
- }, arguments); },
751
666
  __wbg_versions_276b2795b1c6a219: function(arg0) {
752
667
  const ret = getObject(arg0).versions;
753
668
  return addHeapObject(ret);
@@ -756,41 +671,36 @@ function __wbg_get_imports() {
756
671
  console.warn(getObject(arg0));
757
672
  },
758
673
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
759
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1893, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
760
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19487);
674
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1849, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
675
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19274);
761
676
  return addHeapObject(ret);
762
677
  },
763
678
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
764
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
765
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3887);
679
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
680
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3803);
766
681
  return addHeapObject(ret);
767
682
  },
768
683
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
769
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
770
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3887_2);
684
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
685
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3803_2);
771
686
  return addHeapObject(ret);
772
687
  },
773
688
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
774
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
775
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3887_3);
689
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 20, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
690
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3803_3);
776
691
  return addHeapObject(ret);
777
692
  },
778
693
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
779
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
780
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3887_4);
694
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 697, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
695
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7302);
781
696
  return addHeapObject(ret);
782
697
  },
783
698
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
784
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 741, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
785
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7441);
786
- return addHeapObject(ret);
787
- },
788
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
789
699
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
790
700
  const ret = getArrayU8FromWasm0(arg0, arg1);
791
701
  return addHeapObject(ret);
792
702
  },
793
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
703
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
794
704
  // Cast intrinsic for `Ref(String) -> Externref`.
795
705
  const ret = getStringFromWasm0(arg0, arg1);
796
706
  return addHeapObject(ret);
@@ -809,30 +719,26 @@ function __wbg_get_imports() {
809
719
  };
810
720
  }
811
721
 
812
- function __wasm_bindgen_func_elem_7441(arg0, arg1) {
813
- wasm.__wasm_bindgen_func_elem_7441(arg0, arg1);
814
- }
815
-
816
- function __wasm_bindgen_func_elem_3887(arg0, arg1, arg2) {
817
- wasm.__wasm_bindgen_func_elem_3887(arg0, arg1, addHeapObject(arg2));
722
+ function __wasm_bindgen_func_elem_7302(arg0, arg1) {
723
+ wasm.__wasm_bindgen_func_elem_7302(arg0, arg1);
818
724
  }
819
725
 
820
- function __wasm_bindgen_func_elem_3887_2(arg0, arg1, arg2) {
821
- wasm.__wasm_bindgen_func_elem_3887_2(arg0, arg1, addHeapObject(arg2));
726
+ function __wasm_bindgen_func_elem_3803(arg0, arg1, arg2) {
727
+ wasm.__wasm_bindgen_func_elem_3803(arg0, arg1, addHeapObject(arg2));
822
728
  }
823
729
 
824
- function __wasm_bindgen_func_elem_3887_3(arg0, arg1, arg2) {
825
- wasm.__wasm_bindgen_func_elem_3887_3(arg0, arg1, addHeapObject(arg2));
730
+ function __wasm_bindgen_func_elem_3803_2(arg0, arg1, arg2) {
731
+ wasm.__wasm_bindgen_func_elem_3803_2(arg0, arg1, addHeapObject(arg2));
826
732
  }
827
733
 
828
- function __wasm_bindgen_func_elem_3887_4(arg0, arg1, arg2) {
829
- wasm.__wasm_bindgen_func_elem_3887_4(arg0, arg1, addHeapObject(arg2));
734
+ function __wasm_bindgen_func_elem_3803_3(arg0, arg1, arg2) {
735
+ wasm.__wasm_bindgen_func_elem_3803_3(arg0, arg1, addHeapObject(arg2));
830
736
  }
831
737
 
832
- function __wasm_bindgen_func_elem_19487(arg0, arg1, arg2) {
738
+ function __wasm_bindgen_func_elem_19274(arg0, arg1, arg2) {
833
739
  try {
834
740
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
835
- wasm.__wasm_bindgen_func_elem_19487(retptr, arg0, arg1, addHeapObject(arg2));
741
+ wasm.__wasm_bindgen_func_elem_19274(retptr, arg0, arg1, addHeapObject(arg2));
836
742
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
837
743
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
838
744
  if (r1) {
@@ -843,15 +749,12 @@ function __wasm_bindgen_func_elem_19487(arg0, arg1, arg2) {
843
749
  }
844
750
  }
845
751
 
846
- function __wasm_bindgen_func_elem_19489(arg0, arg1, arg2, arg3) {
847
- wasm.__wasm_bindgen_func_elem_19489(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
752
+ function __wasm_bindgen_func_elem_19276(arg0, arg1, arg2, arg3) {
753
+ wasm.__wasm_bindgen_func_elem_19276(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
848
754
  }
849
755
 
850
756
 
851
757
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
852
-
853
-
854
- const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
855
758
  const ChainProviderBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
856
759
  ? { register: () => {}, unregister: () => {} }
857
760
  : new FinalizationRegistry(ptr => wasm.__wbg_chainproviderbuilder_free(ptr, 1));
Binary file
@@ -10,12 +10,11 @@ export const chainproviderbuilder_addNetwork: (a: number, b: number, c: number,
10
10
  export const chainproviderbuilder_addRpcChain: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
11
11
  export const chainproviderbuilder_build: (a: number, b: number) => void;
12
12
  export const chainproviderbuilder_new: () => number;
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;
13
+ export const chainproviderbuilder_setDatabaseContent: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
14
+ export const chainproviderbuilder_setStorage: (a: number, b: number, c: number) => void;
15
15
  export const chainproviderhandle_connect: (a: number, b: number, c: number) => number;
16
- export const chainproviderhandle_persist: (a: number, b: number, c: number) => number;
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
+ export const chainproviderhandle_loadDatabase: (a: number, b: number, c: number) => number;
17
+ export const chainproviderhandle_save_database: (a: number, b: number, c: number) => number;
19
18
  export const connection_close: (a: number) => void;
20
19
  export const connection_nextResponse: (a: number) => number;
21
20
  export const connection_send: (a: number, b: number, c: number) => void;
@@ -24,13 +23,12 @@ export const networkchains_bulletin: (a: number, b: number) => void;
24
23
  export const networkchains_people: (a: number, b: number) => void;
25
24
  export const networkchains_relay: (a: number, b: number) => void;
26
25
  export const setLogLevel: (a: number, b: number) => void;
27
- export const __wasm_bindgen_func_elem_19487: (a: number, b: number, c: number, d: number) => void;
28
- export const __wasm_bindgen_func_elem_19489: (a: number, b: number, c: number, d: number) => void;
29
- export const __wasm_bindgen_func_elem_3887: (a: number, b: number, c: number) => void;
30
- export const __wasm_bindgen_func_elem_3887_2: (a: number, b: number, c: number) => void;
31
- export const __wasm_bindgen_func_elem_3887_3: (a: number, b: number, c: number) => void;
32
- export const __wasm_bindgen_func_elem_3887_4: (a: number, b: number, c: number) => void;
33
- export const __wasm_bindgen_func_elem_7441: (a: number, b: number) => void;
26
+ export const __wasm_bindgen_func_elem_19274: (a: number, b: number, c: number, d: number) => void;
27
+ export const __wasm_bindgen_func_elem_19276: (a: number, b: number, c: number, d: number) => void;
28
+ export const __wasm_bindgen_func_elem_3803: (a: number, b: number, c: number) => void;
29
+ export const __wasm_bindgen_func_elem_3803_2: (a: number, b: number, c: number) => void;
30
+ export const __wasm_bindgen_func_elem_3803_3: (a: number, b: number, c: number) => void;
31
+ export const __wasm_bindgen_func_elem_7302: (a: number, b: number) => void;
34
32
  export const __wbindgen_export: (a: number, b: number) => number;
35
33
  export const __wbindgen_export2: (a: number, b: number, c: number, d: number) => number;
36
34
  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-20260908.1",
3
+ "version": "0.1.1-dev-20260908.3",
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>",