@gmsol-labs/gmsol-sdk 0.5.0-alpha.10
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 +122 -0
- package/index.d.ts +825 -0
- package/index.js +5 -0
- package/index_bg.js +1864 -0
- package/index_bg.wasm +0 -0
- package/package.json +28 -0
package/index_bg.js
ADDED
|
@@ -0,0 +1,1864 @@
|
|
|
1
|
+
let wasm;
|
|
2
|
+
export function __wbg_set_wasm(val) {
|
|
3
|
+
wasm = val;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
let WASM_VECTOR_LEN = 0;
|
|
8
|
+
|
|
9
|
+
let cachedUint8ArrayMemory0 = null;
|
|
10
|
+
|
|
11
|
+
function getUint8ArrayMemory0() {
|
|
12
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
13
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
14
|
+
}
|
|
15
|
+
return cachedUint8ArrayMemory0;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
|
|
19
|
+
|
|
20
|
+
let cachedTextEncoder = new lTextEncoder('utf-8');
|
|
21
|
+
|
|
22
|
+
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
23
|
+
? function (arg, view) {
|
|
24
|
+
return cachedTextEncoder.encodeInto(arg, view);
|
|
25
|
+
}
|
|
26
|
+
: function (arg, view) {
|
|
27
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
28
|
+
view.set(buf);
|
|
29
|
+
return {
|
|
30
|
+
read: arg.length,
|
|
31
|
+
written: buf.length
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
36
|
+
|
|
37
|
+
if (realloc === undefined) {
|
|
38
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
39
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
40
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
41
|
+
WASM_VECTOR_LEN = buf.length;
|
|
42
|
+
return ptr;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
let len = arg.length;
|
|
46
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
47
|
+
|
|
48
|
+
const mem = getUint8ArrayMemory0();
|
|
49
|
+
|
|
50
|
+
let offset = 0;
|
|
51
|
+
|
|
52
|
+
for (; offset < len; offset++) {
|
|
53
|
+
const code = arg.charCodeAt(offset);
|
|
54
|
+
if (code > 0x7F) break;
|
|
55
|
+
mem[ptr + offset] = code;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (offset !== len) {
|
|
59
|
+
if (offset !== 0) {
|
|
60
|
+
arg = arg.slice(offset);
|
|
61
|
+
}
|
|
62
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
63
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
64
|
+
const ret = encodeString(arg, view);
|
|
65
|
+
|
|
66
|
+
offset += ret.written;
|
|
67
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
WASM_VECTOR_LEN = offset;
|
|
71
|
+
return ptr;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
let cachedDataViewMemory0 = null;
|
|
75
|
+
|
|
76
|
+
function getDataViewMemory0() {
|
|
77
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
78
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
79
|
+
}
|
|
80
|
+
return cachedDataViewMemory0;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function addToExternrefTable0(obj) {
|
|
84
|
+
const idx = wasm.__externref_table_alloc();
|
|
85
|
+
wasm.__wbindgen_export_4.set(idx, obj);
|
|
86
|
+
return idx;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function handleError(f, args) {
|
|
90
|
+
try {
|
|
91
|
+
return f.apply(this, args);
|
|
92
|
+
} catch (e) {
|
|
93
|
+
const idx = addToExternrefTable0(e);
|
|
94
|
+
wasm.__wbindgen_exn_store(idx);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
|
|
99
|
+
|
|
100
|
+
let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
101
|
+
|
|
102
|
+
cachedTextDecoder.decode();
|
|
103
|
+
|
|
104
|
+
function getStringFromWasm0(ptr, len) {
|
|
105
|
+
ptr = ptr >>> 0;
|
|
106
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
110
|
+
ptr = ptr >>> 0;
|
|
111
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isLikeNone(x) {
|
|
115
|
+
return x === undefined || x === null;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
function debugString(val) {
|
|
119
|
+
// primitive types
|
|
120
|
+
const type = typeof val;
|
|
121
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
122
|
+
return `${val}`;
|
|
123
|
+
}
|
|
124
|
+
if (type == 'string') {
|
|
125
|
+
return `"${val}"`;
|
|
126
|
+
}
|
|
127
|
+
if (type == 'symbol') {
|
|
128
|
+
const description = val.description;
|
|
129
|
+
if (description == null) {
|
|
130
|
+
return 'Symbol';
|
|
131
|
+
} else {
|
|
132
|
+
return `Symbol(${description})`;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (type == 'function') {
|
|
136
|
+
const name = val.name;
|
|
137
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
138
|
+
return `Function(${name})`;
|
|
139
|
+
} else {
|
|
140
|
+
return 'Function';
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// objects
|
|
144
|
+
if (Array.isArray(val)) {
|
|
145
|
+
const length = val.length;
|
|
146
|
+
let debug = '[';
|
|
147
|
+
if (length > 0) {
|
|
148
|
+
debug += debugString(val[0]);
|
|
149
|
+
}
|
|
150
|
+
for(let i = 1; i < length; i++) {
|
|
151
|
+
debug += ', ' + debugString(val[i]);
|
|
152
|
+
}
|
|
153
|
+
debug += ']';
|
|
154
|
+
return debug;
|
|
155
|
+
}
|
|
156
|
+
// Test for built-in
|
|
157
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
158
|
+
let className;
|
|
159
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
160
|
+
className = builtInMatches[1];
|
|
161
|
+
} else {
|
|
162
|
+
// Failed to match the standard '[object ClassName]'
|
|
163
|
+
return toString.call(val);
|
|
164
|
+
}
|
|
165
|
+
if (className == 'Object') {
|
|
166
|
+
// we're a user defined class or Object
|
|
167
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
168
|
+
// easier than looping through ownProperties of `val`.
|
|
169
|
+
try {
|
|
170
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
171
|
+
} catch (_) {
|
|
172
|
+
return 'Object';
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// errors
|
|
176
|
+
if (val instanceof Error) {
|
|
177
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
178
|
+
}
|
|
179
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
180
|
+
return className;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
function takeFromExternrefTable0(idx) {
|
|
184
|
+
const value = wasm.__wbindgen_export_4.get(idx);
|
|
185
|
+
wasm.__externref_table_dealloc(idx);
|
|
186
|
+
return value;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function passArray8ToWasm0(arg, malloc) {
|
|
190
|
+
const ptr = malloc(arg.length * 1, 1) >>> 0;
|
|
191
|
+
getUint8ArrayMemory0().set(arg, ptr / 1);
|
|
192
|
+
WASM_VECTOR_LEN = arg.length;
|
|
193
|
+
return ptr;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
197
|
+
ptr = ptr >>> 0;
|
|
198
|
+
const mem = getDataViewMemory0();
|
|
199
|
+
const result = [];
|
|
200
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
201
|
+
result.push(wasm.__wbindgen_export_4.get(mem.getUint32(i, true)));
|
|
202
|
+
}
|
|
203
|
+
wasm.__externref_drop_slice(ptr, len);
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
208
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
209
|
+
for (let i = 0; i < array.length; i++) {
|
|
210
|
+
const add = addToExternrefTable0(array[i]);
|
|
211
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
212
|
+
}
|
|
213
|
+
WASM_VECTOR_LEN = array.length;
|
|
214
|
+
return ptr;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Build transactions for creating orders.
|
|
218
|
+
* @param {CreateOrderKind} kind
|
|
219
|
+
* @param {CreateOrderParams[]} orders
|
|
220
|
+
* @param {CreateOrderOptions} options
|
|
221
|
+
* @returns {TransactionGroup}
|
|
222
|
+
*/
|
|
223
|
+
export function create_orders(kind, orders, options) {
|
|
224
|
+
const ptr0 = passArrayJsValueToWasm0(orders, wasm.__wbindgen_malloc);
|
|
225
|
+
const len0 = WASM_VECTOR_LEN;
|
|
226
|
+
const ret = wasm.create_orders(kind, ptr0, len0, options);
|
|
227
|
+
if (ret[2]) {
|
|
228
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
229
|
+
}
|
|
230
|
+
return TransactionGroup.__wrap(ret[0]);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
function _assertClass(instance, klass) {
|
|
234
|
+
if (!(instance instanceof klass)) {
|
|
235
|
+
throw new Error(`expected instance of ${klass.name}`);
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Apply `factor` to the `value`.
|
|
240
|
+
* @param {bigint} value
|
|
241
|
+
* @param {bigint} factor
|
|
242
|
+
* @returns {bigint | undefined}
|
|
243
|
+
*/
|
|
244
|
+
export function apply_factor(value, factor) {
|
|
245
|
+
const ret = wasm.apply_factor(value, value >> BigInt(64), factor, factor >> BigInt(64));
|
|
246
|
+
return ret[0] === 0 ? undefined : (BigInt.asUintN(64, ret[1]) | (BigInt.asUintN(64, ret[2]) << BigInt(64)));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Initialize Javascript logging and panic handler
|
|
251
|
+
*/
|
|
252
|
+
export function solana_program_init() {
|
|
253
|
+
wasm.solana_program_init();
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
const HashFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
257
|
+
? { register: () => {}, unregister: () => {} }
|
|
258
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_hash_free(ptr >>> 0, 1));
|
|
259
|
+
/**
|
|
260
|
+
* A hash; the 32-byte output of a hashing algorithm.
|
|
261
|
+
*
|
|
262
|
+
* This struct is used most often in `solana-sdk` and related crates to contain
|
|
263
|
+
* a [SHA-256] hash, but may instead contain a [blake3] hash, as created by the
|
|
264
|
+
* [`blake3`] module (and used in [`Message::hash`]).
|
|
265
|
+
*
|
|
266
|
+
* [SHA-256]: https://en.wikipedia.org/wiki/SHA-2
|
|
267
|
+
* [blake3]: https://github.com/BLAKE3-team/BLAKE3
|
|
268
|
+
* [`blake3`]: crate::blake3
|
|
269
|
+
* [`Message::hash`]: crate::message::Message::hash
|
|
270
|
+
*/
|
|
271
|
+
export class Hash {
|
|
272
|
+
|
|
273
|
+
static __wrap(ptr) {
|
|
274
|
+
ptr = ptr >>> 0;
|
|
275
|
+
const obj = Object.create(Hash.prototype);
|
|
276
|
+
obj.__wbg_ptr = ptr;
|
|
277
|
+
HashFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
278
|
+
return obj;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
__destroy_into_raw() {
|
|
282
|
+
const ptr = this.__wbg_ptr;
|
|
283
|
+
this.__wbg_ptr = 0;
|
|
284
|
+
HashFinalization.unregister(this);
|
|
285
|
+
return ptr;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
free() {
|
|
289
|
+
const ptr = this.__destroy_into_raw();
|
|
290
|
+
wasm.__wbg_hash_free(ptr, 0);
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Create a new Hash object
|
|
294
|
+
*
|
|
295
|
+
* * `value` - optional hash as a base58 encoded string, `Uint8Array`, `[number]`
|
|
296
|
+
* @param {any} value
|
|
297
|
+
*/
|
|
298
|
+
constructor(value) {
|
|
299
|
+
const ret = wasm.hash_constructor(value);
|
|
300
|
+
if (ret[2]) {
|
|
301
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
302
|
+
}
|
|
303
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
304
|
+
HashFinalization.register(this, this.__wbg_ptr, this);
|
|
305
|
+
return this;
|
|
306
|
+
}
|
|
307
|
+
/**
|
|
308
|
+
* Return the base58 string representation of the hash
|
|
309
|
+
* @returns {string}
|
|
310
|
+
*/
|
|
311
|
+
toString() {
|
|
312
|
+
let deferred1_0;
|
|
313
|
+
let deferred1_1;
|
|
314
|
+
try {
|
|
315
|
+
const ret = wasm.hash_toString(this.__wbg_ptr);
|
|
316
|
+
deferred1_0 = ret[0];
|
|
317
|
+
deferred1_1 = ret[1];
|
|
318
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
319
|
+
} finally {
|
|
320
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
321
|
+
}
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Checks if two `Hash`s are equal
|
|
325
|
+
* @param {Hash} other
|
|
326
|
+
* @returns {boolean}
|
|
327
|
+
*/
|
|
328
|
+
equals(other) {
|
|
329
|
+
_assertClass(other, Hash);
|
|
330
|
+
const ret = wasm.hash_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
331
|
+
return ret !== 0;
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Return the `Uint8Array` representation of the hash
|
|
335
|
+
* @returns {Uint8Array}
|
|
336
|
+
*/
|
|
337
|
+
toBytes() {
|
|
338
|
+
const ret = wasm.hash_toBytes(this.__wbg_ptr);
|
|
339
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
340
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
341
|
+
return v1;
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
const InstructionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
346
|
+
? { register: () => {}, unregister: () => {} }
|
|
347
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_instruction_free(ptr >>> 0, 1));
|
|
348
|
+
/**
|
|
349
|
+
* A directive for a single invocation of a Solana program.
|
|
350
|
+
*
|
|
351
|
+
* An instruction specifies which program it is calling, which accounts it may
|
|
352
|
+
* read or modify, and additional data that serves as input to the program. One
|
|
353
|
+
* or more instructions are included in transactions submitted by Solana
|
|
354
|
+
* clients. Instructions are also used to describe [cross-program
|
|
355
|
+
* invocations][cpi].
|
|
356
|
+
*
|
|
357
|
+
* [cpi]: https://solana.com/docs/core/cpi
|
|
358
|
+
*
|
|
359
|
+
* During execution, a program will receive a list of account data as one of
|
|
360
|
+
* its arguments, in the same order as specified during `Instruction`
|
|
361
|
+
* construction.
|
|
362
|
+
*
|
|
363
|
+
* While Solana is agnostic to the format of the instruction data, it has
|
|
364
|
+
* built-in support for serialization via [`borsh`] and [`bincode`].
|
|
365
|
+
*
|
|
366
|
+
* [`borsh`]: https://docs.rs/borsh/latest/borsh/
|
|
367
|
+
* [`bincode`]: https://docs.rs/bincode/latest/bincode/
|
|
368
|
+
*
|
|
369
|
+
* # Specifying account metadata
|
|
370
|
+
*
|
|
371
|
+
* When constructing an [`Instruction`], a list of all accounts that may be
|
|
372
|
+
* read or written during the execution of that instruction must be supplied as
|
|
373
|
+
* [`AccountMeta`] values.
|
|
374
|
+
*
|
|
375
|
+
* Any account whose data may be mutated by the program during execution must
|
|
376
|
+
* be specified as writable. During execution, writing to an account that was
|
|
377
|
+
* not specified as writable will cause the transaction to fail. Writing to an
|
|
378
|
+
* account that is not owned by the program will cause the transaction to fail.
|
|
379
|
+
*
|
|
380
|
+
* Any account whose lamport balance may be mutated by the program during
|
|
381
|
+
* execution must be specified as writable. During execution, mutating the
|
|
382
|
+
* lamports of an account that was not specified as writable will cause the
|
|
383
|
+
* transaction to fail. While _subtracting_ lamports from an account not owned
|
|
384
|
+
* by the program will cause the transaction to fail, _adding_ lamports to any
|
|
385
|
+
* account is allowed, as long is it is mutable.
|
|
386
|
+
*
|
|
387
|
+
* Accounts that are not read or written by the program may still be specified
|
|
388
|
+
* in an `Instruction`'s account list. These will affect scheduling of program
|
|
389
|
+
* execution by the runtime, but will otherwise be ignored.
|
|
390
|
+
*
|
|
391
|
+
* When building a transaction, the Solana runtime coalesces all accounts used
|
|
392
|
+
* by all instructions in that transaction, along with accounts and permissions
|
|
393
|
+
* required by the runtime, into a single account list. Some accounts and
|
|
394
|
+
* account permissions required by the runtime to process a transaction are
|
|
395
|
+
* _not_ required to be included in an `Instruction`s account list. These
|
|
396
|
+
* include:
|
|
397
|
+
*
|
|
398
|
+
* - The program ID — it is a separate field of `Instruction`
|
|
399
|
+
* - The transaction's fee-paying account — it is added during [`Message`]
|
|
400
|
+
* construction. A program may still require the fee payer as part of the
|
|
401
|
+
* account list if it directly references it.
|
|
402
|
+
*
|
|
403
|
+
* [`Message`]: crate::message::Message
|
|
404
|
+
*
|
|
405
|
+
* Programs may require signatures from some accounts, in which case they
|
|
406
|
+
* should be specified as signers during `Instruction` construction. The
|
|
407
|
+
* program must still validate during execution that the account is a signer.
|
|
408
|
+
*/
|
|
409
|
+
export class Instruction {
|
|
410
|
+
|
|
411
|
+
static __wrap(ptr) {
|
|
412
|
+
ptr = ptr >>> 0;
|
|
413
|
+
const obj = Object.create(Instruction.prototype);
|
|
414
|
+
obj.__wbg_ptr = ptr;
|
|
415
|
+
InstructionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
416
|
+
return obj;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
__destroy_into_raw() {
|
|
420
|
+
const ptr = this.__wbg_ptr;
|
|
421
|
+
this.__wbg_ptr = 0;
|
|
422
|
+
InstructionFinalization.unregister(this);
|
|
423
|
+
return ptr;
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
free() {
|
|
427
|
+
const ptr = this.__destroy_into_raw();
|
|
428
|
+
wasm.__wbg_instruction_free(ptr, 0);
|
|
429
|
+
}
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
const InstructionsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
433
|
+
? { register: () => {}, unregister: () => {} }
|
|
434
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_instructions_free(ptr >>> 0, 1));
|
|
435
|
+
|
|
436
|
+
export class Instructions {
|
|
437
|
+
|
|
438
|
+
__destroy_into_raw() {
|
|
439
|
+
const ptr = this.__wbg_ptr;
|
|
440
|
+
this.__wbg_ptr = 0;
|
|
441
|
+
InstructionsFinalization.unregister(this);
|
|
442
|
+
return ptr;
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
free() {
|
|
446
|
+
const ptr = this.__destroy_into_raw();
|
|
447
|
+
wasm.__wbg_instructions_free(ptr, 0);
|
|
448
|
+
}
|
|
449
|
+
constructor() {
|
|
450
|
+
const ret = wasm.instructions_constructor();
|
|
451
|
+
this.__wbg_ptr = ret >>> 0;
|
|
452
|
+
InstructionsFinalization.register(this, this.__wbg_ptr, this);
|
|
453
|
+
return this;
|
|
454
|
+
}
|
|
455
|
+
/**
|
|
456
|
+
* @param {Instruction} instruction
|
|
457
|
+
*/
|
|
458
|
+
push(instruction) {
|
|
459
|
+
_assertClass(instruction, Instruction);
|
|
460
|
+
var ptr0 = instruction.__destroy_into_raw();
|
|
461
|
+
wasm.instructions_push(this.__wbg_ptr, ptr0);
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const KeypairFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
466
|
+
? { register: () => {}, unregister: () => {} }
|
|
467
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_keypair_free(ptr >>> 0, 1));
|
|
468
|
+
/**
|
|
469
|
+
* A vanilla Ed25519 key pair
|
|
470
|
+
*/
|
|
471
|
+
export class Keypair {
|
|
472
|
+
|
|
473
|
+
static __wrap(ptr) {
|
|
474
|
+
ptr = ptr >>> 0;
|
|
475
|
+
const obj = Object.create(Keypair.prototype);
|
|
476
|
+
obj.__wbg_ptr = ptr;
|
|
477
|
+
KeypairFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
478
|
+
return obj;
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
__destroy_into_raw() {
|
|
482
|
+
const ptr = this.__wbg_ptr;
|
|
483
|
+
this.__wbg_ptr = 0;
|
|
484
|
+
KeypairFinalization.unregister(this);
|
|
485
|
+
return ptr;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
free() {
|
|
489
|
+
const ptr = this.__destroy_into_raw();
|
|
490
|
+
wasm.__wbg_keypair_free(ptr, 0);
|
|
491
|
+
}
|
|
492
|
+
/**
|
|
493
|
+
* Create a new `Keypair `
|
|
494
|
+
*/
|
|
495
|
+
constructor() {
|
|
496
|
+
const ret = wasm.keypair_constructor();
|
|
497
|
+
this.__wbg_ptr = ret >>> 0;
|
|
498
|
+
KeypairFinalization.register(this, this.__wbg_ptr, this);
|
|
499
|
+
return this;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Convert a `Keypair` to a `Uint8Array`
|
|
503
|
+
* @returns {Uint8Array}
|
|
504
|
+
*/
|
|
505
|
+
toBytes() {
|
|
506
|
+
const ret = wasm.keypair_toBytes(this.__wbg_ptr);
|
|
507
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
508
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
509
|
+
return v1;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Recover a `Keypair` from a `Uint8Array`
|
|
513
|
+
* @param {Uint8Array} bytes
|
|
514
|
+
* @returns {Keypair}
|
|
515
|
+
*/
|
|
516
|
+
static fromBytes(bytes) {
|
|
517
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
518
|
+
const len0 = WASM_VECTOR_LEN;
|
|
519
|
+
const ret = wasm.keypair_fromBytes(ptr0, len0);
|
|
520
|
+
if (ret[2]) {
|
|
521
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
522
|
+
}
|
|
523
|
+
return Keypair.__wrap(ret[0]);
|
|
524
|
+
}
|
|
525
|
+
/**
|
|
526
|
+
* Return the `Pubkey` for this `Keypair`
|
|
527
|
+
* @returns {Pubkey}
|
|
528
|
+
*/
|
|
529
|
+
pubkey() {
|
|
530
|
+
const ret = wasm.keypair_pubkey(this.__wbg_ptr);
|
|
531
|
+
return Pubkey.__wrap(ret);
|
|
532
|
+
}
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
const MarketFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
536
|
+
? { register: () => {}, unregister: () => {} }
|
|
537
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_market_free(ptr >>> 0, 1));
|
|
538
|
+
/**
|
|
539
|
+
* Wrapper of [`Market`].
|
|
540
|
+
*/
|
|
541
|
+
export class Market {
|
|
542
|
+
|
|
543
|
+
static __wrap(ptr) {
|
|
544
|
+
ptr = ptr >>> 0;
|
|
545
|
+
const obj = Object.create(Market.prototype);
|
|
546
|
+
obj.__wbg_ptr = ptr;
|
|
547
|
+
MarketFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
548
|
+
return obj;
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
__destroy_into_raw() {
|
|
552
|
+
const ptr = this.__wbg_ptr;
|
|
553
|
+
this.__wbg_ptr = 0;
|
|
554
|
+
MarketFinalization.unregister(this);
|
|
555
|
+
return ptr;
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
free() {
|
|
559
|
+
const ptr = this.__destroy_into_raw();
|
|
560
|
+
wasm.__wbg_market_free(ptr, 0);
|
|
561
|
+
}
|
|
562
|
+
/**
|
|
563
|
+
* Create from base64 encoded account data.
|
|
564
|
+
* @param {string} data
|
|
565
|
+
* @returns {Market}
|
|
566
|
+
*/
|
|
567
|
+
static decode_from_base64(data) {
|
|
568
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
569
|
+
const len0 = WASM_VECTOR_LEN;
|
|
570
|
+
const ret = wasm.market_decode_from_base64(ptr0, len0);
|
|
571
|
+
if (ret[2]) {
|
|
572
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
573
|
+
}
|
|
574
|
+
return Market.__wrap(ret[0]);
|
|
575
|
+
}
|
|
576
|
+
/**
|
|
577
|
+
* Create from account data.
|
|
578
|
+
* @param {Uint8Array} data
|
|
579
|
+
* @returns {Market}
|
|
580
|
+
*/
|
|
581
|
+
static decode(data) {
|
|
582
|
+
const ptr0 = passArray8ToWasm0(data, wasm.__wbindgen_malloc);
|
|
583
|
+
const len0 = WASM_VECTOR_LEN;
|
|
584
|
+
const ret = wasm.market_decode(ptr0, len0);
|
|
585
|
+
if (ret[2]) {
|
|
586
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
587
|
+
}
|
|
588
|
+
return Market.__wrap(ret[0]);
|
|
589
|
+
}
|
|
590
|
+
/**
|
|
591
|
+
* Convert into [`JsMarketModel`]
|
|
592
|
+
* @param {bigint} supply
|
|
593
|
+
* @returns {MarketModel}
|
|
594
|
+
*/
|
|
595
|
+
to_model(supply) {
|
|
596
|
+
const ret = wasm.market_to_model(this.__wbg_ptr, supply);
|
|
597
|
+
return MarketModel.__wrap(ret);
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
|
|
601
|
+
const MarketGraphFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
602
|
+
? { register: () => {}, unregister: () => {} }
|
|
603
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_marketgraph_free(ptr >>> 0, 1));
|
|
604
|
+
/**
|
|
605
|
+
* A JS binding for [`MarkegGraph`].
|
|
606
|
+
*/
|
|
607
|
+
export class MarketGraph {
|
|
608
|
+
|
|
609
|
+
__destroy_into_raw() {
|
|
610
|
+
const ptr = this.__wbg_ptr;
|
|
611
|
+
this.__wbg_ptr = 0;
|
|
612
|
+
MarketGraphFinalization.unregister(this);
|
|
613
|
+
return ptr;
|
|
614
|
+
}
|
|
615
|
+
|
|
616
|
+
free() {
|
|
617
|
+
const ptr = this.__destroy_into_raw();
|
|
618
|
+
wasm.__wbg_marketgraph_free(ptr, 0);
|
|
619
|
+
}
|
|
620
|
+
/**
|
|
621
|
+
* Create an empty market graph.
|
|
622
|
+
* @param {MarketGraphConfig} config
|
|
623
|
+
*/
|
|
624
|
+
constructor(config) {
|
|
625
|
+
const ret = wasm.marketgraph_new(config);
|
|
626
|
+
this.__wbg_ptr = ret >>> 0;
|
|
627
|
+
MarketGraphFinalization.register(this, this.__wbg_ptr, this);
|
|
628
|
+
return this;
|
|
629
|
+
}
|
|
630
|
+
/**
|
|
631
|
+
* Insert market from base64 encoded data.
|
|
632
|
+
* @param {string} data
|
|
633
|
+
* @param {bigint} supply
|
|
634
|
+
* @returns {boolean}
|
|
635
|
+
*/
|
|
636
|
+
insert_market_from_base64(data, supply) {
|
|
637
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
638
|
+
const len0 = WASM_VECTOR_LEN;
|
|
639
|
+
const ret = wasm.marketgraph_insert_market_from_base64(this.__wbg_ptr, ptr0, len0, supply);
|
|
640
|
+
if (ret[2]) {
|
|
641
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
642
|
+
}
|
|
643
|
+
return ret[0] !== 0;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Update token price.
|
|
647
|
+
* @param {string} token
|
|
648
|
+
* @param {Value} price
|
|
649
|
+
*/
|
|
650
|
+
update_token_price(token, price) {
|
|
651
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
652
|
+
const len0 = WASM_VECTOR_LEN;
|
|
653
|
+
const ret = wasm.marketgraph_update_token_price(this.__wbg_ptr, ptr0, len0, price);
|
|
654
|
+
if (ret[1]) {
|
|
655
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
/**
|
|
659
|
+
* Update value.
|
|
660
|
+
* @param {bigint} value
|
|
661
|
+
*/
|
|
662
|
+
update_value(value) {
|
|
663
|
+
wasm.marketgraph_update_value(this.__wbg_ptr, value, value >> BigInt(64));
|
|
664
|
+
}
|
|
665
|
+
/**
|
|
666
|
+
* Update base cost.
|
|
667
|
+
* @param {bigint} base_cost
|
|
668
|
+
*/
|
|
669
|
+
update_base_cost(base_cost) {
|
|
670
|
+
wasm.marketgraph_update_base_cost(this.__wbg_ptr, base_cost, base_cost >> BigInt(64));
|
|
671
|
+
}
|
|
672
|
+
/**
|
|
673
|
+
* Update max steps.
|
|
674
|
+
* @param {number} max_steps
|
|
675
|
+
*/
|
|
676
|
+
update_max_steps(max_steps) {
|
|
677
|
+
wasm.marketgraph_update_max_steps(this.__wbg_ptr, max_steps);
|
|
678
|
+
}
|
|
679
|
+
/**
|
|
680
|
+
* Get market by its market token.
|
|
681
|
+
* @param {string} market_token
|
|
682
|
+
* @returns {MarketModel | undefined}
|
|
683
|
+
*/
|
|
684
|
+
get_market(market_token) {
|
|
685
|
+
const ptr0 = passStringToWasm0(market_token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
686
|
+
const len0 = WASM_VECTOR_LEN;
|
|
687
|
+
const ret = wasm.marketgraph_get_market(this.__wbg_ptr, ptr0, len0);
|
|
688
|
+
if (ret[2]) {
|
|
689
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
690
|
+
}
|
|
691
|
+
return ret[0] === 0 ? undefined : MarketModel.__wrap(ret[0]);
|
|
692
|
+
}
|
|
693
|
+
/**
|
|
694
|
+
* Get all market tokens.
|
|
695
|
+
* @returns {string[]}
|
|
696
|
+
*/
|
|
697
|
+
market_tokens() {
|
|
698
|
+
const ret = wasm.marketgraph_market_tokens(this.__wbg_ptr);
|
|
699
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
700
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
701
|
+
return v1;
|
|
702
|
+
}
|
|
703
|
+
/**
|
|
704
|
+
* Get all index tokens.
|
|
705
|
+
* @returns {string[]}
|
|
706
|
+
*/
|
|
707
|
+
index_tokens() {
|
|
708
|
+
const ret = wasm.marketgraph_index_tokens(this.__wbg_ptr);
|
|
709
|
+
var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]).slice();
|
|
710
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
|
|
711
|
+
return v1;
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Compute best swap path.
|
|
715
|
+
* @param {string} source
|
|
716
|
+
* @param {string} target
|
|
717
|
+
* @param {boolean} skip_bellman_ford
|
|
718
|
+
* @returns {BestSwapPath}
|
|
719
|
+
*/
|
|
720
|
+
best_swap_path(source, target, skip_bellman_ford) {
|
|
721
|
+
const ptr0 = passStringToWasm0(source, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
722
|
+
const len0 = WASM_VECTOR_LEN;
|
|
723
|
+
const ptr1 = passStringToWasm0(target, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
724
|
+
const len1 = WASM_VECTOR_LEN;
|
|
725
|
+
const ret = wasm.marketgraph_best_swap_path(this.__wbg_ptr, ptr0, len0, ptr1, len1, skip_bellman_ford);
|
|
726
|
+
if (ret[2]) {
|
|
727
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
728
|
+
}
|
|
729
|
+
return takeFromExternrefTable0(ret[0]);
|
|
730
|
+
}
|
|
731
|
+
}
|
|
732
|
+
|
|
733
|
+
const MarketModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
734
|
+
? { register: () => {}, unregister: () => {} }
|
|
735
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_marketmodel_free(ptr >>> 0, 1));
|
|
736
|
+
/**
|
|
737
|
+
* Wrapper of [`MarketModel`].
|
|
738
|
+
*/
|
|
739
|
+
export class MarketModel {
|
|
740
|
+
|
|
741
|
+
static __wrap(ptr) {
|
|
742
|
+
ptr = ptr >>> 0;
|
|
743
|
+
const obj = Object.create(MarketModel.prototype);
|
|
744
|
+
obj.__wbg_ptr = ptr;
|
|
745
|
+
MarketModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
746
|
+
return obj;
|
|
747
|
+
}
|
|
748
|
+
|
|
749
|
+
__destroy_into_raw() {
|
|
750
|
+
const ptr = this.__wbg_ptr;
|
|
751
|
+
this.__wbg_ptr = 0;
|
|
752
|
+
MarketModelFinalization.unregister(this);
|
|
753
|
+
return ptr;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
free() {
|
|
757
|
+
const ptr = this.__destroy_into_raw();
|
|
758
|
+
wasm.__wbg_marketmodel_free(ptr, 0);
|
|
759
|
+
}
|
|
760
|
+
/**
|
|
761
|
+
* Get market token price.
|
|
762
|
+
* @param {MarketTokenPriceParams} params
|
|
763
|
+
* @returns {bigint}
|
|
764
|
+
*/
|
|
765
|
+
market_token_price(params) {
|
|
766
|
+
const ret = wasm.marketmodel_market_token_price(this.__wbg_ptr, params);
|
|
767
|
+
if (ret[3]) {
|
|
768
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
769
|
+
}
|
|
770
|
+
return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
|
|
771
|
+
}
|
|
772
|
+
/**
|
|
773
|
+
* Get market status.
|
|
774
|
+
* @param {MarketStatusParams} params
|
|
775
|
+
* @returns {MarketStatus}
|
|
776
|
+
*/
|
|
777
|
+
status(params) {
|
|
778
|
+
const ret = wasm.marketmodel_status(this.__wbg_ptr, params);
|
|
779
|
+
if (ret[2]) {
|
|
780
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
781
|
+
}
|
|
782
|
+
return takeFromExternrefTable0(ret[0]);
|
|
783
|
+
}
|
|
784
|
+
}
|
|
785
|
+
|
|
786
|
+
const MessageFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
787
|
+
? { register: () => {}, unregister: () => {} }
|
|
788
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_message_free(ptr >>> 0, 1));
|
|
789
|
+
/**
|
|
790
|
+
* A Solana transaction message (legacy).
|
|
791
|
+
*
|
|
792
|
+
* See the [`message`] module documentation for further description.
|
|
793
|
+
*
|
|
794
|
+
* [`message`]: crate::message
|
|
795
|
+
*
|
|
796
|
+
* Some constructors accept an optional `payer`, the account responsible for
|
|
797
|
+
* paying the cost of executing a transaction. In most cases, callers should
|
|
798
|
+
* specify the payer explicitly in these constructors. In some cases though,
|
|
799
|
+
* the caller is not _required_ to specify the payer, but is still allowed to:
|
|
800
|
+
* in the `Message` structure, the first account is always the fee-payer, so if
|
|
801
|
+
* the caller has knowledge that the first account of the constructed
|
|
802
|
+
* transaction's `Message` is both a signer and the expected fee-payer, then
|
|
803
|
+
* redundantly specifying the fee-payer is not strictly required.
|
|
804
|
+
*/
|
|
805
|
+
export class Message {
|
|
806
|
+
|
|
807
|
+
static __wrap(ptr) {
|
|
808
|
+
ptr = ptr >>> 0;
|
|
809
|
+
const obj = Object.create(Message.prototype);
|
|
810
|
+
obj.__wbg_ptr = ptr;
|
|
811
|
+
MessageFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
812
|
+
return obj;
|
|
813
|
+
}
|
|
814
|
+
|
|
815
|
+
__destroy_into_raw() {
|
|
816
|
+
const ptr = this.__wbg_ptr;
|
|
817
|
+
this.__wbg_ptr = 0;
|
|
818
|
+
MessageFinalization.unregister(this);
|
|
819
|
+
return ptr;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
free() {
|
|
823
|
+
const ptr = this.__destroy_into_raw();
|
|
824
|
+
wasm.__wbg_message_free(ptr, 0);
|
|
825
|
+
}
|
|
826
|
+
/**
|
|
827
|
+
* The id of a recent ledger entry.
|
|
828
|
+
* @returns {Hash}
|
|
829
|
+
*/
|
|
830
|
+
get recent_blockhash() {
|
|
831
|
+
const ret = wasm.__wbg_get_message_recent_blockhash(this.__wbg_ptr);
|
|
832
|
+
return Hash.__wrap(ret);
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* The id of a recent ledger entry.
|
|
836
|
+
* @param {Hash} arg0
|
|
837
|
+
*/
|
|
838
|
+
set recent_blockhash(arg0) {
|
|
839
|
+
_assertClass(arg0, Hash);
|
|
840
|
+
var ptr0 = arg0.__destroy_into_raw();
|
|
841
|
+
wasm.__wbg_set_message_recent_blockhash(this.__wbg_ptr, ptr0);
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
|
|
845
|
+
const PositionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
846
|
+
? { register: () => {}, unregister: () => {} }
|
|
847
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_position_free(ptr >>> 0, 1));
|
|
848
|
+
/**
|
|
849
|
+
* JS version of [`Position`].
|
|
850
|
+
*/
|
|
851
|
+
export class Position {
|
|
852
|
+
|
|
853
|
+
static __wrap(ptr) {
|
|
854
|
+
ptr = ptr >>> 0;
|
|
855
|
+
const obj = Object.create(Position.prototype);
|
|
856
|
+
obj.__wbg_ptr = ptr;
|
|
857
|
+
PositionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
858
|
+
return obj;
|
|
859
|
+
}
|
|
860
|
+
|
|
861
|
+
__destroy_into_raw() {
|
|
862
|
+
const ptr = this.__wbg_ptr;
|
|
863
|
+
this.__wbg_ptr = 0;
|
|
864
|
+
PositionFinalization.unregister(this);
|
|
865
|
+
return ptr;
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
free() {
|
|
869
|
+
const ptr = this.__destroy_into_raw();
|
|
870
|
+
wasm.__wbg_position_free(ptr, 0);
|
|
871
|
+
}
|
|
872
|
+
/**
|
|
873
|
+
* Create from base64 encoded account data.
|
|
874
|
+
* @param {string} data
|
|
875
|
+
* @returns {Position}
|
|
876
|
+
*/
|
|
877
|
+
static decode_from_base64(data) {
|
|
878
|
+
const ptr0 = passStringToWasm0(data, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
879
|
+
const len0 = WASM_VECTOR_LEN;
|
|
880
|
+
const ret = wasm.position_decode_from_base64(ptr0, len0);
|
|
881
|
+
if (ret[2]) {
|
|
882
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
883
|
+
}
|
|
884
|
+
return Position.__wrap(ret[0]);
|
|
885
|
+
}
|
|
886
|
+
/**
|
|
887
|
+
* Convert to a [`JsPositionModel`].
|
|
888
|
+
* @param {MarketModel} market
|
|
889
|
+
* @returns {PositionModel}
|
|
890
|
+
*/
|
|
891
|
+
to_model(market) {
|
|
892
|
+
_assertClass(market, MarketModel);
|
|
893
|
+
const ret = wasm.position_to_model(this.__wbg_ptr, market.__wbg_ptr);
|
|
894
|
+
if (ret[2]) {
|
|
895
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
896
|
+
}
|
|
897
|
+
return PositionModel.__wrap(ret[0]);
|
|
898
|
+
}
|
|
899
|
+
}
|
|
900
|
+
|
|
901
|
+
const PositionModelFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
902
|
+
? { register: () => {}, unregister: () => {} }
|
|
903
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_positionmodel_free(ptr >>> 0, 1));
|
|
904
|
+
/**
|
|
905
|
+
* JS version of [`PositionModel`].
|
|
906
|
+
*/
|
|
907
|
+
export class PositionModel {
|
|
908
|
+
|
|
909
|
+
static __wrap(ptr) {
|
|
910
|
+
ptr = ptr >>> 0;
|
|
911
|
+
const obj = Object.create(PositionModel.prototype);
|
|
912
|
+
obj.__wbg_ptr = ptr;
|
|
913
|
+
PositionModelFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
914
|
+
return obj;
|
|
915
|
+
}
|
|
916
|
+
|
|
917
|
+
__destroy_into_raw() {
|
|
918
|
+
const ptr = this.__wbg_ptr;
|
|
919
|
+
this.__wbg_ptr = 0;
|
|
920
|
+
PositionModelFinalization.unregister(this);
|
|
921
|
+
return ptr;
|
|
922
|
+
}
|
|
923
|
+
|
|
924
|
+
free() {
|
|
925
|
+
const ptr = this.__destroy_into_raw();
|
|
926
|
+
wasm.__wbg_positionmodel_free(ptr, 0);
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Get position status.
|
|
930
|
+
* @param {Prices} prices
|
|
931
|
+
* @returns {PositionStatus}
|
|
932
|
+
*/
|
|
933
|
+
status(prices) {
|
|
934
|
+
const ret = wasm.positionmodel_status(this.__wbg_ptr, prices);
|
|
935
|
+
if (ret[2]) {
|
|
936
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
937
|
+
}
|
|
938
|
+
return takeFromExternrefTable0(ret[0]);
|
|
939
|
+
}
|
|
940
|
+
/**
|
|
941
|
+
* Get position size.
|
|
942
|
+
* @returns {bigint}
|
|
943
|
+
*/
|
|
944
|
+
size() {
|
|
945
|
+
const ret = wasm.positionmodel_size(this.__wbg_ptr);
|
|
946
|
+
return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
|
|
947
|
+
}
|
|
948
|
+
/**
|
|
949
|
+
* Get position size in tokens.
|
|
950
|
+
* @returns {bigint}
|
|
951
|
+
*/
|
|
952
|
+
size_in_tokens() {
|
|
953
|
+
const ret = wasm.positionmodel_size_in_tokens(this.__wbg_ptr);
|
|
954
|
+
return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Get collateral amount.
|
|
958
|
+
* @returns {bigint}
|
|
959
|
+
*/
|
|
960
|
+
collateral_amount() {
|
|
961
|
+
const ret = wasm.positionmodel_collateral_amount(this.__wbg_ptr);
|
|
962
|
+
return (BigInt.asUintN(64, ret[0]) | (BigInt.asUintN(64, ret[1]) << BigInt(64)));
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
|
|
966
|
+
const PubkeyFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
967
|
+
? { register: () => {}, unregister: () => {} }
|
|
968
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_pubkey_free(ptr >>> 0, 1));
|
|
969
|
+
/**
|
|
970
|
+
* The address of a [Solana account][acc].
|
|
971
|
+
*
|
|
972
|
+
* Some account addresses are [ed25519] public keys, with corresponding secret
|
|
973
|
+
* keys that are managed off-chain. Often, though, account addresses do not
|
|
974
|
+
* have corresponding secret keys — as with [_program derived
|
|
975
|
+
* addresses_][pdas] — or the secret key is not relevant to the operation
|
|
976
|
+
* of a program, and may have even been disposed of. As running Solana programs
|
|
977
|
+
* can not safely create or manage secret keys, the full [`Keypair`] is not
|
|
978
|
+
* defined in `solana-program` but in `solana-sdk`.
|
|
979
|
+
*
|
|
980
|
+
* [acc]: https://solana.com/docs/core/accounts
|
|
981
|
+
* [ed25519]: https://ed25519.cr.yp.to/
|
|
982
|
+
* [pdas]: https://solana.com/docs/core/cpi#program-derived-addresses
|
|
983
|
+
* [`Keypair`]: https://docs.rs/solana-sdk/latest/solana_sdk/signer/keypair/struct.Keypair.html
|
|
984
|
+
*/
|
|
985
|
+
export class Pubkey {
|
|
986
|
+
|
|
987
|
+
static __wrap(ptr) {
|
|
988
|
+
ptr = ptr >>> 0;
|
|
989
|
+
const obj = Object.create(Pubkey.prototype);
|
|
990
|
+
obj.__wbg_ptr = ptr;
|
|
991
|
+
PubkeyFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
992
|
+
return obj;
|
|
993
|
+
}
|
|
994
|
+
|
|
995
|
+
__destroy_into_raw() {
|
|
996
|
+
const ptr = this.__wbg_ptr;
|
|
997
|
+
this.__wbg_ptr = 0;
|
|
998
|
+
PubkeyFinalization.unregister(this);
|
|
999
|
+
return ptr;
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
free() {
|
|
1003
|
+
const ptr = this.__destroy_into_raw();
|
|
1004
|
+
wasm.__wbg_pubkey_free(ptr, 0);
|
|
1005
|
+
}
|
|
1006
|
+
/**
|
|
1007
|
+
* Create a new Pubkey object
|
|
1008
|
+
*
|
|
1009
|
+
* * `value` - optional public key as a base58 encoded string, `Uint8Array`, `[number]`
|
|
1010
|
+
* @param {any} value
|
|
1011
|
+
*/
|
|
1012
|
+
constructor(value) {
|
|
1013
|
+
const ret = wasm.pubkey_constructor(value);
|
|
1014
|
+
if (ret[2]) {
|
|
1015
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1016
|
+
}
|
|
1017
|
+
this.__wbg_ptr = ret[0] >>> 0;
|
|
1018
|
+
PubkeyFinalization.register(this, this.__wbg_ptr, this);
|
|
1019
|
+
return this;
|
|
1020
|
+
}
|
|
1021
|
+
/**
|
|
1022
|
+
* Return the base58 string representation of the public key
|
|
1023
|
+
* @returns {string}
|
|
1024
|
+
*/
|
|
1025
|
+
toString() {
|
|
1026
|
+
let deferred1_0;
|
|
1027
|
+
let deferred1_1;
|
|
1028
|
+
try {
|
|
1029
|
+
const ret = wasm.pubkey_toString(this.__wbg_ptr);
|
|
1030
|
+
deferred1_0 = ret[0];
|
|
1031
|
+
deferred1_1 = ret[1];
|
|
1032
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
1033
|
+
} finally {
|
|
1034
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
/**
|
|
1038
|
+
* Check if a `Pubkey` is on the ed25519 curve.
|
|
1039
|
+
* @returns {boolean}
|
|
1040
|
+
*/
|
|
1041
|
+
isOnCurve() {
|
|
1042
|
+
const ret = wasm.pubkey_isOnCurve(this.__wbg_ptr);
|
|
1043
|
+
return ret !== 0;
|
|
1044
|
+
}
|
|
1045
|
+
/**
|
|
1046
|
+
* Checks if two `Pubkey`s are equal
|
|
1047
|
+
* @param {Pubkey} other
|
|
1048
|
+
* @returns {boolean}
|
|
1049
|
+
*/
|
|
1050
|
+
equals(other) {
|
|
1051
|
+
_assertClass(other, Pubkey);
|
|
1052
|
+
const ret = wasm.pubkey_equals(this.__wbg_ptr, other.__wbg_ptr);
|
|
1053
|
+
return ret !== 0;
|
|
1054
|
+
}
|
|
1055
|
+
/**
|
|
1056
|
+
* Return the `Uint8Array` representation of the public key
|
|
1057
|
+
* @returns {Uint8Array}
|
|
1058
|
+
*/
|
|
1059
|
+
toBytes() {
|
|
1060
|
+
const ret = wasm.pubkey_toBytes(this.__wbg_ptr);
|
|
1061
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1062
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1063
|
+
return v1;
|
|
1064
|
+
}
|
|
1065
|
+
/**
|
|
1066
|
+
* Derive a Pubkey from another Pubkey, string seed, and a program id
|
|
1067
|
+
* @param {Pubkey} base
|
|
1068
|
+
* @param {string} seed
|
|
1069
|
+
* @param {Pubkey} owner
|
|
1070
|
+
* @returns {Pubkey}
|
|
1071
|
+
*/
|
|
1072
|
+
static createWithSeed(base, seed, owner) {
|
|
1073
|
+
_assertClass(base, Pubkey);
|
|
1074
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1075
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1076
|
+
_assertClass(owner, Pubkey);
|
|
1077
|
+
const ret = wasm.pubkey_createWithSeed(base.__wbg_ptr, ptr0, len0, owner.__wbg_ptr);
|
|
1078
|
+
if (ret[2]) {
|
|
1079
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1080
|
+
}
|
|
1081
|
+
return Pubkey.__wrap(ret[0]);
|
|
1082
|
+
}
|
|
1083
|
+
/**
|
|
1084
|
+
* Derive a program address from seeds and a program id
|
|
1085
|
+
* @param {any[]} seeds
|
|
1086
|
+
* @param {Pubkey} program_id
|
|
1087
|
+
* @returns {Pubkey}
|
|
1088
|
+
*/
|
|
1089
|
+
static createProgramAddress(seeds, program_id) {
|
|
1090
|
+
const ptr0 = passArrayJsValueToWasm0(seeds, wasm.__wbindgen_malloc);
|
|
1091
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1092
|
+
_assertClass(program_id, Pubkey);
|
|
1093
|
+
const ret = wasm.pubkey_createProgramAddress(ptr0, len0, program_id.__wbg_ptr);
|
|
1094
|
+
if (ret[2]) {
|
|
1095
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1096
|
+
}
|
|
1097
|
+
return Pubkey.__wrap(ret[0]);
|
|
1098
|
+
}
|
|
1099
|
+
/**
|
|
1100
|
+
* Find a valid program address
|
|
1101
|
+
*
|
|
1102
|
+
* Returns:
|
|
1103
|
+
* * `[PubKey, number]` - the program address and bump seed
|
|
1104
|
+
* @param {any[]} seeds
|
|
1105
|
+
* @param {Pubkey} program_id
|
|
1106
|
+
* @returns {any}
|
|
1107
|
+
*/
|
|
1108
|
+
static findProgramAddress(seeds, program_id) {
|
|
1109
|
+
const ptr0 = passArrayJsValueToWasm0(seeds, wasm.__wbindgen_malloc);
|
|
1110
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1111
|
+
_assertClass(program_id, Pubkey);
|
|
1112
|
+
const ret = wasm.pubkey_findProgramAddress(ptr0, len0, program_id.__wbg_ptr);
|
|
1113
|
+
if (ret[2]) {
|
|
1114
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1115
|
+
}
|
|
1116
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
const SystemInstructionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1121
|
+
? { register: () => {}, unregister: () => {} }
|
|
1122
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_systeminstruction_free(ptr >>> 0, 1));
|
|
1123
|
+
|
|
1124
|
+
export class SystemInstruction {
|
|
1125
|
+
|
|
1126
|
+
__destroy_into_raw() {
|
|
1127
|
+
const ptr = this.__wbg_ptr;
|
|
1128
|
+
this.__wbg_ptr = 0;
|
|
1129
|
+
SystemInstructionFinalization.unregister(this);
|
|
1130
|
+
return ptr;
|
|
1131
|
+
}
|
|
1132
|
+
|
|
1133
|
+
free() {
|
|
1134
|
+
const ptr = this.__destroy_into_raw();
|
|
1135
|
+
wasm.__wbg_systeminstruction_free(ptr, 0);
|
|
1136
|
+
}
|
|
1137
|
+
/**
|
|
1138
|
+
* @param {Pubkey} from_pubkey
|
|
1139
|
+
* @param {Pubkey} to_pubkey
|
|
1140
|
+
* @param {bigint} lamports
|
|
1141
|
+
* @param {bigint} space
|
|
1142
|
+
* @param {Pubkey} owner
|
|
1143
|
+
* @returns {Instruction}
|
|
1144
|
+
*/
|
|
1145
|
+
static createAccount(from_pubkey, to_pubkey, lamports, space, owner) {
|
|
1146
|
+
_assertClass(from_pubkey, Pubkey);
|
|
1147
|
+
_assertClass(to_pubkey, Pubkey);
|
|
1148
|
+
_assertClass(owner, Pubkey);
|
|
1149
|
+
const ret = wasm.systeminstruction_createAccount(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports, space, owner.__wbg_ptr);
|
|
1150
|
+
return Instruction.__wrap(ret);
|
|
1151
|
+
}
|
|
1152
|
+
/**
|
|
1153
|
+
* @param {Pubkey} from_pubkey
|
|
1154
|
+
* @param {Pubkey} to_pubkey
|
|
1155
|
+
* @param {Pubkey} base
|
|
1156
|
+
* @param {string} seed
|
|
1157
|
+
* @param {bigint} lamports
|
|
1158
|
+
* @param {bigint} space
|
|
1159
|
+
* @param {Pubkey} owner
|
|
1160
|
+
* @returns {Instruction}
|
|
1161
|
+
*/
|
|
1162
|
+
static createAccountWithSeed(from_pubkey, to_pubkey, base, seed, lamports, space, owner) {
|
|
1163
|
+
_assertClass(from_pubkey, Pubkey);
|
|
1164
|
+
_assertClass(to_pubkey, Pubkey);
|
|
1165
|
+
_assertClass(base, Pubkey);
|
|
1166
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1167
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1168
|
+
_assertClass(owner, Pubkey);
|
|
1169
|
+
const ret = wasm.systeminstruction_createAccountWithSeed(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, base.__wbg_ptr, ptr0, len0, lamports, space, owner.__wbg_ptr);
|
|
1170
|
+
return Instruction.__wrap(ret);
|
|
1171
|
+
}
|
|
1172
|
+
/**
|
|
1173
|
+
* @param {Pubkey} pubkey
|
|
1174
|
+
* @param {Pubkey} owner
|
|
1175
|
+
* @returns {Instruction}
|
|
1176
|
+
*/
|
|
1177
|
+
static assign(pubkey, owner) {
|
|
1178
|
+
_assertClass(pubkey, Pubkey);
|
|
1179
|
+
_assertClass(owner, Pubkey);
|
|
1180
|
+
const ret = wasm.systeminstruction_assign(pubkey.__wbg_ptr, owner.__wbg_ptr);
|
|
1181
|
+
return Instruction.__wrap(ret);
|
|
1182
|
+
}
|
|
1183
|
+
/**
|
|
1184
|
+
* @param {Pubkey} pubkey
|
|
1185
|
+
* @param {Pubkey} base
|
|
1186
|
+
* @param {string} seed
|
|
1187
|
+
* @param {Pubkey} owner
|
|
1188
|
+
* @returns {Instruction}
|
|
1189
|
+
*/
|
|
1190
|
+
static assignWithSeed(pubkey, base, seed, owner) {
|
|
1191
|
+
_assertClass(pubkey, Pubkey);
|
|
1192
|
+
_assertClass(base, Pubkey);
|
|
1193
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1194
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1195
|
+
_assertClass(owner, Pubkey);
|
|
1196
|
+
const ret = wasm.systeminstruction_assignWithSeed(pubkey.__wbg_ptr, base.__wbg_ptr, ptr0, len0, owner.__wbg_ptr);
|
|
1197
|
+
return Instruction.__wrap(ret);
|
|
1198
|
+
}
|
|
1199
|
+
/**
|
|
1200
|
+
* @param {Pubkey} from_pubkey
|
|
1201
|
+
* @param {Pubkey} to_pubkey
|
|
1202
|
+
* @param {bigint} lamports
|
|
1203
|
+
* @returns {Instruction}
|
|
1204
|
+
*/
|
|
1205
|
+
static transfer(from_pubkey, to_pubkey, lamports) {
|
|
1206
|
+
_assertClass(from_pubkey, Pubkey);
|
|
1207
|
+
_assertClass(to_pubkey, Pubkey);
|
|
1208
|
+
const ret = wasm.systeminstruction_transfer(from_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
1209
|
+
return Instruction.__wrap(ret);
|
|
1210
|
+
}
|
|
1211
|
+
/**
|
|
1212
|
+
* @param {Pubkey} from_pubkey
|
|
1213
|
+
* @param {Pubkey} from_base
|
|
1214
|
+
* @param {string} from_seed
|
|
1215
|
+
* @param {Pubkey} from_owner
|
|
1216
|
+
* @param {Pubkey} to_pubkey
|
|
1217
|
+
* @param {bigint} lamports
|
|
1218
|
+
* @returns {Instruction}
|
|
1219
|
+
*/
|
|
1220
|
+
static transferWithSeed(from_pubkey, from_base, from_seed, from_owner, to_pubkey, lamports) {
|
|
1221
|
+
_assertClass(from_pubkey, Pubkey);
|
|
1222
|
+
_assertClass(from_base, Pubkey);
|
|
1223
|
+
const ptr0 = passStringToWasm0(from_seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1224
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1225
|
+
_assertClass(from_owner, Pubkey);
|
|
1226
|
+
_assertClass(to_pubkey, Pubkey);
|
|
1227
|
+
const ret = wasm.systeminstruction_transferWithSeed(from_pubkey.__wbg_ptr, from_base.__wbg_ptr, ptr0, len0, from_owner.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
1228
|
+
return Instruction.__wrap(ret);
|
|
1229
|
+
}
|
|
1230
|
+
/**
|
|
1231
|
+
* @param {Pubkey} pubkey
|
|
1232
|
+
* @param {bigint} space
|
|
1233
|
+
* @returns {Instruction}
|
|
1234
|
+
*/
|
|
1235
|
+
static allocate(pubkey, space) {
|
|
1236
|
+
_assertClass(pubkey, Pubkey);
|
|
1237
|
+
const ret = wasm.systeminstruction_allocate(pubkey.__wbg_ptr, space);
|
|
1238
|
+
return Instruction.__wrap(ret);
|
|
1239
|
+
}
|
|
1240
|
+
/**
|
|
1241
|
+
* @param {Pubkey} address
|
|
1242
|
+
* @param {Pubkey} base
|
|
1243
|
+
* @param {string} seed
|
|
1244
|
+
* @param {bigint} space
|
|
1245
|
+
* @param {Pubkey} owner
|
|
1246
|
+
* @returns {Instruction}
|
|
1247
|
+
*/
|
|
1248
|
+
static allocateWithSeed(address, base, seed, space, owner) {
|
|
1249
|
+
_assertClass(address, Pubkey);
|
|
1250
|
+
_assertClass(base, Pubkey);
|
|
1251
|
+
const ptr0 = passStringToWasm0(seed, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1252
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1253
|
+
_assertClass(owner, Pubkey);
|
|
1254
|
+
const ret = wasm.systeminstruction_allocateWithSeed(address.__wbg_ptr, base.__wbg_ptr, ptr0, len0, space, owner.__wbg_ptr);
|
|
1255
|
+
return Instruction.__wrap(ret);
|
|
1256
|
+
}
|
|
1257
|
+
/**
|
|
1258
|
+
* @param {Pubkey} from_pubkey
|
|
1259
|
+
* @param {Pubkey} nonce_pubkey
|
|
1260
|
+
* @param {Pubkey} authority
|
|
1261
|
+
* @param {bigint} lamports
|
|
1262
|
+
* @returns {Array<any>}
|
|
1263
|
+
*/
|
|
1264
|
+
static createNonceAccount(from_pubkey, nonce_pubkey, authority, lamports) {
|
|
1265
|
+
_assertClass(from_pubkey, Pubkey);
|
|
1266
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
1267
|
+
_assertClass(authority, Pubkey);
|
|
1268
|
+
const ret = wasm.systeminstruction_createNonceAccount(from_pubkey.__wbg_ptr, nonce_pubkey.__wbg_ptr, authority.__wbg_ptr, lamports);
|
|
1269
|
+
return ret;
|
|
1270
|
+
}
|
|
1271
|
+
/**
|
|
1272
|
+
* @param {Pubkey} nonce_pubkey
|
|
1273
|
+
* @param {Pubkey} authorized_pubkey
|
|
1274
|
+
* @returns {Instruction}
|
|
1275
|
+
*/
|
|
1276
|
+
static advanceNonceAccount(nonce_pubkey, authorized_pubkey) {
|
|
1277
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
1278
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
1279
|
+
const ret = wasm.systeminstruction_advanceNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr);
|
|
1280
|
+
return Instruction.__wrap(ret);
|
|
1281
|
+
}
|
|
1282
|
+
/**
|
|
1283
|
+
* @param {Pubkey} nonce_pubkey
|
|
1284
|
+
* @param {Pubkey} authorized_pubkey
|
|
1285
|
+
* @param {Pubkey} to_pubkey
|
|
1286
|
+
* @param {bigint} lamports
|
|
1287
|
+
* @returns {Instruction}
|
|
1288
|
+
*/
|
|
1289
|
+
static withdrawNonceAccount(nonce_pubkey, authorized_pubkey, to_pubkey, lamports) {
|
|
1290
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
1291
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
1292
|
+
_assertClass(to_pubkey, Pubkey);
|
|
1293
|
+
const ret = wasm.systeminstruction_withdrawNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr, to_pubkey.__wbg_ptr, lamports);
|
|
1294
|
+
return Instruction.__wrap(ret);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* @param {Pubkey} nonce_pubkey
|
|
1298
|
+
* @param {Pubkey} authorized_pubkey
|
|
1299
|
+
* @param {Pubkey} new_authority
|
|
1300
|
+
* @returns {Instruction}
|
|
1301
|
+
*/
|
|
1302
|
+
static authorizeNonceAccount(nonce_pubkey, authorized_pubkey, new_authority) {
|
|
1303
|
+
_assertClass(nonce_pubkey, Pubkey);
|
|
1304
|
+
_assertClass(authorized_pubkey, Pubkey);
|
|
1305
|
+
_assertClass(new_authority, Pubkey);
|
|
1306
|
+
const ret = wasm.systeminstruction_authorizeNonceAccount(nonce_pubkey.__wbg_ptr, authorized_pubkey.__wbg_ptr, new_authority.__wbg_ptr);
|
|
1307
|
+
return Instruction.__wrap(ret);
|
|
1308
|
+
}
|
|
1309
|
+
}
|
|
1310
|
+
|
|
1311
|
+
const TransactionFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1312
|
+
? { register: () => {}, unregister: () => {} }
|
|
1313
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr >>> 0, 1));
|
|
1314
|
+
/**
|
|
1315
|
+
* An atomically-committed sequence of instructions.
|
|
1316
|
+
*
|
|
1317
|
+
* While [`Instruction`]s are the basic unit of computation in Solana,
|
|
1318
|
+
* they are submitted by clients in [`Transaction`]s containing one or
|
|
1319
|
+
* more instructions, and signed by one or more [`Signer`]s.
|
|
1320
|
+
*
|
|
1321
|
+
* [`Signer`]: crate::signer::Signer
|
|
1322
|
+
*
|
|
1323
|
+
* See the [module documentation] for more details about transactions.
|
|
1324
|
+
*
|
|
1325
|
+
* [module documentation]: self
|
|
1326
|
+
*
|
|
1327
|
+
* Some constructors accept an optional `payer`, the account responsible for
|
|
1328
|
+
* paying the cost of executing a transaction. In most cases, callers should
|
|
1329
|
+
* specify the payer explicitly in these constructors. In some cases though,
|
|
1330
|
+
* the caller is not _required_ to specify the payer, but is still allowed to:
|
|
1331
|
+
* in the [`Message`] structure, the first account is always the fee-payer, so
|
|
1332
|
+
* if the caller has knowledge that the first account of the constructed
|
|
1333
|
+
* transaction's `Message` is both a signer and the expected fee-payer, then
|
|
1334
|
+
* redundantly specifying the fee-payer is not strictly required.
|
|
1335
|
+
*/
|
|
1336
|
+
export class Transaction {
|
|
1337
|
+
|
|
1338
|
+
static __wrap(ptr) {
|
|
1339
|
+
ptr = ptr >>> 0;
|
|
1340
|
+
const obj = Object.create(Transaction.prototype);
|
|
1341
|
+
obj.__wbg_ptr = ptr;
|
|
1342
|
+
TransactionFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1343
|
+
return obj;
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1346
|
+
__destroy_into_raw() {
|
|
1347
|
+
const ptr = this.__wbg_ptr;
|
|
1348
|
+
this.__wbg_ptr = 0;
|
|
1349
|
+
TransactionFinalization.unregister(this);
|
|
1350
|
+
return ptr;
|
|
1351
|
+
}
|
|
1352
|
+
|
|
1353
|
+
free() {
|
|
1354
|
+
const ptr = this.__destroy_into_raw();
|
|
1355
|
+
wasm.__wbg_transaction_free(ptr, 0);
|
|
1356
|
+
}
|
|
1357
|
+
/**
|
|
1358
|
+
* Create a new `Transaction`
|
|
1359
|
+
* @param {Instructions} instructions
|
|
1360
|
+
* @param {Pubkey | null} [payer]
|
|
1361
|
+
*/
|
|
1362
|
+
constructor(instructions, payer) {
|
|
1363
|
+
_assertClass(instructions, Instructions);
|
|
1364
|
+
var ptr0 = instructions.__destroy_into_raw();
|
|
1365
|
+
let ptr1 = 0;
|
|
1366
|
+
if (!isLikeNone(payer)) {
|
|
1367
|
+
_assertClass(payer, Pubkey);
|
|
1368
|
+
ptr1 = payer.__destroy_into_raw();
|
|
1369
|
+
}
|
|
1370
|
+
const ret = wasm.transaction_constructor(ptr0, ptr1);
|
|
1371
|
+
this.__wbg_ptr = ret >>> 0;
|
|
1372
|
+
TransactionFinalization.register(this, this.__wbg_ptr, this);
|
|
1373
|
+
return this;
|
|
1374
|
+
}
|
|
1375
|
+
/**
|
|
1376
|
+
* Return a message containing all data that should be signed.
|
|
1377
|
+
* @returns {Message}
|
|
1378
|
+
*/
|
|
1379
|
+
message() {
|
|
1380
|
+
const ret = wasm.transaction_message(this.__wbg_ptr);
|
|
1381
|
+
return Message.__wrap(ret);
|
|
1382
|
+
}
|
|
1383
|
+
/**
|
|
1384
|
+
* Return the serialized message data to sign.
|
|
1385
|
+
* @returns {Uint8Array}
|
|
1386
|
+
*/
|
|
1387
|
+
messageData() {
|
|
1388
|
+
const ret = wasm.transaction_messageData(this.__wbg_ptr);
|
|
1389
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1390
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1391
|
+
return v1;
|
|
1392
|
+
}
|
|
1393
|
+
/**
|
|
1394
|
+
* Verify the transaction
|
|
1395
|
+
*/
|
|
1396
|
+
verify() {
|
|
1397
|
+
const ret = wasm.transaction_verify(this.__wbg_ptr);
|
|
1398
|
+
if (ret[1]) {
|
|
1399
|
+
throw takeFromExternrefTable0(ret[0]);
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
/**
|
|
1403
|
+
* @param {Keypair} keypair
|
|
1404
|
+
* @param {Hash} recent_blockhash
|
|
1405
|
+
*/
|
|
1406
|
+
partialSign(keypair, recent_blockhash) {
|
|
1407
|
+
_assertClass(keypair, Keypair);
|
|
1408
|
+
_assertClass(recent_blockhash, Hash);
|
|
1409
|
+
wasm.transaction_partialSign(this.__wbg_ptr, keypair.__wbg_ptr, recent_blockhash.__wbg_ptr);
|
|
1410
|
+
}
|
|
1411
|
+
/**
|
|
1412
|
+
* @returns {boolean}
|
|
1413
|
+
*/
|
|
1414
|
+
isSigned() {
|
|
1415
|
+
const ret = wasm.transaction_isSigned(this.__wbg_ptr);
|
|
1416
|
+
return ret !== 0;
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* @returns {Uint8Array}
|
|
1420
|
+
*/
|
|
1421
|
+
toBytes() {
|
|
1422
|
+
const ret = wasm.transaction_toBytes(this.__wbg_ptr);
|
|
1423
|
+
var v1 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
1424
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
1425
|
+
return v1;
|
|
1426
|
+
}
|
|
1427
|
+
/**
|
|
1428
|
+
* @param {Uint8Array} bytes
|
|
1429
|
+
* @returns {Transaction}
|
|
1430
|
+
*/
|
|
1431
|
+
static fromBytes(bytes) {
|
|
1432
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
1433
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1434
|
+
const ret = wasm.transaction_fromBytes(ptr0, len0);
|
|
1435
|
+
if (ret[2]) {
|
|
1436
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1437
|
+
}
|
|
1438
|
+
return Transaction.__wrap(ret[0]);
|
|
1439
|
+
}
|
|
1440
|
+
}
|
|
1441
|
+
|
|
1442
|
+
const TransactionGroupFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
1443
|
+
? { register: () => {}, unregister: () => {} }
|
|
1444
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_transactiongroup_free(ptr >>> 0, 1));
|
|
1445
|
+
/**
|
|
1446
|
+
* A JS binding for transaction group.
|
|
1447
|
+
*/
|
|
1448
|
+
export class TransactionGroup {
|
|
1449
|
+
|
|
1450
|
+
static __wrap(ptr) {
|
|
1451
|
+
ptr = ptr >>> 0;
|
|
1452
|
+
const obj = Object.create(TransactionGroup.prototype);
|
|
1453
|
+
obj.__wbg_ptr = ptr;
|
|
1454
|
+
TransactionGroupFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
1455
|
+
return obj;
|
|
1456
|
+
}
|
|
1457
|
+
|
|
1458
|
+
__destroy_into_raw() {
|
|
1459
|
+
const ptr = this.__wbg_ptr;
|
|
1460
|
+
this.__wbg_ptr = 0;
|
|
1461
|
+
TransactionGroupFinalization.unregister(this);
|
|
1462
|
+
return ptr;
|
|
1463
|
+
}
|
|
1464
|
+
|
|
1465
|
+
free() {
|
|
1466
|
+
const ptr = this.__destroy_into_raw();
|
|
1467
|
+
wasm.__wbg_transactiongroup_free(ptr, 0);
|
|
1468
|
+
}
|
|
1469
|
+
/**
|
|
1470
|
+
* Returns serialized transaciton group.
|
|
1471
|
+
* @returns {SerializedTransactionGroup}
|
|
1472
|
+
*/
|
|
1473
|
+
serialize() {
|
|
1474
|
+
const ret = wasm.transactiongroup_serialize(this.__wbg_ptr);
|
|
1475
|
+
if (ret[2]) {
|
|
1476
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1477
|
+
}
|
|
1478
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1479
|
+
}
|
|
1480
|
+
}
|
|
1481
|
+
|
|
1482
|
+
export function __wbg_String_8f0eb39a4a4c2f66(arg0, arg1) {
|
|
1483
|
+
const ret = String(arg1);
|
|
1484
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1485
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1486
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1487
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1488
|
+
};
|
|
1489
|
+
|
|
1490
|
+
export function __wbg_buffer_609cc3eee51ed158(arg0) {
|
|
1491
|
+
const ret = arg0.buffer;
|
|
1492
|
+
return ret;
|
|
1493
|
+
};
|
|
1494
|
+
|
|
1495
|
+
export function __wbg_call_672a4d21634d4a24() { return handleError(function (arg0, arg1) {
|
|
1496
|
+
const ret = arg0.call(arg1);
|
|
1497
|
+
return ret;
|
|
1498
|
+
}, arguments) };
|
|
1499
|
+
|
|
1500
|
+
export function __wbg_crypto_038798f665f985e2(arg0) {
|
|
1501
|
+
const ret = arg0.crypto;
|
|
1502
|
+
return ret;
|
|
1503
|
+
};
|
|
1504
|
+
|
|
1505
|
+
export function __wbg_done_769e5ede4b31c67b(arg0) {
|
|
1506
|
+
const ret = arg0.done;
|
|
1507
|
+
return ret;
|
|
1508
|
+
};
|
|
1509
|
+
|
|
1510
|
+
export function __wbg_entries_3265d4158b33e5dc(arg0) {
|
|
1511
|
+
const ret = Object.entries(arg0);
|
|
1512
|
+
return ret;
|
|
1513
|
+
};
|
|
1514
|
+
|
|
1515
|
+
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
1516
|
+
let deferred0_0;
|
|
1517
|
+
let deferred0_1;
|
|
1518
|
+
try {
|
|
1519
|
+
deferred0_0 = arg0;
|
|
1520
|
+
deferred0_1 = arg1;
|
|
1521
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
1522
|
+
} finally {
|
|
1523
|
+
wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
|
|
1524
|
+
}
|
|
1525
|
+
};
|
|
1526
|
+
|
|
1527
|
+
export function __wbg_getRandomValues_371e7ade8bd92088(arg0, arg1) {
|
|
1528
|
+
arg0.getRandomValues(arg1);
|
|
1529
|
+
};
|
|
1530
|
+
|
|
1531
|
+
export function __wbg_getRandomValues_7dfe5bd1b67c9ca1(arg0) {
|
|
1532
|
+
const ret = arg0.getRandomValues;
|
|
1533
|
+
return ret;
|
|
1534
|
+
};
|
|
1535
|
+
|
|
1536
|
+
export function __wbg_getTime_46267b1c24877e30(arg0) {
|
|
1537
|
+
const ret = arg0.getTime();
|
|
1538
|
+
return ret;
|
|
1539
|
+
};
|
|
1540
|
+
|
|
1541
|
+
export function __wbg_get_67b2ba62fc30de12() { return handleError(function (arg0, arg1) {
|
|
1542
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1543
|
+
return ret;
|
|
1544
|
+
}, arguments) };
|
|
1545
|
+
|
|
1546
|
+
export function __wbg_get_b9b93047fe3cf45b(arg0, arg1) {
|
|
1547
|
+
const ret = arg0[arg1 >>> 0];
|
|
1548
|
+
return ret;
|
|
1549
|
+
};
|
|
1550
|
+
|
|
1551
|
+
export function __wbg_getwithrefkey_1dc361bd10053bfe(arg0, arg1) {
|
|
1552
|
+
const ret = arg0[arg1];
|
|
1553
|
+
return ret;
|
|
1554
|
+
};
|
|
1555
|
+
|
|
1556
|
+
export function __wbg_instanceof_ArrayBuffer_e14585432e3737fc(arg0) {
|
|
1557
|
+
let result;
|
|
1558
|
+
try {
|
|
1559
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1560
|
+
} catch (_) {
|
|
1561
|
+
result = false;
|
|
1562
|
+
}
|
|
1563
|
+
const ret = result;
|
|
1564
|
+
return ret;
|
|
1565
|
+
};
|
|
1566
|
+
|
|
1567
|
+
export function __wbg_instanceof_Uint8Array_17156bcf118086a9(arg0) {
|
|
1568
|
+
let result;
|
|
1569
|
+
try {
|
|
1570
|
+
result = arg0 instanceof Uint8Array;
|
|
1571
|
+
} catch (_) {
|
|
1572
|
+
result = false;
|
|
1573
|
+
}
|
|
1574
|
+
const ret = result;
|
|
1575
|
+
return ret;
|
|
1576
|
+
};
|
|
1577
|
+
|
|
1578
|
+
export function __wbg_instruction_new(arg0) {
|
|
1579
|
+
const ret = Instruction.__wrap(arg0);
|
|
1580
|
+
return ret;
|
|
1581
|
+
};
|
|
1582
|
+
|
|
1583
|
+
export function __wbg_isArray_a1eab7e0d067391b(arg0) {
|
|
1584
|
+
const ret = Array.isArray(arg0);
|
|
1585
|
+
return ret;
|
|
1586
|
+
};
|
|
1587
|
+
|
|
1588
|
+
export function __wbg_isSafeInteger_343e2beeeece1bb0(arg0) {
|
|
1589
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1590
|
+
return ret;
|
|
1591
|
+
};
|
|
1592
|
+
|
|
1593
|
+
export function __wbg_iterator_9a24c88df860dc65() {
|
|
1594
|
+
const ret = Symbol.iterator;
|
|
1595
|
+
return ret;
|
|
1596
|
+
};
|
|
1597
|
+
|
|
1598
|
+
export function __wbg_length_a446193dc22c12f8(arg0) {
|
|
1599
|
+
const ret = arg0.length;
|
|
1600
|
+
return ret;
|
|
1601
|
+
};
|
|
1602
|
+
|
|
1603
|
+
export function __wbg_length_e2d2a49132c1b256(arg0) {
|
|
1604
|
+
const ret = arg0.length;
|
|
1605
|
+
return ret;
|
|
1606
|
+
};
|
|
1607
|
+
|
|
1608
|
+
export function __wbg_msCrypto_ff35fce085fab2a3(arg0) {
|
|
1609
|
+
const ret = arg0.msCrypto;
|
|
1610
|
+
return ret;
|
|
1611
|
+
};
|
|
1612
|
+
|
|
1613
|
+
export function __wbg_new0_f788a2397c7ca929() {
|
|
1614
|
+
const ret = new Date();
|
|
1615
|
+
return ret;
|
|
1616
|
+
};
|
|
1617
|
+
|
|
1618
|
+
export function __wbg_new_405e22f390576ce2() {
|
|
1619
|
+
const ret = new Object();
|
|
1620
|
+
return ret;
|
|
1621
|
+
};
|
|
1622
|
+
|
|
1623
|
+
export function __wbg_new_78feb108b6472713() {
|
|
1624
|
+
const ret = new Array();
|
|
1625
|
+
return ret;
|
|
1626
|
+
};
|
|
1627
|
+
|
|
1628
|
+
export function __wbg_new_8a6f238a6ece86ea() {
|
|
1629
|
+
const ret = new Error();
|
|
1630
|
+
return ret;
|
|
1631
|
+
};
|
|
1632
|
+
|
|
1633
|
+
export function __wbg_new_a12002a7f91c75be(arg0) {
|
|
1634
|
+
const ret = new Uint8Array(arg0);
|
|
1635
|
+
return ret;
|
|
1636
|
+
};
|
|
1637
|
+
|
|
1638
|
+
export function __wbg_newwithlength_a381634e90c276d4(arg0) {
|
|
1639
|
+
const ret = new Uint8Array(arg0 >>> 0);
|
|
1640
|
+
return ret;
|
|
1641
|
+
};
|
|
1642
|
+
|
|
1643
|
+
export function __wbg_newwithlength_c4c419ef0bc8a1f8(arg0) {
|
|
1644
|
+
const ret = new Array(arg0 >>> 0);
|
|
1645
|
+
return ret;
|
|
1646
|
+
};
|
|
1647
|
+
|
|
1648
|
+
export function __wbg_next_25feadfc0913fea9(arg0) {
|
|
1649
|
+
const ret = arg0.next;
|
|
1650
|
+
return ret;
|
|
1651
|
+
};
|
|
1652
|
+
|
|
1653
|
+
export function __wbg_next_6574e1a8a62d1055() { return handleError(function (arg0) {
|
|
1654
|
+
const ret = arg0.next();
|
|
1655
|
+
return ret;
|
|
1656
|
+
}, arguments) };
|
|
1657
|
+
|
|
1658
|
+
export function __wbg_pubkey_new(arg0) {
|
|
1659
|
+
const ret = Pubkey.__wrap(arg0);
|
|
1660
|
+
return ret;
|
|
1661
|
+
};
|
|
1662
|
+
|
|
1663
|
+
export function __wbg_push_737cfc8c1432c2c6(arg0, arg1) {
|
|
1664
|
+
const ret = arg0.push(arg1);
|
|
1665
|
+
return ret;
|
|
1666
|
+
};
|
|
1667
|
+
|
|
1668
|
+
export function __wbg_randomFillSync_994ac6d9ade7a695(arg0, arg1, arg2) {
|
|
1669
|
+
arg0.randomFillSync(getArrayU8FromWasm0(arg1, arg2));
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1672
|
+
export function __wbg_require_0d6aeaec3c042c88(arg0, arg1, arg2) {
|
|
1673
|
+
const ret = arg0.require(getStringFromWasm0(arg1, arg2));
|
|
1674
|
+
return ret;
|
|
1675
|
+
};
|
|
1676
|
+
|
|
1677
|
+
export function __wbg_self_25aabeb5a7b41685() { return handleError(function () {
|
|
1678
|
+
const ret = self.self;
|
|
1679
|
+
return ret;
|
|
1680
|
+
}, arguments) };
|
|
1681
|
+
|
|
1682
|
+
export function __wbg_set_37837023f3d740e8(arg0, arg1, arg2) {
|
|
1683
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1684
|
+
};
|
|
1685
|
+
|
|
1686
|
+
export function __wbg_set_3f1d0b984ed272ed(arg0, arg1, arg2) {
|
|
1687
|
+
arg0[arg1] = arg2;
|
|
1688
|
+
};
|
|
1689
|
+
|
|
1690
|
+
export function __wbg_set_65595bdd868b3009(arg0, arg1, arg2) {
|
|
1691
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
1692
|
+
};
|
|
1693
|
+
|
|
1694
|
+
export function __wbg_stack_0ed75d68575b0f3c(arg0, arg1) {
|
|
1695
|
+
const ret = arg1.stack;
|
|
1696
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1697
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1698
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1699
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1700
|
+
};
|
|
1701
|
+
|
|
1702
|
+
export function __wbg_static_accessor_MODULE_ef3aa2eb251158a5() {
|
|
1703
|
+
const ret = module;
|
|
1704
|
+
return ret;
|
|
1705
|
+
};
|
|
1706
|
+
|
|
1707
|
+
export function __wbg_subarray_aa9065fa9dc5df96(arg0, arg1, arg2) {
|
|
1708
|
+
const ret = arg0.subarray(arg1 >>> 0, arg2 >>> 0);
|
|
1709
|
+
return ret;
|
|
1710
|
+
};
|
|
1711
|
+
|
|
1712
|
+
export function __wbg_value_cd1ffa7b1ab794f1(arg0) {
|
|
1713
|
+
const ret = arg0.value;
|
|
1714
|
+
return ret;
|
|
1715
|
+
};
|
|
1716
|
+
|
|
1717
|
+
export function __wbg_values_99f7a68c7f313d66(arg0) {
|
|
1718
|
+
const ret = arg0.values();
|
|
1719
|
+
return ret;
|
|
1720
|
+
};
|
|
1721
|
+
|
|
1722
|
+
export function __wbindgen_as_number(arg0) {
|
|
1723
|
+
const ret = +arg0;
|
|
1724
|
+
return ret;
|
|
1725
|
+
};
|
|
1726
|
+
|
|
1727
|
+
export function __wbindgen_bigint_from_i128(arg0, arg1) {
|
|
1728
|
+
const ret = arg0 << BigInt(64) | BigInt.asUintN(64, arg1);
|
|
1729
|
+
return ret;
|
|
1730
|
+
};
|
|
1731
|
+
|
|
1732
|
+
export function __wbindgen_bigint_from_i64(arg0) {
|
|
1733
|
+
const ret = arg0;
|
|
1734
|
+
return ret;
|
|
1735
|
+
};
|
|
1736
|
+
|
|
1737
|
+
export function __wbindgen_bigint_from_u128(arg0, arg1) {
|
|
1738
|
+
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
|
|
1739
|
+
return ret;
|
|
1740
|
+
};
|
|
1741
|
+
|
|
1742
|
+
export function __wbindgen_bigint_from_u64(arg0) {
|
|
1743
|
+
const ret = BigInt.asUintN(64, arg0);
|
|
1744
|
+
return ret;
|
|
1745
|
+
};
|
|
1746
|
+
|
|
1747
|
+
export function __wbindgen_bigint_get_as_i64(arg0, arg1) {
|
|
1748
|
+
const v = arg1;
|
|
1749
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1750
|
+
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1751
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1752
|
+
};
|
|
1753
|
+
|
|
1754
|
+
export function __wbindgen_boolean_get(arg0) {
|
|
1755
|
+
const v = arg0;
|
|
1756
|
+
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
1757
|
+
return ret;
|
|
1758
|
+
};
|
|
1759
|
+
|
|
1760
|
+
export function __wbindgen_debug_string(arg0, arg1) {
|
|
1761
|
+
const ret = debugString(arg1);
|
|
1762
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1763
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1764
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1765
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1766
|
+
};
|
|
1767
|
+
|
|
1768
|
+
export function __wbindgen_error_new(arg0, arg1) {
|
|
1769
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1770
|
+
return ret;
|
|
1771
|
+
};
|
|
1772
|
+
|
|
1773
|
+
export function __wbindgen_in(arg0, arg1) {
|
|
1774
|
+
const ret = arg0 in arg1;
|
|
1775
|
+
return ret;
|
|
1776
|
+
};
|
|
1777
|
+
|
|
1778
|
+
export function __wbindgen_init_externref_table() {
|
|
1779
|
+
const table = wasm.__wbindgen_export_4;
|
|
1780
|
+
const offset = table.grow(4);
|
|
1781
|
+
table.set(0, undefined);
|
|
1782
|
+
table.set(offset + 0, undefined);
|
|
1783
|
+
table.set(offset + 1, null);
|
|
1784
|
+
table.set(offset + 2, true);
|
|
1785
|
+
table.set(offset + 3, false);
|
|
1786
|
+
;
|
|
1787
|
+
};
|
|
1788
|
+
|
|
1789
|
+
export function __wbindgen_is_bigint(arg0) {
|
|
1790
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1791
|
+
return ret;
|
|
1792
|
+
};
|
|
1793
|
+
|
|
1794
|
+
export function __wbindgen_is_function(arg0) {
|
|
1795
|
+
const ret = typeof(arg0) === 'function';
|
|
1796
|
+
return ret;
|
|
1797
|
+
};
|
|
1798
|
+
|
|
1799
|
+
export function __wbindgen_is_object(arg0) {
|
|
1800
|
+
const val = arg0;
|
|
1801
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
1802
|
+
return ret;
|
|
1803
|
+
};
|
|
1804
|
+
|
|
1805
|
+
export function __wbindgen_is_string(arg0) {
|
|
1806
|
+
const ret = typeof(arg0) === 'string';
|
|
1807
|
+
return ret;
|
|
1808
|
+
};
|
|
1809
|
+
|
|
1810
|
+
export function __wbindgen_is_undefined(arg0) {
|
|
1811
|
+
const ret = arg0 === undefined;
|
|
1812
|
+
return ret;
|
|
1813
|
+
};
|
|
1814
|
+
|
|
1815
|
+
export function __wbindgen_jsval_eq(arg0, arg1) {
|
|
1816
|
+
const ret = arg0 === arg1;
|
|
1817
|
+
return ret;
|
|
1818
|
+
};
|
|
1819
|
+
|
|
1820
|
+
export function __wbindgen_jsval_loose_eq(arg0, arg1) {
|
|
1821
|
+
const ret = arg0 == arg1;
|
|
1822
|
+
return ret;
|
|
1823
|
+
};
|
|
1824
|
+
|
|
1825
|
+
export function __wbindgen_memory() {
|
|
1826
|
+
const ret = wasm.memory;
|
|
1827
|
+
return ret;
|
|
1828
|
+
};
|
|
1829
|
+
|
|
1830
|
+
export function __wbindgen_number_get(arg0, arg1) {
|
|
1831
|
+
const obj = arg1;
|
|
1832
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1833
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1834
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1835
|
+
};
|
|
1836
|
+
|
|
1837
|
+
export function __wbindgen_number_new(arg0) {
|
|
1838
|
+
const ret = arg0;
|
|
1839
|
+
return ret;
|
|
1840
|
+
};
|
|
1841
|
+
|
|
1842
|
+
export function __wbindgen_shr(arg0, arg1) {
|
|
1843
|
+
const ret = arg0 >> arg1;
|
|
1844
|
+
return ret;
|
|
1845
|
+
};
|
|
1846
|
+
|
|
1847
|
+
export function __wbindgen_string_get(arg0, arg1) {
|
|
1848
|
+
const obj = arg1;
|
|
1849
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1850
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1851
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1852
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1853
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1854
|
+
};
|
|
1855
|
+
|
|
1856
|
+
export function __wbindgen_string_new(arg0, arg1) {
|
|
1857
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1858
|
+
return ret;
|
|
1859
|
+
};
|
|
1860
|
+
|
|
1861
|
+
export function __wbindgen_throw(arg0, arg1) {
|
|
1862
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1863
|
+
};
|
|
1864
|
+
|