@picon-finance/dlmm-sdk 1.0.0 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/actions/create_admin_config.d.ts.map +1 -1
- package/dist/actions/create_admin_config.js +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/quote/wasm-node/picon_dlmm_quote.d.ts +64 -6
- package/dist/quote/wasm-node/picon_dlmm_quote.js +91 -82
- package/dist/quote/wasm-node/picon_dlmm_quote_bg.wasm.d.ts +11 -0
- package/dist/quote/wasm-web/picon_dlmm_quote.d.ts +98 -7
- package/dist/quote/wasm-web/picon_dlmm_quote.js +121 -107
- package/dist/quote/wasm-web/picon_dlmm_quote_bg.wasm.d.ts +11 -0
- package/package.json +12 -13
- package/src/actions/create_admin_config.ts +2 -1
- package/src/index.ts +3 -0
- package/dist/quote/wasm-node/picon_dlmm_quote.d.ts.map +0 -1
- package/dist/quote/wasm-web/picon_dlmm_quote.d.ts.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create_admin_config.d.ts","sourceRoot":"","sources":["../../src/actions/create_admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAGvB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"create_admin_config.d.ts","sourceRoot":"","sources":["../../src/actions/create_admin_config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,iBAAiB,EAGvB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAsD,KAAK,yBAAyB,EAAE,KAAK,GAAG,EAAE,MAAM,WAAW,CAAC;AAYzH,wBAAsB,iBAAiB,CACrC,GAAG,EAAE,GAAG,EACR,EACE,QAAQ,EACR,SAAS,EACT,uBAAuB,GACxB,EAAE;IACD,QAAQ,EAAE,iBAAiB,CAAC;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,uBAAuB,CAAC,EAAE,OAAO,CAAC;CACnC,EACD,cAAc,GAAE,OAAoC,EACpD,OAAO,GAAE,yBAA8B;;;;;;;4NAmBxC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getAddressEncoder, getProgramDerivedAddress, } from "@solana/kit";
|
|
2
|
-
import { LOADER_V3_PROGRAM_ADDRESS } from "@solana-program/loader-v3";
|
|
3
2
|
import { PICON_DLMM_PROGRAM_ADDRESS, getCreateAdminConfigInstructionAsync } from "../generated";
|
|
4
3
|
import { buildTransactionMessage, resolveAdminConfigAddress } from "./helpers";
|
|
4
|
+
const LOADER_V3_PROGRAM_ADDRESS = "BPFLoaderUpgradeab1e11111111111111111111111";
|
|
5
5
|
async function findProgramDataAddress(programAddress) {
|
|
6
6
|
const [programData] = await getProgramDerivedAddress({
|
|
7
7
|
programAddress: LOADER_V3_PROGRAM_ADDRESS,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
export * as generated from "./generated";
|
|
2
|
+
export { DistributionMode } from "./generated/types/distributionMode";
|
|
2
3
|
export * as events from "./events";
|
|
4
|
+
export * from "./utils/constants";
|
|
5
|
+
export { NATIVE_MINT_ADDRESS } from "./utils/ata";
|
|
3
6
|
export * from "./actions";
|
|
4
7
|
export * from "./program_addresses";
|
|
5
8
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,SAAS,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,cAAc,WAAW,CAAC;AAC1B,cAAc,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export * as generated from "./generated";
|
|
2
|
+
export { DistributionMode } from "./generated/types/distributionMode";
|
|
2
3
|
export * as events from "./events";
|
|
4
|
+
export * from "./utils/constants";
|
|
5
|
+
export { NATIVE_MINT_ADDRESS } from "./utils/ata";
|
|
3
6
|
export * from "./actions";
|
|
4
7
|
export * from "./program_addresses";
|
|
@@ -1,6 +1,64 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export interface Bin {
|
|
4
|
+
amountX: bigint;
|
|
5
|
+
amountY: bigint;
|
|
6
|
+
price: bigint;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BinArray {
|
|
10
|
+
index: number;
|
|
11
|
+
bins: Bin[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DynamicFeeConfig {
|
|
15
|
+
filterPeriod: number;
|
|
16
|
+
decayPeriod: number;
|
|
17
|
+
reductionFactor: number;
|
|
18
|
+
dynamicFeeControl: number;
|
|
19
|
+
maxVolatilityAccumulator: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DynamicFeeState {
|
|
23
|
+
config: DynamicFeeConfig;
|
|
24
|
+
referenceBinId: number;
|
|
25
|
+
volatilityReference: number;
|
|
26
|
+
volatilityAccumulator: number;
|
|
27
|
+
lastUpdateTimestamp: bigint;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PoolState {
|
|
31
|
+
binStep: number;
|
|
32
|
+
feeRate: number;
|
|
33
|
+
protocolShare: number;
|
|
34
|
+
activeBinId: number;
|
|
35
|
+
dynamicFeeState: DynamicFeeState;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface QuoteInput {
|
|
39
|
+
amountIn: bigint;
|
|
40
|
+
xToY: boolean;
|
|
41
|
+
slippageToleranceBps: number;
|
|
42
|
+
now: bigint;
|
|
43
|
+
poolState: PoolState;
|
|
44
|
+
binArrays: (BinArray | undefined)[];
|
|
45
|
+
inputTransferFee?: TransferFee;
|
|
46
|
+
outputTransferFee?: TransferFee;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface QuoteOutput {
|
|
50
|
+
amountIn: bigint;
|
|
51
|
+
amountOut: bigint;
|
|
52
|
+
minAmountOut: bigint;
|
|
53
|
+
fee: bigint;
|
|
54
|
+
feeRateMin: bigint;
|
|
55
|
+
feeRateMax: bigint;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface TransferFee {
|
|
59
|
+
feeBps: number;
|
|
60
|
+
maxFee: bigint;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export function quote(input: QuoteInput): QuoteOutput;
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/* @ts-self-types="./picon_dlmm_quote.d.ts" */
|
|
2
2
|
import { readFileSync } from 'node:fs';
|
|
3
|
+
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* @param {QuoteInput} input
|
|
5
7
|
* @returns {QuoteOutput}
|
|
@@ -14,209 +16,201 @@ export function quote(input) {
|
|
|
14
16
|
function __wbg_get_imports() {
|
|
15
17
|
const import0 = {
|
|
16
18
|
__proto__: null,
|
|
17
|
-
__wbg_Error_92b29b0548f8b746: function
|
|
19
|
+
__wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
|
|
18
20
|
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
19
21
|
return ret;
|
|
20
22
|
},
|
|
21
|
-
__wbg_Number_9a4e0ecb0fa16705: function
|
|
23
|
+
__wbg_Number_9a4e0ecb0fa16705: function(arg0) {
|
|
22
24
|
const ret = Number(arg0);
|
|
23
25
|
return ret;
|
|
24
26
|
},
|
|
25
|
-
__wbg_String_8564e559799eccda: function
|
|
27
|
+
__wbg_String_8564e559799eccda: function(arg0, arg1) {
|
|
26
28
|
const ret = String(arg1);
|
|
27
29
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
28
30
|
const len1 = WASM_VECTOR_LEN;
|
|
29
31
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
30
32
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
31
33
|
},
|
|
32
|
-
__wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function
|
|
34
|
+
__wbg___wbindgen_bigint_get_as_i64_d968e41184ae354f: function(arg0, arg1) {
|
|
33
35
|
const v = arg1;
|
|
34
|
-
const ret = typeof
|
|
36
|
+
const ret = typeof(v) === 'bigint' ? v : undefined;
|
|
35
37
|
getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
|
|
36
38
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
37
39
|
},
|
|
38
|
-
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function
|
|
40
|
+
__wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
|
|
39
41
|
const v = arg0;
|
|
40
|
-
const ret = typeof
|
|
42
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
41
43
|
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
42
44
|
},
|
|
43
|
-
__wbg___wbindgen_debug_string_c25d447a39f5578f: function
|
|
45
|
+
__wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
|
|
44
46
|
const ret = debugString(arg1);
|
|
45
47
|
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
46
48
|
const len1 = WASM_VECTOR_LEN;
|
|
47
49
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
48
50
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
49
51
|
},
|
|
50
|
-
__wbg___wbindgen_in_aca499c5de7ff5e5: function
|
|
52
|
+
__wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
|
|
51
53
|
const ret = arg0 in arg1;
|
|
52
54
|
return ret;
|
|
53
55
|
},
|
|
54
|
-
__wbg___wbindgen_is_bigint_2f76dc55065b4273: function
|
|
55
|
-
const ret = typeof
|
|
56
|
+
__wbg___wbindgen_is_bigint_2f76dc55065b4273: function(arg0) {
|
|
57
|
+
const ret = typeof(arg0) === 'bigint';
|
|
56
58
|
return ret;
|
|
57
59
|
},
|
|
58
|
-
__wbg___wbindgen_is_function_1ff95bcc5517c252: function
|
|
59
|
-
const ret = typeof
|
|
60
|
+
__wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
|
|
61
|
+
const ret = typeof(arg0) === 'function';
|
|
60
62
|
return ret;
|
|
61
63
|
},
|
|
62
|
-
__wbg___wbindgen_is_object_a27215656b807791: function
|
|
64
|
+
__wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
|
|
63
65
|
const val = arg0;
|
|
64
|
-
const ret = typeof
|
|
66
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
65
67
|
return ret;
|
|
66
68
|
},
|
|
67
|
-
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function
|
|
69
|
+
__wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
|
|
68
70
|
const ret = arg0 === undefined;
|
|
69
71
|
return ret;
|
|
70
72
|
},
|
|
71
|
-
__wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function
|
|
73
|
+
__wbg___wbindgen_jsval_eq_e659fcf7b0e32763: function(arg0, arg1) {
|
|
72
74
|
const ret = arg0 === arg1;
|
|
73
75
|
return ret;
|
|
74
76
|
},
|
|
75
|
-
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function
|
|
77
|
+
__wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
|
|
76
78
|
const ret = arg0 == arg1;
|
|
77
79
|
return ret;
|
|
78
80
|
},
|
|
79
|
-
__wbg___wbindgen_number_get_394265ed1e1b84ee: function
|
|
81
|
+
__wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
|
|
80
82
|
const obj = arg1;
|
|
81
|
-
const ret = typeof
|
|
83
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
82
84
|
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
83
85
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
84
86
|
},
|
|
85
|
-
__wbg___wbindgen_shr_ad10001a7b001d7f: function
|
|
87
|
+
__wbg___wbindgen_shr_ad10001a7b001d7f: function(arg0, arg1) {
|
|
86
88
|
const ret = arg0 >> arg1;
|
|
87
89
|
return ret;
|
|
88
90
|
},
|
|
89
|
-
__wbg___wbindgen_string_get_b0ca35b86a603356: function
|
|
91
|
+
__wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
|
|
90
92
|
const obj = arg1;
|
|
91
|
-
const ret = typeof
|
|
93
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
92
94
|
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
93
95
|
var len1 = WASM_VECTOR_LEN;
|
|
94
96
|
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
95
97
|
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
96
98
|
},
|
|
97
|
-
__wbg___wbindgen_throw_344f42d3211c4765: function
|
|
99
|
+
__wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
|
|
98
100
|
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
99
101
|
},
|
|
100
|
-
__wbg_call_8a2dd23819f8a60a: function () {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
},
|
|
106
|
-
__wbg_done_89b2b13e91a60321: function (arg0) {
|
|
102
|
+
__wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
|
|
103
|
+
const ret = arg0.call(arg1);
|
|
104
|
+
return ret;
|
|
105
|
+
}, arguments); },
|
|
106
|
+
__wbg_done_89b2b13e91a60321: function(arg0) {
|
|
107
107
|
const ret = arg0.done;
|
|
108
108
|
return ret;
|
|
109
109
|
},
|
|
110
|
-
__wbg_get_c7eb1f358a7654df: function () {
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
},
|
|
116
|
-
__wbg_get_unchecked_6e0ad6d2a41b06f6: function (arg0, arg1) {
|
|
110
|
+
__wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
|
|
111
|
+
const ret = Reflect.get(arg0, arg1);
|
|
112
|
+
return ret;
|
|
113
|
+
}, arguments); },
|
|
114
|
+
__wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
|
|
117
115
|
const ret = arg0[arg1 >>> 0];
|
|
118
116
|
return ret;
|
|
119
117
|
},
|
|
120
|
-
__wbg_get_with_ref_key_6412cf3094599694: function
|
|
118
|
+
__wbg_get_with_ref_key_6412cf3094599694: function(arg0, arg1) {
|
|
121
119
|
const ret = arg0[arg1];
|
|
122
120
|
return ret;
|
|
123
121
|
},
|
|
124
|
-
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function
|
|
122
|
+
__wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
|
|
125
123
|
let result;
|
|
126
124
|
try {
|
|
127
125
|
result = arg0 instanceof ArrayBuffer;
|
|
128
|
-
}
|
|
129
|
-
catch (_) {
|
|
126
|
+
} catch (_) {
|
|
130
127
|
result = false;
|
|
131
128
|
}
|
|
132
129
|
const ret = result;
|
|
133
130
|
return ret;
|
|
134
131
|
},
|
|
135
|
-
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function
|
|
132
|
+
__wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
|
|
136
133
|
let result;
|
|
137
134
|
try {
|
|
138
135
|
result = arg0 instanceof Uint8Array;
|
|
139
|
-
}
|
|
140
|
-
catch (_) {
|
|
136
|
+
} catch (_) {
|
|
141
137
|
result = false;
|
|
142
138
|
}
|
|
143
139
|
const ret = result;
|
|
144
140
|
return ret;
|
|
145
141
|
},
|
|
146
|
-
__wbg_isArray_0677c962b281d01a: function
|
|
142
|
+
__wbg_isArray_0677c962b281d01a: function(arg0) {
|
|
147
143
|
const ret = Array.isArray(arg0);
|
|
148
144
|
return ret;
|
|
149
145
|
},
|
|
150
|
-
__wbg_isSafeInteger_04f36e4056f1b851: function
|
|
146
|
+
__wbg_isSafeInteger_04f36e4056f1b851: function(arg0) {
|
|
151
147
|
const ret = Number.isSafeInteger(arg0);
|
|
152
148
|
return ret;
|
|
153
149
|
},
|
|
154
|
-
__wbg_iterator_6f722e4a93058b71: function
|
|
150
|
+
__wbg_iterator_6f722e4a93058b71: function() {
|
|
155
151
|
const ret = Symbol.iterator;
|
|
156
152
|
return ret;
|
|
157
153
|
},
|
|
158
|
-
__wbg_length_1f0964f4a5e2c6d8: function
|
|
154
|
+
__wbg_length_1f0964f4a5e2c6d8: function(arg0) {
|
|
159
155
|
const ret = arg0.length;
|
|
160
156
|
return ret;
|
|
161
157
|
},
|
|
162
|
-
__wbg_length_370319915dc99107: function
|
|
158
|
+
__wbg_length_370319915dc99107: function(arg0) {
|
|
163
159
|
const ret = arg0.length;
|
|
164
160
|
return ret;
|
|
165
161
|
},
|
|
166
|
-
__wbg_new_cd45aabdf6073e84: function
|
|
162
|
+
__wbg_new_cd45aabdf6073e84: function(arg0) {
|
|
167
163
|
const ret = new Uint8Array(arg0);
|
|
168
164
|
return ret;
|
|
169
165
|
},
|
|
170
|
-
__wbg_new_da52cf8fe3429cb2: function
|
|
166
|
+
__wbg_new_da52cf8fe3429cb2: function() {
|
|
171
167
|
const ret = new Object();
|
|
172
168
|
return ret;
|
|
173
169
|
},
|
|
174
|
-
__wbg_next_6dbf2c0ac8cde20f: function
|
|
170
|
+
__wbg_next_6dbf2c0ac8cde20f: function(arg0) {
|
|
175
171
|
const ret = arg0.next;
|
|
176
172
|
return ret;
|
|
177
173
|
},
|
|
178
|
-
__wbg_next_71f2aa1cb3d1e37e: function () {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
},
|
|
184
|
-
__wbg_prototypesetcall_4770620bbe4688a0: function (arg0, arg1, arg2) {
|
|
174
|
+
__wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
|
|
175
|
+
const ret = arg0.next();
|
|
176
|
+
return ret;
|
|
177
|
+
}, arguments); },
|
|
178
|
+
__wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
|
|
185
179
|
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
|
|
186
180
|
},
|
|
187
|
-
__wbg_set_6be42768c690e380: function
|
|
181
|
+
__wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
|
|
188
182
|
arg0[arg1] = arg2;
|
|
189
183
|
},
|
|
190
|
-
__wbg_value_a5d5488a9589444a: function
|
|
184
|
+
__wbg_value_a5d5488a9589444a: function(arg0) {
|
|
191
185
|
const ret = arg0.value;
|
|
192
186
|
return ret;
|
|
193
187
|
},
|
|
194
|
-
__wbindgen_cast_0000000000000001: function
|
|
188
|
+
__wbindgen_cast_0000000000000001: function(arg0) {
|
|
195
189
|
// Cast intrinsic for `F64 -> Externref`.
|
|
196
190
|
const ret = arg0;
|
|
197
191
|
return ret;
|
|
198
192
|
},
|
|
199
|
-
__wbindgen_cast_0000000000000002: function
|
|
193
|
+
__wbindgen_cast_0000000000000002: function(arg0) {
|
|
200
194
|
// Cast intrinsic for `I64 -> Externref`.
|
|
201
195
|
const ret = arg0;
|
|
202
196
|
return ret;
|
|
203
197
|
},
|
|
204
|
-
__wbindgen_cast_0000000000000003: function
|
|
198
|
+
__wbindgen_cast_0000000000000003: function(arg0, arg1) {
|
|
205
199
|
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
206
200
|
const ret = getStringFromWasm0(arg0, arg1);
|
|
207
201
|
return ret;
|
|
208
202
|
},
|
|
209
|
-
__wbindgen_cast_0000000000000004: function
|
|
203
|
+
__wbindgen_cast_0000000000000004: function(arg0, arg1) {
|
|
210
204
|
// Cast intrinsic for `U128 -> Externref`.
|
|
211
205
|
const ret = (BigInt.asUintN(64, arg0) | (BigInt.asUintN(64, arg1) << BigInt(64)));
|
|
212
206
|
return ret;
|
|
213
207
|
},
|
|
214
|
-
__wbindgen_cast_0000000000000005: function
|
|
208
|
+
__wbindgen_cast_0000000000000005: function(arg0) {
|
|
215
209
|
// Cast intrinsic for `U64 -> Externref`.
|
|
216
210
|
const ret = BigInt.asUintN(64, arg0);
|
|
217
211
|
return ret;
|
|
218
212
|
},
|
|
219
|
-
__wbindgen_init_externref_table: function
|
|
213
|
+
__wbindgen_init_externref_table: function() {
|
|
220
214
|
const table = wasm.__wbindgen_externrefs;
|
|
221
215
|
const offset = table.grow(4);
|
|
222
216
|
table.set(0, undefined);
|
|
@@ -231,16 +225,18 @@ function __wbg_get_imports() {
|
|
|
231
225
|
"./picon_dlmm_quote_bg.js": import0,
|
|
232
226
|
};
|
|
233
227
|
}
|
|
228
|
+
|
|
234
229
|
function addToExternrefTable0(obj) {
|
|
235
230
|
const idx = wasm.__externref_table_alloc();
|
|
236
231
|
wasm.__wbindgen_externrefs.set(idx, obj);
|
|
237
232
|
return idx;
|
|
238
233
|
}
|
|
234
|
+
|
|
239
235
|
function debugString(val) {
|
|
240
236
|
// primitive types
|
|
241
237
|
const type = typeof val;
|
|
242
238
|
if (type == 'number' || type == 'boolean' || val == null) {
|
|
243
|
-
return
|
|
239
|
+
return `${val}`;
|
|
244
240
|
}
|
|
245
241
|
if (type == 'string') {
|
|
246
242
|
return `"${val}"`;
|
|
@@ -249,8 +245,7 @@ function debugString(val) {
|
|
|
249
245
|
const description = val.description;
|
|
250
246
|
if (description == null) {
|
|
251
247
|
return 'Symbol';
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
248
|
+
} else {
|
|
254
249
|
return `Symbol(${description})`;
|
|
255
250
|
}
|
|
256
251
|
}
|
|
@@ -258,8 +253,7 @@ function debugString(val) {
|
|
|
258
253
|
const name = val.name;
|
|
259
254
|
if (typeof name == 'string' && name.length > 0) {
|
|
260
255
|
return `Function(${name})`;
|
|
261
|
-
}
|
|
262
|
-
else {
|
|
256
|
+
} else {
|
|
263
257
|
return 'Function';
|
|
264
258
|
}
|
|
265
259
|
}
|
|
@@ -270,7 +264,7 @@ function debugString(val) {
|
|
|
270
264
|
if (length > 0) {
|
|
271
265
|
debug += debugString(val[0]);
|
|
272
266
|
}
|
|
273
|
-
for
|
|
267
|
+
for(let i = 1; i < length; i++) {
|
|
274
268
|
debug += ', ' + debugString(val[i]);
|
|
275
269
|
}
|
|
276
270
|
debug += ']';
|
|
@@ -281,8 +275,7 @@ function debugString(val) {
|
|
|
281
275
|
let className;
|
|
282
276
|
if (builtInMatches && builtInMatches.length > 1) {
|
|
283
277
|
className = builtInMatches[1];
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
278
|
+
} else {
|
|
286
279
|
// Failed to match the standard '[object ClassName]'
|
|
287
280
|
return toString.call(val);
|
|
288
281
|
}
|
|
@@ -292,8 +285,7 @@ function debugString(val) {
|
|
|
292
285
|
// easier than looping through ownProperties of `val`.
|
|
293
286
|
try {
|
|
294
287
|
return 'Object(' + JSON.stringify(val) + ')';
|
|
295
|
-
}
|
|
296
|
-
catch (_) {
|
|
288
|
+
} catch (_) {
|
|
297
289
|
return 'Object';
|
|
298
290
|
}
|
|
299
291
|
}
|
|
@@ -304,10 +296,12 @@ function debugString(val) {
|
|
|
304
296
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
305
297
|
return className;
|
|
306
298
|
}
|
|
299
|
+
|
|
307
300
|
function getArrayU8FromWasm0(ptr, len) {
|
|
308
301
|
ptr = ptr >>> 0;
|
|
309
302
|
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
310
303
|
}
|
|
304
|
+
|
|
311
305
|
let cachedDataViewMemory0 = null;
|
|
312
306
|
function getDataViewMemory0() {
|
|
313
307
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
@@ -315,9 +309,11 @@ function getDataViewMemory0() {
|
|
|
315
309
|
}
|
|
316
310
|
return cachedDataViewMemory0;
|
|
317
311
|
}
|
|
312
|
+
|
|
318
313
|
function getStringFromWasm0(ptr, len) {
|
|
319
314
|
return decodeText(ptr >>> 0, len);
|
|
320
315
|
}
|
|
316
|
+
|
|
321
317
|
let cachedUint8ArrayMemory0 = null;
|
|
322
318
|
function getUint8ArrayMemory0() {
|
|
323
319
|
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
@@ -325,18 +321,20 @@ function getUint8ArrayMemory0() {
|
|
|
325
321
|
}
|
|
326
322
|
return cachedUint8ArrayMemory0;
|
|
327
323
|
}
|
|
324
|
+
|
|
328
325
|
function handleError(f, args) {
|
|
329
326
|
try {
|
|
330
327
|
return f.apply(this, args);
|
|
331
|
-
}
|
|
332
|
-
catch (e) {
|
|
328
|
+
} catch (e) {
|
|
333
329
|
const idx = addToExternrefTable0(e);
|
|
334
330
|
wasm.__wbindgen_exn_store(idx);
|
|
335
331
|
}
|
|
336
332
|
}
|
|
333
|
+
|
|
337
334
|
function isLikeNone(x) {
|
|
338
335
|
return x === undefined || x === null;
|
|
339
336
|
}
|
|
337
|
+
|
|
340
338
|
function passStringToWasm0(arg, malloc, realloc) {
|
|
341
339
|
if (realloc === undefined) {
|
|
342
340
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -345,14 +343,17 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
345
343
|
WASM_VECTOR_LEN = buf.length;
|
|
346
344
|
return ptr;
|
|
347
345
|
}
|
|
346
|
+
|
|
348
347
|
let len = arg.length;
|
|
349
348
|
let ptr = malloc(len, 1) >>> 0;
|
|
349
|
+
|
|
350
350
|
const mem = getUint8ArrayMemory0();
|
|
351
|
+
|
|
351
352
|
let offset = 0;
|
|
353
|
+
|
|
352
354
|
for (; offset < len; offset++) {
|
|
353
355
|
const code = arg.charCodeAt(offset);
|
|
354
|
-
if (code > 0x7F)
|
|
355
|
-
break;
|
|
356
|
+
if (code > 0x7F) break;
|
|
356
357
|
mem[ptr + offset] = code;
|
|
357
358
|
}
|
|
358
359
|
if (offset !== len) {
|
|
@@ -362,23 +363,29 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
362
363
|
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
363
364
|
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
364
365
|
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
366
|
+
|
|
365
367
|
offset += ret.written;
|
|
366
368
|
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
367
369
|
}
|
|
370
|
+
|
|
368
371
|
WASM_VECTOR_LEN = offset;
|
|
369
372
|
return ptr;
|
|
370
373
|
}
|
|
374
|
+
|
|
371
375
|
function takeFromExternrefTable0(idx) {
|
|
372
376
|
const value = wasm.__wbindgen_externrefs.get(idx);
|
|
373
377
|
wasm.__externref_table_dealloc(idx);
|
|
374
378
|
return value;
|
|
375
379
|
}
|
|
380
|
+
|
|
376
381
|
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
377
382
|
cachedTextDecoder.decode();
|
|
378
383
|
function decodeText(ptr, len) {
|
|
379
384
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
380
385
|
}
|
|
386
|
+
|
|
381
387
|
const cachedTextEncoder = new TextEncoder();
|
|
388
|
+
|
|
382
389
|
if (!('encodeInto' in cachedTextEncoder)) {
|
|
383
390
|
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
384
391
|
const buf = cachedTextEncoder.encode(arg);
|
|
@@ -389,7 +396,9 @@ if (!('encodeInto' in cachedTextEncoder)) {
|
|
|
389
396
|
};
|
|
390
397
|
};
|
|
391
398
|
}
|
|
399
|
+
|
|
392
400
|
let WASM_VECTOR_LEN = 0;
|
|
401
|
+
|
|
393
402
|
const wasmUrl = new URL('picon_dlmm_quote_bg.wasm', import.meta.url);
|
|
394
403
|
const wasmBytes = readFileSync(wasmUrl);
|
|
395
404
|
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const quote: (a: any) => [number, number, number];
|
|
5
|
+
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
6
|
+
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
7
|
+
export const __wbindgen_exn_store: (a: number) => void;
|
|
8
|
+
export const __externref_table_alloc: () => number;
|
|
9
|
+
export const __wbindgen_externrefs: WebAssembly.Table;
|
|
10
|
+
export const __externref_table_dealloc: (a: number) => void;
|
|
11
|
+
export const __wbindgen_start: () => void;
|
|
@@ -1,9 +1,100 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
export interface Bin {
|
|
4
|
+
amountX: bigint;
|
|
5
|
+
amountY: bigint;
|
|
6
|
+
price: bigint;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface BinArray {
|
|
10
|
+
index: number;
|
|
11
|
+
bins: Bin[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export interface DynamicFeeConfig {
|
|
15
|
+
filterPeriod: number;
|
|
16
|
+
decayPeriod: number;
|
|
17
|
+
reductionFactor: number;
|
|
18
|
+
dynamicFeeControl: number;
|
|
19
|
+
maxVolatilityAccumulator: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DynamicFeeState {
|
|
23
|
+
config: DynamicFeeConfig;
|
|
24
|
+
referenceBinId: number;
|
|
25
|
+
volatilityReference: number;
|
|
26
|
+
volatilityAccumulator: number;
|
|
27
|
+
lastUpdateTimestamp: bigint;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface PoolState {
|
|
31
|
+
binStep: number;
|
|
32
|
+
feeRate: number;
|
|
33
|
+
protocolShare: number;
|
|
34
|
+
activeBinId: number;
|
|
35
|
+
dynamicFeeState: DynamicFeeState;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export interface QuoteInput {
|
|
39
|
+
amountIn: bigint;
|
|
40
|
+
xToY: boolean;
|
|
41
|
+
slippageToleranceBps: number;
|
|
42
|
+
now: bigint;
|
|
43
|
+
poolState: PoolState;
|
|
44
|
+
binArrays: (BinArray | undefined)[];
|
|
45
|
+
inputTransferFee?: TransferFee;
|
|
46
|
+
outputTransferFee?: TransferFee;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export interface QuoteOutput {
|
|
50
|
+
amountIn: bigint;
|
|
51
|
+
amountOut: bigint;
|
|
52
|
+
minAmountOut: bigint;
|
|
53
|
+
fee: bigint;
|
|
54
|
+
feeRateMin: bigint;
|
|
55
|
+
feeRateMax: bigint;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export interface TransferFee {
|
|
59
|
+
feeBps: number;
|
|
60
|
+
maxFee: bigint;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
export function quote(input: QuoteInput): QuoteOutput;
|
|
65
|
+
|
|
66
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
67
|
+
|
|
68
|
+
export interface InitOutput {
|
|
69
|
+
readonly memory: WebAssembly.Memory;
|
|
70
|
+
readonly quote: (a: any) => [number, number, number];
|
|
71
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
72
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
73
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
74
|
+
readonly __externref_table_alloc: () => number;
|
|
75
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
76
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
77
|
+
readonly __wbindgen_start: () => void;
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
81
|
+
|
|
1
82
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
83
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
84
|
+
* a precompiled `WebAssembly.Module`.
|
|
85
|
+
*
|
|
86
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
87
|
+
*
|
|
88
|
+
* @returns {InitOutput}
|
|
4
89
|
*/
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
90
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
94
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
95
|
+
*
|
|
96
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
97
|
+
*
|
|
98
|
+
* @returns {Promise<InitOutput>}
|
|
99
|
+
*/
|
|
100
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|