@sanctumso/inf1 0.0.1-dev-5 → 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 +90 -60
- package/index.js +105 -81
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,44 +1,43 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
|
|
4
|
+
* Returns the array of all possible {@link InfErr}s
|
|
5
|
+
*/
|
|
6
|
+
export function allInfErrs(): AllInfErrs;
|
|
7
|
+
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
8
|
+
/**
|
|
6
9
|
* @throws
|
|
7
10
|
*/
|
|
8
|
-
export function
|
|
11
|
+
export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
9
12
|
/**
|
|
10
13
|
* @throws
|
|
11
14
|
*/
|
|
12
|
-
export function
|
|
15
|
+
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
16
|
+
export function getPoolState(inf: Inf): PoolState;
|
|
13
17
|
/**
|
|
14
|
-
*
|
|
18
|
+
* @throws
|
|
15
19
|
*/
|
|
16
|
-
export function
|
|
17
|
-
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
20
|
+
export function getLstStateList(inf: Inf): LstState[];
|
|
18
21
|
/**
|
|
19
22
|
* Returned accounts are deduped
|
|
20
23
|
*
|
|
21
24
|
* @throws
|
|
22
25
|
*/
|
|
23
|
-
export function
|
|
26
|
+
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
24
27
|
/**
|
|
25
28
|
* @throws
|
|
26
29
|
*/
|
|
27
|
-
export function
|
|
30
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
28
31
|
/**
|
|
29
|
-
*
|
|
30
|
-
*
|
|
32
|
+
* Returned accounts are deduped
|
|
33
|
+
*
|
|
34
|
+
* @throws
|
|
31
35
|
*/
|
|
32
|
-
export function
|
|
36
|
+
export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
33
37
|
/**
|
|
34
|
-
* Initialize a new {@link Inf} object.
|
|
35
|
-
*
|
|
36
|
-
* The returned object must be updated for a mint pair before it is ready to
|
|
37
|
-
* quote and operate for trades involving that pair
|
|
38
|
-
*
|
|
39
38
|
* @throws
|
|
40
39
|
*/
|
|
41
|
-
export function
|
|
40
|
+
export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
42
41
|
/**
|
|
43
42
|
* Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
|
|
44
43
|
*/
|
|
@@ -58,11 +57,7 @@ export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
|
58
57
|
/**
|
|
59
58
|
* @throws
|
|
60
59
|
*/
|
|
61
|
-
export function
|
|
62
|
-
/**
|
|
63
|
-
* @throws
|
|
64
|
-
*/
|
|
65
|
-
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
60
|
+
export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
|
|
66
61
|
/**
|
|
67
62
|
* @throws if no valid PDA found
|
|
68
63
|
*/
|
|
@@ -80,32 +75,19 @@ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
|
80
75
|
*/
|
|
81
76
|
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
82
77
|
/**
|
|
83
|
-
*
|
|
78
|
+
* Returns the pubkeys of the accounts that need ot be fetched to initialize
|
|
79
|
+
* a new {@link Inf} object
|
|
84
80
|
*/
|
|
85
|
-
export function
|
|
86
|
-
export interface Account {
|
|
87
|
-
data: Uint8Array;
|
|
88
|
-
owner: B58PK;
|
|
89
|
-
}
|
|
90
|
-
|
|
81
|
+
export function initPks(): Bs58Array[];
|
|
91
82
|
/**
|
|
92
|
-
*
|
|
83
|
+
* Initialize a new {@link Inf} object.
|
|
93
84
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
85
|
+
* The returned object must be updated for a mint pair before it is ready to
|
|
86
|
+
* quote and operate for trades involving that pair
|
|
87
|
+
*
|
|
88
|
+
* @throws
|
|
97
89
|
*/
|
|
98
|
-
export
|
|
99
|
-
|
|
100
|
-
export type AccountMap = Map<B58PK, Account>;
|
|
101
|
-
|
|
102
|
-
export interface PkPair {
|
|
103
|
-
inp: B58PK;
|
|
104
|
-
out: B58PK;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
export type B58PK = Bs58Array;
|
|
108
|
-
|
|
90
|
+
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
109
91
|
|
|
110
92
|
export type ERR_CODE_MSG_SEP = ":";
|
|
111
93
|
|
|
@@ -174,8 +156,6 @@ export interface Instruction {
|
|
|
174
156
|
programAddress: B58PK;
|
|
175
157
|
}
|
|
176
158
|
|
|
177
|
-
export type FoundPda = [B58PK, number];
|
|
178
|
-
|
|
179
159
|
export type FeeMint = "inp" | "out";
|
|
180
160
|
|
|
181
161
|
export interface QuoteArgs {
|
|
@@ -216,14 +196,52 @@ export interface Quote {
|
|
|
216
196
|
mints: PkPair;
|
|
217
197
|
}
|
|
218
198
|
|
|
219
|
-
export interface
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
199
|
+
export interface LstState {
|
|
200
|
+
isInputDisabled: number;
|
|
201
|
+
poolReservesBump: number;
|
|
202
|
+
protocolFeeAccumulatorBump: number;
|
|
203
|
+
solValue: bigint;
|
|
204
|
+
mint: B58PK;
|
|
205
|
+
solValueCalculator: B58PK;
|
|
206
|
+
}
|
|
207
|
+
|
|
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;
|
|
225
220
|
}
|
|
226
221
|
|
|
222
|
+
export interface Account {
|
|
223
|
+
data: Uint8Array;
|
|
224
|
+
owner: B58PK;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Map of `mint: stake pool account` for spl (all deploys) LSTs.
|
|
229
|
+
*
|
|
230
|
+
* This data is required to determine how to properly initialize the corresponding
|
|
231
|
+
* sol value calculator data since which stake pool account corresponds to which mint
|
|
232
|
+
* is not available onchain (yet)
|
|
233
|
+
*/
|
|
234
|
+
export type SplPoolAccounts = Map<B58PK, B58PK>;
|
|
235
|
+
|
|
236
|
+
export type AccountMap = Map<B58PK, Account>;
|
|
237
|
+
|
|
238
|
+
export interface PkPair {
|
|
239
|
+
inp: B58PK;
|
|
240
|
+
out: B58PK;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export type B58PK = Bs58Array;
|
|
244
|
+
|
|
227
245
|
export interface RebalanceArgs {
|
|
228
246
|
out: bigint;
|
|
229
247
|
minStartingOutLst: bigint;
|
|
@@ -237,6 +255,16 @@ export interface RebalanceIxs {
|
|
|
237
255
|
end: Instruction;
|
|
238
256
|
}
|
|
239
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
|
+
|
|
240
268
|
export type Bs58Array = string
|
|
241
269
|
|
|
242
270
|
export class Inf {
|
|
@@ -248,24 +276,26 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
248
276
|
|
|
249
277
|
export interface InitOutput {
|
|
250
278
|
readonly memory: WebAssembly.Memory;
|
|
251
|
-
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
252
|
-
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
253
279
|
readonly allInfErrs: () => any;
|
|
254
280
|
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
281
|
+
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
282
|
+
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
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];
|
|
255
287
|
readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
|
|
256
288
|
readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
|
|
257
|
-
readonly initPks: () => [number, number];
|
|
258
|
-
readonly init: (a: any, b: any) => [number, number, number];
|
|
259
289
|
readonly appendSplLsts: (a: number, b: any) => void;
|
|
260
290
|
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
261
291
|
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
262
|
-
readonly
|
|
263
|
-
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
292
|
+
readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
|
|
264
293
|
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
265
294
|
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
266
295
|
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
267
296
|
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
268
|
-
readonly
|
|
297
|
+
readonly initPks: () => [number, number];
|
|
298
|
+
readonly init: (a: any, b: any) => [number, number, number];
|
|
269
299
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
270
300
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
271
301
|
readonly __wbindgen_exn_store: (a: number) => void;
|