@runflame/wallet-wasm 0.0.1-rc.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.txt +201 -0
- package/flamewallet_wasm.d.ts +313 -0
- package/flamewallet_wasm.js +953 -0
- package/flamewallet_wasm_bg.wasm +0 -0
- package/flamewallet_wasm_bg.wasm.d.ts +109 -0
- package/package.json +30 -0
|
@@ -0,0 +1,953 @@
|
|
|
1
|
+
/* @ts-self-types="./flamewallet_wasm.d.ts" */
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* One account, `m/35263'/network'/0'`. Its keys live in this module's
|
|
5
|
+
* memory until `free()` — or `using` — drops the handle, which zeroizes
|
|
6
|
+
* them; nothing a caller receives is key material.
|
|
7
|
+
*/
|
|
8
|
+
export class Wallet {
|
|
9
|
+
static __wrap(ptr) {
|
|
10
|
+
const obj = Object.create(Wallet.prototype);
|
|
11
|
+
obj.__wbg_ptr = ptr;
|
|
12
|
+
WalletFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
13
|
+
return obj;
|
|
14
|
+
}
|
|
15
|
+
__destroy_into_raw() {
|
|
16
|
+
const ptr = this.__wbg_ptr;
|
|
17
|
+
this.__wbg_ptr = 0;
|
|
18
|
+
WalletFinalization.unregister(this);
|
|
19
|
+
return ptr;
|
|
20
|
+
}
|
|
21
|
+
free() {
|
|
22
|
+
const ptr = this.__destroy_into_raw();
|
|
23
|
+
wasm.__wbg_wallet_free(ptr, 0);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The address and predicate at `path`, without issuing anything.
|
|
27
|
+
* @param {KeyPath} path
|
|
28
|
+
* @returns {IssuedAddress}
|
|
29
|
+
*/
|
|
30
|
+
address(path) {
|
|
31
|
+
try {
|
|
32
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
33
|
+
wasm.wallet_address(retptr, this.__wbg_ptr, addHeapObject(path));
|
|
34
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
35
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
36
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
37
|
+
if (r2) {
|
|
38
|
+
throw takeObject(r1);
|
|
39
|
+
}
|
|
40
|
+
return takeObject(r0);
|
|
41
|
+
} finally {
|
|
42
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Builds, proves and signs a transfer; blocks for the proof.
|
|
47
|
+
* @param {TransferRequest} request
|
|
48
|
+
* @returns {Transfer}
|
|
49
|
+
*/
|
|
50
|
+
buildTransfer(request) {
|
|
51
|
+
try {
|
|
52
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
53
|
+
wasm.wallet_buildTransfer(retptr, this.__wbg_ptr, addHeapObject(request));
|
|
54
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
55
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
56
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
57
|
+
if (r2) {
|
|
58
|
+
throw takeObject(r1);
|
|
59
|
+
}
|
|
60
|
+
return takeObject(r0);
|
|
61
|
+
} finally {
|
|
62
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* The account below `phrase` and `passphrase`, without the caller ever
|
|
67
|
+
* seeing the seed.
|
|
68
|
+
* @param {string} phrase
|
|
69
|
+
* @param {string} passphrase
|
|
70
|
+
* @param {Network} network
|
|
71
|
+
* @param {number} nextIndex
|
|
72
|
+
* @returns {Wallet}
|
|
73
|
+
*/
|
|
74
|
+
static fromMnemonic(phrase, passphrase, network, nextIndex) {
|
|
75
|
+
try {
|
|
76
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
77
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
78
|
+
const len0 = WASM_VECTOR_LEN;
|
|
79
|
+
const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
80
|
+
const len1 = WASM_VECTOR_LEN;
|
|
81
|
+
wasm.wallet_fromMnemonic(retptr, ptr0, len0, ptr1, len1, addHeapObject(network), nextIndex);
|
|
82
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
83
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
84
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
85
|
+
if (r2) {
|
|
86
|
+
throw takeObject(r1);
|
|
87
|
+
}
|
|
88
|
+
return Wallet.__wrap(r0);
|
|
89
|
+
} finally {
|
|
90
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* The account below a 64-byte seed, with `nextIndex` receiving
|
|
95
|
+
* addresses already issued; a new wallet passes 0.
|
|
96
|
+
* @param {Uint8Array} seed
|
|
97
|
+
* @param {Network} network
|
|
98
|
+
* @param {number} nextIndex
|
|
99
|
+
* @returns {Wallet}
|
|
100
|
+
*/
|
|
101
|
+
static fromSeed(seed, network, nextIndex) {
|
|
102
|
+
try {
|
|
103
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
104
|
+
const ptr0 = passArray8ToWasm0(seed, wasm.__wbindgen_export);
|
|
105
|
+
const len0 = WASM_VECTOR_LEN;
|
|
106
|
+
wasm.wallet_fromSeed(retptr, ptr0, len0, addHeapObject(network), nextIndex);
|
|
107
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
108
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
109
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
110
|
+
if (r2) {
|
|
111
|
+
throw takeObject(r1);
|
|
112
|
+
}
|
|
113
|
+
return Wallet.__wrap(r0);
|
|
114
|
+
} finally {
|
|
115
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
/**
|
|
119
|
+
* @returns {Network}
|
|
120
|
+
*/
|
|
121
|
+
network() {
|
|
122
|
+
try {
|
|
123
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
124
|
+
wasm.wallet_network(retptr, this.__wbg_ptr);
|
|
125
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
126
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
127
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
128
|
+
if (r2) {
|
|
129
|
+
throw takeObject(r1);
|
|
130
|
+
}
|
|
131
|
+
return takeObject(r0);
|
|
132
|
+
} finally {
|
|
133
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Issues the next receiving address and advances the counter.
|
|
138
|
+
* @returns {IssuedAddress}
|
|
139
|
+
*/
|
|
140
|
+
nextAddress() {
|
|
141
|
+
try {
|
|
142
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
143
|
+
wasm.wallet_nextAddress(retptr, this.__wbg_ptr);
|
|
144
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
145
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
146
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
147
|
+
if (r2) {
|
|
148
|
+
throw takeObject(r1);
|
|
149
|
+
}
|
|
150
|
+
return takeObject(r0);
|
|
151
|
+
} finally {
|
|
152
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* The next receiving index not yet issued: what an app stores.
|
|
157
|
+
* @returns {number}
|
|
158
|
+
*/
|
|
159
|
+
nextIndex() {
|
|
160
|
+
const ret = wasm.wallet_nextIndex(this.__wbg_ptr);
|
|
161
|
+
return ret >>> 0;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Which path below `nextIndex + gap` owns `predicate`, if any.
|
|
165
|
+
* @param {Uint8Array} predicate
|
|
166
|
+
* @param {number} gap
|
|
167
|
+
* @returns {KeyPath | undefined}
|
|
168
|
+
*/
|
|
169
|
+
owns(predicate, gap) {
|
|
170
|
+
try {
|
|
171
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
172
|
+
const ptr0 = passArray8ToWasm0(predicate, wasm.__wbindgen_export);
|
|
173
|
+
const len0 = WASM_VECTOR_LEN;
|
|
174
|
+
wasm.wallet_owns(retptr, this.__wbg_ptr, ptr0, len0, gap);
|
|
175
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
176
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
177
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
178
|
+
if (r2) {
|
|
179
|
+
throw takeObject(r1);
|
|
180
|
+
}
|
|
181
|
+
return takeObject(r0);
|
|
182
|
+
} finally {
|
|
183
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* The bech32f receiving key an indexer is given.
|
|
188
|
+
* @returns {string}
|
|
189
|
+
*/
|
|
190
|
+
receivingKey() {
|
|
191
|
+
let deferred1_0;
|
|
192
|
+
let deferred1_1;
|
|
193
|
+
try {
|
|
194
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
195
|
+
wasm.wallet_receivingKey(retptr, this.__wbg_ptr);
|
|
196
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
197
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
198
|
+
deferred1_0 = r0;
|
|
199
|
+
deferred1_1 = r1;
|
|
200
|
+
return getStringFromWasm0(r0, r1);
|
|
201
|
+
} finally {
|
|
202
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
203
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
if (Symbol.dispose) Wallet.prototype[Symbol.dispose] = Wallet.prototype.free;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* The predicate a payment to `address` is locked with.
|
|
211
|
+
* @param {string} address
|
|
212
|
+
* @param {Network} network
|
|
213
|
+
* @returns {Uint8Array}
|
|
214
|
+
*/
|
|
215
|
+
export function addressToPredicate(address, network) {
|
|
216
|
+
try {
|
|
217
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
218
|
+
const ptr0 = passStringToWasm0(address, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
219
|
+
const len0 = WASM_VECTOR_LEN;
|
|
220
|
+
wasm.addressToPredicate(retptr, ptr0, len0, addHeapObject(network));
|
|
221
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
222
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
223
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
224
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
225
|
+
if (r3) {
|
|
226
|
+
throw takeObject(r2);
|
|
227
|
+
}
|
|
228
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
229
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
230
|
+
return v2;
|
|
231
|
+
} finally {
|
|
232
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
/**
|
|
237
|
+
* Id, predicate, and a cleartext amount if the contract has one.
|
|
238
|
+
* @param {Uint8Array} bytes
|
|
239
|
+
* @returns {ContractInfo}
|
|
240
|
+
*/
|
|
241
|
+
export function decodeContract(bytes) {
|
|
242
|
+
try {
|
|
243
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
244
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_export);
|
|
245
|
+
const len0 = WASM_VECTOR_LEN;
|
|
246
|
+
wasm.decodeContract(retptr, ptr0, len0);
|
|
247
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
248
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
249
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
250
|
+
if (r2) {
|
|
251
|
+
throw takeObject(r1);
|
|
252
|
+
}
|
|
253
|
+
return takeObject(r0);
|
|
254
|
+
} finally {
|
|
255
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
/**
|
|
260
|
+
* A fresh English mnemonic of `wordCount` words: 12, 15, 18, 21 or 24.
|
|
261
|
+
* @param {number} wordCount
|
|
262
|
+
* @returns {string}
|
|
263
|
+
*/
|
|
264
|
+
export function generateMnemonic(wordCount) {
|
|
265
|
+
let deferred2_0;
|
|
266
|
+
let deferred2_1;
|
|
267
|
+
try {
|
|
268
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
269
|
+
wasm.generateMnemonic(retptr, wordCount);
|
|
270
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
271
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
272
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
273
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
274
|
+
var ptr1 = r0;
|
|
275
|
+
var len1 = r1;
|
|
276
|
+
if (r3) {
|
|
277
|
+
ptr1 = 0; len1 = 0;
|
|
278
|
+
throw takeObject(r2);
|
|
279
|
+
}
|
|
280
|
+
deferred2_0 = ptr1;
|
|
281
|
+
deferred2_1 = len1;
|
|
282
|
+
return getStringFromWasm0(ptr1, len1);
|
|
283
|
+
} finally {
|
|
284
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
285
|
+
wasm.__wbindgen_export4(deferred2_0, deferred2_1, 1);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* The 64-byte BIP-39 seed of `phrase` under `passphrase` (`""` for none).
|
|
291
|
+
* @param {string} phrase
|
|
292
|
+
* @param {string} passphrase
|
|
293
|
+
* @returns {Uint8Array}
|
|
294
|
+
*/
|
|
295
|
+
export function mnemonicToSeed(phrase, passphrase) {
|
|
296
|
+
try {
|
|
297
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
298
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
299
|
+
const len0 = WASM_VECTOR_LEN;
|
|
300
|
+
const ptr1 = passStringToWasm0(passphrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
301
|
+
const len1 = WASM_VECTOR_LEN;
|
|
302
|
+
wasm.mnemonicToSeed(retptr, ptr0, len0, ptr1, len1);
|
|
303
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
304
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
305
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
306
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
307
|
+
if (r3) {
|
|
308
|
+
throw takeObject(r2);
|
|
309
|
+
}
|
|
310
|
+
var v3 = getArrayU8FromWasm0(r0, r1).slice();
|
|
311
|
+
wasm.__wbindgen_export4(r0, r1 * 1, 1);
|
|
312
|
+
return v3;
|
|
313
|
+
} finally {
|
|
314
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
/**
|
|
319
|
+
* Whether `opening` opens the confidential contract in `contract`.
|
|
320
|
+
* @param {Uint8Array} contract
|
|
321
|
+
* @param {Opening} opening
|
|
322
|
+
* @returns {boolean}
|
|
323
|
+
*/
|
|
324
|
+
export function openingMatches(contract, opening) {
|
|
325
|
+
try {
|
|
326
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
327
|
+
const ptr0 = passArray8ToWasm0(contract, wasm.__wbindgen_export);
|
|
328
|
+
const len0 = WASM_VECTOR_LEN;
|
|
329
|
+
wasm.openingMatches(retptr, ptr0, len0, addHeapObject(opening));
|
|
330
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
331
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
332
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
333
|
+
if (r2) {
|
|
334
|
+
throw takeObject(r1);
|
|
335
|
+
}
|
|
336
|
+
return r0 !== 0;
|
|
337
|
+
} finally {
|
|
338
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Whether `phrase` is a valid mnemonic in any BIP-39 language.
|
|
344
|
+
* @param {string} phrase
|
|
345
|
+
* @returns {boolean}
|
|
346
|
+
*/
|
|
347
|
+
export function validateMnemonic(phrase) {
|
|
348
|
+
const ptr0 = passStringToWasm0(phrase, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
349
|
+
const len0 = WASM_VECTOR_LEN;
|
|
350
|
+
const ret = wasm.validateMnemonic(ptr0, len0);
|
|
351
|
+
return ret !== 0;
|
|
352
|
+
}
|
|
353
|
+
function __wbg_get_imports() {
|
|
354
|
+
const import0 = {
|
|
355
|
+
__proto__: null,
|
|
356
|
+
__wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
|
|
357
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
358
|
+
return addHeapObject(ret);
|
|
359
|
+
},
|
|
360
|
+
__wbg_Number_14af1003b8dd5ead: function(arg0) {
|
|
361
|
+
const ret = Number(getObject(arg0));
|
|
362
|
+
return ret;
|
|
363
|
+
},
|
|
364
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
365
|
+
const ret = String(getObject(arg1));
|
|
366
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
367
|
+
const len1 = WASM_VECTOR_LEN;
|
|
368
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
369
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
370
|
+
},
|
|
371
|
+
__wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
|
|
372
|
+
const v = getObject(arg1);
|
|
373
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
374
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
375
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
376
|
+
},
|
|
377
|
+
__wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
|
|
378
|
+
const v = getObject(arg0);
|
|
379
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
380
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
381
|
+
},
|
|
382
|
+
__wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
|
|
383
|
+
const ret = debugString(getObject(arg1));
|
|
384
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
385
|
+
const len1 = WASM_VECTOR_LEN;
|
|
386
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
387
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
388
|
+
},
|
|
389
|
+
__wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
|
|
390
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
391
|
+
return ret;
|
|
392
|
+
},
|
|
393
|
+
__wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
|
|
394
|
+
const ret = typeof(getObject(arg0)) === 'bigint';
|
|
395
|
+
return ret;
|
|
396
|
+
},
|
|
397
|
+
__wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
|
|
398
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
399
|
+
return ret;
|
|
400
|
+
},
|
|
401
|
+
__wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
|
|
402
|
+
const val = getObject(arg0);
|
|
403
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
404
|
+
return ret;
|
|
405
|
+
},
|
|
406
|
+
__wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
|
|
407
|
+
const ret = typeof(getObject(arg0)) === 'string';
|
|
408
|
+
return ret;
|
|
409
|
+
},
|
|
410
|
+
__wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
|
|
411
|
+
const ret = getObject(arg0) === undefined;
|
|
412
|
+
return ret;
|
|
413
|
+
},
|
|
414
|
+
__wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
|
|
415
|
+
const ret = getObject(arg0) === getObject(arg1);
|
|
416
|
+
return ret;
|
|
417
|
+
},
|
|
418
|
+
__wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
|
|
419
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
420
|
+
return ret;
|
|
421
|
+
},
|
|
422
|
+
__wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
|
|
423
|
+
const obj = getObject(arg1);
|
|
424
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
425
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
426
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
427
|
+
},
|
|
428
|
+
__wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
|
|
429
|
+
const obj = getObject(arg1);
|
|
430
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
431
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
432
|
+
var len1 = WASM_VECTOR_LEN;
|
|
433
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
434
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
435
|
+
},
|
|
436
|
+
__wbg___wbindgen_throw_41e9ee4f547fc59a: function(arg0, arg1) {
|
|
437
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
438
|
+
},
|
|
439
|
+
__wbg_call_187d372bd5fdd4aa: function() { return handleError(function (arg0, arg1, arg2) {
|
|
440
|
+
const ret = getObject(arg0).call(getObject(arg1), getObject(arg2));
|
|
441
|
+
return addHeapObject(ret);
|
|
442
|
+
}, arguments); },
|
|
443
|
+
__wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
|
|
444
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
445
|
+
return addHeapObject(ret);
|
|
446
|
+
}, arguments); },
|
|
447
|
+
__wbg_crypto_38df2bab126b63dc: function(arg0) {
|
|
448
|
+
const ret = getObject(arg0).crypto;
|
|
449
|
+
return addHeapObject(ret);
|
|
450
|
+
},
|
|
451
|
+
__wbg_done_b41a1d26cdb37fb6: function(arg0) {
|
|
452
|
+
const ret = getObject(arg0).done;
|
|
453
|
+
return ret;
|
|
454
|
+
},
|
|
455
|
+
__wbg_entries_fb6397112b1de25f: function(arg0) {
|
|
456
|
+
const ret = Object.entries(getObject(arg0));
|
|
457
|
+
return addHeapObject(ret);
|
|
458
|
+
},
|
|
459
|
+
__wbg_from_296ca31f8d0f1c52: function(arg0) {
|
|
460
|
+
const ret = Array.from(getObject(arg0));
|
|
461
|
+
return addHeapObject(ret);
|
|
462
|
+
},
|
|
463
|
+
__wbg_getRandomValues_c44a50d8cfdaebeb: function() { return handleError(function (arg0, arg1) {
|
|
464
|
+
getObject(arg0).getRandomValues(getObject(arg1));
|
|
465
|
+
}, arguments); },
|
|
466
|
+
__wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
|
|
467
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
468
|
+
return addHeapObject(ret);
|
|
469
|
+
}, arguments); },
|
|
470
|
+
__wbg_get_6c896e0571ddae51: function(arg0, arg1) {
|
|
471
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
472
|
+
return addHeapObject(ret);
|
|
473
|
+
},
|
|
474
|
+
__wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
|
|
475
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
476
|
+
return addHeapObject(ret);
|
|
477
|
+
},
|
|
478
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
479
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
480
|
+
return addHeapObject(ret);
|
|
481
|
+
},
|
|
482
|
+
__wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
|
|
483
|
+
let result;
|
|
484
|
+
try {
|
|
485
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
486
|
+
} catch (_) {
|
|
487
|
+
result = false;
|
|
488
|
+
}
|
|
489
|
+
const ret = result;
|
|
490
|
+
return ret;
|
|
491
|
+
},
|
|
492
|
+
__wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
|
|
493
|
+
let result;
|
|
494
|
+
try {
|
|
495
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
496
|
+
} catch (_) {
|
|
497
|
+
result = false;
|
|
498
|
+
}
|
|
499
|
+
const ret = result;
|
|
500
|
+
return ret;
|
|
501
|
+
},
|
|
502
|
+
__wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
|
|
503
|
+
const ret = Array.isArray(getObject(arg0));
|
|
504
|
+
return ret;
|
|
505
|
+
},
|
|
506
|
+
__wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
|
|
507
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
508
|
+
return ret;
|
|
509
|
+
},
|
|
510
|
+
__wbg_iterator_e3c31c892080e444: function() {
|
|
511
|
+
const ret = Symbol.iterator;
|
|
512
|
+
return addHeapObject(ret);
|
|
513
|
+
},
|
|
514
|
+
__wbg_length_7f3c00c40364105e: function(arg0) {
|
|
515
|
+
const ret = getObject(arg0).length;
|
|
516
|
+
return ret;
|
|
517
|
+
},
|
|
518
|
+
__wbg_length_d4bdea10311bd9cf: function(arg0) {
|
|
519
|
+
const ret = getObject(arg0).length;
|
|
520
|
+
return ret;
|
|
521
|
+
},
|
|
522
|
+
__wbg_msCrypto_bd5a034af96bcba6: function(arg0) {
|
|
523
|
+
const ret = getObject(arg0).msCrypto;
|
|
524
|
+
return addHeapObject(ret);
|
|
525
|
+
},
|
|
526
|
+
__wbg_new_1dbf7428bba60a42: function(arg0) {
|
|
527
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
528
|
+
return addHeapObject(ret);
|
|
529
|
+
},
|
|
530
|
+
__wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
|
|
531
|
+
const ret = new TypeError(getStringFromWasm0(arg0, arg1));
|
|
532
|
+
return addHeapObject(ret);
|
|
533
|
+
},
|
|
534
|
+
__wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
|
|
535
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
536
|
+
return addHeapObject(ret);
|
|
537
|
+
},
|
|
538
|
+
__wbg_new_617a8cdb8bb1130e: function() {
|
|
539
|
+
const ret = new Object();
|
|
540
|
+
return addHeapObject(ret);
|
|
541
|
+
},
|
|
542
|
+
__wbg_new_ee2291f50781bf1d: function() {
|
|
543
|
+
const ret = new Array();
|
|
544
|
+
return addHeapObject(ret);
|
|
545
|
+
},
|
|
546
|
+
__wbg_new_with_length_3da0ad195f6f63ba: function(arg0) {
|
|
547
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
548
|
+
return addHeapObject(ret);
|
|
549
|
+
},
|
|
550
|
+
__wbg_next_33784799010f1bbe: function(arg0) {
|
|
551
|
+
const ret = getObject(arg0).next;
|
|
552
|
+
return addHeapObject(ret);
|
|
553
|
+
},
|
|
554
|
+
__wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
|
|
555
|
+
const ret = getObject(arg0).next();
|
|
556
|
+
return addHeapObject(ret);
|
|
557
|
+
}, arguments); },
|
|
558
|
+
__wbg_node_84ea875411254db1: function(arg0) {
|
|
559
|
+
const ret = getObject(arg0).node;
|
|
560
|
+
return addHeapObject(ret);
|
|
561
|
+
},
|
|
562
|
+
__wbg_process_44c7a14e11e9f69e: function(arg0) {
|
|
563
|
+
const ret = getObject(arg0).process;
|
|
564
|
+
return addHeapObject(ret);
|
|
565
|
+
},
|
|
566
|
+
__wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
|
|
567
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
568
|
+
},
|
|
569
|
+
__wbg_randomFillSync_6c25eac9869eb53c: function() { return handleError(function (arg0, arg1) {
|
|
570
|
+
getObject(arg0).randomFillSync(takeObject(arg1));
|
|
571
|
+
}, arguments); },
|
|
572
|
+
__wbg_require_b4edbdcf3e2a1ef0: function() { return handleError(function () {
|
|
573
|
+
const ret = module.require;
|
|
574
|
+
return addHeapObject(ret);
|
|
575
|
+
}, arguments); },
|
|
576
|
+
__wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
|
|
577
|
+
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
|
|
578
|
+
return ret;
|
|
579
|
+
}, arguments); },
|
|
580
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
581
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
582
|
+
},
|
|
583
|
+
__wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
|
|
584
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
585
|
+
},
|
|
586
|
+
__wbg_set_name_2c630595dc90a7aa: function(arg0, arg1, arg2) {
|
|
587
|
+
getObject(arg0).name = getStringFromWasm0(arg1, arg2);
|
|
588
|
+
},
|
|
589
|
+
__wbg_static_accessor_GLOBAL_266715b9d96ba635: function() {
|
|
590
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
591
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
592
|
+
},
|
|
593
|
+
__wbg_static_accessor_GLOBAL_THIS_10fb7dc1ae063179: function() {
|
|
594
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
595
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
596
|
+
},
|
|
597
|
+
__wbg_static_accessor_SELF_0b583911f537483a: function() {
|
|
598
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
599
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
600
|
+
},
|
|
601
|
+
__wbg_static_accessor_WINDOW_d7f903d1508cbdc4: function() {
|
|
602
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
603
|
+
return isLikeNone(ret) ? 0 : addHeapObject(ret);
|
|
604
|
+
},
|
|
605
|
+
__wbg_subarray_002b94d5e13d1411: function(arg0, arg1, arg2) {
|
|
606
|
+
const ret = getObject(arg0).subarray(arg1 >>> 0, arg2 >>> 0);
|
|
607
|
+
return addHeapObject(ret);
|
|
608
|
+
},
|
|
609
|
+
__wbg_value_f3c585ee8f5ba40c: function(arg0) {
|
|
610
|
+
const ret = getObject(arg0).value;
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
},
|
|
613
|
+
__wbg_versions_276b2795b1c6a219: function(arg0) {
|
|
614
|
+
const ret = getObject(arg0).versions;
|
|
615
|
+
return addHeapObject(ret);
|
|
616
|
+
},
|
|
617
|
+
__wbindgen_generic_0000000000000001: function(arg0) {
|
|
618
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
619
|
+
const ret = arg0;
|
|
620
|
+
return addHeapObject(ret);
|
|
621
|
+
},
|
|
622
|
+
__wbindgen_generic_0000000000000002: function(arg0, arg1) {
|
|
623
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
624
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
625
|
+
return addHeapObject(ret);
|
|
626
|
+
},
|
|
627
|
+
__wbindgen_generic_0000000000000003: function(arg0, arg1) {
|
|
628
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
629
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
630
|
+
return addHeapObject(ret);
|
|
631
|
+
},
|
|
632
|
+
__wbindgen_generic_0000000000000004: function(arg0) {
|
|
633
|
+
// Cast intrinsic for `U64 -> Externref`.
|
|
634
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
635
|
+
return addHeapObject(ret);
|
|
636
|
+
},
|
|
637
|
+
__wbindgen_object_clone_ref: function(arg0) {
|
|
638
|
+
const ret = getObject(arg0);
|
|
639
|
+
return addHeapObject(ret);
|
|
640
|
+
},
|
|
641
|
+
__wbindgen_object_drop_ref: function(arg0) {
|
|
642
|
+
takeObject(arg0);
|
|
643
|
+
},
|
|
644
|
+
};
|
|
645
|
+
return {
|
|
646
|
+
__proto__: null,
|
|
647
|
+
"./flamewallet_wasm_bg.js": import0,
|
|
648
|
+
};
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
const WalletFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
652
|
+
? { register: () => {}, unregister: () => {} }
|
|
653
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_wallet_free(ptr, 1));
|
|
654
|
+
|
|
655
|
+
function addHeapObject(obj) {
|
|
656
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
657
|
+
const idx = heap_next;
|
|
658
|
+
heap_next = heap[idx];
|
|
659
|
+
|
|
660
|
+
heap[idx] = obj;
|
|
661
|
+
return idx;
|
|
662
|
+
}
|
|
663
|
+
|
|
664
|
+
function debugString(val) {
|
|
665
|
+
// primitive types
|
|
666
|
+
const type = typeof val;
|
|
667
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
668
|
+
return `${val}`;
|
|
669
|
+
}
|
|
670
|
+
if (type == 'string') {
|
|
671
|
+
return `"${val}"`;
|
|
672
|
+
}
|
|
673
|
+
if (type == 'symbol') {
|
|
674
|
+
const description = val.description;
|
|
675
|
+
if (description == null) {
|
|
676
|
+
return 'Symbol';
|
|
677
|
+
} else {
|
|
678
|
+
return `Symbol(${description})`;
|
|
679
|
+
}
|
|
680
|
+
}
|
|
681
|
+
if (type == 'function') {
|
|
682
|
+
const name = val.name;
|
|
683
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
684
|
+
return `Function(${name})`;
|
|
685
|
+
} else {
|
|
686
|
+
return 'Function';
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
// objects
|
|
690
|
+
if (Array.isArray(val)) {
|
|
691
|
+
const length = val.length;
|
|
692
|
+
let debug = '[';
|
|
693
|
+
if (length > 0) {
|
|
694
|
+
debug += debugString(val[0]);
|
|
695
|
+
}
|
|
696
|
+
for(let i = 1; i < length; i++) {
|
|
697
|
+
debug += ', ' + debugString(val[i]);
|
|
698
|
+
}
|
|
699
|
+
debug += ']';
|
|
700
|
+
return debug;
|
|
701
|
+
}
|
|
702
|
+
// Test for built-in
|
|
703
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
704
|
+
let className;
|
|
705
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
706
|
+
className = builtInMatches[1];
|
|
707
|
+
} else {
|
|
708
|
+
// Failed to match the standard '[object ClassName]'
|
|
709
|
+
return toString.call(val);
|
|
710
|
+
}
|
|
711
|
+
if (className == 'Object') {
|
|
712
|
+
// we're a user defined class or Object
|
|
713
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
714
|
+
// easier than looping through ownProperties of `val`.
|
|
715
|
+
try {
|
|
716
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
717
|
+
} catch (_) {
|
|
718
|
+
return 'Object';
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
// errors
|
|
722
|
+
if (val instanceof Error) {
|
|
723
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
724
|
+
}
|
|
725
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
726
|
+
return className;
|
|
727
|
+
}
|
|
728
|
+
|
|
729
|
+
function dropObject(idx) {
|
|
730
|
+
if (idx < 1028) return;
|
|
731
|
+
heap[idx] = heap_next;
|
|
732
|
+
heap_next = idx;
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
736
|
+
ptr = ptr >>> 0;
|
|
737
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
let cachedDataViewMemory0 = null;
|
|
741
|
+
function getDataViewMemory0() {
|
|
742
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
743
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
744
|
+
}
|
|
745
|
+
return cachedDataViewMemory0;
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
function getStringFromWasm0(ptr, len) {
|
|
749
|
+
return decodeText(ptr >>> 0, len);
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
let cachedUint8ArrayMemory0 = null;
|
|
753
|
+
function getUint8ArrayMemory0() {
|
|
754
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
755
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
756
|
+
}
|
|
757
|
+
return cachedUint8ArrayMemory0;
|
|
758
|
+
}
|
|
759
|
+
|
|
760
|
+
function getObject(idx) { return heap[idx]; }
|
|
761
|
+
|
|
762
|
+
function handleError(f, args) {
|
|
763
|
+
try {
|
|
764
|
+
return f.apply(this, args);
|
|
765
|
+
} catch (e) {
|
|
766
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
767
|
+
}
|
|
768
|
+
}
|
|
769
|
+
|
|
770
|
+
let heap = new Array(1024).fill(undefined);
|
|
771
|
+
heap.push(undefined, null, true, false);
|
|
772
|
+
|
|
773
|
+
let heap_next = heap.length;
|
|
774
|
+
|
|
775
|
+
function isLikeNone(x) {
|
|
776
|
+
return x === undefined || x === null;
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
780
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
781
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
782
|
+
WASM_VECTOR_LEN = arg.length;
|
|
783
|
+
return ptr;
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
787
|
+
if (realloc === undefined) {
|
|
788
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
789
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
790
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
791
|
+
WASM_VECTOR_LEN = buf.length;
|
|
792
|
+
return ptr;
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
let len = arg.length;
|
|
796
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
797
|
+
|
|
798
|
+
const mem = getUint8ArrayMemory0();
|
|
799
|
+
|
|
800
|
+
let offset = 0;
|
|
801
|
+
|
|
802
|
+
for (; offset < len; offset++) {
|
|
803
|
+
const code = arg.charCodeAt(offset);
|
|
804
|
+
if (code > 0x7F) break;
|
|
805
|
+
mem[ptr + offset] = code;
|
|
806
|
+
}
|
|
807
|
+
if (offset !== len) {
|
|
808
|
+
if (offset !== 0) {
|
|
809
|
+
arg = arg.slice(offset);
|
|
810
|
+
}
|
|
811
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
812
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
813
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
814
|
+
|
|
815
|
+
offset += ret.written;
|
|
816
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
WASM_VECTOR_LEN = offset;
|
|
820
|
+
return ptr;
|
|
821
|
+
}
|
|
822
|
+
|
|
823
|
+
function takeObject(idx) {
|
|
824
|
+
const ret = getObject(idx);
|
|
825
|
+
dropObject(idx);
|
|
826
|
+
return ret;
|
|
827
|
+
}
|
|
828
|
+
|
|
829
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
830
|
+
cachedTextDecoder.decode();
|
|
831
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
832
|
+
let numBytesDecoded = 0;
|
|
833
|
+
function decodeText(ptr, len) {
|
|
834
|
+
numBytesDecoded += len;
|
|
835
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
836
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
837
|
+
cachedTextDecoder.decode();
|
|
838
|
+
numBytesDecoded = len;
|
|
839
|
+
}
|
|
840
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
const cachedTextEncoder = new TextEncoder();
|
|
844
|
+
|
|
845
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
846
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
847
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
848
|
+
view.set(buf);
|
|
849
|
+
return {
|
|
850
|
+
read: arg.length,
|
|
851
|
+
written: buf.length
|
|
852
|
+
};
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
|
|
856
|
+
let WASM_VECTOR_LEN = 0;
|
|
857
|
+
|
|
858
|
+
let wasmModule, wasmInstance, wasm;
|
|
859
|
+
function __wbg_finalize_init(instance, module) {
|
|
860
|
+
wasmInstance = instance;
|
|
861
|
+
wasm = instance.exports;
|
|
862
|
+
wasmModule = module;
|
|
863
|
+
cachedDataViewMemory0 = null;
|
|
864
|
+
cachedUint8ArrayMemory0 = null;
|
|
865
|
+
return wasm;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
async function __wbg_load(module, imports) {
|
|
869
|
+
if (typeof Response === 'function' && module instanceof Response) {
|
|
870
|
+
if (!module.ok) {
|
|
871
|
+
throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
if (typeof WebAssembly.instantiateStreaming === 'function') {
|
|
875
|
+
try {
|
|
876
|
+
return await WebAssembly.instantiateStreaming(module, imports);
|
|
877
|
+
} catch (e) {
|
|
878
|
+
const validResponse = expectedResponseType(module.type);
|
|
879
|
+
|
|
880
|
+
if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
|
|
881
|
+
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);
|
|
882
|
+
|
|
883
|
+
} else { throw e; }
|
|
884
|
+
}
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
const bytes = await module.arrayBuffer();
|
|
888
|
+
return await WebAssembly.instantiate(bytes, imports);
|
|
889
|
+
} else {
|
|
890
|
+
const instance = await WebAssembly.instantiate(module, imports);
|
|
891
|
+
|
|
892
|
+
if (instance instanceof WebAssembly.Instance) {
|
|
893
|
+
return { instance, module };
|
|
894
|
+
} else {
|
|
895
|
+
return instance;
|
|
896
|
+
}
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
function expectedResponseType(type) {
|
|
900
|
+
switch (type) {
|
|
901
|
+
case 'basic': case 'cors': case 'default': return true;
|
|
902
|
+
}
|
|
903
|
+
return false;
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
function initSync(module) {
|
|
908
|
+
if (wasm !== undefined) return wasm;
|
|
909
|
+
|
|
910
|
+
|
|
911
|
+
if (module !== undefined) {
|
|
912
|
+
if (Object.getPrototypeOf(module) === Object.prototype) {
|
|
913
|
+
({module} = module)
|
|
914
|
+
} else {
|
|
915
|
+
console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
|
|
916
|
+
}
|
|
917
|
+
}
|
|
918
|
+
|
|
919
|
+
const imports = __wbg_get_imports();
|
|
920
|
+
if (!(module instanceof WebAssembly.Module)) {
|
|
921
|
+
module = new WebAssembly.Module(module);
|
|
922
|
+
}
|
|
923
|
+
const instance = new WebAssembly.Instance(module, imports);
|
|
924
|
+
return __wbg_finalize_init(instance, module);
|
|
925
|
+
}
|
|
926
|
+
|
|
927
|
+
async function __wbg_init(module_or_path) {
|
|
928
|
+
if (wasm !== undefined) return wasm;
|
|
929
|
+
|
|
930
|
+
|
|
931
|
+
if (module_or_path !== undefined) {
|
|
932
|
+
if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
|
|
933
|
+
({module_or_path} = module_or_path)
|
|
934
|
+
} else {
|
|
935
|
+
console.warn('using deprecated parameters for the initialization function; pass a single object instead')
|
|
936
|
+
}
|
|
937
|
+
}
|
|
938
|
+
|
|
939
|
+
if (module_or_path === undefined) {
|
|
940
|
+
module_or_path = new URL('flamewallet_wasm_bg.wasm', import.meta.url);
|
|
941
|
+
}
|
|
942
|
+
const imports = __wbg_get_imports();
|
|
943
|
+
|
|
944
|
+
if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
|
|
945
|
+
module_or_path = fetch(module_or_path);
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
const { instance, module } = await __wbg_load(await module_or_path, imports);
|
|
949
|
+
|
|
950
|
+
return __wbg_finalize_init(instance, module);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
export { initSync, __wbg_init as default };
|