@sanctumso/inf1 0.0.2-dev-1 → 0.0.2-dev-3
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/index.d.ts +123 -96
- package/index.js +184 -158
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
* @throws
|
|
4
|
+
* Returns the pubkeys of the accounts that need to be fetched to initialize
|
|
5
|
+
* a new {@link Inf} object
|
|
7
6
|
*/
|
|
8
|
-
export function
|
|
7
|
+
export function initPks(): Bs58Array[];
|
|
9
8
|
/**
|
|
9
|
+
* Initialize a new {@link Inf} object.
|
|
10
|
+
*
|
|
11
|
+
* The returned object must be updated for a mint pair before it is ready to
|
|
12
|
+
* quote and operate for trades involving that pair
|
|
13
|
+
*
|
|
10
14
|
* @throws
|
|
11
15
|
*/
|
|
12
|
-
export function
|
|
16
|
+
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* Same as {@link init}, but instead of using accounts fetched from RPC,
|
|
19
|
+
* uses the accounts' js objects
|
|
20
|
+
*
|
|
21
|
+
* @throws
|
|
15
22
|
*/
|
|
16
|
-
export function
|
|
23
|
+
export function initObj(pool: PoolStateV2, lst_state_list: LstState[], arg2: SplPoolAccounts): Inf;
|
|
24
|
+
export function cloneInf(src: Inf): Inf;
|
|
17
25
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* Returns a byte array where ret[i] corresponds to the result for `mints[i]`.
|
|
21
|
-
* 0 - false, 1 - true.
|
|
22
|
-
*
|
|
23
|
-
* If false is returned, then the data needs to be added via {@link appendSplLsts}
|
|
26
|
+
* Returned accounts are deduped
|
|
24
27
|
*
|
|
25
|
-
*
|
|
26
|
-
* conversion doesnt work with bool arrays.
|
|
28
|
+
* @throws
|
|
27
29
|
*/
|
|
28
|
-
export function
|
|
30
|
+
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
29
31
|
/**
|
|
30
|
-
* @throws
|
|
32
|
+
* @throws
|
|
31
33
|
*/
|
|
32
|
-
export function
|
|
34
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
33
35
|
/**
|
|
34
|
-
* @
|
|
35
|
-
*
|
|
36
|
-
* @throws if no valid PDA found
|
|
36
|
+
* @throws
|
|
37
37
|
*/
|
|
38
|
-
export function
|
|
38
|
+
export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
|
|
39
39
|
/**
|
|
40
40
|
* @throws
|
|
41
41
|
*/
|
|
@@ -45,18 +45,13 @@ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
|
45
45
|
*/
|
|
46
46
|
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
47
47
|
/**
|
|
48
|
-
* @throws
|
|
49
|
-
*/
|
|
50
|
-
export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
51
|
-
/**
|
|
52
|
-
* @throws
|
|
48
|
+
* @throws if lookahead was set and failed
|
|
53
49
|
*/
|
|
54
|
-
export function
|
|
55
|
-
export function getPoolState(inf: Inf): PoolStateV2;
|
|
50
|
+
export function getPoolState(inf: Inf, lookahead?: SlotLookahead | null): PoolStateV2;
|
|
56
51
|
/**
|
|
57
52
|
* Sets the `PoolState` account data
|
|
58
53
|
*/
|
|
59
|
-
export function setPoolState(inf: Inf,
|
|
54
|
+
export function setPoolState(inf: Inf, intf: PoolStateV2): void;
|
|
60
55
|
/**
|
|
61
56
|
* Returns serialized `PoolState` account data
|
|
62
57
|
*/
|
|
@@ -82,40 +77,84 @@ export function serLstStateList(inf: Inf): Uint8Array;
|
|
|
82
77
|
*/
|
|
83
78
|
export function deserLstStateList(inf: Inf, lst_state_list_data: Uint8Array): void;
|
|
84
79
|
/**
|
|
85
|
-
*
|
|
80
|
+
* @throws if no valid PDA found
|
|
86
81
|
*/
|
|
87
|
-
export function
|
|
88
|
-
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
82
|
+
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
89
83
|
/**
|
|
90
|
-
*
|
|
91
|
-
*
|
|
84
|
+
* @deprecated Protocol fee accumulator token accounts are no longer used in v2
|
|
85
|
+
*
|
|
86
|
+
* @throws if no valid PDA found
|
|
92
87
|
*/
|
|
93
|
-
export function
|
|
88
|
+
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
94
89
|
/**
|
|
95
|
-
*
|
|
90
|
+
* Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
|
|
91
|
+
*/
|
|
92
|
+
export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
|
|
93
|
+
/**
|
|
94
|
+
* Returns if the given SPL LST mints have their {@link SplPoolAccounts} present in the object.
|
|
96
95
|
*
|
|
97
|
-
*
|
|
98
|
-
*
|
|
96
|
+
* Returns a byte array where ret[i] corresponds to the result for `mints[i]`.
|
|
97
|
+
* 0 - false, 1 - true.
|
|
99
98
|
*
|
|
100
|
-
* @
|
|
99
|
+
* If false is returned, then the data needs to be added via {@link appendSplLsts}
|
|
100
|
+
*
|
|
101
|
+
* This fn returns a byte array instead of `boolean` array because wasm_bindgen's type
|
|
102
|
+
* conversion doesnt work with bool arrays.
|
|
101
103
|
*/
|
|
102
|
-
export function
|
|
103
|
-
export function cloneInf(src: Inf): Inf;
|
|
104
|
+
export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
104
105
|
/**
|
|
105
106
|
* Returned accounts are deduped
|
|
106
107
|
*
|
|
107
108
|
* @throws
|
|
108
109
|
*/
|
|
109
|
-
export function
|
|
110
|
+
export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
110
111
|
/**
|
|
111
112
|
* @throws
|
|
112
113
|
*/
|
|
113
|
-
export function
|
|
114
|
+
export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
115
|
+
/**
|
|
116
|
+
* Returns the array of all possible {@link InfErr}s
|
|
117
|
+
*/
|
|
118
|
+
export function allInfErrs(): AllInfErrs;
|
|
119
|
+
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
114
120
|
/**
|
|
115
121
|
* @throws
|
|
116
122
|
*/
|
|
117
|
-
export function
|
|
118
|
-
|
|
123
|
+
export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
124
|
+
/**
|
|
125
|
+
* @throws
|
|
126
|
+
*/
|
|
127
|
+
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
128
|
+
export interface AccountMeta {
|
|
129
|
+
address: B58PK;
|
|
130
|
+
/**
|
|
131
|
+
* Represents the role of an account in a transaction:
|
|
132
|
+
* - Readonly: 0
|
|
133
|
+
* - Writable: 1
|
|
134
|
+
* - ReadonlySigner: 2
|
|
135
|
+
* - WritableSigner: 3
|
|
136
|
+
*/
|
|
137
|
+
role: 0 | 1 | 2 | 3;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export interface Instruction {
|
|
141
|
+
data: Uint8Array;
|
|
142
|
+
accounts: AccountMeta[];
|
|
143
|
+
programAddress: B58PK;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export interface RebalanceArgs {
|
|
147
|
+
out: bigint;
|
|
148
|
+
minStartingOutLst: bigint;
|
|
149
|
+
maxStartingInpLst: bigint;
|
|
150
|
+
mints: PkPair;
|
|
151
|
+
withdrawTo: B58PK;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
export interface RebalanceIxs {
|
|
155
|
+
start: Instruction;
|
|
156
|
+
end: Instruction;
|
|
157
|
+
}
|
|
119
158
|
|
|
120
159
|
export type FeeMint = "inp" | "out";
|
|
121
160
|
|
|
@@ -136,6 +175,13 @@ export interface Quote {
|
|
|
136
175
|
* will leave the user\'s wallet.
|
|
137
176
|
*/
|
|
138
177
|
inp: bigint;
|
|
178
|
+
/**
|
|
179
|
+
* SOL value of `inp` input tokens.
|
|
180
|
+
*
|
|
181
|
+
* SOL value of `out` output tokens
|
|
182
|
+
* = inp_sol_val - fee
|
|
183
|
+
*/
|
|
184
|
+
inpSolVal: bigint;
|
|
139
185
|
/**
|
|
140
186
|
* Amount of output tokens returned by the pool to the user,
|
|
141
187
|
* after fees. This is exactly the amount of tokens that
|
|
@@ -150,13 +196,7 @@ export interface Quote {
|
|
|
150
196
|
mints: PkPair;
|
|
151
197
|
}
|
|
152
198
|
|
|
153
|
-
export
|
|
154
|
-
amt: bigint;
|
|
155
|
-
limit: bigint;
|
|
156
|
-
mints: PkPair;
|
|
157
|
-
signer: B58PK;
|
|
158
|
-
tokenAccs: PkPair;
|
|
159
|
-
}
|
|
199
|
+
export type FoundPda = [B58PK, number];
|
|
160
200
|
|
|
161
201
|
|
|
162
202
|
export type ERR_CODE_MSG_SEP = ":";
|
|
@@ -193,26 +233,17 @@ export interface RebalanceQuote {
|
|
|
193
233
|
* Amount of output tokens that will leave the pool in StartRebalance
|
|
194
234
|
*/
|
|
195
235
|
out: bigint;
|
|
196
|
-
mints: PkPair;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
export interface AccountMeta {
|
|
200
|
-
address: B58PK;
|
|
201
236
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
204
|
-
*
|
|
205
|
-
*
|
|
206
|
-
* - WritableSigner: 3
|
|
237
|
+
* SOL value of `out` output tokens.
|
|
238
|
+
*
|
|
239
|
+
* SOL value of `inp` input tokens
|
|
240
|
+
* should be the same, barring rounding
|
|
207
241
|
*/
|
|
208
|
-
|
|
242
|
+
outSolVal: bigint;
|
|
243
|
+
mints: PkPair;
|
|
209
244
|
}
|
|
210
245
|
|
|
211
|
-
export
|
|
212
|
-
data: Uint8Array;
|
|
213
|
-
accounts: AccountMeta[];
|
|
214
|
-
programAddress: B58PK;
|
|
215
|
-
}
|
|
246
|
+
export type SlotLookahead = { abs: bigint } | { rel: bigint };
|
|
216
247
|
|
|
217
248
|
export interface LstState {
|
|
218
249
|
isInputDisabled: number;
|
|
@@ -264,17 +295,12 @@ export interface PkPair {
|
|
|
264
295
|
|
|
265
296
|
export type B58PK = Bs58Array;
|
|
266
297
|
|
|
267
|
-
export interface
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
maxStartingInpLst: bigint;
|
|
298
|
+
export interface TradeArgs {
|
|
299
|
+
amt: bigint;
|
|
300
|
+
limit: bigint;
|
|
271
301
|
mints: PkPair;
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
export interface RebalanceIxs {
|
|
276
|
-
start: Instruction;
|
|
277
|
-
end: Instruction;
|
|
302
|
+
signer: B58PK;
|
|
303
|
+
tokenAccs: PkPair;
|
|
278
304
|
}
|
|
279
305
|
|
|
280
306
|
export type Bs58Array = string
|
|
@@ -288,17 +314,16 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
288
314
|
|
|
289
315
|
export interface InitOutput {
|
|
290
316
|
readonly memory: WebAssembly.Memory;
|
|
291
|
-
readonly
|
|
292
|
-
readonly
|
|
293
|
-
readonly
|
|
294
|
-
readonly
|
|
295
|
-
readonly
|
|
296
|
-
readonly
|
|
317
|
+
readonly initPks: () => [number, number];
|
|
318
|
+
readonly init: (a: any, b: any) => [number, number, number];
|
|
319
|
+
readonly initObj: (a: any, b: number, c: number, d: any) => [number, number, number];
|
|
320
|
+
readonly cloneInf: (a: number) => number;
|
|
321
|
+
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
322
|
+
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
323
|
+
readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
|
|
297
324
|
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
298
325
|
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
299
|
-
readonly
|
|
300
|
-
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
301
|
-
readonly getPoolState: (a: number) => any;
|
|
326
|
+
readonly getPoolState: (a: number, b: number) => [number, number, number];
|
|
302
327
|
readonly setPoolState: (a: number, b: any) => void;
|
|
303
328
|
readonly serPoolState: (a: number) => [number, number];
|
|
304
329
|
readonly deserPoolState: (a: number, b: number, c: number) => [number, number];
|
|
@@ -306,23 +331,25 @@ export interface InitOutput {
|
|
|
306
331
|
readonly setLstStateList: (a: number, b: number, c: number) => void;
|
|
307
332
|
readonly serLstStateList: (a: number) => [number, number];
|
|
308
333
|
readonly deserLstStateList: (a: number, b: number, c: number) => [number, number];
|
|
334
|
+
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
335
|
+
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
336
|
+
readonly appendSplLsts: (a: number, b: any) => void;
|
|
337
|
+
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
338
|
+
readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
|
|
339
|
+
readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
|
|
340
|
+
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
309
341
|
readonly allInfErrs: () => any;
|
|
310
342
|
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
311
|
-
readonly
|
|
312
|
-
readonly
|
|
313
|
-
readonly init: (a: any, b: any) => [number, number, number];
|
|
314
|
-
readonly cloneInf: (a: number) => number;
|
|
315
|
-
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
316
|
-
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
317
|
-
readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
|
|
343
|
+
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
344
|
+
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
318
345
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
319
346
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
320
347
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
321
348
|
readonly __externref_table_alloc: () => number;
|
|
322
349
|
readonly __wbindgen_export_4: WebAssembly.Table;
|
|
323
|
-
readonly __externref_table_dealloc: (a: number) => void;
|
|
324
350
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
325
351
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
352
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
326
353
|
readonly __wbindgen_start: () => void;
|
|
327
354
|
}
|
|
328
355
|
|