@sanctumso/inf1 0.0.2-dev-2 → 0.0.2-dev-3

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
@@ -36,16 +36,6 @@ export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap):
36
36
  * @throws
37
37
  */
38
38
  export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
39
- /**
40
- * @throws if no valid PDA found
41
- */
42
- export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
43
- /**
44
- * @deprecated Protocol fee accumulator token accounts are no longer used in v2
45
- *
46
- * @throws if no valid PDA found
47
- */
48
- export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
49
39
  /**
50
40
  * @throws
51
41
  */
@@ -54,7 +44,10 @@ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
54
44
  * @throws
55
45
  */
56
46
  export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
57
- export function getPoolState(inf: Inf): PoolStateV2;
47
+ /**
48
+ * @throws if lookahead was set and failed
49
+ */
50
+ export function getPoolState(inf: Inf, lookahead?: SlotLookahead | null): PoolStateV2;
58
51
  /**
59
52
  * Sets the `PoolState` account data
60
53
  */
@@ -84,15 +77,15 @@ export function serLstStateList(inf: Inf): Uint8Array;
84
77
  */
85
78
  export function deserLstStateList(inf: Inf, lst_state_list_data: Uint8Array): void;
86
79
  /**
87
- * Returned accounts are deduped
88
- *
89
- * @throws
80
+ * @throws if no valid PDA found
90
81
  */
91
- export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
82
+ export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
92
83
  /**
93
- * @throws
84
+ * @deprecated Protocol fee accumulator token accounts are no longer used in v2
85
+ *
86
+ * @throws if no valid PDA found
94
87
  */
95
- export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
88
+ export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
96
89
  /**
97
90
  * Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
98
91
  */
@@ -109,6 +102,16 @@ export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
109
102
  * conversion doesnt work with bool arrays.
110
103
  */
111
104
  export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
105
+ /**
106
+ * Returned accounts are deduped
107
+ *
108
+ * @throws
109
+ */
110
+ export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
111
+ /**
112
+ * @throws
113
+ */
114
+ export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
112
115
  /**
113
116
  * Returns the array of all possible {@link InfErr}s
114
117
  */
@@ -122,7 +125,23 @@ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
122
125
  * @throws
123
126
  */
124
127
  export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
125
- export type FoundPda = [B58PK, number];
128
+ export interface AccountMeta {
129
+ address: B58PK;
130
+ /**
131
+ * Represents the role of an account in a transaction:
132
+ * - Readonly: 0
133
+ * - Writable: 1
134
+ * - ReadonlySigner: 2
135
+ * - WritableSigner: 3
136
+ */
137
+ role: 0 | 1 | 2 | 3;
138
+ }
139
+
140
+ export interface Instruction {
141
+ data: Uint8Array;
142
+ accounts: AccountMeta[];
143
+ programAddress: B58PK;
144
+ }
126
145
 
127
146
  export interface RebalanceArgs {
128
147
  out: bigint;
@@ -177,55 +196,7 @@ export interface Quote {
177
196
  mints: PkPair;
178
197
  }
179
198
 
180
- export interface LstState {
181
- isInputDisabled: number;
182
- poolReservesBump: number;
183
- protocolFeeAccumulatorBump: number;
184
- solValue: bigint;
185
- mint: B58PK;
186
- solValueCalculator: B58PK;
187
- }
188
-
189
- export interface PoolStateV2 {
190
- totalSolValue: bigint;
191
- protocolFeeNanos: number;
192
- version: number;
193
- isDisabled: number;
194
- isRebalancing: number;
195
- admin: B58PK;
196
- rebalanceAuthority: B58PK;
197
- protocolFeeBeneficiary: B58PK;
198
- pricingProgram: B58PK;
199
- lpTokenMint: B58PK;
200
- rpsAuthority: B58PK;
201
- rps: bigint;
202
- withheldLamports: bigint;
203
- protocolFeeLamports: bigint;
204
- lastReleaseSlot: bigint;
205
- }
206
-
207
- export interface Account {
208
- data: Uint8Array;
209
- owner: B58PK;
210
- }
211
-
212
- /**
213
- * Map of `mint: stake pool account` for spl (all deploys) LSTs.
214
- *
215
- * This data is required to determine how to properly initialize the corresponding
216
- * sol value calculator data since which stake pool account corresponds to which mint
217
- * is not available onchain (yet)
218
- */
219
- export type SplPoolAccounts = Map<B58PK, B58PK>;
220
-
221
- export type AccountMap = Map<B58PK, Account>;
222
-
223
- export interface PkPair {
224
- inp: B58PK;
225
- out: B58PK;
226
- }
227
-
228
- export type B58PK = Bs58Array;
199
+ export type FoundPda = [B58PK, number];
229
200
 
230
201
 
231
202
  export type ERR_CODE_MSG_SEP = ":";
@@ -272,24 +243,58 @@ export interface RebalanceQuote {
272
243
  mints: PkPair;
273
244
  }
274
245
 
275
- export interface AccountMeta {
276
- address: B58PK;
277
- /**
278
- * Represents the role of an account in a transaction:
279
- * - Readonly: 0
280
- * - Writable: 1
281
- * - ReadonlySigner: 2
282
- * - WritableSigner: 3
283
- */
284
- role: 0 | 1 | 2 | 3;
246
+ export type SlotLookahead = { abs: bigint } | { rel: bigint };
247
+
248
+ export interface LstState {
249
+ isInputDisabled: number;
250
+ poolReservesBump: number;
251
+ protocolFeeAccumulatorBump: number;
252
+ solValue: bigint;
253
+ mint: B58PK;
254
+ solValueCalculator: B58PK;
285
255
  }
286
256
 
287
- export interface Instruction {
257
+ export interface PoolStateV2 {
258
+ totalSolValue: bigint;
259
+ protocolFeeNanos: number;
260
+ version: number;
261
+ isDisabled: number;
262
+ isRebalancing: number;
263
+ admin: B58PK;
264
+ rebalanceAuthority: B58PK;
265
+ protocolFeeBeneficiary: B58PK;
266
+ pricingProgram: B58PK;
267
+ lpTokenMint: B58PK;
268
+ rpsAuthority: B58PK;
269
+ rps: bigint;
270
+ withheldLamports: bigint;
271
+ protocolFeeLamports: bigint;
272
+ lastReleaseSlot: bigint;
273
+ }
274
+
275
+ export interface Account {
288
276
  data: Uint8Array;
289
- accounts: AccountMeta[];
290
- programAddress: B58PK;
277
+ owner: B58PK;
278
+ }
279
+
280
+ /**
281
+ * Map of `mint: stake pool account` for spl (all deploys) LSTs.
282
+ *
283
+ * This data is required to determine how to properly initialize the corresponding
284
+ * sol value calculator data since which stake pool account corresponds to which mint
285
+ * is not available onchain (yet)
286
+ */
287
+ export type SplPoolAccounts = Map<B58PK, B58PK>;
288
+
289
+ export type AccountMap = Map<B58PK, Account>;
290
+
291
+ export interface PkPair {
292
+ inp: B58PK;
293
+ out: B58PK;
291
294
  }
292
295
 
296
+ export type B58PK = Bs58Array;
297
+
293
298
  export interface TradeArgs {
294
299
  amt: bigint;
295
300
  limit: bigint;
@@ -309,7 +314,6 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
309
314
 
310
315
  export interface InitOutput {
311
316
  readonly memory: WebAssembly.Memory;
312
- readonly __wbg_inf_free: (a: number, b: number) => void;
313
317
  readonly initPks: () => [number, number];
314
318
  readonly init: (a: any, b: any) => [number, number, number];
315
319
  readonly initObj: (a: any, b: number, c: number, d: any) => [number, number, number];
@@ -317,11 +321,9 @@ export interface InitOutput {
317
321
  readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
318
322
  readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
319
323
  readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
320
- readonly findPoolReservesAta: (a: any) => [number, number, number];
321
- readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
322
324
  readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
323
325
  readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
324
- readonly getPoolState: (a: number) => any;
326
+ readonly getPoolState: (a: number, b: number) => [number, number, number];
325
327
  readonly setPoolState: (a: number, b: any) => void;
326
328
  readonly serPoolState: (a: number) => [number, number];
327
329
  readonly deserPoolState: (a: number, b: number, c: number) => [number, number];
@@ -329,10 +331,13 @@ export interface InitOutput {
329
331
  readonly setLstStateList: (a: number, b: number, c: number) => void;
330
332
  readonly serLstStateList: (a: number) => [number, number];
331
333
  readonly deserLstStateList: (a: number, b: number, c: number) => [number, number];
332
- readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
333
- readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
334
+ readonly findPoolReservesAta: (a: any) => [number, number, number];
335
+ readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
334
336
  readonly appendSplLsts: (a: number, b: any) => void;
335
337
  readonly hasSplData: (a: number, b: number, c: number) => [number, number];
338
+ readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
339
+ readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
340
+ readonly __wbg_inf_free: (a: number, b: number) => void;
336
341
  readonly allInfErrs: () => any;
337
342
  readonly quoteRebalance: (a: number, b: any) => [number, number, number];
338
343
  readonly tradeExactInIx: (a: number, b: any) => [number, number, number];