@sanctumso/inf1 0.0.1-dev-4 → 0.0.1-dev-6
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 +118 -36
- package/index.js +171 -82
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -4,14 +4,40 @@
|
|
|
4
4
|
* Returns the array of all possible {@link InfErr}s
|
|
5
5
|
*/
|
|
6
6
|
export function allInfErrs(): AllInfErrs;
|
|
7
|
+
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
7
8
|
/**
|
|
8
|
-
* @throws
|
|
9
|
+
* @throws
|
|
9
10
|
*/
|
|
10
|
-
export function
|
|
11
|
+
export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
11
12
|
/**
|
|
12
|
-
* @throws
|
|
13
|
+
* @throws
|
|
13
14
|
*/
|
|
14
|
-
export function
|
|
15
|
+
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
16
|
+
export function getPoolState(inf: Inf): PoolState;
|
|
17
|
+
/**
|
|
18
|
+
* @throws
|
|
19
|
+
*/
|
|
20
|
+
export function getLstStateList(inf: Inf): LstState[];
|
|
21
|
+
/**
|
|
22
|
+
* Returned accounts are deduped
|
|
23
|
+
*
|
|
24
|
+
* @throws
|
|
25
|
+
*/
|
|
26
|
+
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
27
|
+
/**
|
|
28
|
+
* @throws
|
|
29
|
+
*/
|
|
30
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
31
|
+
/**
|
|
32
|
+
* Returned accounts are deduped
|
|
33
|
+
*
|
|
34
|
+
* @throws
|
|
35
|
+
*/
|
|
36
|
+
export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
37
|
+
/**
|
|
38
|
+
* @throws
|
|
39
|
+
*/
|
|
40
|
+
export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
15
41
|
/**
|
|
16
42
|
* Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
|
|
17
43
|
*/
|
|
@@ -29,23 +55,25 @@ export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
|
|
|
29
55
|
*/
|
|
30
56
|
export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
31
57
|
/**
|
|
32
|
-
* Returned accounts are deduped
|
|
33
|
-
*
|
|
34
58
|
* @throws
|
|
35
59
|
*/
|
|
36
|
-
export function
|
|
60
|
+
export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
|
|
37
61
|
/**
|
|
38
|
-
* @throws
|
|
62
|
+
* @throws if no valid PDA found
|
|
39
63
|
*/
|
|
40
|
-
export function
|
|
64
|
+
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
65
|
+
/**
|
|
66
|
+
* @throws if no valid PDA found
|
|
67
|
+
*/
|
|
68
|
+
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
41
69
|
/**
|
|
42
70
|
* @throws
|
|
43
71
|
*/
|
|
44
|
-
export function
|
|
72
|
+
export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
45
73
|
/**
|
|
46
74
|
* @throws
|
|
47
75
|
*/
|
|
48
|
-
export function
|
|
76
|
+
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
49
77
|
/**
|
|
50
78
|
* Returns the pubkeys of the accounts that need ot be fetched to initialize
|
|
51
79
|
* a new {@link Inf} object
|
|
@@ -60,14 +88,6 @@ export function initPks(): Bs58Array[];
|
|
|
60
88
|
* @throws
|
|
61
89
|
*/
|
|
62
90
|
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
63
|
-
/**
|
|
64
|
-
* @throws
|
|
65
|
-
*/
|
|
66
|
-
export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
67
|
-
/**
|
|
68
|
-
* @throws
|
|
69
|
-
*/
|
|
70
|
-
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
71
91
|
|
|
72
92
|
export type ERR_CODE_MSG_SEP = ":";
|
|
73
93
|
|
|
@@ -98,6 +118,26 @@ export type AllInfErrs = [
|
|
|
98
118
|
"SizeTooLargeErr",
|
|
99
119
|
];
|
|
100
120
|
|
|
121
|
+
export interface RebalanceQuoteArgs {
|
|
122
|
+
/**
|
|
123
|
+
* Amount of output tokens that will leave the pool in StartRebalance
|
|
124
|
+
*/
|
|
125
|
+
out: bigint;
|
|
126
|
+
mints: PkPair;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface RebalanceQuote {
|
|
130
|
+
/**
|
|
131
|
+
* Amount of input tokens that needs to enter the pool by EndRebalance
|
|
132
|
+
*/
|
|
133
|
+
inp: bigint;
|
|
134
|
+
/**
|
|
135
|
+
* Amount of output tokens that will leave the pool in StartRebalance
|
|
136
|
+
*/
|
|
137
|
+
out: bigint;
|
|
138
|
+
mints: PkPair;
|
|
139
|
+
}
|
|
140
|
+
|
|
101
141
|
export interface AccountMeta {
|
|
102
142
|
address: B58PK;
|
|
103
143
|
/**
|
|
@@ -156,14 +196,27 @@ export interface Quote {
|
|
|
156
196
|
mints: PkPair;
|
|
157
197
|
}
|
|
158
198
|
|
|
159
|
-
export
|
|
199
|
+
export interface LstState {
|
|
200
|
+
isInputDisabled: number;
|
|
201
|
+
poolReservesBump: number;
|
|
202
|
+
protocolFeeAccumulatorBump: number;
|
|
203
|
+
solValue: bigint;
|
|
204
|
+
mint: B58PK;
|
|
205
|
+
solValueCalculator: B58PK;
|
|
206
|
+
}
|
|
160
207
|
|
|
161
|
-
export interface
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
208
|
+
export interface PoolState {
|
|
209
|
+
totalSolValue: bigint;
|
|
210
|
+
tradingProtocolFeeBps: number;
|
|
211
|
+
lpProtocolFeeBps: number;
|
|
212
|
+
version: number;
|
|
213
|
+
isDisabled: number;
|
|
214
|
+
isRebalancing: number;
|
|
215
|
+
admin: B58PK;
|
|
216
|
+
rebalanceAuthority: B58PK;
|
|
217
|
+
protocolFeeBeneficiary: B58PK;
|
|
218
|
+
pricingProgram: B58PK;
|
|
219
|
+
lpTokenMint: B58PK;
|
|
167
220
|
}
|
|
168
221
|
|
|
169
222
|
export interface Account {
|
|
@@ -189,6 +242,29 @@ export interface PkPair {
|
|
|
189
242
|
|
|
190
243
|
export type B58PK = Bs58Array;
|
|
191
244
|
|
|
245
|
+
export interface RebalanceArgs {
|
|
246
|
+
out: bigint;
|
|
247
|
+
minStartingOutLst: bigint;
|
|
248
|
+
maxStartingInpLst: bigint;
|
|
249
|
+
mints: PkPair;
|
|
250
|
+
withdrawTo: B58PK;
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface RebalanceIxs {
|
|
254
|
+
start: Instruction;
|
|
255
|
+
end: Instruction;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
export interface TradeArgs {
|
|
259
|
+
amt: bigint;
|
|
260
|
+
limit: bigint;
|
|
261
|
+
mints: PkPair;
|
|
262
|
+
signer: B58PK;
|
|
263
|
+
tokenAccs: PkPair;
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
export type FoundPda = [B58PK, number];
|
|
267
|
+
|
|
192
268
|
export type Bs58Array = string
|
|
193
269
|
|
|
194
270
|
export class Inf {
|
|
@@ -201,27 +277,33 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
201
277
|
export interface InitOutput {
|
|
202
278
|
readonly memory: WebAssembly.Memory;
|
|
203
279
|
readonly allInfErrs: () => any;
|
|
204
|
-
readonly
|
|
205
|
-
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
206
|
-
readonly appendSplLsts: (a: number, b: any) => void;
|
|
207
|
-
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
208
|
-
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
209
|
-
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
280
|
+
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
210
281
|
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
211
282
|
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
212
|
-
readonly
|
|
213
|
-
readonly
|
|
283
|
+
readonly getPoolState: (a: number) => any;
|
|
284
|
+
readonly getLstStateList: (a: number) => [number, number, number, number];
|
|
285
|
+
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
286
|
+
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
287
|
+
readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
|
|
288
|
+
readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
|
|
289
|
+
readonly appendSplLsts: (a: number, b: any) => void;
|
|
290
|
+
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
291
|
+
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
292
|
+
readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
|
|
293
|
+
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
294
|
+
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
214
295
|
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
215
296
|
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
216
|
-
readonly
|
|
297
|
+
readonly initPks: () => [number, number];
|
|
298
|
+
readonly init: (a: any, b: any) => [number, number, number];
|
|
217
299
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
218
300
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
219
301
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
220
302
|
readonly __externref_table_alloc: () => number;
|
|
221
303
|
readonly __wbindgen_export_4: WebAssembly.Table;
|
|
222
304
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
223
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
224
305
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
306
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
225
307
|
readonly __wbindgen_start: () => void;
|
|
226
308
|
}
|
|
227
309
|
|