@sanctumso/inf1 0.0.1-dev-9 → 0.0.2-dev-1
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 +135 -114
- package/index.js +203 -131
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,28 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
export function getPoolState(inf: Inf): PoolState;
|
|
4
|
-
/**
|
|
5
|
-
* Returns serialized `PoolState` account data
|
|
6
|
-
*/
|
|
7
|
-
export function serPoolState(inf: Inf): Uint8Array;
|
|
8
|
-
/**
|
|
9
|
-
* @throws if stored lst state list account data is invalid
|
|
10
|
-
*/
|
|
11
|
-
export function getLstStateList(inf: Inf): LstState[];
|
|
12
|
-
/**
|
|
13
|
-
* Returns serialized `LstStateList` account data
|
|
14
|
-
*/
|
|
15
|
-
export function serLstStateList(inf: Inf): Uint8Array;
|
|
16
|
-
/**
|
|
17
|
-
* Returned accounts are deduped
|
|
18
|
-
*
|
|
19
|
-
* @throws
|
|
20
|
-
*/
|
|
21
|
-
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
22
|
-
/**
|
|
23
|
-
* @throws
|
|
24
|
-
*/
|
|
25
|
-
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
26
3
|
/**
|
|
27
4
|
* Returned accounts are deduped
|
|
28
5
|
*
|
|
@@ -50,10 +27,15 @@ export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
|
|
|
50
27
|
*/
|
|
51
28
|
export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
52
29
|
/**
|
|
53
|
-
*
|
|
30
|
+
* @throws if no valid PDA found
|
|
54
31
|
*/
|
|
55
|
-
export function
|
|
56
|
-
|
|
32
|
+
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
33
|
+
/**
|
|
34
|
+
* @deprecated Protocol fee accumulator token accounts are no longer used in v2
|
|
35
|
+
*
|
|
36
|
+
* @throws if no valid PDA found
|
|
37
|
+
*/
|
|
38
|
+
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
57
39
|
/**
|
|
58
40
|
* @throws
|
|
59
41
|
*/
|
|
@@ -62,14 +44,6 @@ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
|
62
44
|
* @throws
|
|
63
45
|
*/
|
|
64
46
|
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
65
|
-
/**
|
|
66
|
-
* @throws if no valid PDA found
|
|
67
|
-
*/
|
|
68
|
-
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
69
|
-
/**
|
|
70
|
-
* @throws if no valid PDA found
|
|
71
|
-
*/
|
|
72
|
-
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
73
47
|
/**
|
|
74
48
|
* @throws
|
|
75
49
|
*/
|
|
@@ -78,10 +52,40 @@ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
|
78
52
|
* @throws
|
|
79
53
|
*/
|
|
80
54
|
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
55
|
+
export function getPoolState(inf: Inf): PoolStateV2;
|
|
81
56
|
/**
|
|
82
|
-
*
|
|
57
|
+
* Sets the `PoolState` account data
|
|
83
58
|
*/
|
|
84
|
-
export function
|
|
59
|
+
export function setPoolState(inf: Inf, arg1: PoolStateV2): void;
|
|
60
|
+
/**
|
|
61
|
+
* Returns serialized `PoolState` account data
|
|
62
|
+
*/
|
|
63
|
+
export function serPoolState(inf: Inf): Uint8Array;
|
|
64
|
+
/**
|
|
65
|
+
* @throws if `pool_state_data` is invalid
|
|
66
|
+
*/
|
|
67
|
+
export function deserPoolState(inf: Inf, pool_state_data: Uint8Array): void;
|
|
68
|
+
/**
|
|
69
|
+
* @throws if stored lst state list account data is invalid
|
|
70
|
+
*/
|
|
71
|
+
export function getLstStateList(inf: Inf): LstState[];
|
|
72
|
+
/**
|
|
73
|
+
* Sets the `LstStateList` account data
|
|
74
|
+
*/
|
|
75
|
+
export function setLstStateList(inf: Inf, lst_state_list: LstState[]): void;
|
|
76
|
+
/**
|
|
77
|
+
* Returns serialized `LstStateList` account data
|
|
78
|
+
*/
|
|
79
|
+
export function serLstStateList(inf: Inf): Uint8Array;
|
|
80
|
+
/**
|
|
81
|
+
* @throws if `lst_state_list_data` is invalid
|
|
82
|
+
*/
|
|
83
|
+
export function deserLstStateList(inf: Inf, lst_state_list_data: Uint8Array): void;
|
|
84
|
+
/**
|
|
85
|
+
* Returns the array of all possible {@link InfErr}s
|
|
86
|
+
*/
|
|
87
|
+
export function allInfErrs(): AllInfErrs;
|
|
88
|
+
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
85
89
|
/**
|
|
86
90
|
* Returns the pubkeys of the accounts that need to be fetched to initialize
|
|
87
91
|
* a new {@link Inf} object
|
|
@@ -96,6 +100,64 @@ export function initPks(): Bs58Array[];
|
|
|
96
100
|
* @throws
|
|
97
101
|
*/
|
|
98
102
|
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
103
|
+
export function cloneInf(src: Inf): Inf;
|
|
104
|
+
/**
|
|
105
|
+
* Returned accounts are deduped
|
|
106
|
+
*
|
|
107
|
+
* @throws
|
|
108
|
+
*/
|
|
109
|
+
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
110
|
+
/**
|
|
111
|
+
* @throws
|
|
112
|
+
*/
|
|
113
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
114
|
+
/**
|
|
115
|
+
* @throws
|
|
116
|
+
*/
|
|
117
|
+
export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
|
|
118
|
+
export type FoundPda = [B58PK, number];
|
|
119
|
+
|
|
120
|
+
export type FeeMint = "inp" | "out";
|
|
121
|
+
|
|
122
|
+
export interface QuoteArgs {
|
|
123
|
+
slotLookahead: bigint;
|
|
124
|
+
amt: bigint;
|
|
125
|
+
mints: PkPair;
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Basically same as [`inf1_std::quote::Quote`] but with fields converted
|
|
130
|
+
* to wasm compat
|
|
131
|
+
*/
|
|
132
|
+
export interface Quote {
|
|
133
|
+
/**
|
|
134
|
+
* Amount of input tokens given by the user to the pool,
|
|
135
|
+
* after fees. This is exactly the amount of tokens that
|
|
136
|
+
* will leave the user\'s wallet.
|
|
137
|
+
*/
|
|
138
|
+
inp: bigint;
|
|
139
|
+
/**
|
|
140
|
+
* Amount of output tokens returned by the pool to the user,
|
|
141
|
+
* after fees. This is exactly the amount of tokens that
|
|
142
|
+
* will enter the user\'s wallet.
|
|
143
|
+
*/
|
|
144
|
+
out: bigint;
|
|
145
|
+
/**
|
|
146
|
+
* The amount of fee accrued to the pool,
|
|
147
|
+
* in terms of sol value (lamports)
|
|
148
|
+
*/
|
|
149
|
+
fee: bigint;
|
|
150
|
+
mints: PkPair;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export interface TradeArgs {
|
|
154
|
+
amt: bigint;
|
|
155
|
+
limit: bigint;
|
|
156
|
+
mints: PkPair;
|
|
157
|
+
signer: B58PK;
|
|
158
|
+
tokenAccs: PkPair;
|
|
159
|
+
}
|
|
160
|
+
|
|
99
161
|
|
|
100
162
|
export type ERR_CODE_MSG_SEP = ":";
|
|
101
163
|
|
|
@@ -152,67 +214,6 @@ export interface Instruction {
|
|
|
152
214
|
programAddress: B58PK;
|
|
153
215
|
}
|
|
154
216
|
|
|
155
|
-
export type FeeMint = "inp" | "out";
|
|
156
|
-
|
|
157
|
-
export interface QuoteArgs {
|
|
158
|
-
amt: bigint;
|
|
159
|
-
mints: PkPair;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
export interface Quote {
|
|
163
|
-
/**
|
|
164
|
-
* Amount of input tokens given by the user to the pool,
|
|
165
|
-
* after fees. This is exactly the amount of tokens that
|
|
166
|
-
* will leave the user\'s wallet.
|
|
167
|
-
*/
|
|
168
|
-
inp: bigint;
|
|
169
|
-
/**
|
|
170
|
-
* Amount of output tokens returned by the pool to the user,
|
|
171
|
-
* after fees. This is exactly the amount of tokens that
|
|
172
|
-
* will enter the user\'s wallet.
|
|
173
|
-
*/
|
|
174
|
-
out: bigint;
|
|
175
|
-
/**
|
|
176
|
-
* The amount of fee accrued to pool LPs,
|
|
177
|
-
* accumulated in the pool reserves.
|
|
178
|
-
*
|
|
179
|
-
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
180
|
-
* depends on value of `self.fee_mint`
|
|
181
|
-
*/
|
|
182
|
-
lpFee: bigint;
|
|
183
|
-
/**
|
|
184
|
-
* The amount of fee accrued to the protocol,
|
|
185
|
-
* to be transferred to the protocol fee accumulator account.
|
|
186
|
-
*
|
|
187
|
-
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
188
|
-
* depends on value of `self.fee_mint`
|
|
189
|
-
*/
|
|
190
|
-
protocolFee: bigint;
|
|
191
|
-
feeMint: FeeMint;
|
|
192
|
-
mints: PkPair;
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
export interface TradeArgs {
|
|
196
|
-
amt: bigint;
|
|
197
|
-
limit: bigint;
|
|
198
|
-
mints: PkPair;
|
|
199
|
-
signer: B58PK;
|
|
200
|
-
tokenAccs: PkPair;
|
|
201
|
-
}
|
|
202
|
-
|
|
203
|
-
export interface RebalanceArgs {
|
|
204
|
-
out: bigint;
|
|
205
|
-
minStartingOutLst: bigint;
|
|
206
|
-
maxStartingInpLst: bigint;
|
|
207
|
-
mints: PkPair;
|
|
208
|
-
withdrawTo: B58PK;
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
export interface RebalanceIxs {
|
|
212
|
-
start: Instruction;
|
|
213
|
-
end: Instruction;
|
|
214
|
-
}
|
|
215
|
-
|
|
216
217
|
export interface LstState {
|
|
217
218
|
isInputDisabled: number;
|
|
218
219
|
poolReservesBump: number;
|
|
@@ -222,10 +223,9 @@ export interface LstState {
|
|
|
222
223
|
solValueCalculator: B58PK;
|
|
223
224
|
}
|
|
224
225
|
|
|
225
|
-
export interface
|
|
226
|
+
export interface PoolStateV2 {
|
|
226
227
|
totalSolValue: bigint;
|
|
227
|
-
|
|
228
|
-
lpProtocolFeeBps: number;
|
|
228
|
+
protocolFeeNanos: number;
|
|
229
229
|
version: number;
|
|
230
230
|
isDisabled: number;
|
|
231
231
|
isRebalancing: number;
|
|
@@ -234,6 +234,11 @@ export interface PoolState {
|
|
|
234
234
|
protocolFeeBeneficiary: B58PK;
|
|
235
235
|
pricingProgram: B58PK;
|
|
236
236
|
lpTokenMint: B58PK;
|
|
237
|
+
rpsAuthority: B58PK;
|
|
238
|
+
rps: bigint;
|
|
239
|
+
withheldLamports: bigint;
|
|
240
|
+
protocolFeeLamports: bigint;
|
|
241
|
+
lastReleaseSlot: bigint;
|
|
237
242
|
}
|
|
238
243
|
|
|
239
244
|
export interface Account {
|
|
@@ -259,7 +264,18 @@ export interface PkPair {
|
|
|
259
264
|
|
|
260
265
|
export type B58PK = Bs58Array;
|
|
261
266
|
|
|
262
|
-
export
|
|
267
|
+
export interface RebalanceArgs {
|
|
268
|
+
out: bigint;
|
|
269
|
+
minStartingOutLst: bigint;
|
|
270
|
+
maxStartingInpLst: bigint;
|
|
271
|
+
mints: PkPair;
|
|
272
|
+
withdrawTo: B58PK;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface RebalanceIxs {
|
|
276
|
+
start: Instruction;
|
|
277
|
+
end: Instruction;
|
|
278
|
+
}
|
|
263
279
|
|
|
264
280
|
export type Bs58Array = string
|
|
265
281
|
|
|
@@ -272,36 +288,41 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
272
288
|
|
|
273
289
|
export interface InitOutput {
|
|
274
290
|
readonly memory: WebAssembly.Memory;
|
|
275
|
-
readonly getPoolState: (a: number) => any;
|
|
276
|
-
readonly serPoolState: (a: number) => [number, number];
|
|
277
|
-
readonly getLstStateList: (a: number) => [number, number, number, number];
|
|
278
|
-
readonly serLstStateList: (a: number) => [number, number];
|
|
279
|
-
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
280
|
-
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
281
291
|
readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
|
|
282
292
|
readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
|
|
283
293
|
readonly appendSplLsts: (a: number, b: any) => void;
|
|
284
294
|
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
285
|
-
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
286
|
-
readonly allInfErrs: () => any;
|
|
287
|
-
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
288
|
-
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
289
|
-
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
290
295
|
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
291
296
|
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
297
|
+
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
298
|
+
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
292
299
|
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
293
300
|
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
294
|
-
readonly
|
|
301
|
+
readonly getPoolState: (a: number) => any;
|
|
302
|
+
readonly setPoolState: (a: number, b: any) => void;
|
|
303
|
+
readonly serPoolState: (a: number) => [number, number];
|
|
304
|
+
readonly deserPoolState: (a: number, b: number, c: number) => [number, number];
|
|
305
|
+
readonly getLstStateList: (a: number) => [number, number, number, number];
|
|
306
|
+
readonly setLstStateList: (a: number, b: number, c: number) => void;
|
|
307
|
+
readonly serLstStateList: (a: number) => [number, number];
|
|
308
|
+
readonly deserLstStateList: (a: number, b: number, c: number) => [number, number];
|
|
309
|
+
readonly allInfErrs: () => any;
|
|
310
|
+
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
311
|
+
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
295
312
|
readonly initPks: () => [number, number];
|
|
296
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];
|
|
297
318
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
298
319
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
299
320
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
300
321
|
readonly __externref_table_alloc: () => number;
|
|
301
322
|
readonly __wbindgen_export_4: WebAssembly.Table;
|
|
302
|
-
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
303
323
|
readonly __externref_table_dealloc: (a: number) => void;
|
|
304
324
|
readonly __externref_drop_slice: (a: number, b: number) => void;
|
|
325
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
305
326
|
readonly __wbindgen_start: () => void;
|
|
306
327
|
}
|
|
307
328
|
|