@parity/truapi-provider 0.1.1-dev-20260908.2 → 0.1.1-dev-20260908.4

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 checkpoint in the chain spec 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 the host chooses.
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 storage.
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
- save_database(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
+ saveDatabase(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_save_database: (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_saveDatabase: (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_19485: (a: number, b: number, c: number, d: number) => void;
201
- readonly __wasm_bindgen_func_elem_19487: (a: number, b: number, c: number, d: number) => void;
202
- readonly __wasm_bindgen_func_elem_3886: (a: number, b: number, c: number) => void;
203
- readonly __wasm_bindgen_func_elem_3886_2: (a: number, b: number, c: number) => void;
204
- readonly __wasm_bindgen_func_elem_3886_3: (a: number, b: number, c: number) => void;
205
- readonly __wasm_bindgen_func_elem_3886_4: (a: number, b: number, c: number) => void;
206
- readonly __wasm_bindgen_func_elem_7436: (a: number, b: number) => void;
195
+ readonly __wasm_bindgen_func_elem_19286: (a: number, b: number, c: number, d: number) => void;
196
+ readonly __wasm_bindgen_func_elem_19288: (a: number, b: number, c: number, d: number) => void;
197
+ readonly __wasm_bindgen_func_elem_3806: (a: number, b: number, c: number) => void;
198
+ readonly __wasm_bindgen_func_elem_3806_2: (a: number, b: number, c: number) => void;
199
+ readonly __wasm_bindgen_func_elem_3806_3: (a: number, b: number, c: number) => void;
200
+ readonly __wasm_bindgen_func_elem_7314: (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
- save_database(genesis_hash) {
227
+ loadDatabase(genesis_hash) {
228
228
  const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
229
229
  const len0 = WASM_VECTOR_LEN;
230
- const ret = wasm.chainproviderhandle_save_database(this.__wbg_ptr, ptr0, len0);
230
+ const ret = wasm.chainproviderhandle_loadDatabase(this.__wbg_ptr, ptr0, len0);
231
231
  return takeObject(ret);
232
232
  }
233
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) {
241
- const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
242
- const len0 = WASM_VECTOR_LEN;
243
- const ret = wasm.chainproviderhandle_snapshot(this.__wbg_ptr, ptr0, len0);
244
- return takeObject(ret);
245
- }
246
- /**
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 storage.
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
+ saveDatabase(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_saveDatabase(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>}
@@ -481,10 +470,6 @@ function __wbg_get_imports() {
481
470
  __wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
482
471
  getObject(arg0)._wbg_cb_unref();
483
472
  },
484
- __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
485
- const ret = getObject(arg0).call(getObject(arg1));
486
- return addHeapObject(ret);
487
- }, arguments); },
488
473
  __wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
489
474
  const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
490
475
  return addHeapObject(ret);
@@ -497,9 +482,6 @@ function __wbg_get_imports() {
497
482
  const ret = clearTimeout(takeObject(arg0));
498
483
  return addHeapObject(ret);
499
484
  },
500
- __wbg_close_4c3686e8e8c6d353: function(arg0) {
501
- getObject(arg0).close();
502
- },
503
485
  __wbg_close_c65ca0257e895318: function() { return handleError(function (arg0) {
504
486
  getObject(arg0).close();
505
487
  }, arguments); },
@@ -511,10 +493,6 @@ function __wbg_get_imports() {
511
493
  const ret = Connection.__wrap(arg0);
512
494
  return addHeapObject(ret);
513
495
  },
514
- __wbg_createObjectStore_ff668af6e79f0433: function() { return handleError(function (arg0, arg1, arg2) {
515
- const ret = getObject(arg0).createObjectStore(getStringFromWasm0(arg1, arg2));
516
- return addHeapObject(ret);
517
- }, arguments); },
518
496
  __wbg_crypto_38df2bab126b63dc: function(arg0) {
519
497
  const ret = getObject(arg0).crypto;
520
498
  return addHeapObject(ret);
@@ -536,10 +514,6 @@ function __wbg_get_imports() {
536
514
  const ret = Reflect.get(getObject(arg0), getObject(arg1));
537
515
  return addHeapObject(ret);
538
516
  }, arguments); },
539
- __wbg_get_cefddcaffca4fbb7: function() { return handleError(function (arg0, arg1) {
540
- const ret = getObject(arg0).get(getObject(arg1));
541
- return addHeapObject(ret);
542
- }, arguments); },
543
517
  __wbg_info_eadbe775a8e2e9eb: function(arg0) {
544
518
  console.info(getObject(arg0));
545
519
  },
@@ -553,36 +527,6 @@ function __wbg_get_imports() {
553
527
  const ret = result;
554
528
  return ret;
555
529
  },
556
- __wbg_instanceof_IdbDatabase_1cc734ba1b040dd7: function(arg0) {
557
- let result;
558
- try {
559
- result = getObject(arg0) instanceof IDBDatabase;
560
- } catch (_) {
561
- result = false;
562
- }
563
- const ret = result;
564
- return ret;
565
- },
566
- __wbg_instanceof_IdbFactory_85ccbbe95ef25434: function(arg0) {
567
- let result;
568
- try {
569
- result = getObject(arg0) instanceof IDBFactory;
570
- } catch (_) {
571
- result = false;
572
- }
573
- const ret = result;
574
- return ret;
575
- },
576
- __wbg_instanceof_IdbRequest_fe7a4cb10800af5b: function(arg0) {
577
- let result;
578
- try {
579
- result = getObject(arg0) instanceof IDBRequest;
580
- } catch (_) {
581
- result = false;
582
- }
583
- const ret = result;
584
- return ret;
585
- },
586
530
  __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
587
531
  const ret = getObject(arg0).length;
588
532
  return ret;
@@ -606,7 +550,7 @@ function __wbg_get_imports() {
606
550
  const a = state0.a;
607
551
  state0.a = 0;
608
552
  try {
609
- return __wasm_bindgen_func_elem_19487(a, state0.b, arg0, arg1);
553
+ return __wasm_bindgen_func_elem_19288(a, state0.b, arg0, arg1);
610
554
  } finally {
611
555
  state0.a = a;
612
556
  }
@@ -633,14 +577,6 @@ function __wbg_get_imports() {
633
577
  const ret = getObject(arg0).now();
634
578
  return ret;
635
579
  },
636
- __wbg_objectStore_d5f47956b6c741e3: function() { return handleError(function (arg0, arg1, arg2) {
637
- const ret = getObject(arg0).objectStore(getStringFromWasm0(arg1, arg2));
638
- return addHeapObject(ret);
639
- }, arguments); },
640
- __wbg_open_72e5234a49d5f85d: function() { return handleError(function (arg0, arg1, arg2, arg3) {
641
- const ret = getObject(arg0).open(getStringFromWasm0(arg1, arg2), arg3 >>> 0);
642
- return addHeapObject(ret);
643
- }, arguments); },
644
580
  __wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
645
581
  const ret = getObject(arg0).performance;
646
582
  return addHeapObject(ret);
@@ -652,10 +588,6 @@ function __wbg_get_imports() {
652
588
  __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
653
589
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
654
590
  },
655
- __wbg_put_a368805e3dcab3a7: function() { return handleError(function (arg0, arg1, arg2) {
656
- const ret = getObject(arg0).put(getObject(arg1), getObject(arg2));
657
- return addHeapObject(ret);
658
- }, arguments); },
659
591
  __wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
660
592
  const ret = getObject(arg0).queueMicrotask;
661
593
  return addHeapObject(ret);
@@ -678,10 +610,6 @@ function __wbg_get_imports() {
678
610
  const ret = Promise.resolve(getObject(arg0));
679
611
  return addHeapObject(ret);
680
612
  },
681
- __wbg_result_2b1294a2bf8dc773: function() { return handleError(function (arg0) {
682
- const ret = getObject(arg0).result;
683
- return addHeapObject(ret);
684
- }, arguments); },
685
613
  __wbg_send_a321b376d40ec867: function() { return handleError(function (arg0, arg1, arg2) {
686
614
  getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
687
615
  }, arguments); },
@@ -695,36 +623,18 @@ function __wbg_get_imports() {
695
623
  __wbg_set_binaryType_a37b086c78ca7c29: function(arg0, arg1) {
696
624
  getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
697
625
  },
698
- __wbg_set_onabort_e8ad31807de2db24: function(arg0, arg1) {
699
- getObject(arg0).onabort = getObject(arg1);
700
- },
701
626
  __wbg_set_onclose_f706475385ecce07: function(arg0, arg1) {
702
627
  getObject(arg0).onclose = getObject(arg1);
703
628
  },
704
- __wbg_set_oncomplete_e6abb66d0ad42731: function(arg0, arg1) {
705
- getObject(arg0).oncomplete = getObject(arg1);
706
- },
707
- __wbg_set_onerror_3488a474171ed56d: function(arg0, arg1) {
708
- getObject(arg0).onerror = getObject(arg1);
709
- },
710
629
  __wbg_set_onerror_9f5773fd31512333: function(arg0, arg1) {
711
630
  getObject(arg0).onerror = getObject(arg1);
712
631
  },
713
- __wbg_set_onerror_f8d31be44335c633: function(arg0, arg1) {
714
- getObject(arg0).onerror = getObject(arg1);
715
- },
716
632
  __wbg_set_onmessage_836d2f72130b4706: function(arg0, arg1) {
717
633
  getObject(arg0).onmessage = getObject(arg1);
718
634
  },
719
635
  __wbg_set_onopen_4f65470ae522a61a: function(arg0, arg1) {
720
636
  getObject(arg0).onopen = getObject(arg1);
721
637
  },
722
- __wbg_set_onsuccess_cd0c3642a2873e66: function(arg0, arg1) {
723
- getObject(arg0).onsuccess = getObject(arg1);
724
- },
725
- __wbg_set_onupgradeneeded_7b2cf4ba1c57e655: function(arg0, arg1) {
726
- getObject(arg0).onupgradeneeded = getObject(arg1);
727
- },
728
638
  __wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
729
639
  const ret = typeof global === 'undefined' ? null : global;
730
640
  return isLikeNone(ret) ? 0 : addHeapObject(ret);
@@ -745,10 +655,6 @@ function __wbg_get_imports() {
745
655
  const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
746
656
  return addHeapObject(ret);
747
657
  },
748
- __wbg_target_e759594a8d965ed7: function(arg0) {
749
- const ret = getObject(arg0).target;
750
- return isLikeNone(ret) ? 0 : addHeapObject(ret);
751
- },
752
658
  __wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
753
659
  const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
754
660
  return addHeapObject(ret);
@@ -757,10 +663,6 @@ function __wbg_get_imports() {
757
663
  const ret = getObject(arg0).then(getObject(arg1));
758
664
  return addHeapObject(ret);
759
665
  },
760
- __wbg_transaction_d911d96b4b0af154: function() { return handleError(function (arg0, arg1, arg2, arg3) {
761
- const ret = getObject(arg0).transaction(getStringFromWasm0(arg1, arg2), __wbindgen_enum_IdbTransactionMode[arg3]);
762
- return addHeapObject(ret);
763
- }, arguments); },
764
666
  __wbg_versions_276b2795b1c6a219: function(arg0) {
765
667
  const ret = getObject(arg0).versions;
766
668
  return addHeapObject(ret);
@@ -769,41 +671,36 @@ function __wbg_get_imports() {
769
671
  console.warn(getObject(arg0));
770
672
  },
771
673
  __wbindgen_cast_0000000000000001: function(arg0, arg1) {
772
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1887, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
773
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19485);
674
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [Externref], shim_idx: 1853, ret: Result(Unit), inner_ret: Some(Result(Unit)) }, mutable: true }) -> Externref`.
675
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_19286);
774
676
  return addHeapObject(ret);
775
677
  },
776
678
  __wbindgen_cast_0000000000000002: function(arg0, arg1) {
777
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("CloseEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
778
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3886);
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_3806);
779
681
  return addHeapObject(ret);
780
682
  },
781
683
  __wbindgen_cast_0000000000000003: function(arg0, arg1) {
782
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("Event")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
783
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3886_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_3806_2);
784
686
  return addHeapObject(ret);
785
687
  },
786
688
  __wbindgen_cast_0000000000000004: function(arg0, arg1) {
787
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("IDBVersionChangeEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
788
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3886_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_3806_3);
789
691
  return addHeapObject(ret);
790
692
  },
791
693
  __wbindgen_cast_0000000000000005: function(arg0, arg1) {
792
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [NamedExternref("MessageEvent")], shim_idx: 21, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
793
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_3886_4);
694
+ // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 701, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
695
+ const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7314);
794
696
  return addHeapObject(ret);
795
697
  },
796
698
  __wbindgen_cast_0000000000000006: function(arg0, arg1) {
797
- // Cast intrinsic for `Closure(Closure { owned: true, function: Function { arguments: [], shim_idx: 735, ret: Unit, inner_ret: Some(Unit) }, mutable: true }) -> Externref`.
798
- const ret = makeMutClosure(arg0, arg1, __wasm_bindgen_func_elem_7436);
799
- return addHeapObject(ret);
800
- },
801
- __wbindgen_cast_0000000000000007: function(arg0, arg1) {
802
699
  // Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
803
700
  const ret = getArrayU8FromWasm0(arg0, arg1);
804
701
  return addHeapObject(ret);
805
702
  },
806
- __wbindgen_cast_0000000000000008: function(arg0, arg1) {
703
+ __wbindgen_cast_0000000000000007: function(arg0, arg1) {
807
704
  // Cast intrinsic for `Ref(String) -> Externref`.
808
705
  const ret = getStringFromWasm0(arg0, arg1);
809
706
  return addHeapObject(ret);
@@ -822,30 +719,26 @@ function __wbg_get_imports() {
822
719
  };
823
720
  }
824
721
 
825
- function __wasm_bindgen_func_elem_7436(arg0, arg1) {
826
- wasm.__wasm_bindgen_func_elem_7436(arg0, arg1);
827
- }
828
-
829
- function __wasm_bindgen_func_elem_3886(arg0, arg1, arg2) {
830
- wasm.__wasm_bindgen_func_elem_3886(arg0, arg1, addHeapObject(arg2));
722
+ function __wasm_bindgen_func_elem_7314(arg0, arg1) {
723
+ wasm.__wasm_bindgen_func_elem_7314(arg0, arg1);
831
724
  }
832
725
 
833
- function __wasm_bindgen_func_elem_3886_2(arg0, arg1, arg2) {
834
- wasm.__wasm_bindgen_func_elem_3886_2(arg0, arg1, addHeapObject(arg2));
726
+ function __wasm_bindgen_func_elem_3806(arg0, arg1, arg2) {
727
+ wasm.__wasm_bindgen_func_elem_3806(arg0, arg1, addHeapObject(arg2));
835
728
  }
836
729
 
837
- function __wasm_bindgen_func_elem_3886_3(arg0, arg1, arg2) {
838
- wasm.__wasm_bindgen_func_elem_3886_3(arg0, arg1, addHeapObject(arg2));
730
+ function __wasm_bindgen_func_elem_3806_2(arg0, arg1, arg2) {
731
+ wasm.__wasm_bindgen_func_elem_3806_2(arg0, arg1, addHeapObject(arg2));
839
732
  }
840
733
 
841
- function __wasm_bindgen_func_elem_3886_4(arg0, arg1, arg2) {
842
- wasm.__wasm_bindgen_func_elem_3886_4(arg0, arg1, addHeapObject(arg2));
734
+ function __wasm_bindgen_func_elem_3806_3(arg0, arg1, arg2) {
735
+ wasm.__wasm_bindgen_func_elem_3806_3(arg0, arg1, addHeapObject(arg2));
843
736
  }
844
737
 
845
- function __wasm_bindgen_func_elem_19485(arg0, arg1, arg2) {
738
+ function __wasm_bindgen_func_elem_19286(arg0, arg1, arg2) {
846
739
  try {
847
740
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
848
- wasm.__wasm_bindgen_func_elem_19485(retptr, arg0, arg1, addHeapObject(arg2));
741
+ wasm.__wasm_bindgen_func_elem_19286(retptr, arg0, arg1, addHeapObject(arg2));
849
742
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
850
743
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
851
744
  if (r1) {
@@ -856,15 +749,12 @@ function __wasm_bindgen_func_elem_19485(arg0, arg1, arg2) {
856
749
  }
857
750
  }
858
751
 
859
- function __wasm_bindgen_func_elem_19487(arg0, arg1, arg2, arg3) {
860
- wasm.__wasm_bindgen_func_elem_19487(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
752
+ function __wasm_bindgen_func_elem_19288(arg0, arg1, arg2, arg3) {
753
+ wasm.__wasm_bindgen_func_elem_19288(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
861
754
  }
862
755
 
863
756
 
864
757
  const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
865
-
866
-
867
- const __wbindgen_enum_IdbTransactionMode = ["readonly", "readwrite", "versionchange", "readwriteflush", "cleanup"];
868
758
  const ChainProviderBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
869
759
  ? { register: () => {}, unregister: () => {} }
870
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_save_database: (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_saveDatabase: (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_19485: (a: number, b: number, c: number, d: number) => void;
28
- export const __wasm_bindgen_func_elem_19487: (a: number, b: number, c: number, d: number) => void;
29
- export const __wasm_bindgen_func_elem_3886: (a: number, b: number, c: number) => void;
30
- export const __wasm_bindgen_func_elem_3886_2: (a: number, b: number, c: number) => void;
31
- export const __wasm_bindgen_func_elem_3886_3: (a: number, b: number, c: number) => void;
32
- export const __wasm_bindgen_func_elem_3886_4: (a: number, b: number, c: number) => void;
33
- export const __wasm_bindgen_func_elem_7436: (a: number, b: number) => void;
26
+ export const __wasm_bindgen_func_elem_19286: (a: number, b: number, c: number, d: number) => void;
27
+ export const __wasm_bindgen_func_elem_19288: (a: number, b: number, c: number, d: number) => void;
28
+ export const __wasm_bindgen_func_elem_3806: (a: number, b: number, c: number) => void;
29
+ export const __wasm_bindgen_func_elem_3806_2: (a: number, b: number, c: number) => void;
30
+ export const __wasm_bindgen_func_elem_3806_3: (a: number, b: number, c: number) => void;
31
+ export const __wasm_bindgen_func_elem_7314: (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.2",
3
+ "version": "0.1.1-dev-20260908.4",
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>",