@sanctumso/inf1 0.0.1-dev-4 → 0.0.1-dev-5

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 CHANGED
@@ -1,17 +1,44 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * Returned accounts are deduped
5
+ *
6
+ * @throws
7
+ */
8
+ export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
9
+ /**
10
+ * @throws
11
+ */
12
+ export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
3
13
  /**
4
14
  * Returns the array of all possible {@link InfErr}s
5
15
  */
6
16
  export function allInfErrs(): AllInfErrs;
17
+ export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
7
18
  /**
8
- * @throws if no valid PDA found
19
+ * Returned accounts are deduped
20
+ *
21
+ * @throws
9
22
  */
10
- export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
23
+ export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
11
24
  /**
12
- * @throws if no valid PDA found
25
+ * @throws
13
26
  */
14
- export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
27
+ export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
28
+ /**
29
+ * Returns the pubkeys of the accounts that need ot be fetched to initialize
30
+ * a new {@link Inf} object
31
+ */
32
+ export function initPks(): Bs58Array[];
33
+ /**
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
+ * @throws
40
+ */
41
+ export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
15
42
  /**
16
43
  * Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
17
44
  */
@@ -28,16 +55,6 @@ export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
28
55
  * conversion doesnt work with bool arrays.
29
56
  */
30
57
  export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
31
- /**
32
- * Returned accounts are deduped
33
- *
34
- * @throws
35
- */
36
- export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
37
- /**
38
- * @throws
39
- */
40
- export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
41
58
  /**
42
59
  * @throws
43
60
  */
@@ -47,19 +64,13 @@ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
47
64
  */
48
65
  export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
49
66
  /**
50
- * Returns the pubkeys of the accounts that need ot be fetched to initialize
51
- * a new {@link Inf} object
67
+ * @throws if no valid PDA found
52
68
  */
53
- export function initPks(): Bs58Array[];
69
+ export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
54
70
  /**
55
- * Initialize a new {@link Inf} object.
56
- *
57
- * The returned object must be updated for a mint pair before it is ready to
58
- * quote and operate for trades involving that pair
59
- *
60
- * @throws
71
+ * @throws if no valid PDA found
61
72
  */
62
- export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
73
+ export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
63
74
  /**
64
75
  * @throws
65
76
  */
@@ -68,6 +79,33 @@ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
68
79
  * @throws
69
80
  */
70
81
  export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
82
+ /**
83
+ * @throws
84
+ */
85
+ export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
86
+ export interface Account {
87
+ data: Uint8Array;
88
+ owner: B58PK;
89
+ }
90
+
91
+ /**
92
+ * Map of `mint: stake pool account` for spl (all deploys) LSTs.
93
+ *
94
+ * This data is required to determine how to properly initialize the corresponding
95
+ * sol value calculator data since which stake pool account corresponds to which mint
96
+ * is not available onchain (yet)
97
+ */
98
+ export type SplPoolAccounts = Map<B58PK, B58PK>;
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
+
71
109
 
72
110
  export type ERR_CODE_MSG_SEP = ":";
73
111
 
@@ -98,6 +136,26 @@ export type AllInfErrs = [
98
136
  "SizeTooLargeErr",
99
137
  ];
100
138
 
139
+ export interface RebalanceQuoteArgs {
140
+ /**
141
+ * Amount of output tokens that will leave the pool in StartRebalance
142
+ */
143
+ out: bigint;
144
+ mints: PkPair;
145
+ }
146
+
147
+ export interface RebalanceQuote {
148
+ /**
149
+ * Amount of input tokens that needs to enter the pool by EndRebalance
150
+ */
151
+ inp: bigint;
152
+ /**
153
+ * Amount of output tokens that will leave the pool in StartRebalance
154
+ */
155
+ out: bigint;
156
+ mints: PkPair;
157
+ }
158
+
101
159
  export interface AccountMeta {
102
160
  address: B58PK;
103
161
  /**
@@ -116,6 +174,8 @@ export interface Instruction {
116
174
  programAddress: B58PK;
117
175
  }
118
176
 
177
+ export type FoundPda = [B58PK, number];
178
+
119
179
  export type FeeMint = "inp" | "out";
120
180
 
121
181
  export interface QuoteArgs {
@@ -156,8 +216,6 @@ export interface Quote {
156
216
  mints: PkPair;
157
217
  }
158
218
 
159
- export type FoundPda = [B58PK, number];
160
-
161
219
  export interface TradeArgs {
162
220
  amt: bigint;
163
221
  limit: bigint;
@@ -166,29 +224,19 @@ export interface TradeArgs {
166
224
  tokenAccs: PkPair;
167
225
  }
168
226
 
169
- export interface Account {
170
- data: Uint8Array;
171
- owner: B58PK;
227
+ export interface RebalanceArgs {
228
+ out: bigint;
229
+ minStartingOutLst: bigint;
230
+ maxStartingInpLst: bigint;
231
+ mints: PkPair;
232
+ withdrawTo: B58PK;
172
233
  }
173
234
 
174
- /**
175
- * Map of `mint: stake pool account` for spl (all deploys) LSTs.
176
- *
177
- * This data is required to determine how to properly initialize the corresponding
178
- * sol value calculator data since which stake pool account corresponds to which mint
179
- * is not available onchain (yet)
180
- */
181
- export type SplPoolAccounts = Map<B58PK, B58PK>;
182
-
183
- export type AccountMap = Map<B58PK, Account>;
184
-
185
- export interface PkPair {
186
- inp: B58PK;
187
- out: B58PK;
235
+ export interface RebalanceIxs {
236
+ start: Instruction;
237
+ end: Instruction;
188
238
  }
189
239
 
190
- export type B58PK = Bs58Array;
191
-
192
240
  export type Bs58Array = string
193
241
 
194
242
  export class Inf {
@@ -200,28 +248,32 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
200
248
 
201
249
  export interface InitOutput {
202
250
  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];
203
253
  readonly allInfErrs: () => any;
204
- readonly findPoolReservesAta: (a: any) => [number, number, number];
205
- readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
254
+ readonly quoteRebalance: (a: number, b: any) => [number, number, number];
255
+ readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
256
+ 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];
206
259
  readonly appendSplLsts: (a: number, b: any) => void;
207
260
  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];
261
+ readonly __wbg_inf_free: (a: number, b: number) => void;
210
262
  readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
211
263
  readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
212
- readonly initPks: () => [number, number];
213
- readonly init: (a: any, b: any) => [number, number, number];
264
+ readonly findPoolReservesAta: (a: any) => [number, number, number];
265
+ readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
214
266
  readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
215
267
  readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
216
- readonly __wbg_inf_free: (a: number, b: number) => void;
268
+ readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
217
269
  readonly __wbindgen_malloc: (a: number, b: number) => number;
218
270
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
219
271
  readonly __wbindgen_exn_store: (a: number) => void;
220
272
  readonly __externref_table_alloc: () => number;
221
273
  readonly __wbindgen_export_4: WebAssembly.Table;
222
274
  readonly __externref_table_dealloc: (a: number) => void;
223
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
224
275
  readonly __externref_drop_slice: (a: number, b: number) => void;
276
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
225
277
  readonly __wbindgen_start: () => void;
226
278
  }
227
279