@sanctumso/inf1 0.0.1-dev-7 → 0.0.1-dev-8

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 +118 -108
  2. package/index.js +153 -128
  3. package/index_bg.wasm +0 -0
  4. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -1,32 +1,18 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
+ export function getPoolState(inf: Inf): PoolState;
3
4
  /**
4
- * @throws
5
- */
6
- export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
7
- /**
8
- * @throws
9
- */
10
- export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
11
- /**
12
- * Returns the pubkeys of the accounts that need ot be fetched to initialize
13
- * a new {@link Inf} object
5
+ * Returns serialized `PoolState` account data
14
6
  */
15
- export function initPks(): Bs58Array[];
7
+ export function serPoolState(inf: Inf): Uint8Array;
16
8
  /**
17
- * Initialize a new {@link Inf} object.
18
- *
19
- * The returned object must be updated for a mint pair before it is ready to
20
- * quote and operate for trades involving that pair
21
- *
22
- * @throws
9
+ * @throws if stored lst state list account data is invalid
23
10
  */
24
- export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
25
- export function getPoolState(inf: Inf): PoolState;
11
+ export function getLstStateList(inf: Inf): LstState[];
26
12
  /**
27
- * @throws
13
+ * Returns serialized `LstStateList` account data
28
14
  */
29
- export function getLstStateList(inf: Inf): LstState[];
15
+ export function serLstStateList(inf: Inf): Uint8Array;
30
16
  /**
31
17
  * Returned accounts are deduped
32
18
  *
@@ -37,22 +23,6 @@ export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
37
23
  * @throws
38
24
  */
39
25
  export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
40
- /**
41
- * @throws if no valid PDA found
42
- */
43
- export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
44
- /**
45
- * @throws if no valid PDA found
46
- */
47
- export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
48
- /**
49
- * @throws
50
- */
51
- export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
52
- /**
53
- * @throws
54
- */
55
- export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
56
26
  /**
57
27
  * Returned accounts are deduped
58
28
  *
@@ -84,60 +54,48 @@ export function hasSplData(inf: Inf, mints: Bs58Array[]): Uint8Array;
84
54
  */
85
55
  export function allInfErrs(): AllInfErrs;
86
56
  export function quoteRebalance(inf: Inf, arg1: RebalanceQuoteArgs): RebalanceQuote;
57
+ /**
58
+ * @throws
59
+ */
60
+ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
61
+ /**
62
+ * @throws
63
+ */
64
+ export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
65
+ /**
66
+ * @throws if no valid PDA found
67
+ */
68
+ export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
69
+ /**
70
+ * @throws if no valid PDA found
71
+ */
72
+ export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
73
+ /**
74
+ * @throws
75
+ */
76
+ export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
77
+ /**
78
+ * @throws
79
+ */
80
+ export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
87
81
  /**
88
82
  * @throws
89
83
  */
90
84
  export function rebalanceIxs(inf: Inf, arg1: RebalanceArgs): RebalanceIxs;
91
- export type FeeMint = "inp" | "out";
92
-
93
- export interface QuoteArgs {
94
- amt: bigint;
95
- mints: PkPair;
96
- }
97
-
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;
129
- }
130
-
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
- }
140
-
85
+ /**
86
+ * Returns the pubkeys of the accounts that need to be fetched to initialize
87
+ * a new {@link Inf} object
88
+ */
89
+ export function initPks(): Bs58Array[];
90
+ /**
91
+ * Initialize a new {@link Inf} object.
92
+ *
93
+ * The returned object must be updated for a mint pair before it is ready to
94
+ * quote and operate for trades involving that pair
95
+ *
96
+ * @throws
97
+ */
98
+ export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
141
99
 
142
100
  export type ERR_CODE_MSG_SEP = ":";
143
101
 
@@ -206,6 +164,67 @@ export interface Instruction {
206
164
  programAddress: B58PK;
207
165
  }
208
166
 
167
+ export type FeeMint = "inp" | "out";
168
+
169
+ export interface QuoteArgs {
170
+ amt: bigint;
171
+ mints: PkPair;
172
+ }
173
+
174
+ export interface Quote {
175
+ /**
176
+ * Amount of input tokens given by the user to the pool,
177
+ * after fees. This is exactly the amount of tokens that
178
+ * will leave the user\'s wallet.
179
+ */
180
+ inp: bigint;
181
+ /**
182
+ * Amount of output tokens returned by the pool to the user,
183
+ * after fees. This is exactly the amount of tokens that
184
+ * will enter the user\'s wallet.
185
+ */
186
+ out: bigint;
187
+ /**
188
+ * The amount of fee accrued to pool LPs,
189
+ * accumulated in the pool reserves.
190
+ *
191
+ * Which mint it is denoted in (whether inp_mint or out_mint)
192
+ * depends on value of `self.fee_mint`
193
+ */
194
+ lpFee: bigint;
195
+ /**
196
+ * The amount of fee accrued to the protocol,
197
+ * to be transferred to the protocol fee accumulator account.
198
+ *
199
+ * Which mint it is denoted in (whether inp_mint or out_mint)
200
+ * depends on value of `self.fee_mint`
201
+ */
202
+ protocolFee: bigint;
203
+ feeMint: FeeMint;
204
+ mints: PkPair;
205
+ }
206
+
207
+ export interface TradeArgs {
208
+ amt: bigint;
209
+ limit: bigint;
210
+ mints: PkPair;
211
+ signer: B58PK;
212
+ tokenAccs: PkPair;
213
+ }
214
+
215
+ export interface RebalanceArgs {
216
+ out: bigint;
217
+ minStartingOutLst: bigint;
218
+ maxStartingInpLst: bigint;
219
+ mints: PkPair;
220
+ withdrawTo: B58PK;
221
+ }
222
+
223
+ export interface RebalanceIxs {
224
+ start: Instruction;
225
+ end: Instruction;
226
+ }
227
+
209
228
  export interface LstState {
210
229
  isInputDisabled: number;
211
230
  poolReservesBump: number;
@@ -252,18 +271,7 @@ export interface PkPair {
252
271
 
253
272
  export type B58PK = Bs58Array;
254
273
 
255
- export interface RebalanceArgs {
256
- out: bigint;
257
- minStartingOutLst: bigint;
258
- maxStartingInpLst: bigint;
259
- mints: PkPair;
260
- withdrawTo: B58PK;
261
- }
262
-
263
- export interface RebalanceIxs {
264
- start: Instruction;
265
- end: Instruction;
266
- }
274
+ export type FoundPda = [B58PK, number];
267
275
 
268
276
  export type Bs58Array = string
269
277
 
@@ -276,18 +284,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
276
284
 
277
285
  export interface InitOutput {
278
286
  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
287
  readonly getPoolState: (a: number) => any;
288
+ readonly serPoolState: (a: number) => [number, number];
284
289
  readonly getLstStateList: (a: number) => [number, number, number, number];
290
+ readonly serLstStateList: (a: number) => [number, number];
285
291
  readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
286
292
  readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
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];
291
293
  readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
292
294
  readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
293
295
  readonly appendSplLsts: (a: number, b: any) => void;
@@ -295,15 +297,23 @@ export interface InitOutput {
295
297
  readonly __wbg_inf_free: (a: number, b: number) => void;
296
298
  readonly allInfErrs: () => any;
297
299
  readonly quoteRebalance: (a: number, b: any) => [number, number, number];
300
+ readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
301
+ readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
302
+ readonly findPoolReservesAta: (a: any) => [number, number, number];
303
+ readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
304
+ readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
305
+ readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
298
306
  readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
307
+ readonly initPks: () => [number, number];
308
+ readonly init: (a: any, b: any) => [number, number, number];
299
309
  readonly __wbindgen_malloc: (a: number, b: number) => number;
300
310
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
301
311
  readonly __wbindgen_exn_store: (a: number) => void;
302
312
  readonly __externref_table_alloc: () => number;
303
313
  readonly __wbindgen_export_4: WebAssembly.Table;
314
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
304
315
  readonly __externref_table_dealloc: (a: number) => void;
305
316
  readonly __externref_drop_slice: (a: number, b: number) => void;
306
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
307
317
  readonly __wbindgen_start: () => void;
308
318
  }
309
319