@orca-so/whirlpools-core 0.1.19 → 0.2.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 +70 -1
- package/dist/browser/README.md +70 -1
- package/dist/browser/orca_whirlpools_core_js_bindings.d.ts +189 -189
- package/dist/browser/orca_whirlpools_core_js_bindings.js +2 -1
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.js +611 -792
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/browser/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +26 -23
- package/dist/nodejs/README.md +70 -1
- package/dist/nodejs/orca_whirlpools_core_js_bindings.d.ts +189 -189
- package/dist/nodejs/orca_whirlpools_core_js_bindings.js +616 -795
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm +0 -0
- package/dist/nodejs/orca_whirlpools_core_js_bindings_bg.wasm.d.ts +26 -23
- package/package.json +1 -1
|
@@ -2,93 +2,11 @@
|
|
|
2
2
|
let imports = {};
|
|
3
3
|
imports['__wbindgen_placeholder__'] = module.exports;
|
|
4
4
|
let wasm;
|
|
5
|
-
const {
|
|
5
|
+
const { TextDecoder, TextEncoder } = require(`util`);
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
heap.push(undefined, null, true, false);
|
|
10
|
-
|
|
11
|
-
function getObject(idx) { return heap[idx]; }
|
|
12
|
-
|
|
13
|
-
function isLikeNone(x) {
|
|
14
|
-
return x === undefined || x === null;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
let cachedDataViewMemory0 = null;
|
|
18
|
-
|
|
19
|
-
function getDataViewMemory0() {
|
|
20
|
-
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
21
|
-
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
22
|
-
}
|
|
23
|
-
return cachedDataViewMemory0;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
function debugString(val) {
|
|
27
|
-
// primitive types
|
|
28
|
-
const type = typeof val;
|
|
29
|
-
if (type == 'number' || type == 'boolean' || val == null) {
|
|
30
|
-
return `${val}`;
|
|
31
|
-
}
|
|
32
|
-
if (type == 'string') {
|
|
33
|
-
return `"${val}"`;
|
|
34
|
-
}
|
|
35
|
-
if (type == 'symbol') {
|
|
36
|
-
const description = val.description;
|
|
37
|
-
if (description == null) {
|
|
38
|
-
return 'Symbol';
|
|
39
|
-
} else {
|
|
40
|
-
return `Symbol(${description})`;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
if (type == 'function') {
|
|
44
|
-
const name = val.name;
|
|
45
|
-
if (typeof name == 'string' && name.length > 0) {
|
|
46
|
-
return `Function(${name})`;
|
|
47
|
-
} else {
|
|
48
|
-
return 'Function';
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
// objects
|
|
52
|
-
if (Array.isArray(val)) {
|
|
53
|
-
const length = val.length;
|
|
54
|
-
let debug = '[';
|
|
55
|
-
if (length > 0) {
|
|
56
|
-
debug += debugString(val[0]);
|
|
57
|
-
}
|
|
58
|
-
for(let i = 1; i < length; i++) {
|
|
59
|
-
debug += ', ' + debugString(val[i]);
|
|
60
|
-
}
|
|
61
|
-
debug += ']';
|
|
62
|
-
return debug;
|
|
63
|
-
}
|
|
64
|
-
// Test for built-in
|
|
65
|
-
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
66
|
-
let className;
|
|
67
|
-
if (builtInMatches.length > 1) {
|
|
68
|
-
className = builtInMatches[1];
|
|
69
|
-
} else {
|
|
70
|
-
// Failed to match the standard '[object ClassName]'
|
|
71
|
-
return toString.call(val);
|
|
72
|
-
}
|
|
73
|
-
if (className == 'Object') {
|
|
74
|
-
// we're a user defined class or Object
|
|
75
|
-
// JSON.stringify avoids problems with cycles, and is generally much
|
|
76
|
-
// easier than looping through ownProperties of `val`.
|
|
77
|
-
try {
|
|
78
|
-
return 'Object(' + JSON.stringify(val) + ')';
|
|
79
|
-
} catch (_) {
|
|
80
|
-
return 'Object';
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
// errors
|
|
84
|
-
if (val instanceof Error) {
|
|
85
|
-
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
86
|
-
}
|
|
87
|
-
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
88
|
-
return className;
|
|
89
|
-
}
|
|
7
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
90
8
|
|
|
91
|
-
|
|
9
|
+
cachedTextDecoder.decode();
|
|
92
10
|
|
|
93
11
|
let cachedUint8ArrayMemory0 = null;
|
|
94
12
|
|
|
@@ -99,6 +17,13 @@ function getUint8ArrayMemory0() {
|
|
|
99
17
|
return cachedUint8ArrayMemory0;
|
|
100
18
|
}
|
|
101
19
|
|
|
20
|
+
function getStringFromWasm0(ptr, len) {
|
|
21
|
+
ptr = ptr >>> 0;
|
|
22
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
let WASM_VECTOR_LEN = 0;
|
|
26
|
+
|
|
102
27
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
103
28
|
|
|
104
29
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -153,360 +78,102 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
153
78
|
return ptr;
|
|
154
79
|
}
|
|
155
80
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
cachedTextDecoder.decode();
|
|
159
|
-
|
|
160
|
-
function getStringFromWasm0(ptr, len) {
|
|
161
|
-
ptr = ptr >>> 0;
|
|
162
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
let heap_next = heap.length;
|
|
166
|
-
|
|
167
|
-
function addHeapObject(obj) {
|
|
168
|
-
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
169
|
-
const idx = heap_next;
|
|
170
|
-
heap_next = heap[idx];
|
|
171
|
-
|
|
172
|
-
heap[idx] = obj;
|
|
173
|
-
return idx;
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function dropObject(idx) {
|
|
177
|
-
if (idx < 132) return;
|
|
178
|
-
heap[idx] = heap_next;
|
|
179
|
-
heap_next = idx;
|
|
81
|
+
function isLikeNone(x) {
|
|
82
|
+
return x === undefined || x === null;
|
|
180
83
|
}
|
|
181
84
|
|
|
182
|
-
|
|
183
|
-
const ret = getObject(idx);
|
|
184
|
-
dropObject(idx);
|
|
185
|
-
return ret;
|
|
186
|
-
}
|
|
85
|
+
let cachedDataViewMemory0 = null;
|
|
187
86
|
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
} catch (e) {
|
|
192
|
-
wasm.__wbindgen_exn_store(addHeapObject(e));
|
|
87
|
+
function getDataViewMemory0() {
|
|
88
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
89
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
193
90
|
}
|
|
91
|
+
return cachedDataViewMemory0;
|
|
194
92
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Get the first tick index in the tick array that contains the specified tick index.
|
|
197
|
-
*
|
|
198
|
-
* # Parameters
|
|
199
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
200
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
201
|
-
*
|
|
202
|
-
* # Returns
|
|
203
|
-
* - A i32 integer representing the first tick index in the tick array
|
|
204
|
-
*/
|
|
205
|
-
module.exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
|
|
206
|
-
const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
|
|
207
|
-
return ret;
|
|
208
|
-
};
|
|
209
93
|
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
/**
|
|
226
|
-
* Derive the tick index from a sqrt price. The precision of this method is only guarranted
|
|
227
|
-
* if tick is within the bounds of {max, min} tick-index.
|
|
228
|
-
*
|
|
229
|
-
* # Parameters
|
|
230
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price
|
|
231
|
-
*
|
|
232
|
-
* # Returns
|
|
233
|
-
* - `Ok`: A i32 integer representing the tick integer
|
|
234
|
-
*/
|
|
235
|
-
module.exports.sqrtPriceToTickIndex = function(sqrt_price) {
|
|
236
|
-
const ret = wasm.sqrtPriceToTickIndex(addHeapObject(sqrt_price));
|
|
237
|
-
return ret;
|
|
238
|
-
};
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Get the initializable tick index.
|
|
242
|
-
* If the tick index is already initializable, it is returned as is.
|
|
243
|
-
*
|
|
244
|
-
* # Parameters
|
|
245
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
246
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
247
|
-
* - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
|
|
248
|
-
*
|
|
249
|
-
* # Returns
|
|
250
|
-
* - A i32 integer representing the previous initializable tick index
|
|
251
|
-
*/
|
|
252
|
-
module.exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
|
|
253
|
-
const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
|
|
254
|
-
return ret;
|
|
255
|
-
};
|
|
256
|
-
|
|
257
|
-
/**
|
|
258
|
-
* Get the previous initializable tick index.
|
|
259
|
-
*
|
|
260
|
-
* # Parameters
|
|
261
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
262
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
263
|
-
*
|
|
264
|
-
* # Returns
|
|
265
|
-
* - A i32 integer representing the previous initializable tick index
|
|
266
|
-
*/
|
|
267
|
-
module.exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
|
|
268
|
-
const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
|
|
269
|
-
return ret;
|
|
270
|
-
};
|
|
271
|
-
|
|
272
|
-
/**
|
|
273
|
-
* Get the next initializable tick index.
|
|
274
|
-
*
|
|
275
|
-
* # Parameters
|
|
276
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
277
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
278
|
-
*
|
|
279
|
-
* # Returns
|
|
280
|
-
* - A i32 integer representing the next initializable tick index
|
|
281
|
-
*/
|
|
282
|
-
module.exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
|
|
283
|
-
const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
|
|
284
|
-
return ret;
|
|
285
|
-
};
|
|
286
|
-
|
|
287
|
-
/**
|
|
288
|
-
* Check if a tick is in-bounds.
|
|
289
|
-
*
|
|
290
|
-
* # Parameters
|
|
291
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
292
|
-
*
|
|
293
|
-
* # Returns
|
|
294
|
-
* - A boolean value indicating if the tick is in-bounds
|
|
295
|
-
*/
|
|
296
|
-
module.exports.isTickIndexInBounds = function(tick_index) {
|
|
297
|
-
const ret = wasm.isTickIndexInBounds(tick_index);
|
|
298
|
-
return ret !== 0;
|
|
299
|
-
};
|
|
300
|
-
|
|
301
|
-
/**
|
|
302
|
-
* Check if a tick is initializable.
|
|
303
|
-
* A tick is initializable if it is divisible by the tick spacing.
|
|
304
|
-
*
|
|
305
|
-
* # Parameters
|
|
306
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
307
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
308
|
-
*
|
|
309
|
-
* # Returns
|
|
310
|
-
* - A boolean value indicating if the tick is initializable
|
|
311
|
-
*/
|
|
312
|
-
module.exports.isTickInitializable = function(tick_index, tick_spacing) {
|
|
313
|
-
const ret = wasm.isTickInitializable(tick_index, tick_spacing);
|
|
314
|
-
return ret !== 0;
|
|
315
|
-
};
|
|
316
|
-
|
|
317
|
-
/**
|
|
318
|
-
* Get the tick index for the inverse of the price that this tick represents.
|
|
319
|
-
* Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
|
|
320
|
-
* inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
|
|
321
|
-
*
|
|
322
|
-
* # Parameters
|
|
323
|
-
* - `tick_index` - A i32 integer representing the tick integer
|
|
324
|
-
*
|
|
325
|
-
* # Returns
|
|
326
|
-
* - A i32 integer representing the tick index for the inverse of the price
|
|
327
|
-
*/
|
|
328
|
-
module.exports.invertTickIndex = function(tick_index) {
|
|
329
|
-
const ret = wasm.invertTickIndex(tick_index);
|
|
330
|
-
return ret;
|
|
331
|
-
};
|
|
332
|
-
|
|
333
|
-
/**
|
|
334
|
-
* Get the sqrt price for the inverse of the price that this tick represents.
|
|
335
|
-
* Because converting to a tick index and then back to a sqrt price is lossy,
|
|
336
|
-
* this function is clamped to the nearest tick index.
|
|
337
|
-
*
|
|
338
|
-
* # Parameters
|
|
339
|
-
* - `sqrt_price` - A u128 integer representing the sqrt price
|
|
340
|
-
*
|
|
341
|
-
* # Returns
|
|
342
|
-
* - A u128 integer representing the sqrt price for the inverse of the price
|
|
343
|
-
*/
|
|
344
|
-
module.exports.invertSqrtPrice = function(sqrt_price) {
|
|
345
|
-
const ret = wasm.invertSqrtPrice(addHeapObject(sqrt_price));
|
|
346
|
-
return takeObject(ret);
|
|
347
|
-
};
|
|
348
|
-
|
|
349
|
-
/**
|
|
350
|
-
* Get the minimum and maximum tick index that can be initialized.
|
|
351
|
-
*
|
|
352
|
-
* # Parameters
|
|
353
|
-
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
354
|
-
*
|
|
355
|
-
* # Returns
|
|
356
|
-
* - A TickRange struct containing the lower and upper tick index
|
|
357
|
-
*/
|
|
358
|
-
module.exports.getFullRangeTickIndexes = function(tick_spacing) {
|
|
359
|
-
const ret = wasm.getFullRangeTickIndexes(tick_spacing);
|
|
360
|
-
return takeObject(ret);
|
|
361
|
-
};
|
|
362
|
-
|
|
363
|
-
/**
|
|
364
|
-
* Order tick indexes in ascending order.
|
|
365
|
-
* If the lower tick index is greater than the upper tick index, the indexes are swapped.
|
|
366
|
-
* This is useful for ensuring that the lower tick index is always less than the upper tick index.
|
|
367
|
-
*
|
|
368
|
-
* # Parameters
|
|
369
|
-
* - `tick_index_1` - A i32 integer representing the first tick index
|
|
370
|
-
* - `tick_index_2` - A i32 integer representing the second tick index
|
|
371
|
-
*
|
|
372
|
-
* # Returns
|
|
373
|
-
* - A TickRange struct containing the lower and upper tick index
|
|
374
|
-
*/
|
|
375
|
-
module.exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
|
|
376
|
-
const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
|
|
377
|
-
return takeObject(ret);
|
|
378
|
-
};
|
|
379
|
-
|
|
380
|
-
/**
|
|
381
|
-
* Check if a whirlpool is a full-range only pool.
|
|
382
|
-
*
|
|
383
|
-
* # Parameters
|
|
384
|
-
* - `tick_spacing` - A u16 integer representing the tick spacing
|
|
385
|
-
*
|
|
386
|
-
* # Returns
|
|
387
|
-
* - A boolean value indicating if the whirlpool is a full-range only pool
|
|
388
|
-
*/
|
|
389
|
-
module.exports.isFullRangeOnly = function(tick_spacing) {
|
|
390
|
-
const ret = wasm.isFullRangeOnly(tick_spacing);
|
|
391
|
-
return ret !== 0;
|
|
392
|
-
};
|
|
393
|
-
|
|
394
|
-
/**
|
|
395
|
-
* Get the index of a tick in a tick array.
|
|
396
|
-
*
|
|
397
|
-
* # Parameters
|
|
398
|
-
* - `tick_index` - A i32 integer representing the tick index
|
|
399
|
-
* - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
|
|
400
|
-
* - `tick_spacing` - A u16 integer representing the tick spacing
|
|
401
|
-
*
|
|
402
|
-
* # Returns
|
|
403
|
-
* - A i32 integer representing the tick index in the tick array
|
|
404
|
-
*/
|
|
405
|
-
module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
|
|
406
|
-
const ret = wasm.getTickIndexInArray(tick_index, tick_array_start_index, tick_spacing);
|
|
407
|
-
return ret;
|
|
408
|
-
};
|
|
409
|
-
|
|
410
|
-
/**
|
|
411
|
-
* Calculate rewards owed for a position
|
|
412
|
-
*
|
|
413
|
-
* # Paramters
|
|
414
|
-
* - `whirlpool`: The whirlpool state
|
|
415
|
-
* - `position`: The position state
|
|
416
|
-
* - `tick_lower`: The lower tick state
|
|
417
|
-
* - `tick_upper`: The upper tick state
|
|
418
|
-
* - `current_timestamp`: The current timestamp
|
|
419
|
-
* - `transfer_fee_1`: The transfer fee for token 1
|
|
420
|
-
* - `transfer_fee_2`: The transfer fee for token 2
|
|
421
|
-
* - `transfer_fee_3`: The transfer fee for token 3
|
|
422
|
-
*
|
|
423
|
-
* # Returns
|
|
424
|
-
* - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
|
|
425
|
-
*/
|
|
426
|
-
module.exports.collectRewardsQuote = function(whirlpool, position, tick_lower, tick_upper, current_timestamp, transfer_fee_1, transfer_fee_2, transfer_fee_3) {
|
|
427
|
-
try {
|
|
428
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
429
|
-
wasm.collectRewardsQuote(retptr, addHeapObject(whirlpool), addHeapObject(position), addHeapObject(tick_lower), addHeapObject(tick_upper), current_timestamp, isLikeNone(transfer_fee_1) ? 0 : addHeapObject(transfer_fee_1), isLikeNone(transfer_fee_2) ? 0 : addHeapObject(transfer_fee_2), isLikeNone(transfer_fee_3) ? 0 : addHeapObject(transfer_fee_3));
|
|
430
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
431
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
432
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
433
|
-
if (r2) {
|
|
434
|
-
throw takeObject(r1);
|
|
94
|
+
function debugString(val) {
|
|
95
|
+
// primitive types
|
|
96
|
+
const type = typeof val;
|
|
97
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
98
|
+
return `${val}`;
|
|
99
|
+
}
|
|
100
|
+
if (type == 'string') {
|
|
101
|
+
return `"${val}"`;
|
|
102
|
+
}
|
|
103
|
+
if (type == 'symbol') {
|
|
104
|
+
const description = val.description;
|
|
105
|
+
if (description == null) {
|
|
106
|
+
return 'Symbol';
|
|
107
|
+
} else {
|
|
108
|
+
return `Symbol(${description})`;
|
|
435
109
|
}
|
|
436
|
-
return takeObject(r0);
|
|
437
|
-
} finally {
|
|
438
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
439
110
|
}
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
module.exports._INVALID_SQRT_PRICE_LIMIT_DIRECTION = function() {
|
|
488
|
-
const ret = wasm._INVALID_SQRT_PRICE_LIMIT_DIRECTION();
|
|
489
|
-
return ret;
|
|
490
|
-
};
|
|
491
|
-
|
|
492
|
-
module.exports._ZERO_TRADABLE_AMOUNT = function() {
|
|
493
|
-
const ret = wasm._ZERO_TRADABLE_AMOUNT();
|
|
494
|
-
return ret;
|
|
495
|
-
};
|
|
111
|
+
if (type == 'function') {
|
|
112
|
+
const name = val.name;
|
|
113
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
114
|
+
return `Function(${name})`;
|
|
115
|
+
} else {
|
|
116
|
+
return 'Function';
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// objects
|
|
120
|
+
if (Array.isArray(val)) {
|
|
121
|
+
const length = val.length;
|
|
122
|
+
let debug = '[';
|
|
123
|
+
if (length > 0) {
|
|
124
|
+
debug += debugString(val[0]);
|
|
125
|
+
}
|
|
126
|
+
for(let i = 1; i < length; i++) {
|
|
127
|
+
debug += ', ' + debugString(val[i]);
|
|
128
|
+
}
|
|
129
|
+
debug += ']';
|
|
130
|
+
return debug;
|
|
131
|
+
}
|
|
132
|
+
// Test for built-in
|
|
133
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
134
|
+
let className;
|
|
135
|
+
if (builtInMatches.length > 1) {
|
|
136
|
+
className = builtInMatches[1];
|
|
137
|
+
} else {
|
|
138
|
+
// Failed to match the standard '[object ClassName]'
|
|
139
|
+
return toString.call(val);
|
|
140
|
+
}
|
|
141
|
+
if (className == 'Object') {
|
|
142
|
+
// we're a user defined class or Object
|
|
143
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
144
|
+
// easier than looping through ownProperties of `val`.
|
|
145
|
+
try {
|
|
146
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
147
|
+
} catch (_) {
|
|
148
|
+
return 'Object';
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
// errors
|
|
152
|
+
if (val instanceof Error) {
|
|
153
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
154
|
+
}
|
|
155
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
156
|
+
return className;
|
|
157
|
+
}
|
|
496
158
|
|
|
497
|
-
|
|
498
|
-
const
|
|
499
|
-
|
|
500
|
-
|
|
159
|
+
function addToExternrefTable0(obj) {
|
|
160
|
+
const idx = wasm.__externref_table_alloc();
|
|
161
|
+
wasm.__wbindgen_export_2.set(idx, obj);
|
|
162
|
+
return idx;
|
|
163
|
+
}
|
|
501
164
|
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
}
|
|
165
|
+
function handleError(f, args) {
|
|
166
|
+
try {
|
|
167
|
+
return f.apply(this, args);
|
|
168
|
+
} catch (e) {
|
|
169
|
+
const idx = addToExternrefTable0(e);
|
|
170
|
+
wasm.__wbindgen_exn_store(idx);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
506
173
|
|
|
507
|
-
module.exports.
|
|
508
|
-
const ret = wasm.
|
|
509
|
-
return ret;
|
|
174
|
+
module.exports._POSITION_BUNDLE_SIZE = function() {
|
|
175
|
+
const ret = wasm._POSITION_BUNDLE_SIZE();
|
|
176
|
+
return ret >>> 0;
|
|
510
177
|
};
|
|
511
178
|
|
|
512
179
|
module.exports._NUM_REWARDS = function() {
|
|
@@ -555,17 +222,10 @@ function passArray8ToWasm0(arg, malloc) {
|
|
|
555
222
|
* * `u32` - The first unoccupied position (None if full)
|
|
556
223
|
*/
|
|
557
224
|
module.exports.firstUnoccupiedPositionInBundle = function(bitmap) {
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
wasm.firstUnoccupiedPositionInBundle(retptr, ptr0, len0);
|
|
563
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
564
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
565
|
-
return r0 === 0 ? undefined : r1 >>> 0;
|
|
566
|
-
} finally {
|
|
567
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
568
|
-
}
|
|
225
|
+
const ptr0 = passArray8ToWasm0(bitmap, wasm.__wbindgen_malloc);
|
|
226
|
+
const len0 = WASM_VECTOR_LEN;
|
|
227
|
+
const ret = wasm.firstUnoccupiedPositionInBundle(ptr0, len0);
|
|
228
|
+
return ret[0] === 0 ? undefined : ret[1] >>> 0;
|
|
569
229
|
};
|
|
570
230
|
|
|
571
231
|
/**
|
|
@@ -614,7 +274,7 @@ module.exports.isPositionBundleEmpty = function(bitmap) {
|
|
|
614
274
|
* - A boolean value indicating if the position is in range
|
|
615
275
|
*/
|
|
616
276
|
module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
617
|
-
const ret = wasm.isPositionInRange(
|
|
277
|
+
const ret = wasm.isPositionInRange(current_sqrt_price, tick_index_1, tick_index_2);
|
|
618
278
|
return ret !== 0;
|
|
619
279
|
};
|
|
620
280
|
|
|
@@ -634,8 +294,8 @@ module.exports.isPositionInRange = function(current_sqrt_price, tick_index_1, ti
|
|
|
634
294
|
* - A PositionStatus enum value indicating the status of the position
|
|
635
295
|
*/
|
|
636
296
|
module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
637
|
-
const ret = wasm.positionStatus(
|
|
638
|
-
return
|
|
297
|
+
const ret = wasm.positionStatus(current_sqrt_price, tick_index_1, tick_index_2);
|
|
298
|
+
return ret;
|
|
639
299
|
};
|
|
640
300
|
|
|
641
301
|
/**
|
|
@@ -650,8 +310,8 @@ module.exports.positionStatus = function(current_sqrt_price, tick_index_1, tick_
|
|
|
650
310
|
* - A PositionRatio struct containing the ratio of token_a and token_b
|
|
651
311
|
*/
|
|
652
312
|
module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_index_2) {
|
|
653
|
-
const ret = wasm.positionRatio(
|
|
654
|
-
return
|
|
313
|
+
const ret = wasm.positionRatio(current_sqrt_price, tick_index_1, tick_index_2);
|
|
314
|
+
return ret;
|
|
655
315
|
};
|
|
656
316
|
|
|
657
317
|
/**
|
|
@@ -669,7 +329,7 @@ module.exports.positionRatio = function(current_sqrt_price, tick_index_1, tick_i
|
|
|
669
329
|
*/
|
|
670
330
|
module.exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
|
|
671
331
|
const ret = wasm.priceToSqrtPrice(price, decimals_a, decimals_b);
|
|
672
|
-
return
|
|
332
|
+
return ret;
|
|
673
333
|
};
|
|
674
334
|
|
|
675
335
|
/**
|
|
@@ -685,65 +345,350 @@ module.exports.priceToSqrtPrice = function(price, decimals_a, decimals_b) {
|
|
|
685
345
|
* # Returns
|
|
686
346
|
* * `f64` - The decimal price
|
|
687
347
|
*/
|
|
688
|
-
module.exports.sqrtPriceToPrice = function(sqrt_price, decimals_a, decimals_b) {
|
|
689
|
-
const ret = wasm.sqrtPriceToPrice(
|
|
348
|
+
module.exports.sqrtPriceToPrice = function(sqrt_price, decimals_a, decimals_b) {
|
|
349
|
+
const ret = wasm.sqrtPriceToPrice(sqrt_price, decimals_a, decimals_b);
|
|
350
|
+
return ret;
|
|
351
|
+
};
|
|
352
|
+
|
|
353
|
+
/**
|
|
354
|
+
* Invert a price
|
|
355
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
356
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
357
|
+
*
|
|
358
|
+
* # Parameters
|
|
359
|
+
* * `price` - The price to invert
|
|
360
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
361
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
362
|
+
*
|
|
363
|
+
* # Returns
|
|
364
|
+
* * `f64` - The inverted price
|
|
365
|
+
*/
|
|
366
|
+
module.exports.invertPrice = function(price, decimals_a, decimals_b) {
|
|
367
|
+
const ret = wasm.invertPrice(price, decimals_a, decimals_b);
|
|
368
|
+
return ret;
|
|
369
|
+
};
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* Convert a tick index into a price
|
|
373
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
374
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
375
|
+
*
|
|
376
|
+
* # Parameters
|
|
377
|
+
* * `tick_index` - The tick index to convert
|
|
378
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
379
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
380
|
+
*
|
|
381
|
+
* # Returns
|
|
382
|
+
* * `f64` - The decimal price
|
|
383
|
+
*/
|
|
384
|
+
module.exports.tickIndexToPrice = function(tick_index, decimals_a, decimals_b) {
|
|
385
|
+
const ret = wasm.tickIndexToPrice(tick_index, decimals_a, decimals_b);
|
|
386
|
+
return ret;
|
|
387
|
+
};
|
|
388
|
+
|
|
389
|
+
/**
|
|
390
|
+
* Convert a price into a tick index
|
|
391
|
+
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
392
|
+
* Make sure to do these operations last and not to use the result for further calculations.
|
|
393
|
+
*
|
|
394
|
+
* # Parameters
|
|
395
|
+
* * `price` - The price to convert
|
|
396
|
+
* * `decimals_a` - The number of decimals of the base token
|
|
397
|
+
* * `decimals_b` - The number of decimals of the quote token
|
|
398
|
+
*
|
|
399
|
+
* # Returns
|
|
400
|
+
* * `i32` - The tick index
|
|
401
|
+
*/
|
|
402
|
+
module.exports.priceToTickIndex = function(price, decimals_a, decimals_b) {
|
|
403
|
+
const ret = wasm.priceToTickIndex(price, decimals_a, decimals_b);
|
|
404
|
+
return ret;
|
|
405
|
+
};
|
|
406
|
+
|
|
407
|
+
/**
|
|
408
|
+
* Get the first tick index in the tick array that contains the specified tick index.
|
|
409
|
+
*
|
|
410
|
+
* # Parameters
|
|
411
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
412
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
413
|
+
*
|
|
414
|
+
* # Returns
|
|
415
|
+
* - A i32 integer representing the first tick index in the tick array
|
|
416
|
+
*/
|
|
417
|
+
module.exports.getTickArrayStartTickIndex = function(tick_index, tick_spacing) {
|
|
418
|
+
const ret = wasm.getTickArrayStartTickIndex(tick_index, tick_spacing);
|
|
419
|
+
return ret;
|
|
420
|
+
};
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Derive the sqrt-price from a tick index. The precision of this method is only guarranted
|
|
424
|
+
* if tick is within the bounds of {max, min} tick-index.
|
|
425
|
+
*
|
|
426
|
+
* # Parameters
|
|
427
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
428
|
+
*
|
|
429
|
+
* # Returns
|
|
430
|
+
* - `Ok`: A u128 Q32.64 representing the sqrt_price
|
|
431
|
+
*/
|
|
432
|
+
module.exports.tickIndexToSqrtPrice = function(tick_index) {
|
|
433
|
+
const ret = wasm.tickIndexToSqrtPrice(tick_index);
|
|
434
|
+
return ret;
|
|
435
|
+
};
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Derive the tick index from a sqrt price. The precision of this method is only guarranted
|
|
439
|
+
* if tick is within the bounds of {max, min} tick-index.
|
|
440
|
+
*
|
|
441
|
+
* # Parameters
|
|
442
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price
|
|
443
|
+
*
|
|
444
|
+
* # Returns
|
|
445
|
+
* - `Ok`: A i32 integer representing the tick integer
|
|
446
|
+
*/
|
|
447
|
+
module.exports.sqrtPriceToTickIndex = function(sqrt_price) {
|
|
448
|
+
const ret = wasm.sqrtPriceToTickIndex(sqrt_price);
|
|
449
|
+
return ret;
|
|
450
|
+
};
|
|
451
|
+
|
|
452
|
+
/**
|
|
453
|
+
* Get the initializable tick index.
|
|
454
|
+
* If the tick index is already initializable, it is returned as is.
|
|
455
|
+
*
|
|
456
|
+
* # Parameters
|
|
457
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
458
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
459
|
+
* - `round_up` - A boolean value indicating if the supplied tick index should be rounded up. None will round to the nearest.
|
|
460
|
+
*
|
|
461
|
+
* # Returns
|
|
462
|
+
* - A i32 integer representing the previous initializable tick index
|
|
463
|
+
*/
|
|
464
|
+
module.exports.getInitializableTickIndex = function(tick_index, tick_spacing, round_up) {
|
|
465
|
+
const ret = wasm.getInitializableTickIndex(tick_index, tick_spacing, isLikeNone(round_up) ? 0xFFFFFF : round_up ? 1 : 0);
|
|
466
|
+
return ret;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
/**
|
|
470
|
+
* Get the previous initializable tick index.
|
|
471
|
+
*
|
|
472
|
+
* # Parameters
|
|
473
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
474
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
475
|
+
*
|
|
476
|
+
* # Returns
|
|
477
|
+
* - A i32 integer representing the previous initializable tick index
|
|
478
|
+
*/
|
|
479
|
+
module.exports.getPrevInitializableTickIndex = function(tick_index, tick_spacing) {
|
|
480
|
+
const ret = wasm.getPrevInitializableTickIndex(tick_index, tick_spacing);
|
|
481
|
+
return ret;
|
|
482
|
+
};
|
|
483
|
+
|
|
484
|
+
/**
|
|
485
|
+
* Get the next initializable tick index.
|
|
486
|
+
*
|
|
487
|
+
* # Parameters
|
|
488
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
489
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
490
|
+
*
|
|
491
|
+
* # Returns
|
|
492
|
+
* - A i32 integer representing the next initializable tick index
|
|
493
|
+
*/
|
|
494
|
+
module.exports.getNextInitializableTickIndex = function(tick_index, tick_spacing) {
|
|
495
|
+
const ret = wasm.getNextInitializableTickIndex(tick_index, tick_spacing);
|
|
496
|
+
return ret;
|
|
497
|
+
};
|
|
498
|
+
|
|
499
|
+
/**
|
|
500
|
+
* Check if a tick is in-bounds.
|
|
501
|
+
*
|
|
502
|
+
* # Parameters
|
|
503
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
504
|
+
*
|
|
505
|
+
* # Returns
|
|
506
|
+
* - A boolean value indicating if the tick is in-bounds
|
|
507
|
+
*/
|
|
508
|
+
module.exports.isTickIndexInBounds = function(tick_index) {
|
|
509
|
+
const ret = wasm.isTickIndexInBounds(tick_index);
|
|
510
|
+
return ret !== 0;
|
|
511
|
+
};
|
|
512
|
+
|
|
513
|
+
/**
|
|
514
|
+
* Check if a tick is initializable.
|
|
515
|
+
* A tick is initializable if it is divisible by the tick spacing.
|
|
516
|
+
*
|
|
517
|
+
* # Parameters
|
|
518
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
519
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
520
|
+
*
|
|
521
|
+
* # Returns
|
|
522
|
+
* - A boolean value indicating if the tick is initializable
|
|
523
|
+
*/
|
|
524
|
+
module.exports.isTickInitializable = function(tick_index, tick_spacing) {
|
|
525
|
+
const ret = wasm.isTickInitializable(tick_index, tick_spacing);
|
|
526
|
+
return ret !== 0;
|
|
527
|
+
};
|
|
528
|
+
|
|
529
|
+
/**
|
|
530
|
+
* Get the tick index for the inverse of the price that this tick represents.
|
|
531
|
+
* Eg: Consider tick i where Pb/Pa = 1.0001 ^ i
|
|
532
|
+
* inverse of this, i.e. Pa/Pb = 1 / (1.0001 ^ i) = 1.0001^-i
|
|
533
|
+
*
|
|
534
|
+
* # Parameters
|
|
535
|
+
* - `tick_index` - A i32 integer representing the tick integer
|
|
536
|
+
*
|
|
537
|
+
* # Returns
|
|
538
|
+
* - A i32 integer representing the tick index for the inverse of the price
|
|
539
|
+
*/
|
|
540
|
+
module.exports.invertTickIndex = function(tick_index) {
|
|
541
|
+
const ret = wasm.invertTickIndex(tick_index);
|
|
542
|
+
return ret;
|
|
543
|
+
};
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Get the sqrt price for the inverse of the price that this tick represents.
|
|
547
|
+
* Because converting to a tick index and then back to a sqrt price is lossy,
|
|
548
|
+
* this function is clamped to the nearest tick index.
|
|
549
|
+
*
|
|
550
|
+
* # Parameters
|
|
551
|
+
* - `sqrt_price` - A u128 integer representing the sqrt price
|
|
552
|
+
*
|
|
553
|
+
* # Returns
|
|
554
|
+
* - A u128 integer representing the sqrt price for the inverse of the price
|
|
555
|
+
*/
|
|
556
|
+
module.exports.invertSqrtPrice = function(sqrt_price) {
|
|
557
|
+
const ret = wasm.invertSqrtPrice(sqrt_price);
|
|
558
|
+
return ret;
|
|
559
|
+
};
|
|
560
|
+
|
|
561
|
+
/**
|
|
562
|
+
* Get the minimum and maximum tick index that can be initialized.
|
|
563
|
+
*
|
|
564
|
+
* # Parameters
|
|
565
|
+
* - `tick_spacing` - A i32 integer representing the tick spacing
|
|
566
|
+
*
|
|
567
|
+
* # Returns
|
|
568
|
+
* - A TickRange struct containing the lower and upper tick index
|
|
569
|
+
*/
|
|
570
|
+
module.exports.getFullRangeTickIndexes = function(tick_spacing) {
|
|
571
|
+
const ret = wasm.getFullRangeTickIndexes(tick_spacing);
|
|
690
572
|
return ret;
|
|
691
573
|
};
|
|
692
574
|
|
|
693
575
|
/**
|
|
694
|
-
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
576
|
+
* Order tick indexes in ascending order.
|
|
577
|
+
* If the lower tick index is greater than the upper tick index, the indexes are swapped.
|
|
578
|
+
* This is useful for ensuring that the lower tick index is always less than the upper tick index.
|
|
697
579
|
*
|
|
698
580
|
* # Parameters
|
|
699
|
-
*
|
|
700
|
-
*
|
|
701
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
581
|
+
* - `tick_index_1` - A i32 integer representing the first tick index
|
|
582
|
+
* - `tick_index_2` - A i32 integer representing the second tick index
|
|
702
583
|
*
|
|
703
584
|
* # Returns
|
|
704
|
-
*
|
|
585
|
+
* - A TickRange struct containing the lower and upper tick index
|
|
705
586
|
*/
|
|
706
|
-
module.exports.
|
|
707
|
-
const ret = wasm.
|
|
587
|
+
module.exports.orderTickIndexes = function(tick_index_1, tick_index_2) {
|
|
588
|
+
const ret = wasm.orderTickIndexes(tick_index_1, tick_index_2);
|
|
708
589
|
return ret;
|
|
709
590
|
};
|
|
710
591
|
|
|
711
592
|
/**
|
|
712
|
-
*
|
|
713
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
714
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
593
|
+
* Check if a whirlpool is a full-range only pool.
|
|
715
594
|
*
|
|
716
595
|
* # Parameters
|
|
717
|
-
*
|
|
718
|
-
* * `decimals_a` - The number of decimals of the base token
|
|
719
|
-
* * `decimals_b` - The number of decimals of the quote token
|
|
596
|
+
* - `tick_spacing` - A u16 integer representing the tick spacing
|
|
720
597
|
*
|
|
721
598
|
* # Returns
|
|
722
|
-
*
|
|
599
|
+
* - A boolean value indicating if the whirlpool is a full-range only pool
|
|
723
600
|
*/
|
|
724
|
-
module.exports.
|
|
725
|
-
const ret = wasm.
|
|
726
|
-
return ret;
|
|
601
|
+
module.exports.isFullRangeOnly = function(tick_spacing) {
|
|
602
|
+
const ret = wasm.isFullRangeOnly(tick_spacing);
|
|
603
|
+
return ret !== 0;
|
|
727
604
|
};
|
|
728
605
|
|
|
729
606
|
/**
|
|
730
|
-
*
|
|
731
|
-
* IMPORTANT: floating point operations can reduce the precision of the result.
|
|
732
|
-
* Make sure to do these operations last and not to use the result for further calculations.
|
|
607
|
+
* Get the index of a tick in a tick array.
|
|
733
608
|
*
|
|
734
609
|
* # Parameters
|
|
735
|
-
*
|
|
736
|
-
*
|
|
737
|
-
*
|
|
610
|
+
* - `tick_index` - A i32 integer representing the tick index
|
|
611
|
+
* - `tick_array_start_index` - A i32 integer representing the start tick index of the tick array
|
|
612
|
+
* - `tick_spacing` - A u16 integer representing the tick spacing
|
|
738
613
|
*
|
|
739
614
|
* # Returns
|
|
740
|
-
*
|
|
615
|
+
* - A i32 integer representing the tick index in the tick array
|
|
741
616
|
*/
|
|
742
|
-
module.exports.
|
|
743
|
-
const ret = wasm.
|
|
617
|
+
module.exports.getTickIndexInArray = function(tick_index, tick_array_start_index, tick_spacing) {
|
|
618
|
+
const ret = wasm.getTickIndexInArray(tick_index, tick_array_start_index, tick_spacing);
|
|
619
|
+
return ret;
|
|
620
|
+
};
|
|
621
|
+
|
|
622
|
+
module.exports._TICK_ARRAY_NOT_EVENLY_SPACED = function() {
|
|
623
|
+
const ret = wasm._TICK_ARRAY_NOT_EVENLY_SPACED();
|
|
624
|
+
return ret;
|
|
625
|
+
};
|
|
626
|
+
|
|
627
|
+
module.exports._TICK_INDEX_OUT_OF_BOUNDS = function() {
|
|
628
|
+
const ret = wasm._TICK_INDEX_OUT_OF_BOUNDS();
|
|
629
|
+
return ret;
|
|
630
|
+
};
|
|
631
|
+
|
|
632
|
+
module.exports._INVALID_TICK_INDEX = function() {
|
|
633
|
+
const ret = wasm._INVALID_TICK_INDEX();
|
|
634
|
+
return ret;
|
|
635
|
+
};
|
|
636
|
+
|
|
637
|
+
module.exports._ARITHMETIC_OVERFLOW = function() {
|
|
638
|
+
const ret = wasm._ARITHMETIC_OVERFLOW();
|
|
639
|
+
return ret;
|
|
640
|
+
};
|
|
641
|
+
|
|
642
|
+
module.exports._AMOUNT_EXCEEDS_MAX_U64 = function() {
|
|
643
|
+
const ret = wasm._AMOUNT_EXCEEDS_MAX_U64();
|
|
644
|
+
return ret;
|
|
645
|
+
};
|
|
646
|
+
|
|
647
|
+
module.exports._SQRT_PRICE_OUT_OF_BOUNDS = function() {
|
|
648
|
+
const ret = wasm._SQRT_PRICE_OUT_OF_BOUNDS();
|
|
649
|
+
return ret;
|
|
650
|
+
};
|
|
651
|
+
|
|
652
|
+
module.exports._TICK_SEQUENCE_EMPTY = function() {
|
|
653
|
+
const ret = wasm._TICK_SEQUENCE_EMPTY();
|
|
654
|
+
return ret;
|
|
655
|
+
};
|
|
656
|
+
|
|
657
|
+
module.exports._SQRT_PRICE_LIMIT_OUT_OF_BOUNDS = function() {
|
|
658
|
+
const ret = wasm._SQRT_PRICE_LIMIT_OUT_OF_BOUNDS();
|
|
659
|
+
return ret;
|
|
660
|
+
};
|
|
661
|
+
|
|
662
|
+
module.exports._INVALID_SQRT_PRICE_LIMIT_DIRECTION = function() {
|
|
663
|
+
const ret = wasm._INVALID_SQRT_PRICE_LIMIT_DIRECTION();
|
|
664
|
+
return ret;
|
|
665
|
+
};
|
|
666
|
+
|
|
667
|
+
module.exports._ZERO_TRADABLE_AMOUNT = function() {
|
|
668
|
+
const ret = wasm._ZERO_TRADABLE_AMOUNT();
|
|
669
|
+
return ret;
|
|
670
|
+
};
|
|
671
|
+
|
|
672
|
+
module.exports._INVALID_TIMESTAMP = function() {
|
|
673
|
+
const ret = wasm._INVALID_TIMESTAMP();
|
|
674
|
+
return ret;
|
|
675
|
+
};
|
|
676
|
+
|
|
677
|
+
module.exports._INVALID_TRANSFER_FEE = function() {
|
|
678
|
+
const ret = wasm._INVALID_TRANSFER_FEE();
|
|
744
679
|
return ret;
|
|
745
680
|
};
|
|
746
681
|
|
|
682
|
+
module.exports._INVALID_SLIPPAGE_TOLERANCE = function() {
|
|
683
|
+
const ret = wasm._INVALID_SLIPPAGE_TOLERANCE();
|
|
684
|
+
return ret;
|
|
685
|
+
};
|
|
686
|
+
|
|
687
|
+
function takeFromExternrefTable0(idx) {
|
|
688
|
+
const value = wasm.__wbindgen_export_2.get(idx);
|
|
689
|
+
wasm.__externref_table_dealloc(idx);
|
|
690
|
+
return value;
|
|
691
|
+
}
|
|
747
692
|
/**
|
|
748
693
|
* Calculate the amount A delta between two sqrt_prices
|
|
749
694
|
*
|
|
@@ -757,19 +702,11 @@ module.exports.priceToTickIndex = function(price, decimals_a, decimals_b) {
|
|
|
757
702
|
* - `u64`: The amount delta
|
|
758
703
|
*/
|
|
759
704
|
module.exports.tryGetAmountDeltaA = function(sqrt_price_1, sqrt_price_2, liquidity, round_up) {
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
764
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
765
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
766
|
-
if (r3) {
|
|
767
|
-
throw takeObject(r2);
|
|
768
|
-
}
|
|
769
|
-
return BigInt.asUintN(64, r0);
|
|
770
|
-
} finally {
|
|
771
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
705
|
+
const ret = wasm.tryGetAmountDeltaA(sqrt_price_1, sqrt_price_2, liquidity, round_up);
|
|
706
|
+
if (ret[2]) {
|
|
707
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
772
708
|
}
|
|
709
|
+
return BigInt.asUintN(64, ret[0]);
|
|
773
710
|
};
|
|
774
711
|
|
|
775
712
|
/**
|
|
@@ -785,19 +722,11 @@ module.exports.tryGetAmountDeltaA = function(sqrt_price_1, sqrt_price_2, liquidi
|
|
|
785
722
|
* - `u64`: The amount delta
|
|
786
723
|
*/
|
|
787
724
|
module.exports.tryGetAmountDeltaB = function(sqrt_price_1, sqrt_price_2, liquidity, round_up) {
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
792
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
793
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
794
|
-
if (r3) {
|
|
795
|
-
throw takeObject(r2);
|
|
796
|
-
}
|
|
797
|
-
return BigInt.asUintN(64, r0);
|
|
798
|
-
} finally {
|
|
799
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
725
|
+
const ret = wasm.tryGetAmountDeltaB(sqrt_price_1, sqrt_price_2, liquidity, round_up);
|
|
726
|
+
if (ret[2]) {
|
|
727
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
800
728
|
}
|
|
729
|
+
return BigInt.asUintN(64, ret[0]);
|
|
801
730
|
};
|
|
802
731
|
|
|
803
732
|
/**
|
|
@@ -813,19 +742,11 @@ module.exports.tryGetAmountDeltaB = function(sqrt_price_1, sqrt_price_2, liquidi
|
|
|
813
742
|
* - `u128`: The next square root price
|
|
814
743
|
*/
|
|
815
744
|
module.exports.tryGetNextSqrtPriceFromA = function(current_sqrt_price, current_liquidity, amount, specified_input) {
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
820
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
821
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
822
|
-
if (r2) {
|
|
823
|
-
throw takeObject(r1);
|
|
824
|
-
}
|
|
825
|
-
return takeObject(r0);
|
|
826
|
-
} finally {
|
|
827
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
745
|
+
const ret = wasm.tryGetNextSqrtPriceFromA(current_sqrt_price, current_liquidity, amount, specified_input);
|
|
746
|
+
if (ret[2]) {
|
|
747
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
828
748
|
}
|
|
749
|
+
return takeFromExternrefTable0(ret[0]);
|
|
829
750
|
};
|
|
830
751
|
|
|
831
752
|
/**
|
|
@@ -841,19 +762,11 @@ module.exports.tryGetNextSqrtPriceFromA = function(current_sqrt_price, current_l
|
|
|
841
762
|
* - `u128`: The next square root price
|
|
842
763
|
*/
|
|
843
764
|
module.exports.tryGetNextSqrtPriceFromB = function(current_sqrt_price, current_liquidity, amount, specified_input) {
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
848
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
849
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
850
|
-
if (r2) {
|
|
851
|
-
throw takeObject(r1);
|
|
852
|
-
}
|
|
853
|
-
return takeObject(r0);
|
|
854
|
-
} finally {
|
|
855
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
765
|
+
const ret = wasm.tryGetNextSqrtPriceFromB(current_sqrt_price, current_liquidity, amount, specified_input);
|
|
766
|
+
if (ret[2]) {
|
|
767
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
856
768
|
}
|
|
769
|
+
return takeFromExternrefTable0(ret[0]);
|
|
857
770
|
};
|
|
858
771
|
|
|
859
772
|
/**
|
|
@@ -869,19 +782,11 @@ module.exports.tryGetNextSqrtPriceFromB = function(current_sqrt_price, current_l
|
|
|
869
782
|
* - `u64`: The amount after the fee has been applied
|
|
870
783
|
*/
|
|
871
784
|
module.exports.tryApplyTransferFee = function(amount, transfer_fee) {
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
876
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
877
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
878
|
-
if (r3) {
|
|
879
|
-
throw takeObject(r2);
|
|
880
|
-
}
|
|
881
|
-
return BigInt.asUintN(64, r0);
|
|
882
|
-
} finally {
|
|
883
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
785
|
+
const ret = wasm.tryApplyTransferFee(amount, transfer_fee);
|
|
786
|
+
if (ret[2]) {
|
|
787
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
884
788
|
}
|
|
789
|
+
return BigInt.asUintN(64, ret[0]);
|
|
885
790
|
};
|
|
886
791
|
|
|
887
792
|
/**
|
|
@@ -897,19 +802,11 @@ module.exports.tryApplyTransferFee = function(amount, transfer_fee) {
|
|
|
897
802
|
* - `u64`: The amount before the fee has been applied
|
|
898
803
|
*/
|
|
899
804
|
module.exports.tryReverseApplyTransferFee = function(amount, transfer_fee) {
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
904
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
905
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
906
|
-
if (r3) {
|
|
907
|
-
throw takeObject(r2);
|
|
908
|
-
}
|
|
909
|
-
return BigInt.asUintN(64, r0);
|
|
910
|
-
} finally {
|
|
911
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
805
|
+
const ret = wasm.tryReverseApplyTransferFee(amount, transfer_fee);
|
|
806
|
+
if (ret[2]) {
|
|
807
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
912
808
|
}
|
|
809
|
+
return BigInt.asUintN(64, ret[0]);
|
|
913
810
|
};
|
|
914
811
|
|
|
915
812
|
/**
|
|
@@ -924,19 +821,11 @@ module.exports.tryReverseApplyTransferFee = function(amount, transfer_fee) {
|
|
|
924
821
|
* - `u64`: The maximum amount
|
|
925
822
|
*/
|
|
926
823
|
module.exports.tryGetMaxAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
931
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
932
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
933
|
-
if (r3) {
|
|
934
|
-
throw takeObject(r2);
|
|
935
|
-
}
|
|
936
|
-
return BigInt.asUintN(64, r0);
|
|
937
|
-
} finally {
|
|
938
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
824
|
+
const ret = wasm.tryGetMaxAmountWithSlippageTolerance(amount, slippage_tolerance_bps);
|
|
825
|
+
if (ret[2]) {
|
|
826
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
939
827
|
}
|
|
828
|
+
return BigInt.asUintN(64, ret[0]);
|
|
940
829
|
};
|
|
941
830
|
|
|
942
831
|
/**
|
|
@@ -951,19 +840,11 @@ module.exports.tryGetMaxAmountWithSlippageTolerance = function(amount, slippage_
|
|
|
951
840
|
* - `u64`: The minimum amount
|
|
952
841
|
*/
|
|
953
842
|
module.exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_tolerance_bps) {
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
958
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
959
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
960
|
-
if (r3) {
|
|
961
|
-
throw takeObject(r2);
|
|
962
|
-
}
|
|
963
|
-
return BigInt.asUintN(64, r0);
|
|
964
|
-
} finally {
|
|
965
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
843
|
+
const ret = wasm.tryGetMinAmountWithSlippageTolerance(amount, slippage_tolerance_bps);
|
|
844
|
+
if (ret[2]) {
|
|
845
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
966
846
|
}
|
|
847
|
+
return BigInt.asUintN(64, ret[0]);
|
|
967
848
|
};
|
|
968
849
|
|
|
969
850
|
/**
|
|
@@ -979,19 +860,11 @@ module.exports.tryGetMinAmountWithSlippageTolerance = function(amount, slippage_
|
|
|
979
860
|
* - `u64`: The amount after the fee has been applied
|
|
980
861
|
*/
|
|
981
862
|
module.exports.tryApplySwapFee = function(amount, fee_rate) {
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
986
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
987
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
988
|
-
if (r3) {
|
|
989
|
-
throw takeObject(r2);
|
|
990
|
-
}
|
|
991
|
-
return BigInt.asUintN(64, r0);
|
|
992
|
-
} finally {
|
|
993
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
863
|
+
const ret = wasm.tryApplySwapFee(amount, fee_rate);
|
|
864
|
+
if (ret[2]) {
|
|
865
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
994
866
|
}
|
|
867
|
+
return BigInt.asUintN(64, ret[0]);
|
|
995
868
|
};
|
|
996
869
|
|
|
997
870
|
/**
|
|
@@ -1007,19 +880,11 @@ module.exports.tryApplySwapFee = function(amount, fee_rate) {
|
|
|
1007
880
|
* - `u64`: The amount before the fee has been applied
|
|
1008
881
|
*/
|
|
1009
882
|
module.exports.tryReverseApplySwapFee = function(amount, fee_rate) {
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
var r0 = getDataViewMemory0().getBigInt64(retptr + 8 * 0, true);
|
|
1014
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1015
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
1016
|
-
if (r3) {
|
|
1017
|
-
throw takeObject(r2);
|
|
1018
|
-
}
|
|
1019
|
-
return BigInt.asUintN(64, r0);
|
|
1020
|
-
} finally {
|
|
1021
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
883
|
+
const ret = wasm.tryReverseApplySwapFee(amount, fee_rate);
|
|
884
|
+
if (ret[2]) {
|
|
885
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1022
886
|
}
|
|
887
|
+
return BigInt.asUintN(64, ret[0]);
|
|
1023
888
|
};
|
|
1024
889
|
|
|
1025
890
|
/**
|
|
@@ -1038,19 +903,11 @@ module.exports.tryReverseApplySwapFee = function(amount, fee_rate) {
|
|
|
1038
903
|
* The exact input or output amount for the swap transaction.
|
|
1039
904
|
*/
|
|
1040
905
|
module.exports.swapQuoteByInputToken = function(token_in, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, transfer_fee_a, transfer_fee_b) {
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1045
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1046
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1047
|
-
if (r2) {
|
|
1048
|
-
throw takeObject(r1);
|
|
1049
|
-
}
|
|
1050
|
-
return takeObject(r0);
|
|
1051
|
-
} finally {
|
|
1052
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
906
|
+
const ret = wasm.swapQuoteByInputToken(token_in, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
907
|
+
if (ret[2]) {
|
|
908
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1053
909
|
}
|
|
910
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1054
911
|
};
|
|
1055
912
|
|
|
1056
913
|
/**
|
|
@@ -1069,19 +926,11 @@ module.exports.swapQuoteByInputToken = function(token_in, specified_token_a, sli
|
|
|
1069
926
|
* The exact input or output amount for the swap transaction.
|
|
1070
927
|
*/
|
|
1071
928
|
module.exports.swapQuoteByOutputToken = function(token_out, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, transfer_fee_a, transfer_fee_b) {
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1076
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1077
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1078
|
-
if (r2) {
|
|
1079
|
-
throw takeObject(r1);
|
|
1080
|
-
}
|
|
1081
|
-
return takeObject(r0);
|
|
1082
|
-
} finally {
|
|
1083
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
929
|
+
const ret = wasm.swapQuoteByOutputToken(token_out, specified_token_a, slippage_tolerance_bps, whirlpool, tick_arrays, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
930
|
+
if (ret[2]) {
|
|
931
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1084
932
|
}
|
|
933
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1085
934
|
};
|
|
1086
935
|
|
|
1087
936
|
/**
|
|
@@ -1099,19 +948,11 @@ module.exports.swapQuoteByOutputToken = function(token_out, specified_token_a, s
|
|
|
1099
948
|
* - `CollectFeesQuote`: The fees owed for token A and token B
|
|
1100
949
|
*/
|
|
1101
950
|
module.exports.collectFeesQuote = function(whirlpool, position, tick_lower, tick_upper, transfer_fee_a, transfer_fee_b) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1106
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1107
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1108
|
-
if (r2) {
|
|
1109
|
-
throw takeObject(r1);
|
|
1110
|
-
}
|
|
1111
|
-
return takeObject(r0);
|
|
1112
|
-
} finally {
|
|
1113
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
951
|
+
const ret = wasm.collectFeesQuote(whirlpool, position, tick_lower, tick_upper, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
952
|
+
if (ret[2]) {
|
|
953
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1114
954
|
}
|
|
955
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1115
956
|
};
|
|
1116
957
|
|
|
1117
958
|
/**
|
|
@@ -1130,19 +971,11 @@ module.exports.collectFeesQuote = function(whirlpool, position, tick_lower, tick
|
|
|
1130
971
|
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
1131
972
|
*/
|
|
1132
973
|
module.exports.decreaseLiquidityQuote = function(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1137
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1138
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1139
|
-
if (r2) {
|
|
1140
|
-
throw takeObject(r1);
|
|
1141
|
-
}
|
|
1142
|
-
return takeObject(r0);
|
|
1143
|
-
} finally {
|
|
1144
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
974
|
+
const ret = wasm.decreaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
975
|
+
if (ret[2]) {
|
|
976
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1145
977
|
}
|
|
978
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1146
979
|
};
|
|
1147
980
|
|
|
1148
981
|
/**
|
|
@@ -1161,19 +994,11 @@ module.exports.decreaseLiquidityQuote = function(liquidity_delta, slippage_toler
|
|
|
1161
994
|
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
1162
995
|
*/
|
|
1163
996
|
module.exports.decreaseLiquidityQuoteA = function(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1168
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1169
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1170
|
-
if (r2) {
|
|
1171
|
-
throw takeObject(r1);
|
|
1172
|
-
}
|
|
1173
|
-
return takeObject(r0);
|
|
1174
|
-
} finally {
|
|
1175
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
997
|
+
const ret = wasm.decreaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
998
|
+
if (ret[2]) {
|
|
999
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1176
1000
|
}
|
|
1001
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1177
1002
|
};
|
|
1178
1003
|
|
|
1179
1004
|
/**
|
|
@@ -1192,19 +1017,11 @@ module.exports.decreaseLiquidityQuoteA = function(token_amount_a, slippage_toler
|
|
|
1192
1017
|
* - A DecreaseLiquidityQuote struct containing the estimated token amounts
|
|
1193
1018
|
*/
|
|
1194
1019
|
module.exports.decreaseLiquidityQuoteB = function(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1199
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1200
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1201
|
-
if (r2) {
|
|
1202
|
-
throw takeObject(r1);
|
|
1203
|
-
}
|
|
1204
|
-
return takeObject(r0);
|
|
1205
|
-
} finally {
|
|
1206
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1020
|
+
const ret = wasm.decreaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
1021
|
+
if (ret[2]) {
|
|
1022
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1207
1023
|
}
|
|
1024
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1208
1025
|
};
|
|
1209
1026
|
|
|
1210
1027
|
/**
|
|
@@ -1223,19 +1040,11 @@ module.exports.decreaseLiquidityQuoteB = function(token_amount_b, slippage_toler
|
|
|
1223
1040
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
1224
1041
|
*/
|
|
1225
1042
|
module.exports.increaseLiquidityQuote = function(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1230
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1231
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1232
|
-
if (r2) {
|
|
1233
|
-
throw takeObject(r1);
|
|
1234
|
-
}
|
|
1235
|
-
return takeObject(r0);
|
|
1236
|
-
} finally {
|
|
1237
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1043
|
+
const ret = wasm.increaseLiquidityQuote(liquidity_delta, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
1044
|
+
if (ret[2]) {
|
|
1045
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1238
1046
|
}
|
|
1047
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1239
1048
|
};
|
|
1240
1049
|
|
|
1241
1050
|
/**
|
|
@@ -1254,19 +1063,11 @@ module.exports.increaseLiquidityQuote = function(liquidity_delta, slippage_toler
|
|
|
1254
1063
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
1255
1064
|
*/
|
|
1256
1065
|
module.exports.increaseLiquidityQuoteA = function(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1261
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1262
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
1263
|
-
if (r2) {
|
|
1264
|
-
throw takeObject(r1);
|
|
1265
|
-
}
|
|
1266
|
-
return takeObject(r0);
|
|
1267
|
-
} finally {
|
|
1268
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1066
|
+
const ret = wasm.increaseLiquidityQuoteA(token_amount_a, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
1067
|
+
if (ret[2]) {
|
|
1068
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1269
1069
|
}
|
|
1070
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1270
1071
|
};
|
|
1271
1072
|
|
|
1272
1073
|
/**
|
|
@@ -1285,30 +1086,60 @@ module.exports.increaseLiquidityQuoteA = function(token_amount_a, slippage_toler
|
|
|
1285
1086
|
* - An IncreaseLiquidityQuote struct containing the estimated token amounts
|
|
1286
1087
|
*/
|
|
1287
1088
|
module.exports.increaseLiquidityQuoteB = function(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, transfer_fee_a, transfer_fee_b) {
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1089
|
+
const ret = wasm.increaseLiquidityQuoteB(token_amount_b, slippage_tolerance_bps, current_sqrt_price, tick_index_1, tick_index_2, isLikeNone(transfer_fee_a) ? 0 : addToExternrefTable0(transfer_fee_a), isLikeNone(transfer_fee_b) ? 0 : addToExternrefTable0(transfer_fee_b));
|
|
1090
|
+
if (ret[2]) {
|
|
1091
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1092
|
+
}
|
|
1093
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1094
|
+
};
|
|
1095
|
+
|
|
1096
|
+
/**
|
|
1097
|
+
* Calculate rewards owed for a position
|
|
1098
|
+
*
|
|
1099
|
+
* # Paramters
|
|
1100
|
+
* - `whirlpool`: The whirlpool state
|
|
1101
|
+
* - `position`: The position state
|
|
1102
|
+
* - `tick_lower`: The lower tick state
|
|
1103
|
+
* - `tick_upper`: The upper tick state
|
|
1104
|
+
* - `current_timestamp`: The current timestamp
|
|
1105
|
+
* - `transfer_fee_1`: The transfer fee for token 1
|
|
1106
|
+
* - `transfer_fee_2`: The transfer fee for token 2
|
|
1107
|
+
* - `transfer_fee_3`: The transfer fee for token 3
|
|
1108
|
+
*
|
|
1109
|
+
* # Returns
|
|
1110
|
+
* - `CollectRewardsQuote`: The rewards owed for the 3 reward tokens.
|
|
1111
|
+
*/
|
|
1112
|
+
module.exports.collectRewardsQuote = function(whirlpool, position, tick_lower, tick_upper, current_timestamp, transfer_fee_1, transfer_fee_2, transfer_fee_3) {
|
|
1113
|
+
const ret = wasm.collectRewardsQuote(whirlpool, position, tick_lower, tick_upper, current_timestamp, isLikeNone(transfer_fee_1) ? 0 : addToExternrefTable0(transfer_fee_1), isLikeNone(transfer_fee_2) ? 0 : addToExternrefTable0(transfer_fee_2), isLikeNone(transfer_fee_3) ? 0 : addToExternrefTable0(transfer_fee_3));
|
|
1114
|
+
if (ret[2]) {
|
|
1115
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1300
1116
|
}
|
|
1117
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1118
|
+
};
|
|
1119
|
+
|
|
1120
|
+
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
1121
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
1122
|
+
return ret;
|
|
1123
|
+
};
|
|
1124
|
+
|
|
1125
|
+
module.exports.__wbindgen_string_get = function(arg0, arg1) {
|
|
1126
|
+
const obj = arg1;
|
|
1127
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
1128
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1129
|
+
var len1 = WASM_VECTOR_LEN;
|
|
1130
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1131
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1301
1132
|
};
|
|
1302
1133
|
|
|
1303
1134
|
module.exports.__wbindgen_bigint_get_as_i64 = function(arg0, arg1) {
|
|
1304
|
-
const v =
|
|
1135
|
+
const v = arg1;
|
|
1305
1136
|
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
1306
1137
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
1307
1138
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1308
1139
|
};
|
|
1309
1140
|
|
|
1310
1141
|
module.exports.__wbindgen_debug_string = function(arg0, arg1) {
|
|
1311
|
-
const ret = debugString(
|
|
1142
|
+
const ret = debugString(arg1);
|
|
1312
1143
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1313
1144
|
const len1 = WASM_VECTOR_LEN;
|
|
1314
1145
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
@@ -1321,133 +1152,110 @@ module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
|
1321
1152
|
|
|
1322
1153
|
module.exports.__wbindgen_memory = function() {
|
|
1323
1154
|
const ret = wasm.memory;
|
|
1324
|
-
return
|
|
1325
|
-
};
|
|
1326
|
-
|
|
1327
|
-
module.exports.__wbindgen_string_new = function(arg0, arg1) {
|
|
1328
|
-
const ret = getStringFromWasm0(arg0, arg1);
|
|
1329
|
-
return addHeapObject(ret);
|
|
1155
|
+
return ret;
|
|
1330
1156
|
};
|
|
1331
1157
|
|
|
1332
|
-
module.exports.
|
|
1333
|
-
|
|
1334
|
-
|
|
1158
|
+
module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
|
|
1159
|
+
const ret = Reflect.get(arg0, arg1);
|
|
1160
|
+
return ret;
|
|
1161
|
+
}, arguments) };
|
|
1335
1162
|
|
|
1336
|
-
module.exports.
|
|
1337
|
-
const
|
|
1338
|
-
|
|
1339
|
-
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1340
|
-
var len1 = WASM_VECTOR_LEN;
|
|
1341
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1342
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1163
|
+
module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
|
|
1164
|
+
const ret = arg0.buffer;
|
|
1165
|
+
return ret;
|
|
1343
1166
|
};
|
|
1344
1167
|
|
|
1345
1168
|
module.exports.__wbg_get_5419cf6b954aa11d = function(arg0, arg1) {
|
|
1346
|
-
const ret =
|
|
1347
|
-
return
|
|
1169
|
+
const ret = arg0[arg1 >>> 0];
|
|
1170
|
+
return ret;
|
|
1348
1171
|
};
|
|
1349
1172
|
|
|
1350
1173
|
module.exports.__wbg_length_f217bbbf7e8e4df4 = function(arg0) {
|
|
1351
|
-
const ret =
|
|
1174
|
+
const ret = arg0.length;
|
|
1352
1175
|
return ret;
|
|
1353
1176
|
};
|
|
1354
1177
|
|
|
1355
1178
|
module.exports.__wbg_new_034f913e7636e987 = function() {
|
|
1356
1179
|
const ret = new Array();
|
|
1357
|
-
return
|
|
1180
|
+
return ret;
|
|
1358
1181
|
};
|
|
1359
1182
|
|
|
1360
1183
|
module.exports.__wbindgen_number_new = function(arg0) {
|
|
1361
1184
|
const ret = arg0;
|
|
1362
|
-
return
|
|
1363
|
-
};
|
|
1364
|
-
|
|
1365
|
-
module.exports.__wbindgen_object_clone_ref = function(arg0) {
|
|
1366
|
-
const ret = getObject(arg0);
|
|
1367
|
-
return addHeapObject(ret);
|
|
1185
|
+
return ret;
|
|
1368
1186
|
};
|
|
1369
1187
|
|
|
1370
1188
|
module.exports.__wbindgen_is_function = function(arg0) {
|
|
1371
|
-
const ret = typeof(
|
|
1189
|
+
const ret = typeof(arg0) === 'function';
|
|
1372
1190
|
return ret;
|
|
1373
1191
|
};
|
|
1374
1192
|
|
|
1375
1193
|
module.exports.__wbindgen_is_object = function(arg0) {
|
|
1376
|
-
const val =
|
|
1194
|
+
const val = arg0;
|
|
1377
1195
|
const ret = typeof(val) === 'object' && val !== null;
|
|
1378
1196
|
return ret;
|
|
1379
1197
|
};
|
|
1380
1198
|
|
|
1381
1199
|
module.exports.__wbg_next_13b477da1eaa3897 = function(arg0) {
|
|
1382
|
-
const ret =
|
|
1383
|
-
return
|
|
1200
|
+
const ret = arg0.next;
|
|
1201
|
+
return ret;
|
|
1384
1202
|
};
|
|
1385
1203
|
|
|
1386
1204
|
module.exports.__wbg_next_b06e115d1b01e10b = function() { return handleError(function (arg0) {
|
|
1387
|
-
const ret =
|
|
1388
|
-
return
|
|
1205
|
+
const ret = arg0.next();
|
|
1206
|
+
return ret;
|
|
1389
1207
|
}, arguments) };
|
|
1390
1208
|
|
|
1391
1209
|
module.exports.__wbg_done_983b5ffcaec8c583 = function(arg0) {
|
|
1392
|
-
const ret =
|
|
1210
|
+
const ret = arg0.done;
|
|
1393
1211
|
return ret;
|
|
1394
1212
|
};
|
|
1395
1213
|
|
|
1396
1214
|
module.exports.__wbg_value_2ab8a198c834c26a = function(arg0) {
|
|
1397
|
-
const ret =
|
|
1398
|
-
return
|
|
1215
|
+
const ret = arg0.value;
|
|
1216
|
+
return ret;
|
|
1399
1217
|
};
|
|
1400
1218
|
|
|
1401
1219
|
module.exports.__wbg_iterator_695d699a44d6234c = function() {
|
|
1402
1220
|
const ret = Symbol.iterator;
|
|
1403
|
-
return
|
|
1221
|
+
return ret;
|
|
1404
1222
|
};
|
|
1405
1223
|
|
|
1406
|
-
module.exports.__wbg_get_ef828680c64da212 = function() { return handleError(function (arg0, arg1) {
|
|
1407
|
-
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
1408
|
-
return addHeapObject(ret);
|
|
1409
|
-
}, arguments) };
|
|
1410
|
-
|
|
1411
1224
|
module.exports.__wbg_call_a9ef466721e824f2 = function() { return handleError(function (arg0, arg1) {
|
|
1412
|
-
const ret =
|
|
1413
|
-
return
|
|
1225
|
+
const ret = arg0.call(arg1);
|
|
1226
|
+
return ret;
|
|
1414
1227
|
}, arguments) };
|
|
1415
1228
|
|
|
1416
1229
|
module.exports.__wbg_new_e69b5f66fda8f13c = function() {
|
|
1417
1230
|
const ret = new Object();
|
|
1418
|
-
return
|
|
1419
|
-
};
|
|
1420
|
-
|
|
1421
|
-
module.exports.__wbg_buffer_ccaed51a635d8a2d = function(arg0) {
|
|
1422
|
-
const ret = getObject(arg0).buffer;
|
|
1423
|
-
return addHeapObject(ret);
|
|
1231
|
+
return ret;
|
|
1424
1232
|
};
|
|
1425
1233
|
|
|
1426
1234
|
module.exports.__wbindgen_number_get = function(arg0, arg1) {
|
|
1427
|
-
const obj =
|
|
1235
|
+
const obj = arg1;
|
|
1428
1236
|
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
1429
1237
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
1430
1238
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
1431
1239
|
};
|
|
1432
1240
|
|
|
1433
1241
|
module.exports.__wbindgen_is_undefined = function(arg0) {
|
|
1434
|
-
const ret =
|
|
1242
|
+
const ret = arg0 === undefined;
|
|
1435
1243
|
return ret;
|
|
1436
1244
|
};
|
|
1437
1245
|
|
|
1438
1246
|
module.exports.__wbg_set_425e70f7c64ac962 = function(arg0, arg1, arg2) {
|
|
1439
|
-
|
|
1247
|
+
arg0[arg1 >>> 0] = arg2;
|
|
1440
1248
|
};
|
|
1441
1249
|
|
|
1442
1250
|
module.exports.__wbg_isArray_6f3b47f09adb61b5 = function(arg0) {
|
|
1443
|
-
const ret = Array.isArray(
|
|
1251
|
+
const ret = Array.isArray(arg0);
|
|
1444
1252
|
return ret;
|
|
1445
1253
|
};
|
|
1446
1254
|
|
|
1447
1255
|
module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
|
|
1448
1256
|
let result;
|
|
1449
1257
|
try {
|
|
1450
|
-
result =
|
|
1258
|
+
result = arg0 instanceof ArrayBuffer;
|
|
1451
1259
|
} catch (_) {
|
|
1452
1260
|
result = false;
|
|
1453
1261
|
}
|
|
@@ -1456,28 +1264,28 @@ module.exports.__wbg_instanceof_ArrayBuffer_74945570b4a62ec7 = function(arg0) {
|
|
|
1456
1264
|
};
|
|
1457
1265
|
|
|
1458
1266
|
module.exports.__wbg_isSafeInteger_b9dff570f01a9100 = function(arg0) {
|
|
1459
|
-
const ret = Number.isSafeInteger(
|
|
1267
|
+
const ret = Number.isSafeInteger(arg0);
|
|
1460
1268
|
return ret;
|
|
1461
1269
|
};
|
|
1462
1270
|
|
|
1463
1271
|
module.exports.__wbg_new_fec2611eb9180f95 = function(arg0) {
|
|
1464
|
-
const ret = new Uint8Array(
|
|
1465
|
-
return
|
|
1272
|
+
const ret = new Uint8Array(arg0);
|
|
1273
|
+
return ret;
|
|
1466
1274
|
};
|
|
1467
1275
|
|
|
1468
1276
|
module.exports.__wbg_set_ec2fcf81bc573fd9 = function(arg0, arg1, arg2) {
|
|
1469
|
-
|
|
1277
|
+
arg0.set(arg1, arg2 >>> 0);
|
|
1470
1278
|
};
|
|
1471
1279
|
|
|
1472
1280
|
module.exports.__wbg_length_9254c4bd3b9f23c4 = function(arg0) {
|
|
1473
|
-
const ret =
|
|
1281
|
+
const ret = arg0.length;
|
|
1474
1282
|
return ret;
|
|
1475
1283
|
};
|
|
1476
1284
|
|
|
1477
1285
|
module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
|
|
1478
1286
|
let result;
|
|
1479
1287
|
try {
|
|
1480
|
-
result =
|
|
1288
|
+
result = arg0 instanceof Uint8Array;
|
|
1481
1289
|
} catch (_) {
|
|
1482
1290
|
result = false;
|
|
1483
1291
|
}
|
|
@@ -1487,85 +1295,96 @@ module.exports.__wbg_instanceof_Uint8Array_df0761410414ef36 = function(arg0) {
|
|
|
1487
1295
|
|
|
1488
1296
|
module.exports.__wbindgen_bigint_from_u64 = function(arg0) {
|
|
1489
1297
|
const ret = BigInt.asUintN(64, arg0);
|
|
1490
|
-
return
|
|
1298
|
+
return ret;
|
|
1491
1299
|
};
|
|
1492
1300
|
|
|
1493
1301
|
module.exports.__wbindgen_shr = function(arg0, arg1) {
|
|
1494
|
-
const ret =
|
|
1495
|
-
return
|
|
1302
|
+
const ret = arg0 >> arg1;
|
|
1303
|
+
return ret;
|
|
1496
1304
|
};
|
|
1497
1305
|
|
|
1498
1306
|
module.exports.__wbindgen_bigint_from_i64 = function(arg0) {
|
|
1499
1307
|
const ret = arg0;
|
|
1500
|
-
return
|
|
1308
|
+
return ret;
|
|
1501
1309
|
};
|
|
1502
1310
|
|
|
1503
1311
|
module.exports.__wbindgen_jsval_eq = function(arg0, arg1) {
|
|
1504
|
-
const ret =
|
|
1312
|
+
const ret = arg0 === arg1;
|
|
1505
1313
|
return ret;
|
|
1506
1314
|
};
|
|
1507
1315
|
|
|
1508
1316
|
module.exports.__wbindgen_jsval_loose_eq = function(arg0, arg1) {
|
|
1509
|
-
const ret =
|
|
1317
|
+
const ret = arg0 == arg1;
|
|
1510
1318
|
return ret;
|
|
1511
1319
|
};
|
|
1512
1320
|
|
|
1513
1321
|
module.exports.__wbindgen_boolean_get = function(arg0) {
|
|
1514
|
-
const v =
|
|
1322
|
+
const v = arg0;
|
|
1515
1323
|
const ret = typeof(v) === 'boolean' ? (v ? 1 : 0) : 2;
|
|
1516
1324
|
return ret;
|
|
1517
1325
|
};
|
|
1518
1326
|
|
|
1519
|
-
module.exports.
|
|
1520
|
-
const ret =
|
|
1521
|
-
|
|
1522
|
-
const len1 = WASM_VECTOR_LEN;
|
|
1523
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1524
|
-
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1327
|
+
module.exports.__wbindgen_as_number = function(arg0) {
|
|
1328
|
+
const ret = +arg0;
|
|
1329
|
+
return ret;
|
|
1525
1330
|
};
|
|
1526
1331
|
|
|
1527
1332
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
1528
1333
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
1529
|
-
return
|
|
1334
|
+
return ret;
|
|
1530
1335
|
};
|
|
1531
1336
|
|
|
1532
1337
|
module.exports.__wbindgen_bigint_from_u128 = function(arg0, arg1) {
|
|
1533
1338
|
const ret = BigInt.asUintN(64, arg0) << BigInt(64) | BigInt.asUintN(64, arg1);
|
|
1534
|
-
return
|
|
1339
|
+
return ret;
|
|
1535
1340
|
};
|
|
1536
1341
|
|
|
1537
|
-
module.exports.
|
|
1538
|
-
const ret =
|
|
1539
|
-
return
|
|
1342
|
+
module.exports.__wbg_getwithrefkey_edc2c8960f0f1191 = function(arg0, arg1) {
|
|
1343
|
+
const ret = arg0[arg1];
|
|
1344
|
+
return ret;
|
|
1540
1345
|
};
|
|
1541
1346
|
|
|
1542
|
-
module.exports.
|
|
1543
|
-
|
|
1347
|
+
module.exports.__wbg_String_88810dfeb4021902 = function(arg0, arg1) {
|
|
1348
|
+
const ret = String(arg1);
|
|
1349
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1350
|
+
const len1 = WASM_VECTOR_LEN;
|
|
1351
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
1352
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
1544
1353
|
};
|
|
1545
1354
|
|
|
1546
|
-
module.exports.
|
|
1547
|
-
const ret =
|
|
1355
|
+
module.exports.__wbg_getwithrefkey_5e6d9547403deab8 = function(arg0, arg1) {
|
|
1356
|
+
const ret = arg0[arg1];
|
|
1548
1357
|
return ret;
|
|
1549
1358
|
};
|
|
1550
1359
|
|
|
1551
|
-
module.exports.
|
|
1552
|
-
|
|
1553
|
-
|
|
1360
|
+
module.exports.__wbg_set_841ac57cff3d672b = function(arg0, arg1, arg2) {
|
|
1361
|
+
arg0[arg1] = arg2;
|
|
1362
|
+
};
|
|
1363
|
+
|
|
1364
|
+
module.exports.__wbindgen_is_array = function(arg0) {
|
|
1365
|
+
const ret = Array.isArray(arg0);
|
|
1366
|
+
return ret;
|
|
1554
1367
|
};
|
|
1555
1368
|
|
|
1556
1369
|
module.exports.__wbindgen_in = function(arg0, arg1) {
|
|
1557
|
-
const ret =
|
|
1370
|
+
const ret = arg0 in arg1;
|
|
1558
1371
|
return ret;
|
|
1559
1372
|
};
|
|
1560
1373
|
|
|
1561
1374
|
module.exports.__wbindgen_is_bigint = function(arg0) {
|
|
1562
|
-
const ret = typeof(
|
|
1375
|
+
const ret = typeof(arg0) === 'bigint';
|
|
1563
1376
|
return ret;
|
|
1564
1377
|
};
|
|
1565
1378
|
|
|
1566
|
-
module.exports.
|
|
1567
|
-
const
|
|
1568
|
-
|
|
1379
|
+
module.exports.__wbindgen_init_externref_table = function() {
|
|
1380
|
+
const table = wasm.__wbindgen_export_2;
|
|
1381
|
+
const offset = table.grow(4);
|
|
1382
|
+
table.set(0, undefined);
|
|
1383
|
+
table.set(offset + 0, undefined);
|
|
1384
|
+
table.set(offset + 1, null);
|
|
1385
|
+
table.set(offset + 2, true);
|
|
1386
|
+
table.set(offset + 3, false);
|
|
1387
|
+
;
|
|
1569
1388
|
};
|
|
1570
1389
|
|
|
1571
1390
|
const path = require('path').join(__dirname, 'orca_whirlpools_core_js_bindings_bg.wasm');
|
|
@@ -1576,3 +1395,5 @@ const wasmInstance = new WebAssembly.Instance(wasmModule, imports);
|
|
|
1576
1395
|
wasm = wasmInstance.exports;
|
|
1577
1396
|
module.exports.__wasm = wasm;
|
|
1578
1397
|
|
|
1398
|
+
wasm.__wbindgen_start();
|
|
1399
|
+
|