@bubolabs/wallet-wasm 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/README.md +103 -0
- package/index.d.ts +289 -0
- package/index.js +748 -0
- package/package.json +34 -0
- package/pkg/bubo_wallet_wasm.d.ts +192 -0
- package/pkg/bubo_wallet_wasm.js +9 -0
- package/pkg/bubo_wallet_wasm_bg.js +1343 -0
- package/pkg/bubo_wallet_wasm_bg.wasm +0 -0
- package/pkg/bubo_wallet_wasm_bg.wasm.d.ts +78 -0
- package/pkg/package.json +18 -0
- package/pkg-cardano/bubo_wallet_wasm.d.ts +4367 -0
- package/pkg-cardano/bubo_wallet_wasm.js +9 -0
- package/pkg-cardano/bubo_wallet_wasm_bg.js +30154 -0
- package/pkg-cardano/bubo_wallet_wasm_bg.wasm +0 -0
- package/pkg-cardano/bubo_wallet_wasm_bg.wasm.d.ts +2447 -0
- package/pkg-cardano/package.json +18 -0
|
@@ -0,0 +1,1343 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A hash; the 32-byte output of a hashing algorithm.
|
|
3
|
+
*
|
|
4
|
+
* This struct is used most often in `solana-sdk` and related crates to contain
|
|
5
|
+
* a [SHA-256] hash, but may instead contain a [blake3] hash.
|
|
6
|
+
*
|
|
7
|
+
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
|
8
|
+
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
|
9
|
+
*/
|
|
10
|
+
export class Hash {
|
|
11
|
+
static __wrap(ptr) {
|
|
12
|
+
ptr = ptr >>> 0;
|
|
13
|
+
const obj = Object.create(Hash.prototype);
|
|
14
|
+
obj.__wbg_ptr = ptr;
|
|
15
|
+
HashFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
16
|
+
return obj;
|
|
17
|
+
}
|
|
18
|
+
__destroy_into_raw() {
|
|
19
|
+
const ptr = this.__wbg_ptr;
|
|
20
|
+
this.__wbg_ptr = 0;
|
|
21
|
+
HashFinalization.unregister(this);
|
|
22
|
+
return ptr;
|
|
23
|
+
}
|
|
24
|
+
free() {
|
|
25
|
+
const ptr = this.__destroy_into_raw();
|
|
26
|
+
wasm.__wbg_hash_free(ptr, 0);
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Create a new Hash object
|
|
30
|
+
*
|
|
31
|
+
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
|
32
|
+
* @param {any} value
|
|
33
|
+
*/
|
|
34
|
+
constructor(value) {
|
|
35
|
+
const ret = wasm.hash_constructor(value);
|
|
36
|
+
if (ret[2]) {
|
|
37
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
38
|
+
}
|
|
39
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
40
|
+
HashFinalization.register(this, this.__wbg_ptr, this);
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Checks if two `Hash`s are equal
|
|
45
|
+
* @param {Hash} other
|
|
46
|
+
* @returns {boolean}
|
|
47
|
+
*/
|
|
48
|
+
equals(other) {
|
|
49
|
+
_assertClass(other, Hash);
|
|
50
|
+
const ret = wasm.hash_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
51
|
+
return ret !== 0;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Return the `Uint8Array` representation of the hash
|
|
55
|
+
* @returns {Uint8Array}
|
|
56
|
+
*/
|
|
57
|
+
toBytes() {
|
|
58
|
+
const ret = wasm.hash_toBytes(this.__wbg_ptr);
|
|
59
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
60
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
61
|
+
return v1;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Return the base58 string representation of the hash
|
|
65
|
+
* @returns {string}
|
|
66
|
+
*/
|
|
67
|
+
toString() {
|
|
68
|
+
let deferred1_0;
|
|
69
|
+
let deferred1_1;
|
|
70
|
+
try {
|
|
71
|
+
const ret = wasm.hash_toString(this.__wbg_ptr);
|
|
72
|
+
deferred1_0 = ret[0];
|
|
73
|
+
deferred1_1 = ret[1];
|
|
74
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
75
|
+
} finally {
|
|
76
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
if (Symbol.dispose) Hash.prototype[Symbol.dispose] = Hash.prototype.free;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* wasm-bindgen version of the Instruction struct.
|
|
84
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
85
|
+
* is fixed. This must not diverge from the regular non-wasm Instruction struct.
|
|
86
|
+
*/
|
|
87
|
+
export class Instruction {
|
|
88
|
+
static __wrap(ptr) {
|
|
89
|
+
ptr = ptr >>> 0;
|
|
90
|
+
const obj = Object.create(Instruction.prototype);
|
|
91
|
+
obj.__wbg_ptr = ptr;
|
|
92
|
+
InstructionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
93
|
+
return obj;
|
|
94
|
+
}
|
|
95
|
+
__destroy_into_raw() {
|
|
96
|
+
const ptr = this.__wbg_ptr;
|
|
97
|
+
this.__wbg_ptr = 0;
|
|
98
|
+
InstructionFinalization.unregister(this);
|
|
99
|
+
return ptr;
|
|
100
|
+
}
|
|
101
|
+
free() {
|
|
102
|
+
const ptr = this.__destroy_into_raw();
|
|
103
|
+
wasm.__wbg_instruction_free(ptr, 0);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
if (Symbol.dispose) Instruction.prototype[Symbol.dispose] = Instruction.prototype.free;
|
|
107
|
+
|
|
108
|
+
export class Instructions {
|
|
109
|
+
__destroy_into_raw() {
|
|
110
|
+
const ptr = this.__wbg_ptr;
|
|
111
|
+
this.__wbg_ptr = 0;
|
|
112
|
+
InstructionsFinalization.unregister(this);
|
|
113
|
+
return ptr;
|
|
114
|
+
}
|
|
115
|
+
free() {
|
|
116
|
+
const ptr = this.__destroy_into_raw();
|
|
117
|
+
wasm.__wbg_instructions_free(ptr, 0);
|
|
118
|
+
}
|
|
119
|
+
constructor() {
|
|
120
|
+
const ret = wasm.instructions_constructor();
|
|
121
|
+
this.__wbg_ptr = ret >>> 0;
|
|
122
|
+
InstructionsFinalization.register(this, this.__wbg_ptr, this);
|
|
123
|
+
return this;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* @param {Instruction} instruction
|
|
127
|
+
*/
|
|
128
|
+
push(instruction) {
|
|
129
|
+
_assertClass(instruction, Instruction);
|
|
130
|
+
var ptr0 = instruction.__destroy_into_raw();
|
|
131
|
+
wasm.instructions_push(this.__wbg_ptr, ptr0);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (Symbol.dispose) Instructions.prototype[Symbol.dispose] = Instructions.prototype.free;
|
|
135
|
+
|
|
136
|
+
/**
|
|
137
|
+
* A vanilla Ed25519 key pair
|
|
138
|
+
*/
|
|
139
|
+
export class Keypair {
|
|
140
|
+
static __wrap(ptr) {
|
|
141
|
+
ptr = ptr >>> 0;
|
|
142
|
+
const obj = Object.create(Keypair.prototype);
|
|
143
|
+
obj.__wbg_ptr = ptr;
|
|
144
|
+
KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
145
|
+
return obj;
|
|
146
|
+
}
|
|
147
|
+
__destroy_into_raw() {
|
|
148
|
+
const ptr = this.__wbg_ptr;
|
|
149
|
+
this.__wbg_ptr = 0;
|
|
150
|
+
KeypairFinalization.unregister(this);
|
|
151
|
+
return ptr;
|
|
152
|
+
}
|
|
153
|
+
free() {
|
|
154
|
+
const ptr = this.__destroy_into_raw();
|
|
155
|
+
wasm.__wbg_keypair_free(ptr, 0);
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Create a new `Keypair `
|
|
159
|
+
*/
|
|
160
|
+
constructor() {
|
|
161
|
+
const ret = wasm.keypair_constructor();
|
|
162
|
+
this.__wbg_ptr = ret >>> 0;
|
|
163
|
+
KeypairFinalization.register(this, this.__wbg_ptr, this);
|
|
164
|
+
return this;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Recover a `Keypair` from a `Uint8Array`
|
|
168
|
+
* @param {Uint8Array} bytes
|
|
169
|
+
* @returns {Keypair}
|
|
170
|
+
*/
|
|
171
|
+
static fromBytes(bytes) {
|
|
172
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
173
|
+
const len0 = WASM_VECTOR_LEN;
|
|
174
|
+
const ret = wasm.keypair_fromBytes(ptr0, len0);
|
|
175
|
+
if (ret[2]) {
|
|
176
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
177
|
+
}
|
|
178
|
+
return Keypair.__wrap(ret[0]);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* Return the `Pubkey` for this `Keypair`
|
|
182
|
+
* @returns {Pubkey}
|
|
183
|
+
*/
|
|
184
|
+
pubkey() {
|
|
185
|
+
const ret = wasm.keypair_pubkey(this.__wbg_ptr);
|
|
186
|
+
return Pubkey.__wrap(ret);
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Convert a `Keypair` to a `Uint8Array`
|
|
190
|
+
* @returns {Uint8Array}
|
|
191
|
+
*/
|
|
192
|
+
toBytes() {
|
|
193
|
+
const ret = wasm.keypair_toBytes(this.__wbg_ptr);
|
|
194
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
195
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
196
|
+
return v1;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
if (Symbol.dispose) Keypair.prototype[Symbol.dispose] = Keypair.prototype.free;
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* wasm-bindgen version of the Message struct.
|
|
203
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
204
|
+
* is fixed. This must not diverge from the regular non-wasm Message struct.
|
|
205
|
+
*/
|
|
206
|
+
export class Message {
|
|
207
|
+
static __wrap(ptr) {
|
|
208
|
+
ptr = ptr >>> 0;
|
|
209
|
+
const obj = Object.create(Message.prototype);
|
|
210
|
+
obj.__wbg_ptr = ptr;
|
|
211
|
+
MessageFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
212
|
+
return obj;
|
|
213
|
+
}
|
|
214
|
+
__destroy_into_raw() {
|
|
215
|
+
const ptr = this.__wbg_ptr;
|
|
216
|
+
this.__wbg_ptr = 0;
|
|
217
|
+
MessageFinalization.unregister(this);
|
|
218
|
+
return ptr;
|
|
219
|
+
}
|
|
220
|
+
free() {
|
|
221
|
+
const ptr = this.__destroy_into_raw();
|
|
222
|
+
wasm.__wbg_message_free(ptr, 0);
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* The id of a recent ledger entry.
|
|
226
|
+
* @returns {Hash}
|
|
227
|
+
*/
|
|
228
|
+
get recent_blockhash() {
|
|
229
|
+
const ret = wasm.__wbg_get_message_recent_blockhash(this.__wbg_ptr);
|
|
230
|
+
return Hash.__wrap(ret);
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* The id of a recent ledger entry.
|
|
234
|
+
* @param {Hash} arg0
|
|
235
|
+
*/
|
|
236
|
+
set recent_blockhash(arg0) {
|
|
237
|
+
_assertClass(arg0, Hash);
|
|
238
|
+
var ptr0 = arg0.__destroy_into_raw();
|
|
239
|
+
wasm.__wbg_set_message_recent_blockhash(this.__wbg_ptr, ptr0);
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
if (Symbol.dispose) Message.prototype[Symbol.dispose] = Message.prototype.free;
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* The address of a [Solana account][acc].
|
|
246
|
+
*
|
|
247
|
+
* Some account addresses are [ed25519] public keys, with corresponding secret
|
|
248
|
+
* keys that are managed off-chain. Often, though, account addresses do not
|
|
249
|
+
* have corresponding secret keys — as with [_program derived
|
|
250
|
+
* addresses_][pdas] — or the secret key is not relevant to the operation
|
|
251
|
+
* of a program, and may have even been disposed of. As running Solana programs
|
|
252
|
+
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
|
253
|
+
* defined in `solana-program` but in `solana-sdk`.
|
|
254
|
+
*
|
|
255
|
+
* [acc]: https://solana.com/docs/core/accounts
|
|
256
|
+
* [ed25519]: https://ed25519.cr.yp.to/
|
|
257
|
+
* [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
|
|
258
|
+
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
|
259
|
+
*/
|
|
260
|
+
export class Pubkey {
|
|
261
|
+
static __wrap(ptr) {
|
|
262
|
+
ptr = ptr >>> 0;
|
|
263
|
+
const obj = Object.create(Pubkey.prototype);
|
|
264
|
+
obj.__wbg_ptr = ptr;
|
|
265
|
+
PubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
266
|
+
return obj;
|
|
267
|
+
}
|
|
268
|
+
__destroy_into_raw() {
|
|
269
|
+
const ptr = this.__wbg_ptr;
|
|
270
|
+
this.__wbg_ptr = 0;
|
|
271
|
+
PubkeyFinalization.unregister(this);
|
|
272
|
+
return ptr;
|
|
273
|
+
}
|
|
274
|
+
free() {
|
|
275
|
+
const ptr = this.__destroy_into_raw();
|
|
276
|
+
wasm.__wbg_pubkey_free(ptr, 0);
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Create a new Pubkey object
|
|
280
|
+
*
|
|
281
|
+
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
|
282
|
+
* @param {any} value
|
|
283
|
+
*/
|
|
284
|
+
constructor(value) {
|
|
285
|
+
const ret = wasm.pubkey_constructor(value);
|
|
286
|
+
if (ret[2]) {
|
|
287
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
288
|
+
}
|
|
289
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
290
|
+
PubkeyFinalization.register(this, this.__wbg_ptr, this);
|
|
291
|
+
return this;
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Checks if two `Pubkey`s are equal
|
|
295
|
+
* @param {Pubkey} other
|
|
296
|
+
* @returns {boolean}
|
|
297
|
+
*/
|
|
298
|
+
equals(other) {
|
|
299
|
+
_assertClass(other, Pubkey);
|
|
300
|
+
const ret = wasm.pubkey_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
301
|
+
return ret !== 0;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Return the `Uint8Array` representation of the public key
|
|
305
|
+
* @returns {Uint8Array}
|
|
306
|
+
*/
|
|
307
|
+
toBytes() {
|
|
308
|
+
const ret = wasm.pubkey_toBytes(this.__wbg_ptr);
|
|
309
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
310
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
311
|
+
return v1;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Return the base58 string representation of the public key
|
|
315
|
+
* @returns {string}
|
|
316
|
+
*/
|
|
317
|
+
toString() {
|
|
318
|
+
let deferred1_0;
|
|
319
|
+
let deferred1_1;
|
|
320
|
+
try {
|
|
321
|
+
const ret = wasm.pubkey_toString(this.__wbg_ptr);
|
|
322
|
+
deferred1_0 = ret[0];
|
|
323
|
+
deferred1_1 = ret[1];
|
|
324
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
325
|
+
} finally {
|
|
326
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
if (Symbol.dispose) Pubkey.prototype[Symbol.dispose] = Pubkey.prototype.free;
|
|
331
|
+
|
|
332
|
+
export class SystemInstruction {
|
|
333
|
+
__destroy_into_raw() {
|
|
334
|
+
const ptr = this.__wbg_ptr;
|
|
335
|
+
this.__wbg_ptr = 0;
|
|
336
|
+
SystemInstructionFinalization.unregister(this);
|
|
337
|
+
return ptr;
|
|
338
|
+
}
|
|
339
|
+
free() {
|
|
340
|
+
const ptr = this.__destroy_into_raw();
|
|
341
|
+
wasm.__wbg_systeminstruction_free(ptr, 0);
|
|
342
|
+
}
|
|
343
|
+
/**
|
|
344
|
+
* @param {Pubkey} nonce_pubkey
|
|
345
|
+
* @param {Pubkey} authorized_pubkey
|
|
346
|
+
* @returns {Instruction}
|
|
347
|
+
*/
|
|
348
|
+
static advanceNonceAccount(nonce_pubkey, authorized_pubkey) {
|
|
349
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
350
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
351
|
+
const ret = wasm.systeminstruction_advanceNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr);
|
|
352
|
+
return Instruction.__wrap(ret);
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* @param {Pubkey} pubkey
|
|
356
|
+
* @param {bigint} space
|
|
357
|
+
* @returns {Instruction}
|
|
358
|
+
*/
|
|
359
|
+
static allocate(pubkey, space) {
|
|
360
|
+
_assertClass(pubkey, Pubkey);
|
|
361
|
+
const ret = wasm.systeminstruction_allocate(pubkey.__wbg_ptr, space);
|
|
362
|
+
return Instruction.__wrap(ret);
|
|
363
|
+
}
|
|
364
|
+
/**
|
|
365
|
+
* @param {Pubkey} address
|
|
366
|
+
* @param {Pubkey} base
|
|
367
|
+
* @param {string} seed
|
|
368
|
+
* @param {bigint} space
|
|
369
|
+
* @param {Pubkey} owner
|
|
370
|
+
* @returns {Instruction}
|
|
371
|
+
*/
|
|
372
|
+
static allocateWithSeed(address, base, seed, space, owner) {
|
|
373
|
+
_assertClass(address, Pubkey);
|
|
374
|
+
_assertClass(base, Pubkey);
|
|
375
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
376
|
+
const len0 = WASM_VECTOR_LEN;
|
|
377
|
+
_assertClass(owner, Pubkey);
|
|
378
|
+
const ret = wasm.systeminstruction_allocateWithSeed(address.__wbg_ptr, base.__wbg_ptr, ptr0, len0, space, owner.__wbg_ptr);
|
|
379
|
+
return Instruction.__wrap(ret);
|
|
380
|
+
}
|
|
381
|
+
/**
|
|
382
|
+
* @param {Pubkey} pubkey
|
|
383
|
+
* @param {Pubkey} owner
|
|
384
|
+
* @returns {Instruction}
|
|
385
|
+
*/
|
|
386
|
+
static assign(pubkey, owner) {
|
|
387
|
+
_assertClass(pubkey, Pubkey);
|
|
388
|
+
_assertClass(owner, Pubkey);
|
|
389
|
+
const ret = wasm.systeminstruction_assign(pubkey.__wbg_ptr, owner.__wbg_ptr);
|
|
390
|
+
return Instruction.__wrap(ret);
|
|
391
|
+
}
|
|
392
|
+
/**
|
|
393
|
+
* @param {Pubkey} pubkey
|
|
394
|
+
* @param {Pubkey} base
|
|
395
|
+
* @param {string} seed
|
|
396
|
+
* @param {Pubkey} owner
|
|
397
|
+
* @returns {Instruction}
|
|
398
|
+
*/
|
|
399
|
+
static assignWithSeed(pubkey, base, seed, owner) {
|
|
400
|
+
_assertClass(pubkey, Pubkey);
|
|
401
|
+
_assertClass(base, Pubkey);
|
|
402
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
403
|
+
const len0 = WASM_VECTOR_LEN;
|
|
404
|
+
_assertClass(owner, Pubkey);
|
|
405
|
+
const ret = wasm.systeminstruction_assignWithSeed(pubkey.__wbg_ptr, base.__wbg_ptr, ptr0, len0, owner.__wbg_ptr);
|
|
406
|
+
return Instruction.__wrap(ret);
|
|
407
|
+
}
|
|
408
|
+
/**
|
|
409
|
+
* @param {Pubkey} nonce_pubkey
|
|
410
|
+
* @param {Pubkey} authorized_pubkey
|
|
411
|
+
* @param {Pubkey} new_authority
|
|
412
|
+
* @returns {Instruction}
|
|
413
|
+
*/
|
|
414
|
+
static authorizeNonceAccount(nonce_pubkey, authorized_pubkey, new_authority) {
|
|
415
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
416
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
417
|
+
_assertClass(new_authority, Pubkey);
|
|
418
|
+
const ret = wasm.systeminstruction_authorizeNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr, new_authority.__wbg_ptr);
|
|
419
|
+
return Instruction.__wrap(ret);
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* @param {Pubkey} from_pubkey
|
|
423
|
+
* @param {Pubkey} to_pubkey
|
|
424
|
+
* @param {bigint} lamports
|
|
425
|
+
* @param {bigint} space
|
|
426
|
+
* @param {Pubkey} owner
|
|
427
|
+
* @returns {Instruction}
|
|
428
|
+
*/
|
|
429
|
+
static createAccount(from_pubkey, to_pubkey, lamports, space, owner) {
|
|
430
|
+
_assertClass(from_pubkey, Pubkey);
|
|
431
|
+
_assertClass(to_pubkey, Pubkey);
|
|
432
|
+
_assertClass(owner, Pubkey);
|
|
433
|
+
const ret = wasm.systeminstruction_createAccount(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports, space, owner.__wbg_ptr);
|
|
434
|
+
return Instruction.__wrap(ret);
|
|
435
|
+
}
|
|
436
|
+
/**
|
|
437
|
+
* @param {Pubkey} from_pubkey
|
|
438
|
+
* @param {Pubkey} to_pubkey
|
|
439
|
+
* @param {Pubkey} base
|
|
440
|
+
* @param {string} seed
|
|
441
|
+
* @param {bigint} lamports
|
|
442
|
+
* @param {bigint} space
|
|
443
|
+
* @param {Pubkey} owner
|
|
444
|
+
* @returns {Instruction}
|
|
445
|
+
*/
|
|
446
|
+
static createAccountWithSeed(from_pubkey, to_pubkey, base, seed, lamports, space, owner) {
|
|
447
|
+
_assertClass(from_pubkey, Pubkey);
|
|
448
|
+
_assertClass(to_pubkey, Pubkey);
|
|
449
|
+
_assertClass(base, Pubkey);
|
|
450
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
451
|
+
const len0 = WASM_VECTOR_LEN;
|
|
452
|
+
_assertClass(owner, Pubkey);
|
|
453
|
+
const ret = wasm.systeminstruction_createAccountWithSeed(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, base.__wbg_ptr, ptr0, len0, lamports, space, owner.__wbg_ptr);
|
|
454
|
+
return Instruction.__wrap(ret);
|
|
455
|
+
}
|
|
456
|
+
/**
|
|
457
|
+
* @param {Pubkey} from_pubkey
|
|
458
|
+
* @param {Pubkey} nonce_pubkey
|
|
459
|
+
* @param {Pubkey} authority
|
|
460
|
+
* @param {bigint} lamports
|
|
461
|
+
* @returns {Array<any>}
|
|
462
|
+
*/
|
|
463
|
+
static createNonceAccount(from_pubkey, nonce_pubkey, authority, lamports) {
|
|
464
|
+
_assertClass(from_pubkey, Pubkey);
|
|
465
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
466
|
+
_assertClass(authority, Pubkey);
|
|
467
|
+
const ret = wasm.systeminstruction_createNonceAccount(from_pubkey.__wbg_ptr, nonce_pubkey.__wbg_ptr, authority.__wbg_ptr, lamports);
|
|
468
|
+
return ret;
|
|
469
|
+
}
|
|
470
|
+
/**
|
|
471
|
+
* @param {Pubkey} from_pubkey
|
|
472
|
+
* @param {Pubkey} to_pubkey
|
|
473
|
+
* @param {bigint} lamports
|
|
474
|
+
* @returns {Instruction}
|
|
475
|
+
*/
|
|
476
|
+
static transfer(from_pubkey, to_pubkey, lamports) {
|
|
477
|
+
_assertClass(from_pubkey, Pubkey);
|
|
478
|
+
_assertClass(to_pubkey, Pubkey);
|
|
479
|
+
const ret = wasm.systeminstruction_transfer(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
480
|
+
return Instruction.__wrap(ret);
|
|
481
|
+
}
|
|
482
|
+
/**
|
|
483
|
+
* @param {Pubkey} from_pubkey
|
|
484
|
+
* @param {Pubkey} from_base
|
|
485
|
+
* @param {string} from_seed
|
|
486
|
+
* @param {Pubkey} from_owner
|
|
487
|
+
* @param {Pubkey} to_pubkey
|
|
488
|
+
* @param {bigint} lamports
|
|
489
|
+
* @returns {Instruction}
|
|
490
|
+
*/
|
|
491
|
+
static transferWithSeed(from_pubkey, from_base, from_seed, from_owner, to_pubkey, lamports) {
|
|
492
|
+
_assertClass(from_pubkey, Pubkey);
|
|
493
|
+
_assertClass(from_base, Pubkey);
|
|
494
|
+
const ptr0 = passStringToWasm0(from_seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
495
|
+
const len0 = WASM_VECTOR_LEN;
|
|
496
|
+
_assertClass(from_owner, Pubkey);
|
|
497
|
+
_assertClass(to_pubkey, Pubkey);
|
|
498
|
+
const ret = wasm.systeminstruction_transferWithSeed(from_pubkey.__wbg_ptr, from_base.__wbg_ptr, ptr0, len0, from_owner.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
499
|
+
return Instruction.__wrap(ret);
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* @param {Pubkey} nonce_pubkey
|
|
503
|
+
* @param {Pubkey} authorized_pubkey
|
|
504
|
+
* @param {Pubkey} to_pubkey
|
|
505
|
+
* @param {bigint} lamports
|
|
506
|
+
* @returns {Instruction}
|
|
507
|
+
*/
|
|
508
|
+
static withdrawNonceAccount(nonce_pubkey, authorized_pubkey, to_pubkey, lamports) {
|
|
509
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
510
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
511
|
+
_assertClass(to_pubkey, Pubkey);
|
|
512
|
+
const ret = wasm.systeminstruction_withdrawNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
513
|
+
return Instruction.__wrap(ret);
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
if (Symbol.dispose) SystemInstruction.prototype[Symbol.dispose] = SystemInstruction.prototype.free;
|
|
517
|
+
|
|
518
|
+
/**
|
|
519
|
+
* wasm-bindgen version of the Transaction struct.
|
|
520
|
+
* This duplication is required until https://github.com/rustwasm/wasm-bindgen/issues/3671
|
|
521
|
+
* is fixed. This must not diverge from the regular non-wasm Transaction struct.
|
|
522
|
+
*/
|
|
523
|
+
export class Transaction {
|
|
524
|
+
static __wrap(ptr) {
|
|
525
|
+
ptr = ptr >>> 0;
|
|
526
|
+
const obj = Object.create(Transaction.prototype);
|
|
527
|
+
obj.__wbg_ptr = ptr;
|
|
528
|
+
TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
529
|
+
return obj;
|
|
530
|
+
}
|
|
531
|
+
__destroy_into_raw() {
|
|
532
|
+
const ptr = this.__wbg_ptr;
|
|
533
|
+
this.__wbg_ptr = 0;
|
|
534
|
+
TransactionFinalization.unregister(this);
|
|
535
|
+
return ptr;
|
|
536
|
+
}
|
|
537
|
+
free() {
|
|
538
|
+
const ptr = this.__destroy_into_raw();
|
|
539
|
+
wasm.__wbg_transaction_free(ptr, 0);
|
|
540
|
+
}
|
|
541
|
+
/**
|
|
542
|
+
* Create a new `Transaction`
|
|
543
|
+
* @param {Instructions} instructions
|
|
544
|
+
* @param {Pubkey | null} [payer]
|
|
545
|
+
*/
|
|
546
|
+
constructor(instructions, payer) {
|
|
547
|
+
_assertClass(instructions, Instructions);
|
|
548
|
+
var ptr0 = instructions.__destroy_into_raw();
|
|
549
|
+
let ptr1 = 0;
|
|
550
|
+
if (!isLikeNone(payer)) {
|
|
551
|
+
_assertClass(payer, Pubkey);
|
|
552
|
+
ptr1 = payer.__destroy_into_raw();
|
|
553
|
+
}
|
|
554
|
+
const ret = wasm.transaction_constructor(ptr0, ptr1);
|
|
555
|
+
this.__wbg_ptr = ret >>> 0;
|
|
556
|
+
TransactionFinalization.register(this, this.__wbg_ptr, this);
|
|
557
|
+
return this;
|
|
558
|
+
}
|
|
559
|
+
/**
|
|
560
|
+
* @param {Uint8Array} bytes
|
|
561
|
+
* @returns {Transaction}
|
|
562
|
+
*/
|
|
563
|
+
static fromBytes(bytes) {
|
|
564
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
565
|
+
const len0 = WASM_VECTOR_LEN;
|
|
566
|
+
const ret = wasm.transaction_fromBytes(ptr0, len0);
|
|
567
|
+
if (ret[2]) {
|
|
568
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
569
|
+
}
|
|
570
|
+
return Transaction.__wrap(ret[0]);
|
|
571
|
+
}
|
|
572
|
+
/**
|
|
573
|
+
* @returns {boolean}
|
|
574
|
+
*/
|
|
575
|
+
isSigned() {
|
|
576
|
+
const ret = wasm.transaction_isSigned(this.__wbg_ptr);
|
|
577
|
+
return ret !== 0;
|
|
578
|
+
}
|
|
579
|
+
/**
|
|
580
|
+
* Return a message containing all data that should be signed.
|
|
581
|
+
* @returns {Message}
|
|
582
|
+
*/
|
|
583
|
+
message() {
|
|
584
|
+
const ret = wasm.transaction_message(this.__wbg_ptr);
|
|
585
|
+
return Message.__wrap(ret);
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Return the serialized message data to sign.
|
|
589
|
+
* @returns {Uint8Array}
|
|
590
|
+
*/
|
|
591
|
+
messageData() {
|
|
592
|
+
const ret = wasm.transaction_messageData(this.__wbg_ptr);
|
|
593
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
594
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
595
|
+
return v1;
|
|
596
|
+
}
|
|
597
|
+
/**
|
|
598
|
+
* @param {Keypair} keypair
|
|
599
|
+
* @param {Hash} recent_blockhash
|
|
600
|
+
*/
|
|
601
|
+
partialSign(keypair, recent_blockhash) {
|
|
602
|
+
_assertClass(keypair, Keypair);
|
|
603
|
+
_assertClass(recent_blockhash, Hash);
|
|
604
|
+
wasm.transaction_partialSign(this.__wbg_ptr, keypair.__wbg_ptr, recent_blockhash.__wbg_ptr);
|
|
605
|
+
}
|
|
606
|
+
/**
|
|
607
|
+
* @returns {Uint8Array}
|
|
608
|
+
*/
|
|
609
|
+
toBytes() {
|
|
610
|
+
const ret = wasm.transaction_toBytes(this.__wbg_ptr);
|
|
611
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
612
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
613
|
+
return v1;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* Verify the transaction
|
|
617
|
+
*/
|
|
618
|
+
verify() {
|
|
619
|
+
const ret = wasm.transaction_verify(this.__wbg_ptr);
|
|
620
|
+
if (ret[1]) {
|
|
621
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
622
|
+
}
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
if (Symbol.dispose) Transaction.prototype[Symbol.dispose] = Transaction.prototype.free;
|
|
626
|
+
|
|
627
|
+
/**
|
|
628
|
+
* @param {string} request_json
|
|
629
|
+
* @returns {Uint8Array}
|
|
630
|
+
*/
|
|
631
|
+
export function buildAndSign(request_json) {
|
|
632
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
633
|
+
const len0 = WASM_VECTOR_LEN;
|
|
634
|
+
const ret = wasm.buildAndSign(ptr0, len0);
|
|
635
|
+
if (ret[3]) {
|
|
636
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
637
|
+
}
|
|
638
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
639
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
640
|
+
return v2;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @param {string} request_json
|
|
645
|
+
* @returns {Uint8Array}
|
|
646
|
+
*/
|
|
647
|
+
export function buildAndSignFromPrivateKey(request_json) {
|
|
648
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
649
|
+
const len0 = WASM_VECTOR_LEN;
|
|
650
|
+
const ret = wasm.buildAndSignFromPrivateKey(ptr0, len0);
|
|
651
|
+
if (ret[3]) {
|
|
652
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
653
|
+
}
|
|
654
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
655
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
656
|
+
return v2;
|
|
657
|
+
}
|
|
658
|
+
|
|
659
|
+
/**
|
|
660
|
+
* @param {string} request_json
|
|
661
|
+
* @returns {string}
|
|
662
|
+
*/
|
|
663
|
+
export function deriveAddress(request_json) {
|
|
664
|
+
let deferred3_0;
|
|
665
|
+
let deferred3_1;
|
|
666
|
+
try {
|
|
667
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
668
|
+
const len0 = WASM_VECTOR_LEN;
|
|
669
|
+
const ret = wasm.deriveAddress(ptr0, len0);
|
|
670
|
+
var ptr2 = ret[0];
|
|
671
|
+
var len2 = ret[1];
|
|
672
|
+
if (ret[3]) {
|
|
673
|
+
ptr2 = 0; len2 = 0;
|
|
674
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
675
|
+
}
|
|
676
|
+
deferred3_0 = ptr2;
|
|
677
|
+
deferred3_1 = len2;
|
|
678
|
+
return getStringFromWasm0(ptr2, len2);
|
|
679
|
+
} finally {
|
|
680
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
|
|
684
|
+
/**
|
|
685
|
+
* @param {string} request_json
|
|
686
|
+
* @returns {string}
|
|
687
|
+
*/
|
|
688
|
+
export function deriveAddressFromPrivateKey(request_json) {
|
|
689
|
+
let deferred3_0;
|
|
690
|
+
let deferred3_1;
|
|
691
|
+
try {
|
|
692
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
693
|
+
const len0 = WASM_VECTOR_LEN;
|
|
694
|
+
const ret = wasm.deriveAddressFromPrivateKey(ptr0, len0);
|
|
695
|
+
var ptr2 = ret[0];
|
|
696
|
+
var len2 = ret[1];
|
|
697
|
+
if (ret[3]) {
|
|
698
|
+
ptr2 = 0; len2 = 0;
|
|
699
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
700
|
+
}
|
|
701
|
+
deferred3_0 = ptr2;
|
|
702
|
+
deferred3_1 = len2;
|
|
703
|
+
return getStringFromWasm0(ptr2, len2);
|
|
704
|
+
} finally {
|
|
705
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
|
|
709
|
+
/**
|
|
710
|
+
* @param {string} request_json
|
|
711
|
+
* @returns {string}
|
|
712
|
+
*/
|
|
713
|
+
export function deriveWallet(request_json) {
|
|
714
|
+
let deferred3_0;
|
|
715
|
+
let deferred3_1;
|
|
716
|
+
try {
|
|
717
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
718
|
+
const len0 = WASM_VECTOR_LEN;
|
|
719
|
+
const ret = wasm.deriveWallet(ptr0, len0);
|
|
720
|
+
var ptr2 = ret[0];
|
|
721
|
+
var len2 = ret[1];
|
|
722
|
+
if (ret[3]) {
|
|
723
|
+
ptr2 = 0; len2 = 0;
|
|
724
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
725
|
+
}
|
|
726
|
+
deferred3_0 = ptr2;
|
|
727
|
+
deferred3_1 = len2;
|
|
728
|
+
return getStringFromWasm0(ptr2, len2);
|
|
729
|
+
} finally {
|
|
730
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
731
|
+
}
|
|
732
|
+
}
|
|
733
|
+
|
|
734
|
+
/**
|
|
735
|
+
* @param {string} request_json
|
|
736
|
+
* @returns {string}
|
|
737
|
+
*/
|
|
738
|
+
export function deriveWalletFromPrivateKey(request_json) {
|
|
739
|
+
let deferred3_0;
|
|
740
|
+
let deferred3_1;
|
|
741
|
+
try {
|
|
742
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
743
|
+
const len0 = WASM_VECTOR_LEN;
|
|
744
|
+
const ret = wasm.deriveWalletFromPrivateKey(ptr0, len0);
|
|
745
|
+
var ptr2 = ret[0];
|
|
746
|
+
var len2 = ret[1];
|
|
747
|
+
if (ret[3]) {
|
|
748
|
+
ptr2 = 0; len2 = 0;
|
|
749
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
750
|
+
}
|
|
751
|
+
deferred3_0 = ptr2;
|
|
752
|
+
deferred3_1 = len2;
|
|
753
|
+
return getStringFromWasm0(ptr2, len2);
|
|
754
|
+
} finally {
|
|
755
|
+
wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
|
|
759
|
+
export function init() {
|
|
760
|
+
const ret = wasm.init();
|
|
761
|
+
if (ret[1]) {
|
|
762
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
/**
|
|
767
|
+
* @param {string} chain_id
|
|
768
|
+
* @param {string} method
|
|
769
|
+
* @param {string} payload_json
|
|
770
|
+
* @returns {string}
|
|
771
|
+
*/
|
|
772
|
+
export function invokeChainExtension(chain_id, method, payload_json) {
|
|
773
|
+
let deferred5_0;
|
|
774
|
+
let deferred5_1;
|
|
775
|
+
try {
|
|
776
|
+
const ptr0 = passStringToWasm0(chain_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
777
|
+
const len0 = WASM_VECTOR_LEN;
|
|
778
|
+
const ptr1 = passStringToWasm0(method, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
779
|
+
const len1 = WASM_VECTOR_LEN;
|
|
780
|
+
const ptr2 = passStringToWasm0(payload_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
781
|
+
const len2 = WASM_VECTOR_LEN;
|
|
782
|
+
const ret = wasm.invokeChainExtension(ptr0, len0, ptr1, len1, ptr2, len2);
|
|
783
|
+
var ptr4 = ret[0];
|
|
784
|
+
var len4 = ret[1];
|
|
785
|
+
if (ret[3]) {
|
|
786
|
+
ptr4 = 0; len4 = 0;
|
|
787
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
788
|
+
}
|
|
789
|
+
deferred5_0 = ptr4;
|
|
790
|
+
deferred5_1 = len4;
|
|
791
|
+
return getStringFromWasm0(ptr4, len4);
|
|
792
|
+
} finally {
|
|
793
|
+
wasm.__wbindgen_free(deferred5_0, deferred5_1, 1);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
|
|
797
|
+
/**
|
|
798
|
+
* @returns {string}
|
|
799
|
+
*/
|
|
800
|
+
export function listChainExtensions() {
|
|
801
|
+
let deferred2_0;
|
|
802
|
+
let deferred2_1;
|
|
803
|
+
try {
|
|
804
|
+
const ret = wasm.listChainExtensions();
|
|
805
|
+
var ptr1 = ret[0];
|
|
806
|
+
var len1 = ret[1];
|
|
807
|
+
if (ret[3]) {
|
|
808
|
+
ptr1 = 0; len1 = 0;
|
|
809
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
810
|
+
}
|
|
811
|
+
deferred2_0 = ptr1;
|
|
812
|
+
deferred2_1 = len1;
|
|
813
|
+
return getStringFromWasm0(ptr1, len1);
|
|
814
|
+
} finally {
|
|
815
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
/**
|
|
820
|
+
* @returns {string}
|
|
821
|
+
*/
|
|
822
|
+
export function listSupportedChains() {
|
|
823
|
+
let deferred2_0;
|
|
824
|
+
let deferred2_1;
|
|
825
|
+
try {
|
|
826
|
+
const ret = wasm.listSupportedChains();
|
|
827
|
+
var ptr1 = ret[0];
|
|
828
|
+
var len1 = ret[1];
|
|
829
|
+
if (ret[3]) {
|
|
830
|
+
ptr1 = 0; len1 = 0;
|
|
831
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
832
|
+
}
|
|
833
|
+
deferred2_0 = ptr1;
|
|
834
|
+
deferred2_1 = len1;
|
|
835
|
+
return getStringFromWasm0(ptr1, len1);
|
|
836
|
+
} finally {
|
|
837
|
+
wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
/**
|
|
842
|
+
* @param {string} request_json
|
|
843
|
+
* @returns {Uint8Array}
|
|
844
|
+
*/
|
|
845
|
+
export function signBytes(request_json) {
|
|
846
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
847
|
+
const len0 = WASM_VECTOR_LEN;
|
|
848
|
+
const ret = wasm.signBytes(ptr0, len0);
|
|
849
|
+
if (ret[3]) {
|
|
850
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
851
|
+
}
|
|
852
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
853
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
854
|
+
return v2;
|
|
855
|
+
}
|
|
856
|
+
|
|
857
|
+
/**
|
|
858
|
+
* @param {string} request_json
|
|
859
|
+
* @returns {Uint8Array}
|
|
860
|
+
*/
|
|
861
|
+
export function signBytesFromPrivateKey(request_json) {
|
|
862
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
863
|
+
const len0 = WASM_VECTOR_LEN;
|
|
864
|
+
const ret = wasm.signBytesFromPrivateKey(ptr0, len0);
|
|
865
|
+
if (ret[3]) {
|
|
866
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
867
|
+
}
|
|
868
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
869
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
870
|
+
return v2;
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
/**
|
|
874
|
+
* @param {string} request_json
|
|
875
|
+
* @returns {Uint8Array}
|
|
876
|
+
*/
|
|
877
|
+
export function signMessage(request_json) {
|
|
878
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
879
|
+
const len0 = WASM_VECTOR_LEN;
|
|
880
|
+
const ret = wasm.signMessage(ptr0, len0);
|
|
881
|
+
if (ret[3]) {
|
|
882
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
883
|
+
}
|
|
884
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
885
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
886
|
+
return v2;
|
|
887
|
+
}
|
|
888
|
+
|
|
889
|
+
/**
|
|
890
|
+
* @param {string} request_json
|
|
891
|
+
* @returns {Uint8Array}
|
|
892
|
+
*/
|
|
893
|
+
export function signMessageFromPrivateKey(request_json) {
|
|
894
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
895
|
+
const len0 = WASM_VECTOR_LEN;
|
|
896
|
+
const ret = wasm.signMessageFromPrivateKey(ptr0, len0);
|
|
897
|
+
if (ret[3]) {
|
|
898
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
899
|
+
}
|
|
900
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
901
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
902
|
+
return v2;
|
|
903
|
+
}
|
|
904
|
+
|
|
905
|
+
/**
|
|
906
|
+
* @param {string} request_json
|
|
907
|
+
* @returns {Uint8Array}
|
|
908
|
+
*/
|
|
909
|
+
export function signTypedData(request_json) {
|
|
910
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
911
|
+
const len0 = WASM_VECTOR_LEN;
|
|
912
|
+
const ret = wasm.signTypedData(ptr0, len0);
|
|
913
|
+
if (ret[3]) {
|
|
914
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
915
|
+
}
|
|
916
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
917
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
918
|
+
return v2;
|
|
919
|
+
}
|
|
920
|
+
|
|
921
|
+
/**
|
|
922
|
+
* @param {string} request_json
|
|
923
|
+
* @returns {Uint8Array}
|
|
924
|
+
*/
|
|
925
|
+
export function signTypedDataFromPrivateKey(request_json) {
|
|
926
|
+
const ptr0 = passStringToWasm0(request_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
927
|
+
const len0 = WASM_VECTOR_LEN;
|
|
928
|
+
const ret = wasm.signTypedDataFromPrivateKey(ptr0, len0);
|
|
929
|
+
if (ret[3]) {
|
|
930
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
931
|
+
}
|
|
932
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
933
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
934
|
+
return v2;
|
|
935
|
+
}
|
|
936
|
+
export function __wbg___wbindgen_debug_string_5398f5bb970e0daa(arg0, arg1) {
|
|
937
|
+
const ret = debugString(arg1);
|
|
938
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
939
|
+
const len1 = WASM_VECTOR_LEN;
|
|
940
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
941
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
942
|
+
}
|
|
943
|
+
export function __wbg___wbindgen_is_function_3c846841762788c1(arg0) {
|
|
944
|
+
const ret = typeof(arg0) === 'function';
|
|
945
|
+
return ret;
|
|
946
|
+
}
|
|
947
|
+
export function __wbg___wbindgen_is_object_781bc9f159099513(arg0) {
|
|
948
|
+
const val = arg0;
|
|
949
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
950
|
+
return ret;
|
|
951
|
+
}
|
|
952
|
+
export function __wbg___wbindgen_is_string_7ef6b97b02428fae(arg0) {
|
|
953
|
+
const ret = typeof(arg0) === 'string';
|
|
954
|
+
return ret;
|
|
955
|
+
}
|
|
956
|
+
export function __wbg___wbindgen_is_undefined_52709e72fb9f179c(arg0) {
|
|
957
|
+
const ret = arg0 === undefined;
|
|
958
|
+
return ret;
|
|
959
|
+
}
|
|
960
|
+
export function __wbg___wbindgen_number_get_34bb9d9dcfa21373(arg0, arg1) {
|
|
961
|
+
const obj = arg1;
|
|
962
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
963
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
964
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
965
|
+
}
|
|
966
|
+
export function __wbg___wbindgen_string_get_395e606bd0ee4427(arg0, arg1) {
|
|
967
|
+
const obj = arg1;
|
|
968
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
969
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
970
|
+
var len1 = WASM_VECTOR_LEN;
|
|
971
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
972
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
973
|
+
}
|
|
974
|
+
export function __wbg___wbindgen_throw_6ddd609b62940d55(arg0, arg1) {
|
|
975
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
976
|
+
}
|
|
977
|
+
export function __wbg_call_2d781c1f4d5c0ef8() { return handleError(function (arg0, arg1, arg2) {
|
|
978
|
+
const ret = arg0.call(arg1, arg2);
|
|
979
|
+
return ret;
|
|
980
|
+
}, arguments); }
|
|
981
|
+
export function __wbg_call_e133b57c9155d22c() { return handleError(function (arg0, arg1) {
|
|
982
|
+
const ret = arg0.call(arg1);
|
|
983
|
+
return ret;
|
|
984
|
+
}, arguments); }
|
|
985
|
+
export function __wbg_crypto_38df2bab126b63dc(arg0) {
|
|
986
|
+
const ret = arg0.crypto;
|
|
987
|
+
return ret;
|
|
988
|
+
}
|
|
989
|
+
export function __wbg_done_08ce71ee07e3bd17(arg0) {
|
|
990
|
+
const ret = arg0.done;
|
|
991
|
+
return ret;
|
|
992
|
+
}
|
|
993
|
+
export function __wbg_getRandomValues_c44a50d8cfdaebeb() { return handleError(function (arg0, arg1) {
|
|
994
|
+
arg0.getRandomValues(arg1);
|
|
995
|
+
}, arguments); }
|
|
996
|
+
export function __wbg_get_326e41e095fb2575() { return handleError(function (arg0, arg1) {
|
|
997
|
+
const ret = Reflect.get(arg0, arg1);
|
|
998
|
+
return ret;
|
|
999
|
+
}, arguments); }
|
|
1000
|
+
export function __wbg_instanceof_Uint8Array_740438561a5b956d(arg0) {
|
|
1001
|
+
let result;
|
|
1002
|
+
try {
|
|
1003
|
+
result = arg0 instanceof Uint8Array;
|
|
1004
|
+
} catch (_) {
|
|
1005
|
+
result = false;
|
|
1006
|
+
}
|
|
1007
|
+
const ret = result;
|
|
1008
|
+
return ret;
|
|
1009
|
+
}
|
|
1010
|
+
export function __wbg_instruction_new(arg0) {
|
|
1011
|
+
const ret = Instruction.__wrap(arg0);
|
|
1012
|
+
return ret;
|
|
1013
|
+
}
|
|
1014
|
+
export function __wbg_isArray_33b91feb269ff46e(arg0) {
|
|
1015
|
+
const ret = Array.isArray(arg0);
|
|
1016
|
+
return ret;
|
|
1017
|
+
}
|
|
1018
|
+
export function __wbg_iterator_d8f549ec8fb061b1() {
|
|
1019
|
+
const ret = Symbol.iterator;
|
|
1020
|
+
return ret;
|
|
1021
|
+
}
|
|
1022
|
+
export function __wbg_length_ea16607d7b61445b(arg0) {
|
|
1023
|
+
const ret = arg0.length;
|
|
1024
|
+
return ret;
|
|
1025
|
+
}
|
|
1026
|
+
export function __wbg_msCrypto_bd5a034af96bcba6(arg0) {
|
|
1027
|
+
const ret = arg0.msCrypto;
|
|
1028
|
+
return ret;
|
|
1029
|
+
}
|
|
1030
|
+
export function __wbg_new_typed_bccac67128ed885a() {
|
|
1031
|
+
const ret = new Array();
|
|
1032
|
+
return ret;
|
|
1033
|
+
}
|
|
1034
|
+
export function __wbg_new_with_length_825018a1616e9e55(arg0) {
|
|
1035
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1036
|
+
return ret;
|
|
1037
|
+
}
|
|
1038
|
+
export function __wbg_next_11b99ee6237339e3() { return handleError(function (arg0) {
|
|
1039
|
+
const ret = arg0.next();
|
|
1040
|
+
return ret;
|
|
1041
|
+
}, arguments); }
|
|
1042
|
+
export function __wbg_next_e01a967809d1aa68(arg0) {
|
|
1043
|
+
const ret = arg0.next;
|
|
1044
|
+
return ret;
|
|
1045
|
+
}
|
|
1046
|
+
export function __wbg_node_84ea875411254db1(arg0) {
|
|
1047
|
+
const ret = arg0.node;
|
|
1048
|
+
return ret;
|
|
1049
|
+
}
|
|
1050
|
+
export function __wbg_process_44c7a14e11e9f69e(arg0) {
|
|
1051
|
+
const ret = arg0.process;
|
|
1052
|
+
return ret;
|
|
1053
|
+
}
|
|
1054
|
+
export function __wbg_prototypesetcall_d62e5099504357e6(arg0, arg1, arg2) {
|
|
1055
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
1056
|
+
}
|
|
1057
|
+
export function __wbg_push_e87b0e732085a946(arg0, arg1) {
|
|
1058
|
+
const ret = arg0.push(arg1);
|
|
1059
|
+
return ret;
|
|
1060
|
+
}
|
|
1061
|
+
export function __wbg_randomFillSync_6c25eac9869eb53c() { return handleError(function (arg0, arg1) {
|
|
1062
|
+
arg0.randomFillSync(arg1);
|
|
1063
|
+
}, arguments); }
|
|
1064
|
+
export function __wbg_require_b4edbdcf3e2a1ef0() { return handleError(function () {
|
|
1065
|
+
const ret = module.require;
|
|
1066
|
+
return ret;
|
|
1067
|
+
}, arguments); }
|
|
1068
|
+
export function __wbg_static_accessor_GLOBAL_8adb955bd33fac2f() {
|
|
1069
|
+
const ret = typeof global === 'undefined' ? null : global;
|
|
1070
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1071
|
+
}
|
|
1072
|
+
export function __wbg_static_accessor_GLOBAL_THIS_ad356e0db91c7913() {
|
|
1073
|
+
const ret = typeof globalThis === 'undefined' ? null : globalThis;
|
|
1074
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1075
|
+
}
|
|
1076
|
+
export function __wbg_static_accessor_SELF_f207c857566db248() {
|
|
1077
|
+
const ret = typeof self === 'undefined' ? null : self;
|
|
1078
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1079
|
+
}
|
|
1080
|
+
export function __wbg_static_accessor_WINDOW_bb9f1ba69d61b386() {
|
|
1081
|
+
const ret = typeof window === 'undefined' ? null : window;
|
|
1082
|
+
return isLikeNone(ret) ? 0 : addToExternrefTable0(ret);
|
|
1083
|
+
}
|
|
1084
|
+
export function __wbg_subarray_a068d24e39478a8a(arg0, arg1, arg2) {
|
|
1085
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1086
|
+
return ret;
|
|
1087
|
+
}
|
|
1088
|
+
export function __wbg_value_21fc78aab0322612(arg0) {
|
|
1089
|
+
const ret = arg0.value;
|
|
1090
|
+
return ret;
|
|
1091
|
+
}
|
|
1092
|
+
export function __wbg_values_736fa07770c6527d(arg0) {
|
|
1093
|
+
const ret = arg0.values();
|
|
1094
|
+
return ret;
|
|
1095
|
+
}
|
|
1096
|
+
export function __wbg_versions_276b2795b1c6a219(arg0) {
|
|
1097
|
+
const ret = arg0.versions;
|
|
1098
|
+
return ret;
|
|
1099
|
+
}
|
|
1100
|
+
export function __wbindgen_cast_0000000000000001(arg0, arg1) {
|
|
1101
|
+
// Cast intrinsic for `Ref(Slice(U8)) -> NamedExternref("Uint8Array")`.
|
|
1102
|
+
const ret = getArrayU8FromWasm0(arg0, arg1);
|
|
1103
|
+
return ret;
|
|
1104
|
+
}
|
|
1105
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
1106
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
1107
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1108
|
+
return ret;
|
|
1109
|
+
}
|
|
1110
|
+
export function __wbindgen_init_externref_table() {
|
|
1111
|
+
const table = wasm.__wbindgen_externrefs;
|
|
1112
|
+
const offset = table.grow(4);
|
|
1113
|
+
table.set(0, undefined);
|
|
1114
|
+
table.set(offset + 0, undefined);
|
|
1115
|
+
table.set(offset + 1, null);
|
|
1116
|
+
table.set(offset + 2, true);
|
|
1117
|
+
table.set(offset + 3, false);
|
|
1118
|
+
}
|
|
1119
|
+
const HashFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1120
|
+
? { register: () => {}, unregister: () => {} }
|
|
1121
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_hash_free(ptr >>> 0, 1));
|
|
1122
|
+
const InstructionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1123
|
+
? { register: () => {}, unregister: () => {} }
|
|
1124
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_instruction_free(ptr >>> 0, 1));
|
|
1125
|
+
const InstructionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1126
|
+
? { register: () => {}, unregister: () => {} }
|
|
1127
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_instructions_free(ptr >>> 0, 1));
|
|
1128
|
+
const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1129
|
+
? { register: () => {}, unregister: () => {} }
|
|
1130
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
|
|
1131
|
+
const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1132
|
+
? { register: () => {}, unregister: () => {} }
|
|
1133
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
|
|
1134
|
+
const PubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1135
|
+
? { register: () => {}, unregister: () => {} }
|
|
1136
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pubkey_free(ptr >>> 0, 1));
|
|
1137
|
+
const SystemInstructionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1138
|
+
? { register: () => {}, unregister: () => {} }
|
|
1139
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_systeminstruction_free(ptr >>> 0, 1));
|
|
1140
|
+
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1141
|
+
? { register: () => {}, unregister: () => {} }
|
|
1142
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
|
1143
|
+
|
|
1144
|
+
function addToExternrefTable0(obj) {
|
|
1145
|
+
const idx = wasm.__externref_table_alloc();
|
|
1146
|
+
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
1147
|
+
return idx;
|
|
1148
|
+
}
|
|
1149
|
+
|
|
1150
|
+
function _assertClass(instance, klass) {
|
|
1151
|
+
if (!(instance instanceof klass)) {
|
|
1152
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1156
|
+
function debugString(val) {
|
|
1157
|
+
// primitive types
|
|
1158
|
+
const type = typeof val;
|
|
1159
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
1160
|
+
return `${val}`;
|
|
1161
|
+
}
|
|
1162
|
+
if (type == 'string') {
|
|
1163
|
+
return `"${val}"`;
|
|
1164
|
+
}
|
|
1165
|
+
if (type == 'symbol') {
|
|
1166
|
+
const description = val.description;
|
|
1167
|
+
if (description == null) {
|
|
1168
|
+
return 'Symbol';
|
|
1169
|
+
} else {
|
|
1170
|
+
return `Symbol(${description})`;
|
|
1171
|
+
}
|
|
1172
|
+
}
|
|
1173
|
+
if (type == 'function') {
|
|
1174
|
+
const name = val.name;
|
|
1175
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
1176
|
+
return `Function(${name})`;
|
|
1177
|
+
} else {
|
|
1178
|
+
return 'Function';
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
// objects
|
|
1182
|
+
if (Array.isArray(val)) {
|
|
1183
|
+
const length = val.length;
|
|
1184
|
+
let debug = '[';
|
|
1185
|
+
if (length > 0) {
|
|
1186
|
+
debug += debugString(val[0]);
|
|
1187
|
+
}
|
|
1188
|
+
for(let i = 1; i < length; i++) {
|
|
1189
|
+
debug += ', ' + debugString(val[i]);
|
|
1190
|
+
}
|
|
1191
|
+
debug += ']';
|
|
1192
|
+
return debug;
|
|
1193
|
+
}
|
|
1194
|
+
// Test for built-in
|
|
1195
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
1196
|
+
let className;
|
|
1197
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
1198
|
+
className = builtInMatches[1];
|
|
1199
|
+
} else {
|
|
1200
|
+
// Failed to match the standard '[object ClassName]'
|
|
1201
|
+
return toString.call(val);
|
|
1202
|
+
}
|
|
1203
|
+
if (className == 'Object') {
|
|
1204
|
+
// we're a user defined class or Object
|
|
1205
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
1206
|
+
// easier than looping through ownProperties of `val`.
|
|
1207
|
+
try {
|
|
1208
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
1209
|
+
} catch (_) {
|
|
1210
|
+
return 'Object';
|
|
1211
|
+
}
|
|
1212
|
+
}
|
|
1213
|
+
// errors
|
|
1214
|
+
if (val instanceof Error) {
|
|
1215
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
1216
|
+
}
|
|
1217
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
1218
|
+
return className;
|
|
1219
|
+
}
|
|
1220
|
+
|
|
1221
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
1222
|
+
ptr = ptr >>> 0;
|
|
1223
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
let cachedDataViewMemory0 = null;
|
|
1227
|
+
function getDataViewMemory0() {
|
|
1228
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
1229
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
1230
|
+
}
|
|
1231
|
+
return cachedDataViewMemory0;
|
|
1232
|
+
}
|
|
1233
|
+
|
|
1234
|
+
function getStringFromWasm0(ptr, len) {
|
|
1235
|
+
ptr = ptr >>> 0;
|
|
1236
|
+
return decodeText(ptr, len);
|
|
1237
|
+
}
|
|
1238
|
+
|
|
1239
|
+
let cachedUint8ArrayMemory0 = null;
|
|
1240
|
+
function getUint8ArrayMemory0() {
|
|
1241
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
1242
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
1243
|
+
}
|
|
1244
|
+
return cachedUint8ArrayMemory0;
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
function handleError(f, args) {
|
|
1248
|
+
try {
|
|
1249
|
+
return f.apply(this, args);
|
|
1250
|
+
} catch (e) {
|
|
1251
|
+
const idx = addToExternrefTable0(e);
|
|
1252
|
+
wasm.__wbindgen_exn_store(idx);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1255
|
+
|
|
1256
|
+
function isLikeNone(x) {
|
|
1257
|
+
return x === undefined || x === null;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
1261
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
1262
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
1263
|
+
WASM_VECTOR_LEN = arg.length;
|
|
1264
|
+
return ptr;
|
|
1265
|
+
}
|
|
1266
|
+
|
|
1267
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
1268
|
+
if (realloc === undefined) {
|
|
1269
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1270
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
1271
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
1272
|
+
WASM_VECTOR_LEN = buf.length;
|
|
1273
|
+
return ptr;
|
|
1274
|
+
}
|
|
1275
|
+
|
|
1276
|
+
let len = arg.length;
|
|
1277
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
1278
|
+
|
|
1279
|
+
const mem = getUint8ArrayMemory0();
|
|
1280
|
+
|
|
1281
|
+
let offset = 0;
|
|
1282
|
+
|
|
1283
|
+
for (; offset < len; offset++) {
|
|
1284
|
+
const code = arg.charCodeAt(offset);
|
|
1285
|
+
if (code > 0x7F) break;
|
|
1286
|
+
mem[ptr + offset] = code;
|
|
1287
|
+
}
|
|
1288
|
+
if (offset !== len) {
|
|
1289
|
+
if (offset !== 0) {
|
|
1290
|
+
arg = arg.slice(offset);
|
|
1291
|
+
}
|
|
1292
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
1293
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
1294
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
1295
|
+
|
|
1296
|
+
offset += ret.written;
|
|
1297
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
1298
|
+
}
|
|
1299
|
+
|
|
1300
|
+
WASM_VECTOR_LEN = offset;
|
|
1301
|
+
return ptr;
|
|
1302
|
+
}
|
|
1303
|
+
|
|
1304
|
+
function takeFromExternrefTable0(idx) {
|
|
1305
|
+
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
1306
|
+
wasm.__externref_table_dealloc(idx);
|
|
1307
|
+
return value;
|
|
1308
|
+
}
|
|
1309
|
+
|
|
1310
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1311
|
+
cachedTextDecoder.decode();
|
|
1312
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
1313
|
+
let numBytesDecoded = 0;
|
|
1314
|
+
function decodeText(ptr, len) {
|
|
1315
|
+
numBytesDecoded += len;
|
|
1316
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
1317
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
1318
|
+
cachedTextDecoder.decode();
|
|
1319
|
+
numBytesDecoded = len;
|
|
1320
|
+
}
|
|
1321
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const cachedTextEncoder = new TextEncoder();
|
|
1325
|
+
|
|
1326
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
1327
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
1328
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
1329
|
+
view.set(buf);
|
|
1330
|
+
return {
|
|
1331
|
+
read: arg.length,
|
|
1332
|
+
written: buf.length
|
|
1333
|
+
};
|
|
1334
|
+
};
|
|
1335
|
+
}
|
|
1336
|
+
|
|
1337
|
+
let WASM_VECTOR_LEN = 0;
|
|
1338
|
+
|
|
1339
|
+
|
|
1340
|
+
let wasm;
|
|
1341
|
+
export function __wbg_set_wasm(val) {
|
|
1342
|
+
wasm = val;
|
|
1343
|
+
}
|