@sanctumso/inf1 0.0.1-dev-5 → 0.0.1-dev-7
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 +133 -103
- package/index.js +138 -113
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,30 +1,13 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* Returned accounts are deduped
|
|
5
|
-
*
|
|
6
4
|
* @throws
|
|
7
5
|
*/
|
|
8
|
-
export function
|
|
9
|
-
/**
|
|
10
|
-
* @throws
|
|
11
|
-
*/
|
|
12
|
-
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
13
|
-
/**
|
|
14
|
-
* Returns the array of all possible {@link InfErr}s
|
|
15
|
-
*/
|
|
16
|
-
export function allInfErrs(): AllInfErrs;
|
|
17
|
-
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
18
|
-
/**
|
|
19
|
-
* Returned accounts are deduped
|
|
20
|
-
*
|
|
21
|
-
* @throws
|
|
22
|
-
*/
|
|
23
|
-
export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
6
|
+
export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
24
7
|
/**
|
|
25
8
|
* @throws
|
|
26
9
|
*/
|
|
27
|
-
export function
|
|
10
|
+
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
28
11
|
/**
|
|
29
12
|
* Returns the pubkeys of the accounts that need ot be fetched to initialize
|
|
30
13
|
* a new {@link Inf} object
|
|
@@ -39,30 +22,21 @@ export function initPks(): Bs58Array[];
|
|
|
39
22
|
* @throws
|
|
40
23
|
*/
|
|
41
24
|
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
25
|
+
export function getPoolState(inf: Inf): PoolState;
|
|
42
26
|
/**
|
|
43
|
-
*
|
|
27
|
+
* @throws
|
|
44
28
|
*/
|
|
45
|
-
export function
|
|
29
|
+
export function getLstStateList(inf: Inf): LstState[];
|
|
46
30
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
* Returns a byte array where ret[i] corresponds to the result for `mints[i]`.
|
|
50
|
-
* 0 - false, 1 - true.
|
|
51
|
-
*
|
|
52
|
-
* If false is returned, then the data needs to be added via {@link appendSplLsts}
|
|
31
|
+
* Returned accounts are deduped
|
|
53
32
|
*
|
|
54
|
-
* This fn returns a byte array instead of `boolean` array because wasm_bindgen's type
|
|
55
|
-
* conversion doesnt work with bool arrays.
|
|
56
|
-
*/
|
|
57
|
-
export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
58
|
-
/**
|
|
59
33
|
* @throws
|
|
60
34
|
*/
|
|
61
|
-
export function
|
|
35
|
+
export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
62
36
|
/**
|
|
63
37
|
* @throws
|
|
64
38
|
*/
|
|
65
|
-
export function
|
|
39
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
66
40
|
/**
|
|
67
41
|
* @throws if no valid PDA found
|
|
68
42
|
*/
|
|
@@ -80,31 +54,89 @@ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
|
80
54
|
*/
|
|
81
55
|
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
82
56
|
/**
|
|
57
|
+
* Returned accounts are deduped
|
|
58
|
+
*
|
|
83
59
|
* @throws
|
|
84
60
|
*/
|
|
85
|
-
export function
|
|
86
|
-
export interface Account {
|
|
87
|
-
data: Uint8Array;
|
|
88
|
-
owner: B58PK;
|
|
89
|
-
}
|
|
90
|
-
|
|
61
|
+
export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
91
62
|
/**
|
|
92
|
-
*
|
|
63
|
+
* @throws
|
|
64
|
+
*/
|
|
65
|
+
export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
66
|
+
/**
|
|
67
|
+
* Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
|
|
68
|
+
*/
|
|
69
|
+
export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
|
|
70
|
+
/**
|
|
71
|
+
* Returns if the given SPL LST mints have their {@link SplPoolAccounts} present in the object.
|
|
93
72
|
*
|
|
94
|
-
*
|
|
95
|
-
*
|
|
96
|
-
*
|
|
73
|
+
* Returns a byte array where ret[i] corresponds to the result for `mints[i]`.
|
|
74
|
+
* 0 - false, 1 - true.
|
|
75
|
+
*
|
|
76
|
+
* If false is returned, then the data needs to be added via {@link appendSplLsts}
|
|
77
|
+
*
|
|
78
|
+
* This fn returns a byte array instead of `boolean` array because wasm_bindgen's type
|
|
79
|
+
* conversion doesnt work with bool arrays.
|
|
97
80
|
*/
|
|
98
|
-
export
|
|
81
|
+
export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
|
|
82
|
+
/**
|
|
83
|
+
* Returns the array of all possible {@link InfErr}s
|
|
84
|
+
*/
|
|
85
|
+
export function allInfErrs(): AllInfErrs;
|
|
86
|
+
export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
|
|
87
|
+
/**
|
|
88
|
+
* @throws
|
|
89
|
+
*/
|
|
90
|
+
export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
|
|
91
|
+
export type FeeMint = "inp" | "out";
|
|
99
92
|
|
|
100
|
-
export
|
|
93
|
+
export interface QuoteArgs {
|
|
94
|
+
amt: bigint;
|
|
95
|
+
mints: PkPair;
|
|
96
|
+
}
|
|
101
97
|
|
|
102
|
-
export interface
|
|
103
|
-
|
|
104
|
-
|
|
98
|
+
export interface Quote {
|
|
99
|
+
/**
|
|
100
|
+
* Amount of input tokens given by the user to the pool,
|
|
101
|
+
* after fees. This is exactly the amount of tokens that
|
|
102
|
+
* will leave the user\'s wallet.
|
|
103
|
+
*/
|
|
104
|
+
inp: bigint;
|
|
105
|
+
/**
|
|
106
|
+
* Amount of output tokens returned by the pool to the user,
|
|
107
|
+
* after fees. This is exactly the amount of tokens that
|
|
108
|
+
* will enter the user\'s wallet.
|
|
109
|
+
*/
|
|
110
|
+
out: bigint;
|
|
111
|
+
/**
|
|
112
|
+
* The amount of fee accrued to pool LPs,
|
|
113
|
+
* accumulated in the pool reserves.
|
|
114
|
+
*
|
|
115
|
+
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
116
|
+
* depends on value of `self.fee_mint`
|
|
117
|
+
*/
|
|
118
|
+
lpFee: bigint;
|
|
119
|
+
/**
|
|
120
|
+
* The amount of fee accrued to the protocol,
|
|
121
|
+
* to be transferred to the protocol fee accumulator account.
|
|
122
|
+
*
|
|
123
|
+
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
124
|
+
* depends on value of `self.fee_mint`
|
|
125
|
+
*/
|
|
126
|
+
protocolFee: bigint;
|
|
127
|
+
feeMint: FeeMint;
|
|
128
|
+
mints: PkPair;
|
|
105
129
|
}
|
|
106
130
|
|
|
107
|
-
export type
|
|
131
|
+
export type FoundPda = [B58PK, number];
|
|
132
|
+
|
|
133
|
+
export interface TradeArgs {
|
|
134
|
+
amt: bigint;
|
|
135
|
+
limit: bigint;
|
|
136
|
+
mints: PkPair;
|
|
137
|
+
signer: B58PK;
|
|
138
|
+
tokenAccs: PkPair;
|
|
139
|
+
}
|
|
108
140
|
|
|
109
141
|
|
|
110
142
|
export type ERR_CODE_MSG_SEP = ":";
|
|
@@ -174,56 +206,52 @@ export interface Instruction {
|
|
|
174
206
|
programAddress: B58PK;
|
|
175
207
|
}
|
|
176
208
|
|
|
177
|
-
export
|
|
178
|
-
|
|
179
|
-
|
|
209
|
+
export interface LstState {
|
|
210
|
+
isInputDisabled: number;
|
|
211
|
+
poolReservesBump: number;
|
|
212
|
+
protocolFeeAccumulatorBump: number;
|
|
213
|
+
solValue: bigint;
|
|
214
|
+
mint: B58PK;
|
|
215
|
+
solValueCalculator: B58PK;
|
|
216
|
+
}
|
|
180
217
|
|
|
181
|
-
export interface
|
|
182
|
-
|
|
183
|
-
|
|
218
|
+
export interface PoolState {
|
|
219
|
+
totalSolValue: bigint;
|
|
220
|
+
tradingProtocolFeeBps: number;
|
|
221
|
+
lpProtocolFeeBps: number;
|
|
222
|
+
version: number;
|
|
223
|
+
isDisabled: number;
|
|
224
|
+
isRebalancing: number;
|
|
225
|
+
admin: B58PK;
|
|
226
|
+
rebalanceAuthority: B58PK;
|
|
227
|
+
protocolFeeBeneficiary: B58PK;
|
|
228
|
+
pricingProgram: B58PK;
|
|
229
|
+
lpTokenMint: B58PK;
|
|
184
230
|
}
|
|
185
231
|
|
|
186
|
-
export interface
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
* after fees. This is exactly the amount of tokens that
|
|
190
|
-
* will leave the user\'s wallet.
|
|
191
|
-
*/
|
|
192
|
-
inp: bigint;
|
|
193
|
-
/**
|
|
194
|
-
* Amount of output tokens returned by the pool to the user,
|
|
195
|
-
* after fees. This is exactly the amount of tokens that
|
|
196
|
-
* will enter the user\'s wallet.
|
|
197
|
-
*/
|
|
198
|
-
out: bigint;
|
|
199
|
-
/**
|
|
200
|
-
* The amount of fee accrued to pool LPs,
|
|
201
|
-
* accumulated in the pool reserves.
|
|
202
|
-
*
|
|
203
|
-
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
204
|
-
* depends on value of `self.fee_mint`
|
|
205
|
-
*/
|
|
206
|
-
lpFee: bigint;
|
|
207
|
-
/**
|
|
208
|
-
* The amount of fee accrued to the protocol,
|
|
209
|
-
* to be transferred to the protocol fee accumulator account.
|
|
210
|
-
*
|
|
211
|
-
* Which mint it is denoted in (whether inp_mint or out_mint)
|
|
212
|
-
* depends on value of `self.fee_mint`
|
|
213
|
-
*/
|
|
214
|
-
protocolFee: bigint;
|
|
215
|
-
feeMint: FeeMint;
|
|
216
|
-
mints: PkPair;
|
|
232
|
+
export interface Account {
|
|
233
|
+
data: Uint8Array;
|
|
234
|
+
owner: B58PK;
|
|
217
235
|
}
|
|
218
236
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
237
|
+
/**
|
|
238
|
+
* Map of `mint: stake pool account` for spl (all deploys) LSTs.
|
|
239
|
+
*
|
|
240
|
+
* This data is required to determine how to properly initialize the corresponding
|
|
241
|
+
* sol value calculator data since which stake pool account corresponds to which mint
|
|
242
|
+
* is not available onchain (yet)
|
|
243
|
+
*/
|
|
244
|
+
export type SplPoolAccounts = Map<B58PK, B58PK>;
|
|
245
|
+
|
|
246
|
+
export type AccountMap = Map<B58PK, Account>;
|
|
247
|
+
|
|
248
|
+
export interface PkPair {
|
|
249
|
+
inp: B58PK;
|
|
250
|
+
out: B58PK;
|
|
225
251
|
}
|
|
226
252
|
|
|
253
|
+
export type B58PK = Bs58Array;
|
|
254
|
+
|
|
227
255
|
export interface RebalanceArgs {
|
|
228
256
|
out: bigint;
|
|
229
257
|
minStartingOutLst: bigint;
|
|
@@ -248,23 +276,25 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
248
276
|
|
|
249
277
|
export interface InitOutput {
|
|
250
278
|
readonly memory: WebAssembly.Memory;
|
|
279
|
+
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
280
|
+
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
281
|
+
readonly initPks: () => [number, number];
|
|
282
|
+
readonly init: (a: any, b: any) => [number, number, number];
|
|
283
|
+
readonly getPoolState: (a: number) => any;
|
|
284
|
+
readonly getLstStateList: (a: number) => [number, number, number, number];
|
|
251
285
|
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
252
286
|
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
253
|
-
readonly
|
|
254
|
-
readonly
|
|
287
|
+
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
288
|
+
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
289
|
+
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
290
|
+
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
255
291
|
readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
|
|
256
292
|
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
293
|
readonly appendSplLsts: (a: number, b: any) => void;
|
|
260
294
|
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
261
295
|
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
262
|
-
readonly
|
|
263
|
-
readonly
|
|
264
|
-
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
265
|
-
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
266
|
-
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
267
|
-
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
296
|
+
readonly allInfErrs: () => any;
|
|
297
|
+
readonly quoteRebalance: (a: number, b: any) => [number, number, number];
|
|
268
298
|
readonly rebalanceIxs: (a: number, 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;
|