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

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.
Files changed (4) hide show
  1. package/index.d.ts +132 -120
  2. package/index.js +128 -115
  3. package/index_bg.wasm +0 -0
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,5 +1,31 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ /**
4
+ * @throws if no valid PDA found
5
+ */
6
+ export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
7
+ /**
8
+ * @deprecated Protocol fee accumulator token accounts are no longer used in v2
9
+ *
10
+ * @throws if no valid PDA found
11
+ */
12
+ export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
13
+ /**
14
+ * @throws
15
+ */
16
+ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
17
+ /**
18
+ * @throws
19
+ */
20
+ export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
21
+ /**
22
+ * @throws
23
+ */
24
+ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
25
+ /**
26
+ * @throws
27
+ */
28
+ export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
3
29
  /**
4
30
  * Returns the pubkeys of the accounts that need to be fetched to initialize
5
31
  * a new {@link Inf} object
@@ -33,17 +59,15 @@ export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
33
59
  */
34
60
  export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
35
61
  /**
62
+ * Returned accounts are deduped
63
+ *
36
64
  * @throws
37
65
  */
38
- export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
39
- /**
40
- * @throws
41
- */
42
- export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
66
+ export function accountsToUpdateForRebalance(inf: Inf, arg1: PkPair): Bs58Array[];
43
67
  /**
44
68
  * @throws
45
69
  */
46
- export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
70
+ export function updateForRebalance(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
47
71
  /**
48
72
  * @throws if lookahead was set and failed
49
73
  */
@@ -77,15 +101,9 @@ export function serLstStateList(inf: Inf): Uint8Array;
77
101
  */
78
102
  export function deserLstStateList(inf: Inf, lst_state_list_data: Uint8Array): void;
79
103
  /**
80
- * @throws if no valid PDA found
81
- */
82
- export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
83
- /**
84
- * @deprecated Protocol fee accumulator token accounts are no longer used in v2
85
- *
86
- * @throws if no valid PDA found
104
+ * @throws
87
105
  */
88
- export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
106
+ export function withdrawProtocolFeesV2IxRaw(arg0: WithdrawProtocolFeesV2Args): Instruction;
89
107
  /**
90
108
  * Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
91
109
  */
@@ -103,59 +121,14 @@ export function appendSplLsts(inf: Inf, arg1: SplPoolAccounts): void;
103
121
  */
104
122
  export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
105
123
  /**
106
- * Returned accounts are deduped
107
- *
108
124
  * @throws
109
125
  */
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;
126
+ export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
115
127
  /**
116
128
  * Returns the array of all possible {@link InfErr}s
117
129
  */
118
130
  export function allInfErrs(): AllInfErrs;
119
131
  export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
120
- /**
121
- * @throws
122
- */
123
- export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
124
- /**
125
- * @throws
126
- */
127
- export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
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
- }
145
-
146
- export interface RebalanceArgs {
147
- out: bigint;
148
- minStartingOutLst: bigint;
149
- maxStartingInpLst: bigint;
150
- mints: PkPair;
151
- withdrawTo: B58PK;
152
- }
153
-
154
- export interface RebalanceIxs {
155
- start: Instruction;
156
- end: Instruction;
157
- }
158
-
159
132
  export type FeeMint = "inp" | "out";
160
133
 
161
134
  export interface QuoteArgs {
@@ -196,51 +169,12 @@ export interface Quote {
196
169
  mints: PkPair;
197
170
  }
198
171
 
199
- export type FoundPda = [B58PK, number];
200
-
201
-
202
- export type ERR_CODE_MSG_SEP = ":";
203
-
204
- /**
205
- * All {@link Error} objects thrown by the SDK have messages of this format
206
- */
207
- export type InfErrMsg = `${InfErr}${ERR_CODE_MSG_SEP}${string}`;
208
-
209
-
210
- /**
211
- * All {@link Error} objects thrown by SDK functions will start with
212
- * `{InfErr}:`, so that the `InfErr` error code can be
213
- * extracted by splitting on the first colon `:`
214
- */
215
- export type InfErr = "AccDeserErr" | "InternalErr" | "MissingAccErr" | "MissingSplDataErr" | "MissingSvcDataErr" | "NoValidPdaErr" | "PoolErr" | "UnknownPpErr" | "UnknownSvcErr" | "UnsupportedMintErr" | "SizeTooSmallErr" | "SizeTooLargeErr";
216
-
217
- export type AllInfErrs = InfErr[];
218
-
219
- export interface RebalanceQuoteArgs {
220
- /**
221
- * Amount of output tokens that will leave the pool in StartRebalance
222
- */
223
- out: bigint;
224
- mints: PkPair;
225
- }
226
-
227
- export interface RebalanceQuote {
228
- /**
229
- * Amount of input tokens that needs to enter the pool by EndRebalance
230
- */
231
- inp: bigint;
232
- /**
233
- * Amount of output tokens that will leave the pool in StartRebalance
234
- */
235
- out: bigint;
236
- /**
237
- * SOL value of `out` output tokens.
238
- *
239
- * SOL value of `inp` input tokens
240
- * should be the same, barring rounding
241
- */
242
- outSolVal: bigint;
172
+ export interface TradeArgs {
173
+ amt: bigint;
174
+ limit: bigint;
243
175
  mints: PkPair;
176
+ signer: B58PK;
177
+ tokenAccs: PkPair;
244
178
  }
245
179
 
246
180
  export type SlotLookahead = { abs: bigint } | { rel: bigint };
@@ -295,12 +229,89 @@ export interface PkPair {
295
229
 
296
230
  export type B58PK = Bs58Array;
297
231
 
298
- export interface TradeArgs {
299
- amt: bigint;
300
- limit: bigint;
232
+ export interface WithdrawProtocolFeesV2Args {
233
+ protocolFeeBeneficiary: B58PK;
234
+ withdrawTo: B58PK;
235
+ infMint: B58PK;
236
+ tokenProgram: B58PK;
237
+ }
238
+
239
+ export type FoundPda = [B58PK, number];
240
+
241
+ export interface RebalanceArgs {
242
+ out: bigint;
243
+ minStartingOutLst: bigint;
244
+ maxStartingInpLst: bigint;
301
245
  mints: PkPair;
302
- signer: B58PK;
303
- tokenAccs: PkPair;
246
+ withdrawTo: B58PK;
247
+ }
248
+
249
+ export interface RebalanceIxs {
250
+ start: Instruction;
251
+ end: Instruction;
252
+ }
253
+
254
+
255
+ export type ERR_CODE_MSG_SEP = ":";
256
+
257
+ /**
258
+ * All {@link Error} objects thrown by the SDK have messages of this format
259
+ */
260
+ export type InfErrMsg = `${InfErr}${ERR_CODE_MSG_SEP}${string}`;
261
+
262
+
263
+ /**
264
+ * All {@link Error} objects thrown by SDK functions will start with
265
+ * `{InfErr}:`, so that the `InfErr` error code can be
266
+ * extracted by splitting on the first colon `:`
267
+ */
268
+ export type InfErr = "AccDeserErr" | "InternalErr" | "MissingAccErr" | "MissingSplDataErr" | "MissingSvcDataErr" | "NoValidPdaErr" | "PoolErr" | "UnknownPpErr" | "UnknownSvcErr" | "UnsupportedMintErr" | "SizeTooSmallErr" | "SizeTooLargeErr";
269
+
270
+ export type AllInfErrs = InfErr[];
271
+
272
+ export interface RebalanceQuoteArgs {
273
+ /**
274
+ * Amount of output tokens that will leave the pool in StartRebalance
275
+ */
276
+ out: bigint;
277
+ mints: PkPair;
278
+ }
279
+
280
+ export interface RebalanceQuote {
281
+ /**
282
+ * Amount of input tokens that needs to enter the pool by EndRebalance
283
+ */
284
+ inp: bigint;
285
+ /**
286
+ * Amount of output tokens that will leave the pool in StartRebalance
287
+ */
288
+ out: bigint;
289
+ /**
290
+ * SOL value of `out` output tokens.
291
+ *
292
+ * SOL value of `inp` input tokens
293
+ * should be the same, barring rounding
294
+ */
295
+ outSolVal: bigint;
296
+ mints: PkPair;
297
+ }
298
+
299
+ export interface AccountMeta {
300
+ address: B58PK;
301
+ /**
302
+ * Represents the role of an account in a transaction:
303
+ * - Readonly: 0
304
+ * - Writable: 1
305
+ * - ReadonlySigner: 2
306
+ * - WritableSigner: 3
307
+ */
308
+ role: 0 | 1 | 2 | 3;
309
+ }
310
+
311
+ export interface Instruction {
312
+ data: Uint8Array;
313
+ accounts: AccountMeta[];
314
+ programAddress: B58PK;
304
315
  }
305
316
 
306
317
  export type Bs58Array = string
@@ -314,15 +325,21 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
314
325
 
315
326
  export interface InitOutput {
316
327
  readonly memory: WebAssembly.Memory;
328
+ readonly findPoolReservesAta: (a: any) => [number, number, number];
329
+ readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
330
+ readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
331
+ readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
332
+ readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
333
+ readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
317
334
  readonly initPks: () => [number, number];
318
335
  readonly init: (a: any, b: any) => [number, number, number];
319
336
  readonly initObj: (a: any, b: number, c: number, d: any) => [number, number, number];
320
337
  readonly cloneInf: (a: number) => number;
321
338
  readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
322
339
  readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
323
- readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
324
- readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
325
- readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
340
+ readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
341
+ readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
342
+ readonly __wbg_inf_free: (a: number, b: number) => void;
326
343
  readonly getPoolState: (a: number, b: number) => [number, number, number];
327
344
  readonly setPoolState: (a: number, b: any) => void;
328
345
  readonly serPoolState: (a: number) => [number, number];
@@ -331,25 +348,20 @@ export interface InitOutput {
331
348
  readonly setLstStateList: (a: number, b: number, c: number) => void;
332
349
  readonly serLstStateList: (a: number) => [number, number];
333
350
  readonly deserLstStateList: (a: number, b: number, c: number) => [number, number];
334
- readonly findPoolReservesAta: (a: any) => [number, number, number];
335
- readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
351
+ readonly withdrawProtocolFeesV2IxRaw: (a: any) => [number, number, number];
336
352
  readonly appendSplLsts: (a: number, b: any) => void;
337
353
  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;
354
+ readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
341
355
  readonly allInfErrs: () => any;
342
356
  readonly quoteRebalance: (a: number, b: any) => [number, number, number];
343
- readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
344
- readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
345
357
  readonly __wbindgen_malloc: (a: number, b: number) => number;
346
358
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
347
359
  readonly __wbindgen_exn_store: (a: number) => void;
348
360
  readonly __externref_table_alloc: () => number;
349
361
  readonly __wbindgen_export_4: WebAssembly.Table;
362
+ readonly __externref_table_dealloc: (a: number) => void;
350
363
  readonly __externref_drop_slice: (a: number, b: number) => void;
351
364
  readonly __wbindgen_free: (a: number, b: number, c: number) => void;
352
- readonly __externref_table_dealloc: (a: number) => void;
353
365
  readonly __wbindgen_start: () => void;
354
366
  }
355
367