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

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 +119 -121
  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
 
@@ -154,19 +112,7 @@ export type InfErrMsg = `${InfErr}${ERR_CODE_MSG_SEP}${string}`;
154
112
  */
155
113
  export type InfErr = "AccDeserErr" | "InternalErr" | "MissingAccErr" | "MissingSplDataErr" | "MissingSvcDataErr" | "NoValidPdaErr" | "PoolErr" | "UnknownPpErr" | "UnknownSvcErr" | "UnsupportedMintErr" | "SizeTooSmallErr" | "SizeTooLargeErr";
156
114
 
157
- export type AllInfErrs = [
158
- "AccDeserErr",
159
- "InternalErr",
160
- "MissingAccErr",
161
- "MissingSplDataErr",
162
- "MissingSvcDataErr",
163
- "NoValidPdaErr",
164
- "PoolErr",
165
- "UnknownSvcErr",
166
- "UnsupportedMintErr",
167
- "SizeTooSmallErr",
168
- "SizeTooLargeErr",
169
- ];
115
+ export type AllInfErrs = InfErr[];
170
116
 
171
117
  export interface RebalanceQuoteArgs {
172
118
  /**
@@ -206,6 +152,67 @@ export interface Instruction {
206
152
  programAddress: B58PK;
207
153
  }
208
154
 
155
+ export type FeeMint = "inp" | "out";
156
+
157
+ export interface QuoteArgs {
158
+ amt: bigint;
159
+ mints: PkPair;
160
+ }
161
+
162
+ export interface Quote {
163
+ /**
164
+ * Amount of input tokens given by the user to the pool,
165
+ * after fees. This is exactly the amount of tokens that
166
+ * will leave the user\'s wallet.
167
+ */
168
+ inp: bigint;
169
+ /**
170
+ * Amount of output tokens returned by the pool to the user,
171
+ * after fees. This is exactly the amount of tokens that
172
+ * will enter the user\'s wallet.
173
+ */
174
+ out: bigint;
175
+ /**
176
+ * The amount of fee accrued to pool LPs,
177
+ * accumulated in the pool reserves.
178
+ *
179
+ * Which mint it is denoted in (whether inp_mint or out_mint)
180
+ * depends on value of `self.fee_mint`
181
+ */
182
+ lpFee: bigint;
183
+ /**
184
+ * The amount of fee accrued to the protocol,
185
+ * to be transferred to the protocol fee accumulator account.
186
+ *
187
+ * Which mint it is denoted in (whether inp_mint or out_mint)
188
+ * depends on value of `self.fee_mint`
189
+ */
190
+ protocolFee: bigint;
191
+ feeMint: FeeMint;
192
+ mints: PkPair;
193
+ }
194
+
195
+ export interface TradeArgs {
196
+ amt: bigint;
197
+ limit: bigint;
198
+ mints: PkPair;
199
+ signer: B58PK;
200
+ tokenAccs: PkPair;
201
+ }
202
+
203
+ export interface RebalanceArgs {
204
+ out: bigint;
205
+ minStartingOutLst: bigint;
206
+ maxStartingInpLst: bigint;
207
+ mints: PkPair;
208
+ withdrawTo: B58PK;
209
+ }
210
+
211
+ export interface RebalanceIxs {
212
+ start: Instruction;
213
+ end: Instruction;
214
+ }
215
+
209
216
  export interface LstState {
210
217
  isInputDisabled: number;
211
218
  poolReservesBump: number;
@@ -252,18 +259,7 @@ export interface PkPair {
252
259
 
253
260
  export type B58PK = Bs58Array;
254
261
 
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
- }
262
+ export type FoundPda = [B58PK, number];
267
263
 
268
264
  export type Bs58Array = string
269
265
 
@@ -276,18 +272,12 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
276
272
 
277
273
  export interface InitOutput {
278
274
  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
275
  readonly getPoolState: (a: number) => any;
276
+ readonly serPoolState: (a: number) => [number, number];
284
277
  readonly getLstStateList: (a: number) => [number, number, number, number];
278
+ readonly serLstStateList: (a: number) => [number, number];
285
279
  readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
286
280
  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
281
  readonly accountsToUpdateForRebalance: (a: number, b: any) => [number, number, number, number];
292
282
  readonly updateForRebalance: (a: number, b: any, c: any) => [number, number];
293
283
  readonly appendSplLsts: (a: number, b: any) => void;
@@ -295,15 +285,23 @@ export interface InitOutput {
295
285
  readonly __wbg_inf_free: (a: number, b: number) => void;
296
286
  readonly allInfErrs: () => any;
297
287
  readonly quoteRebalance: (a: number, b: any) => [number, number, number];
288
+ readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
289
+ readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
290
+ readonly findPoolReservesAta: (a: any) => [number, number, number];
291
+ readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
292
+ readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
293
+ readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
298
294
  readonly rebalanceIxs: (a: number, b: any) => [number, number, number];
295
+ readonly initPks: () => [number, number];
296
+ readonly init: (a: any, b: any) => [number, number, number];
299
297
  readonly __wbindgen_malloc: (a: number, b: number) => number;
300
298
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
301
299
  readonly __wbindgen_exn_store: (a: number) => void;
302
300
  readonly __externref_table_alloc: () => number;
303
301
  readonly __wbindgen_export_4: WebAssembly.Table;
302
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
304
303
  readonly __externref_table_dealloc: (a: number) => void;
305
304
  readonly __externref_drop_slice: (a: number, b: number) => void;
306
- readonly __wbindgen_free: (a: number, b: number, c: number) => void;
307
305
  readonly __wbindgen_start: () => void;
308
306
  }
309
307