@parity/truapi-provider 0.1.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/LICENSE +21 -0
- package/LICENSE-APACHE +201 -0
- package/NOTICE +19 -0
- package/README.md +85 -0
- package/dist/truapi_provider.d.ts +229 -0
- package/dist/truapi_provider.js +1090 -0
- package/dist/truapi_provider_bg.wasm +0 -0
- package/dist/truapi_provider_bg.wasm.d.ts +37 -0
- package/package.json +42 -0
|
@@ -0,0 +1,1090 @@
|
|
|
1
|
+
/* @ts-self-types="./truapi_provider.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Collects genesis-hash to chain-source registrations from JS.
|
|
5
|
+
*/
|
|
6
|
+
export class ChainProviderBuilder {
|
|
7
|
+
__destroy_into_raw() {
|
|
8
|
+
const ptr = this.__wbg_ptr;
|
|
9
|
+
this.__wbg_ptr = 0;
|
|
10
|
+
ChainProviderBuilderFinalization.unregister(this);
|
|
11
|
+
return ptr;
|
|
12
|
+
}
|
|
13
|
+
free() {
|
|
14
|
+
const ptr = this.__destroy_into_raw();
|
|
15
|
+
wasm.__wbg_chainproviderbuilder_free(ptr, 0);
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Register an embedded light-client chain identified by the
|
|
19
|
+
* `0x`-prefixed genesis hash. Use this for a relay or standalone chain;
|
|
20
|
+
* parachains are served through the bundled catalog (`addNetwork`), which
|
|
21
|
+
* supplies their relay wiring and statement-store placement.
|
|
22
|
+
* @param {string} genesis_hash
|
|
23
|
+
* @param {string} specification
|
|
24
|
+
*/
|
|
25
|
+
addLightChain(genesis_hash, specification) {
|
|
26
|
+
try {
|
|
27
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
28
|
+
const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
29
|
+
const len0 = WASM_VECTOR_LEN;
|
|
30
|
+
const ptr1 = passStringToWasm0(specification, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
31
|
+
const len1 = WASM_VECTOR_LEN;
|
|
32
|
+
wasm.chainproviderbuilder_addLightChain(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
33
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
34
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
35
|
+
if (r1) {
|
|
36
|
+
throw takeObject(r0);
|
|
37
|
+
}
|
|
38
|
+
} finally {
|
|
39
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Register every chain of the bundled network `name` (relay plus system
|
|
44
|
+
* parachains, with relay wiring and statement-store placement supplied by
|
|
45
|
+
* the catalog). Returns the network's genesis hashes.
|
|
46
|
+
* @param {string} name
|
|
47
|
+
* @returns {NetworkChains}
|
|
48
|
+
*/
|
|
49
|
+
addNetwork(name) {
|
|
50
|
+
try {
|
|
51
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
52
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
53
|
+
const len0 = WASM_VECTOR_LEN;
|
|
54
|
+
wasm.chainproviderbuilder_addNetwork(retptr, this.__wbg_ptr, ptr0, len0);
|
|
55
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
56
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
57
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
58
|
+
if (r2) {
|
|
59
|
+
throw takeObject(r1);
|
|
60
|
+
}
|
|
61
|
+
return NetworkChains.__wrap(r0);
|
|
62
|
+
} finally {
|
|
63
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Register a remote JSON-RPC node for the chain identified by the
|
|
68
|
+
* `0x`-prefixed genesis hash. A later registration for the same hash
|
|
69
|
+
* replaces the earlier one.
|
|
70
|
+
* @param {string} genesis_hash
|
|
71
|
+
* @param {string} url
|
|
72
|
+
*/
|
|
73
|
+
addRpcChain(genesis_hash, url) {
|
|
74
|
+
try {
|
|
75
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
76
|
+
const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
77
|
+
const len0 = WASM_VECTOR_LEN;
|
|
78
|
+
const ptr1 = passStringToWasm0(url, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
79
|
+
const len1 = WASM_VECTOR_LEN;
|
|
80
|
+
wasm.chainproviderbuilder_addRpcChain(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
81
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
82
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
83
|
+
if (r1) {
|
|
84
|
+
throw takeObject(r0);
|
|
85
|
+
}
|
|
86
|
+
} finally {
|
|
87
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Build the provider, consuming the builder.
|
|
92
|
+
* @returns {ChainProviderHandle}
|
|
93
|
+
*/
|
|
94
|
+
build() {
|
|
95
|
+
try {
|
|
96
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
97
|
+
wasm.chainproviderbuilder_build(retptr, this.__wbg_ptr);
|
|
98
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
99
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
100
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
101
|
+
if (r2) {
|
|
102
|
+
throw takeObject(r1);
|
|
103
|
+
}
|
|
104
|
+
return ChainProviderHandle.__wrap(r0);
|
|
105
|
+
} finally {
|
|
106
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Create an empty builder.
|
|
111
|
+
*/
|
|
112
|
+
constructor() {
|
|
113
|
+
const ret = wasm.chainproviderbuilder_new();
|
|
114
|
+
this.__wbg_ptr = ret;
|
|
115
|
+
ChainProviderBuilderFinalization.register(this, this.__wbg_ptr, this);
|
|
116
|
+
return this;
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
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.
|
|
126
|
+
* @param {string} genesis_hash
|
|
127
|
+
* @param {string} blob
|
|
128
|
+
*/
|
|
129
|
+
setDatabaseContent(genesis_hash, blob) {
|
|
130
|
+
try {
|
|
131
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
132
|
+
const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
133
|
+
const len0 = WASM_VECTOR_LEN;
|
|
134
|
+
const ptr1 = passStringToWasm0(blob, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
135
|
+
const len1 = WASM_VECTOR_LEN;
|
|
136
|
+
wasm.chainproviderbuilder_setDatabaseContent(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
137
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
138
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
139
|
+
if (r1) {
|
|
140
|
+
throw takeObject(r0);
|
|
141
|
+
}
|
|
142
|
+
} finally {
|
|
143
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
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.
|
|
154
|
+
*
|
|
155
|
+
* A blob seeded through
|
|
156
|
+
* [`set_database_content`](Self::set_database_content) beats one loaded
|
|
157
|
+
* here for the same chain.
|
|
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
|
+
* 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
|
|
168
|
+
*/
|
|
169
|
+
setStorage(client) {
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
wasm.chainproviderbuilder_setStorage(retptr, this.__wbg_ptr, addHeapObject(client));
|
|
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
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (Symbol.dispose) ChainProviderBuilder.prototype[Symbol.dispose] = ChainProviderBuilder.prototype.free;
|
|
184
|
+
|
|
185
|
+
/**
|
|
186
|
+
* A built provider; hand out one per page/worker.
|
|
187
|
+
*/
|
|
188
|
+
export class ChainProviderHandle {
|
|
189
|
+
static __wrap(ptr) {
|
|
190
|
+
const obj = Object.create(ChainProviderHandle.prototype);
|
|
191
|
+
obj.__wbg_ptr = ptr;
|
|
192
|
+
ChainProviderHandleFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
193
|
+
return obj;
|
|
194
|
+
}
|
|
195
|
+
__destroy_into_raw() {
|
|
196
|
+
const ptr = this.__wbg_ptr;
|
|
197
|
+
this.__wbg_ptr = 0;
|
|
198
|
+
ChainProviderHandleFinalization.unregister(this);
|
|
199
|
+
return ptr;
|
|
200
|
+
}
|
|
201
|
+
free() {
|
|
202
|
+
const ptr = this.__destroy_into_raw();
|
|
203
|
+
wasm.__wbg_chainproviderhandle_free(ptr, 0);
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Open a connection to the chain identified by the `0x`-prefixed genesis
|
|
207
|
+
* hash. Rejects when the chain is not registered or the transport fails.
|
|
208
|
+
* @param {string} genesis_hash
|
|
209
|
+
* @returns {Promise<Connection>}
|
|
210
|
+
*/
|
|
211
|
+
connect(genesis_hash) {
|
|
212
|
+
const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
213
|
+
const len0 = WASM_VECTOR_LEN;
|
|
214
|
+
const ret = wasm.chainproviderhandle_connect(this.__wbg_ptr, ptr0, len0);
|
|
215
|
+
return takeObject(ret);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
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.
|
|
221
|
+
*
|
|
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
|
+
* @param {string} genesis_hash
|
|
225
|
+
* @returns {Promise<boolean>}
|
|
226
|
+
*/
|
|
227
|
+
loadDatabase(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_loadDatabase(this.__wbg_ptr, ptr0, len0);
|
|
231
|
+
return takeObject(ret);
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Snapshot the finalized state of the chain and write it to storage.
|
|
235
|
+
* Resolves with whether a blob was stored.
|
|
236
|
+
*
|
|
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.
|
|
242
|
+
* @param {string} genesis_hash
|
|
243
|
+
* @returns {Promise<boolean>}
|
|
244
|
+
*/
|
|
245
|
+
saveDatabase(genesis_hash) {
|
|
246
|
+
const ptr0 = passStringToWasm0(genesis_hash, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
248
|
+
const ret = wasm.chainproviderhandle_saveDatabase(this.__wbg_ptr, ptr0, len0);
|
|
249
|
+
return takeObject(ret);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (Symbol.dispose) ChainProviderHandle.prototype[Symbol.dispose] = ChainProviderHandle.prototype.free;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* A live JSON-RPC connection: a raw string pipe.
|
|
256
|
+
*/
|
|
257
|
+
export class Connection {
|
|
258
|
+
static __wrap(ptr) {
|
|
259
|
+
const obj = Object.create(Connection.prototype);
|
|
260
|
+
obj.__wbg_ptr = ptr;
|
|
261
|
+
ConnectionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
262
|
+
return obj;
|
|
263
|
+
}
|
|
264
|
+
__destroy_into_raw() {
|
|
265
|
+
const ptr = this.__wbg_ptr;
|
|
266
|
+
this.__wbg_ptr = 0;
|
|
267
|
+
ConnectionFinalization.unregister(this);
|
|
268
|
+
return ptr;
|
|
269
|
+
}
|
|
270
|
+
free() {
|
|
271
|
+
const ptr = this.__destroy_into_raw();
|
|
272
|
+
wasm.__wbg_connection_free(ptr, 0);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* Close the connection; pending `nextResponse()` calls resolve to
|
|
276
|
+
* `undefined`.
|
|
277
|
+
*/
|
|
278
|
+
close() {
|
|
279
|
+
wasm.connection_close(this.__wbg_ptr);
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Resolve with the next JSON-RPC response or notification, or
|
|
283
|
+
* `undefined` once the connection is closed or dead.
|
|
284
|
+
*
|
|
285
|
+
* Calling this in a loop is not optional: it is the only thing that drains
|
|
286
|
+
* the connection. Frames queue until they are taken, and once the backlog
|
|
287
|
+
* reaches the budget for the connection further [`send`](Connection::send) calls
|
|
288
|
+
* come back as JSON-RPC errors instead of being queued, so a caller that
|
|
289
|
+
* sends without reading eventually gets nothing but errors.
|
|
290
|
+
* @returns {Promise<string | undefined>}
|
|
291
|
+
*/
|
|
292
|
+
nextResponse() {
|
|
293
|
+
const ret = wasm.connection_nextResponse(this.__wbg_ptr);
|
|
294
|
+
return takeObject(ret);
|
|
295
|
+
}
|
|
296
|
+
/**
|
|
297
|
+
* Queue a JSON-RPC request string.
|
|
298
|
+
* @param {string} request
|
|
299
|
+
*/
|
|
300
|
+
send(request) {
|
|
301
|
+
const ptr0 = passStringToWasm0(request, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
302
|
+
const len0 = WASM_VECTOR_LEN;
|
|
303
|
+
wasm.connection_send(this.__wbg_ptr, ptr0, len0);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (Symbol.dispose) Connection.prototype[Symbol.dispose] = Connection.prototype.free;
|
|
307
|
+
|
|
308
|
+
/**
|
|
309
|
+
* The genesis hashes of a network registered via
|
|
310
|
+
* [`ChainProviderBuilder::add_network`], as `0x`-prefixed hex strings.
|
|
311
|
+
*/
|
|
312
|
+
export class NetworkChains {
|
|
313
|
+
static __wrap(ptr) {
|
|
314
|
+
const obj = Object.create(NetworkChains.prototype);
|
|
315
|
+
obj.__wbg_ptr = ptr;
|
|
316
|
+
NetworkChainsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
317
|
+
return obj;
|
|
318
|
+
}
|
|
319
|
+
__destroy_into_raw() {
|
|
320
|
+
const ptr = this.__wbg_ptr;
|
|
321
|
+
this.__wbg_ptr = 0;
|
|
322
|
+
NetworkChainsFinalization.unregister(this);
|
|
323
|
+
return ptr;
|
|
324
|
+
}
|
|
325
|
+
free() {
|
|
326
|
+
const ptr = this.__destroy_into_raw();
|
|
327
|
+
wasm.__wbg_networkchains_free(ptr, 0);
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Asset Hub genesis hash.
|
|
331
|
+
* @returns {string}
|
|
332
|
+
*/
|
|
333
|
+
get assethub() {
|
|
334
|
+
let deferred1_0;
|
|
335
|
+
let deferred1_1;
|
|
336
|
+
try {
|
|
337
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
|
+
wasm.networkchains_assethub(retptr, this.__wbg_ptr);
|
|
339
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
340
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
341
|
+
deferred1_0 = r0;
|
|
342
|
+
deferred1_1 = r1;
|
|
343
|
+
return getStringFromWasm0(r0, r1);
|
|
344
|
+
} finally {
|
|
345
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
346
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
/**
|
|
350
|
+
* Bulletin-chain genesis hash.
|
|
351
|
+
* @returns {string}
|
|
352
|
+
*/
|
|
353
|
+
get bulletin() {
|
|
354
|
+
let deferred1_0;
|
|
355
|
+
let deferred1_1;
|
|
356
|
+
try {
|
|
357
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
358
|
+
wasm.networkchains_bulletin(retptr, this.__wbg_ptr);
|
|
359
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
360
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
361
|
+
deferred1_0 = r0;
|
|
362
|
+
deferred1_1 = r1;
|
|
363
|
+
return getStringFromWasm0(r0, r1);
|
|
364
|
+
} finally {
|
|
365
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
366
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
/**
|
|
370
|
+
* People-chain genesis hash.
|
|
371
|
+
* @returns {string}
|
|
372
|
+
*/
|
|
373
|
+
get people() {
|
|
374
|
+
let deferred1_0;
|
|
375
|
+
let deferred1_1;
|
|
376
|
+
try {
|
|
377
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
378
|
+
wasm.networkchains_people(retptr, this.__wbg_ptr);
|
|
379
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
380
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
381
|
+
deferred1_0 = r0;
|
|
382
|
+
deferred1_1 = r1;
|
|
383
|
+
return getStringFromWasm0(r0, r1);
|
|
384
|
+
} finally {
|
|
385
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
386
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Relay-chain genesis hash.
|
|
391
|
+
* @returns {string}
|
|
392
|
+
*/
|
|
393
|
+
get relay() {
|
|
394
|
+
let deferred1_0;
|
|
395
|
+
let deferred1_1;
|
|
396
|
+
try {
|
|
397
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
398
|
+
wasm.networkchains_relay(retptr, this.__wbg_ptr);
|
|
399
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
400
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
401
|
+
deferred1_0 = r0;
|
|
402
|
+
deferred1_1 = r1;
|
|
403
|
+
return getStringFromWasm0(r0, r1);
|
|
404
|
+
} finally {
|
|
405
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
406
|
+
wasm.__wbindgen_export5(deferred1_0, deferred1_1, 1);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
if (Symbol.dispose) NetworkChains.prototype[Symbol.dispose] = NetworkChains.prototype.free;
|
|
411
|
+
|
|
412
|
+
/**
|
|
413
|
+
* Route the embedded provider's (and smoldot's) `tracing` output to the
|
|
414
|
+
* browser console at `level` (`error`|`warn`|`info`|`debug`|`trace`; anything
|
|
415
|
+
* else disables it). Installs the console subscriber on the first call and is
|
|
416
|
+
* safe to call again at any time to retune verbosity.
|
|
417
|
+
* @param {string} level
|
|
418
|
+
*/
|
|
419
|
+
export function setLogLevel(level) {
|
|
420
|
+
const ptr0 = passStringToWasm0(level, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
421
|
+
const len0 = WASM_VECTOR_LEN;
|
|
422
|
+
wasm.setLogLevel(ptr0, len0);
|
|
423
|
+
}
|
|
424
|
+
function __wbg_get_imports() {
|
|
425
|
+
const import0 = {
|
|
426
|
+
__proto__: null,
|
|
427
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
428
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
429
|
+
return addHeapObject(ret);
|
|
430
|
+
},
|
|
431
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
432
|
+
const ret = debugString(getObject(arg1));
|
|
433
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
434
|
+
const len1 = WASM_VECTOR_LEN;
|
|
435
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
436
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
437
|
+
},
|
|
438
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
439
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
440
|
+
return ret;
|
|
441
|
+
},
|
|
442
|
+
__wbg___wbindgen_is_null_ea9085d691f535d3: function(arg0) {
|
|
443
|
+
const ret = getObject(arg0) === null;
|
|
444
|
+
return ret;
|
|
445
|
+
},
|
|
446
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
447
|
+
const val = getObject(arg0);
|
|
448
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
449
|
+
return ret;
|
|
450
|
+
},
|
|
451
|
+
__wbg___wbindgen_is_string_ea5e6cc2e4141dfe: function(arg0) {
|
|
452
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
453
|
+
return ret;
|
|
454
|
+
},
|
|
455
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
456
|
+
const ret = getObject(arg0) === undefined;
|
|
457
|
+
return ret;
|
|
458
|
+
},
|
|
459
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
460
|
+
const obj = getObject(arg1);
|
|
461
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
462
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
463
|
+
var len1 = WASM_VECTOR_LEN;
|
|
464
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
465
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
466
|
+
},
|
|
467
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
468
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
469
|
+
},
|
|
470
|
+
__wbg__wbg_cb_unref_fffb441def202758: function(arg0) {
|
|
471
|
+
getObject(arg0)._wbg_cb_unref();
|
|
472
|
+
},
|
|
473
|
+
__wbg_call_a6e5c5dce5018821: function() { return handleError(function (arg0, arg1, arg2) {
|
|
474
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
475
|
+
return addHeapObject(ret);
|
|
476
|
+
}, arguments); },
|
|
477
|
+
__wbg_call_e3b662382210db98: function() { return handleError(function (arg0, arg1, arg2, arg3) {
|
|
478
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2), getObject(arg3));
|
|
479
|
+
return addHeapObject(ret);
|
|
480
|
+
}, arguments); },
|
|
481
|
+
__wbg_clearTimeout_3629d6209dfcc46e: function(arg0) {
|
|
482
|
+
const ret = clearTimeout(takeObject(arg0));
|
|
483
|
+
return addHeapObject(ret);
|
|
484
|
+
},
|
|
485
|
+
__wbg_close_c65ca0257e895318: function() { return handleError(function (arg0) {
|
|
486
|
+
getObject(arg0).close();
|
|
487
|
+
}, arguments); },
|
|
488
|
+
__wbg_code_1fc52b4142a112ac: function(arg0) {
|
|
489
|
+
const ret = getObject(arg0).code;
|
|
490
|
+
return ret;
|
|
491
|
+
},
|
|
492
|
+
__wbg_connection_new: function(arg0) {
|
|
493
|
+
const ret = Connection.__wrap(arg0);
|
|
494
|
+
return addHeapObject(ret);
|
|
495
|
+
},
|
|
496
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
497
|
+
const ret = getObject(arg0).crypto;
|
|
498
|
+
return addHeapObject(ret);
|
|
499
|
+
},
|
|
500
|
+
__wbg_data_328de4280640da92: function(arg0) {
|
|
501
|
+
const ret = getObject(arg0).data;
|
|
502
|
+
return addHeapObject(ret);
|
|
503
|
+
},
|
|
504
|
+
__wbg_debug_87fd9b1a625b7efb: function(arg0) {
|
|
505
|
+
console.debug(getObject(arg0));
|
|
506
|
+
},
|
|
507
|
+
__wbg_error_744744ff0c9861e6: function(arg0) {
|
|
508
|
+
console.error(getObject(arg0));
|
|
509
|
+
},
|
|
510
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
511
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
512
|
+
}, arguments); },
|
|
513
|
+
__wbg_get_78f252d074a84d0b: function() { return handleError(function (arg0, arg1) {
|
|
514
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
515
|
+
return addHeapObject(ret);
|
|
516
|
+
}, arguments); },
|
|
517
|
+
__wbg_info_eadbe775a8e2e9eb: function(arg0) {
|
|
518
|
+
console.info(getObject(arg0));
|
|
519
|
+
},
|
|
520
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
521
|
+
let result;
|
|
522
|
+
try {
|
|
523
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
524
|
+
} catch (_) {
|
|
525
|
+
result = false;
|
|
526
|
+
}
|
|
527
|
+
const ret = result;
|
|
528
|
+
return ret;
|
|
529
|
+
},
|
|
530
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
531
|
+
const ret = getObject(arg0).length;
|
|
532
|
+
return ret;
|
|
533
|
+
},
|
|
534
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
535
|
+
const ret = getObject(arg0).msCrypto;
|
|
536
|
+
return addHeapObject(ret);
|
|
537
|
+
},
|
|
538
|
+
__wbg_new_bf8729ffe10e9ee7: function() { return handleError(function (arg0, arg1) {
|
|
539
|
+
const ret = new WebSocket(getStringFromWasm0(arg0, arg1));
|
|
540
|
+
return addHeapObject(ret);
|
|
541
|
+
}, arguments); },
|
|
542
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
543
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
544
|
+
return addHeapObject(ret);
|
|
545
|
+
},
|
|
546
|
+
__wbg_new_typed_1824d93f294193e5: function(arg0, arg1) {
|
|
547
|
+
try {
|
|
548
|
+
var state0 = {a: arg0, b: arg1};
|
|
549
|
+
var cb0 = (arg0, arg1) => {
|
|
550
|
+
const a = state0.a;
|
|
551
|
+
state0.a = 0;
|
|
552
|
+
try {
|
|
553
|
+
return __wasm_bindgen_func_elem_19290(a, state0.b, arg0, arg1);
|
|
554
|
+
} finally {
|
|
555
|
+
state0.a = a;
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
const ret = new Promise(cb0);
|
|
559
|
+
return addHeapObject(ret);
|
|
560
|
+
} finally {
|
|
561
|
+
state0.a = 0;
|
|
562
|
+
}
|
|
563
|
+
},
|
|
564
|
+
__wbg_new_with_length_e6785c33c8e4cce8: function(arg0) {
|
|
565
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
566
|
+
return addHeapObject(ret);
|
|
567
|
+
},
|
|
568
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
569
|
+
const ret = getObject(arg0).node;
|
|
570
|
+
return addHeapObject(ret);
|
|
571
|
+
},
|
|
572
|
+
__wbg_now_86c0d4ba3fa605b8: function() {
|
|
573
|
+
const ret = Date.now();
|
|
574
|
+
return ret;
|
|
575
|
+
},
|
|
576
|
+
__wbg_now_e7c6795a7f81e10f: function(arg0) {
|
|
577
|
+
const ret = getObject(arg0).now();
|
|
578
|
+
return ret;
|
|
579
|
+
},
|
|
580
|
+
__wbg_performance_3fcf6e32a7e1ed0a: function(arg0) {
|
|
581
|
+
const ret = getObject(arg0).performance;
|
|
582
|
+
return addHeapObject(ret);
|
|
583
|
+
},
|
|
584
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
585
|
+
const ret = getObject(arg0).process;
|
|
586
|
+
return addHeapObject(ret);
|
|
587
|
+
},
|
|
588
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
589
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
590
|
+
},
|
|
591
|
+
__wbg_queueMicrotask_0ab5b2d2393e99b9: function(arg0) {
|
|
592
|
+
const ret = getObject(arg0).queueMicrotask;
|
|
593
|
+
return addHeapObject(ret);
|
|
594
|
+
},
|
|
595
|
+
__wbg_queueMicrotask_6a09b7bc46549209: function(arg0) {
|
|
596
|
+
queueMicrotask(getObject(arg0));
|
|
597
|
+
},
|
|
598
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
599
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
600
|
+
}, arguments); },
|
|
601
|
+
__wbg_readyState_50bc38c2a9e83db6: function(arg0) {
|
|
602
|
+
const ret = getObject(arg0).readyState;
|
|
603
|
+
return ret;
|
|
604
|
+
},
|
|
605
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
606
|
+
const ret = module.require;
|
|
607
|
+
return addHeapObject(ret);
|
|
608
|
+
}, arguments); },
|
|
609
|
+
__wbg_resolve_2191a4dfe481c25b: function(arg0) {
|
|
610
|
+
const ret = Promise.resolve(getObject(arg0));
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
},
|
|
613
|
+
__wbg_send_a321b376d40ec867: function() { return handleError(function (arg0, arg1, arg2) {
|
|
614
|
+
getObject(arg0).send(getArrayU8FromWasm0(arg1, arg2));
|
|
615
|
+
}, arguments); },
|
|
616
|
+
__wbg_send_df98dd5ede9b3f4d: function() { return handleError(function (arg0, arg1, arg2) {
|
|
617
|
+
getObject(arg0).send(getStringFromWasm0(arg1, arg2));
|
|
618
|
+
}, arguments); },
|
|
619
|
+
__wbg_setTimeout_56bcdccbad22fd44: function() { return handleError(function (arg0, arg1) {
|
|
620
|
+
const ret = setTimeout(getObject(arg0), arg1);
|
|
621
|
+
return addHeapObject(ret);
|
|
622
|
+
}, arguments); },
|
|
623
|
+
__wbg_set_binaryType_a37b086c78ca7c29: function(arg0, arg1) {
|
|
624
|
+
getObject(arg0).binaryType = __wbindgen_enum_BinaryType[arg1];
|
|
625
|
+
},
|
|
626
|
+
__wbg_set_onclose_f706475385ecce07: function(arg0, arg1) {
|
|
627
|
+
getObject(arg0).onclose = getObject(arg1);
|
|
628
|
+
},
|
|
629
|
+
__wbg_set_onerror_9f5773fd31512333: function(arg0, arg1) {
|
|
630
|
+
getObject(arg0).onerror = getObject(arg1);
|
|
631
|
+
},
|
|
632
|
+
__wbg_set_onmessage_836d2f72130b4706: function(arg0, arg1) {
|
|
633
|
+
getObject(arg0).onmessage = getObject(arg1);
|
|
634
|
+
},
|
|
635
|
+
__wbg_set_onopen_4f65470ae522a61a: function(arg0, arg1) {
|
|
636
|
+
getObject(arg0).onopen = getObject(arg1);
|
|
637
|
+
},
|
|
638
|
+
__wbg_static_accessor_GLOBAL_4ef717fb391d88b7: function() {
|
|
639
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
640
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
641
|
+
},
|
|
642
|
+
__wbg_static_accessor_GLOBAL_THIS_8d1badc68b5a74f4: function() {
|
|
643
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
644
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
645
|
+
},
|
|
646
|
+
__wbg_static_accessor_SELF_146583524fe1469b: function() {
|
|
647
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
648
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
649
|
+
},
|
|
650
|
+
__wbg_static_accessor_WINDOW_f2829a2234d7819e: function() {
|
|
651
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
652
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
653
|
+
},
|
|
654
|
+
__wbg_subarray_3ed232c8a6baee09: function(arg0, arg1, arg2) {
|
|
655
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
656
|
+
return addHeapObject(ret);
|
|
657
|
+
},
|
|
658
|
+
__wbg_then_16d107c451e9905d: function(arg0, arg1, arg2) {
|
|
659
|
+
const ret = getObject(arg0).then(getObject(arg1), getObject(arg2));
|
|
660
|
+
return addHeapObject(ret);
|
|
661
|
+
},
|
|
662
|
+
__wbg_then_6ec10ae38b3e92f7: function(arg0, arg1) {
|
|
663
|
+
const ret = getObject(arg0).then(getObject(arg1));
|
|
664
|
+
return addHeapObject(ret);
|
|
665
|
+
},
|
|
666
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
667
|
+
const ret = getObject(arg0).versions;
|
|
668
|
+
return addHeapObject(ret);
|
|
669
|
+
},
|
|
670
|
+
__wbg_warn_b1370d804fa3e259: function(arg0) {
|
|
671
|
+
console.warn(getObject(arg0));
|
|
672
|
+
},
|
|
673
|
+
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
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_19288);
|
|
676
|
+
return addHeapObject(ret);
|
|
677
|
+
},
|
|
678
|
+
__wbindgen_cast_0000000000000002: function(arg0, arg1) {
|
|
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_3807);
|
|
681
|
+
return addHeapObject(ret);
|
|
682
|
+
},
|
|
683
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
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_3807_2);
|
|
686
|
+
return addHeapObject(ret);
|
|
687
|
+
},
|
|
688
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
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_3807_3);
|
|
691
|
+
return addHeapObject(ret);
|
|
692
|
+
},
|
|
693
|
+
__wbindgen_cast_0000000000000005: function(arg0, arg1) {
|
|
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_7316);
|
|
696
|
+
return addHeapObject(ret);
|
|
697
|
+
},
|
|
698
|
+
__wbindgen_cast_0000000000000006: function(arg0, arg1) {
|
|
699
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
700
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
701
|
+
return addHeapObject(ret);
|
|
702
|
+
},
|
|
703
|
+
__wbindgen_cast_0000000000000007: function(arg0, arg1) {
|
|
704
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
705
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
706
|
+
return addHeapObject(ret);
|
|
707
|
+
},
|
|
708
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
709
|
+
const ret = getObject(arg0);
|
|
710
|
+
return addHeapObject(ret);
|
|
711
|
+
},
|
|
712
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
713
|
+
takeObject(arg0);
|
|
714
|
+
},
|
|
715
|
+
};
|
|
716
|
+
return {
|
|
717
|
+
__proto__: null,
|
|
718
|
+
"./truapi_provider_bg.js": import0,
|
|
719
|
+
};
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
function __wasm_bindgen_func_elem_7316(arg0, arg1) {
|
|
723
|
+
wasm.__wasm_bindgen_func_elem_7316(arg0, arg1);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function __wasm_bindgen_func_elem_3807(arg0, arg1, arg2) {
|
|
727
|
+
wasm.__wasm_bindgen_func_elem_3807(arg0, arg1, addHeapObject(arg2));
|
|
728
|
+
}
|
|
729
|
+
|
|
730
|
+
function __wasm_bindgen_func_elem_3807_2(arg0, arg1, arg2) {
|
|
731
|
+
wasm.__wasm_bindgen_func_elem_3807_2(arg0, arg1, addHeapObject(arg2));
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
function __wasm_bindgen_func_elem_3807_3(arg0, arg1, arg2) {
|
|
735
|
+
wasm.__wasm_bindgen_func_elem_3807_3(arg0, arg1, addHeapObject(arg2));
|
|
736
|
+
}
|
|
737
|
+
|
|
738
|
+
function __wasm_bindgen_func_elem_19288(arg0, arg1, arg2) {
|
|
739
|
+
try {
|
|
740
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
741
|
+
wasm.__wasm_bindgen_func_elem_19288(retptr, arg0, arg1, addHeapObject(arg2));
|
|
742
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
743
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
744
|
+
if (r1) {
|
|
745
|
+
throw takeObject(r0);
|
|
746
|
+
}
|
|
747
|
+
} finally {
|
|
748
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
function __wasm_bindgen_func_elem_19290(arg0, arg1, arg2, arg3) {
|
|
753
|
+
wasm.__wasm_bindgen_func_elem_19290(arg0, arg1, addHeapObject(arg2), addHeapObject(arg3));
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
|
|
757
|
+
const __wbindgen_enum_BinaryType = ["blob", "arraybuffer"];
|
|
758
|
+
const ChainProviderBuilderFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
759
|
+
? { register: () => {}, unregister: () => {} }
|
|
760
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_chainproviderbuilder_free(ptr, 1));
|
|
761
|
+
const ChainProviderHandleFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
762
|
+
? { register: () => {}, unregister: () => {} }
|
|
763
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_chainproviderhandle_free(ptr, 1));
|
|
764
|
+
const ConnectionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
765
|
+
? { register: () => {}, unregister: () => {} }
|
|
766
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_connection_free(ptr, 1));
|
|
767
|
+
const NetworkChainsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
768
|
+
? { register: () => {}, unregister: () => {} }
|
|
769
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_networkchains_free(ptr, 1));
|
|
770
|
+
|
|
771
|
+
function addHeapObject(obj) {
|
|
772
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
773
|
+
const idx = heap_next;
|
|
774
|
+
heap_next = heap[idx];
|
|
775
|
+
|
|
776
|
+
heap[idx] = obj;
|
|
777
|
+
return idx;
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
const CLOSURE_DTORS = (typeof FinalizationRegistry === 'undefined')
|
|
781
|
+
? { register: () => {}, unregister: () => {} }
|
|
782
|
+
: new FinalizationRegistry(state => wasm.__wbindgen_export4(state.a, state.b));
|
|
783
|
+
|
|
784
|
+
function debugString(val) {
|
|
785
|
+
// primitive types
|
|
786
|
+
const type = typeof val;
|
|
787
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
788
|
+
return `${val}`;
|
|
789
|
+
}
|
|
790
|
+
if (type == 'string') {
|
|
791
|
+
return `"${val}"`;
|
|
792
|
+
}
|
|
793
|
+
if (type == 'symbol') {
|
|
794
|
+
const description = val.description;
|
|
795
|
+
if (description == null) {
|
|
796
|
+
return 'Symbol';
|
|
797
|
+
} else {
|
|
798
|
+
return `Symbol(${description})`;
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
if (type == 'function') {
|
|
802
|
+
const name = val.name;
|
|
803
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
804
|
+
return `Function(${name})`;
|
|
805
|
+
} else {
|
|
806
|
+
return 'Function';
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
// objects
|
|
810
|
+
if (Array.isArray(val)) {
|
|
811
|
+
const length = val.length;
|
|
812
|
+
let debug = '[';
|
|
813
|
+
if (length > 0) {
|
|
814
|
+
debug += debugString(val[0]);
|
|
815
|
+
}
|
|
816
|
+
for(let i = 1; i < length; i++) {
|
|
817
|
+
debug += ', ' + debugString(val[i]);
|
|
818
|
+
}
|
|
819
|
+
debug += ']';
|
|
820
|
+
return debug;
|
|
821
|
+
}
|
|
822
|
+
// Test for built-in
|
|
823
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
824
|
+
let className;
|
|
825
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
826
|
+
className = builtInMatches[1];
|
|
827
|
+
} else {
|
|
828
|
+
// Failed to match the standard '[object ClassName]'
|
|
829
|
+
return toString.call(val);
|
|
830
|
+
}
|
|
831
|
+
if (className == 'Object') {
|
|
832
|
+
// we're a user defined class or Object
|
|
833
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
834
|
+
// easier than looping through ownProperties of `val`.
|
|
835
|
+
try {
|
|
836
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
837
|
+
} catch (_) {
|
|
838
|
+
return 'Object';
|
|
839
|
+
}
|
|
840
|
+
}
|
|
841
|
+
// errors
|
|
842
|
+
if (val instanceof Error) {
|
|
843
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
844
|
+
}
|
|
845
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
846
|
+
return className;
|
|
847
|
+
}
|
|
848
|
+
|
|
849
|
+
function dropObject(idx) {
|
|
850
|
+
if (idx < 1028) return;
|
|
851
|
+
heap[idx] = heap_next;
|
|
852
|
+
heap_next = idx;
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
856
|
+
ptr = ptr >>> 0;
|
|
857
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
858
|
+
}
|
|
859
|
+
|
|
860
|
+
let cachedDataViewMemory0 = null;
|
|
861
|
+
function getDataViewMemory0() {
|
|
862
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
863
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
864
|
+
}
|
|
865
|
+
return cachedDataViewMemory0;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
function getStringFromWasm0(ptr, len) {
|
|
869
|
+
return decodeText(ptr >>> 0, len);
|
|
870
|
+
}
|
|
871
|
+
|
|
872
|
+
let cachedUint8ArrayMemory0 = null;
|
|
873
|
+
function getUint8ArrayMemory0() {
|
|
874
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
875
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
876
|
+
}
|
|
877
|
+
return cachedUint8ArrayMemory0;
|
|
878
|
+
}
|
|
879
|
+
|
|
880
|
+
function getObject(idx) { return heap[idx]; }
|
|
881
|
+
|
|
882
|
+
function handleError(f, args) {
|
|
883
|
+
try {
|
|
884
|
+
return f.apply(this, args);
|
|
885
|
+
} catch (e) {
|
|
886
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
let heap = new Array(1024).fill(undefined);
|
|
891
|
+
heap.push(undefined, null, true, false);
|
|
892
|
+
|
|
893
|
+
let heap_next = heap.length;
|
|
894
|
+
|
|
895
|
+
function isLikeNone(x) {
|
|
896
|
+
return x === undefined || x === null;
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function makeMutClosure(arg0, arg1, f) {
|
|
900
|
+
const state = { a: arg0, b: arg1, cnt: 1 };
|
|
901
|
+
const real = (...args) => {
|
|
902
|
+
|
|
903
|
+
// First up with a closure we increment the internal reference
|
|
904
|
+
// count. This ensures that the Rust closure environment won't
|
|
905
|
+
// be deallocated while we're invoking it.
|
|
906
|
+
state.cnt++;
|
|
907
|
+
const a = state.a;
|
|
908
|
+
state.a = 0;
|
|
909
|
+
try {
|
|
910
|
+
return f(a, state.b, ...args);
|
|
911
|
+
} finally {
|
|
912
|
+
state.a = a;
|
|
913
|
+
real._wbg_cb_unref();
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
real._wbg_cb_unref = () => {
|
|
917
|
+
if (--state.cnt === 0) {
|
|
918
|
+
wasm.__wbindgen_export4(state.a, state.b);
|
|
919
|
+
state.a = 0;
|
|
920
|
+
CLOSURE_DTORS.unregister(state);
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
CLOSURE_DTORS.register(real, state, state);
|
|
924
|
+
return real;
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
928
|
+
if (realloc === undefined) {
|
|
929
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
930
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
931
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
932
|
+
WASM_VECTOR_LEN = buf.length;
|
|
933
|
+
return ptr;
|
|
934
|
+
}
|
|
935
|
+
|
|
936
|
+
let len = arg.length;
|
|
937
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
938
|
+
|
|
939
|
+
const mem = getUint8ArrayMemory0();
|
|
940
|
+
|
|
941
|
+
let offset = 0;
|
|
942
|
+
|
|
943
|
+
for (; offset < len; offset++) {
|
|
944
|
+
const code = arg.charCodeAt(offset);
|
|
945
|
+
if (code > 0x7F) break;
|
|
946
|
+
mem[ptr + offset] = code;
|
|
947
|
+
}
|
|
948
|
+
if (offset !== len) {
|
|
949
|
+
if (offset !== 0) {
|
|
950
|
+
arg = arg.slice(offset);
|
|
951
|
+
}
|
|
952
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
953
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
954
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
955
|
+
|
|
956
|
+
offset += ret.written;
|
|
957
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
958
|
+
}
|
|
959
|
+
|
|
960
|
+
WASM_VECTOR_LEN = offset;
|
|
961
|
+
return ptr;
|
|
962
|
+
}
|
|
963
|
+
|
|
964
|
+
function takeObject(idx) {
|
|
965
|
+
const ret = getObject(idx);
|
|
966
|
+
dropObject(idx);
|
|
967
|
+
return ret;
|
|
968
|
+
}
|
|
969
|
+
|
|
970
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
971
|
+
cachedTextDecoder.decode();
|
|
972
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
973
|
+
let numBytesDecoded = 0;
|
|
974
|
+
function decodeText(ptr, len) {
|
|
975
|
+
numBytesDecoded += len;
|
|
976
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
977
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
978
|
+
cachedTextDecoder.decode();
|
|
979
|
+
numBytesDecoded = len;
|
|
980
|
+
}
|
|
981
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
982
|
+
}
|
|
983
|
+
|
|
984
|
+
const cachedTextEncoder = new TextEncoder();
|
|
985
|
+
|
|
986
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
987
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
988
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
989
|
+
view.set(buf);
|
|
990
|
+
return {
|
|
991
|
+
read: arg.length,
|
|
992
|
+
written: buf.length
|
|
993
|
+
};
|
|
994
|
+
};
|
|
995
|
+
}
|
|
996
|
+
|
|
997
|
+
let WASM_VECTOR_LEN = 0;
|
|
998
|
+
|
|
999
|
+
let wasmModule, wasmInstance, wasm;
|
|
1000
|
+
function __wbg_finalize_init(instance, module) {
|
|
1001
|
+
wasmInstance = instance;
|
|
1002
|
+
wasm = instance.exports;
|
|
1003
|
+
wasmModule = module;
|
|
1004
|
+
cachedDataViewMemory0 = null;
|
|
1005
|
+
cachedUint8ArrayMemory0 = null;
|
|
1006
|
+
return wasm;
|
|
1007
|
+
}
|
|
1008
|
+
|
|
1009
|
+
async function __wbg_load(module, imports) {
|
|
1010
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
1011
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
1012
|
+
try {
|
|
1013
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
1014
|
+
} catch (e) {
|
|
1015
|
+
const validResponse = module.ok && expectedResponseType(module.type);
|
|
1016
|
+
|
|
1017
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
1018
|
+
console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
|
|
1019
|
+
|
|
1020
|
+
} else { throw e; }
|
|
1021
|
+
}
|
|
1022
|
+
}
|
|
1023
|
+
|
|
1024
|
+
const bytes = await module.arrayBuffer();
|
|
1025
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
1026
|
+
} else {
|
|
1027
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
1028
|
+
|
|
1029
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
1030
|
+
return { instance, module };
|
|
1031
|
+
} else {
|
|
1032
|
+
return instance;
|
|
1033
|
+
}
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
function expectedResponseType(type) {
|
|
1037
|
+
switch (type) {
|
|
1038
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
1039
|
+
}
|
|
1040
|
+
return false;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
function initSync(module) {
|
|
1045
|
+
if (wasm !== undefined) return wasm;
|
|
1046
|
+
|
|
1047
|
+
|
|
1048
|
+
if (module !== undefined) {
|
|
1049
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
1050
|
+
({module} = module)
|
|
1051
|
+
} else {
|
|
1052
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
1053
|
+
}
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
const imports = __wbg_get_imports();
|
|
1057
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
1058
|
+
module = new WebAssembly.Module(module);
|
|
1059
|
+
}
|
|
1060
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
1061
|
+
return __wbg_finalize_init(instance, module);
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
async function __wbg_init(module_or_path) {
|
|
1065
|
+
if (wasm !== undefined) return wasm;
|
|
1066
|
+
|
|
1067
|
+
|
|
1068
|
+
if (module_or_path !== undefined) {
|
|
1069
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
1070
|
+
({module_or_path} = module_or_path)
|
|
1071
|
+
} else {
|
|
1072
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
|
|
1076
|
+
if (module_or_path === undefined) {
|
|
1077
|
+
module_or_path = new URL('truapi_provider_bg.wasm', import.meta.url);
|
|
1078
|
+
}
|
|
1079
|
+
const imports = __wbg_get_imports();
|
|
1080
|
+
|
|
1081
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
1082
|
+
module_or_path = fetch(module_or_path);
|
|
1083
|
+
}
|
|
1084
|
+
|
|
1085
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
1086
|
+
|
|
1087
|
+
return __wbg_finalize_init(instance, module);
|
|
1088
|
+
}
|
|
1089
|
+
|
|
1090
|
+
export { initSync, __wbg_init as default };
|