@sanctumso/inf1 0.0.1-dev-3 → 0.0.1-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.
- package/index.d.ts +81 -62
- package/index.js +56 -58
- package/index_bg.wasm +0 -0
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* Returns the array of all possible {@link InfErr}s
|
|
5
5
|
*/
|
|
6
|
-
export function
|
|
6
|
+
export function allInfErrs(): AllInfErrs;
|
|
7
7
|
/**
|
|
8
|
-
* @throws
|
|
8
|
+
* @throws if no valid PDA found
|
|
9
9
|
*/
|
|
10
|
-
export function
|
|
10
|
+
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
11
|
+
/**
|
|
12
|
+
* @throws if no valid PDA found
|
|
13
|
+
*/
|
|
14
|
+
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
11
15
|
/**
|
|
12
16
|
* Add SPL LSTs auxiliary data to support new SPL LSTs that may have previously not been covered
|
|
13
17
|
*/
|
|
@@ -33,7 +37,7 @@ export function accountsToUpdateForTrade(inf: Inf, arg1: PkPair): Bs58Array[];
|
|
|
33
37
|
/**
|
|
34
38
|
* @throws
|
|
35
39
|
*/
|
|
36
|
-
export function updateForTrade(inf: Inf, arg1: PkPair,
|
|
40
|
+
export function updateForTrade(inf: Inf, arg1: PkPair, account_map: AccountMap): void;
|
|
37
41
|
/**
|
|
38
42
|
* @throws
|
|
39
43
|
*/
|
|
@@ -42,18 +46,6 @@ export function quoteTradeExactIn(inf: Inf, arg1: QuoteArgs): Quote;
|
|
|
42
46
|
* @throws
|
|
43
47
|
*/
|
|
44
48
|
export function quoteTradeExactOut(inf: Inf, arg1: QuoteArgs): Quote;
|
|
45
|
-
/**
|
|
46
|
-
* Returns the array of all possible {@link InfErr}s
|
|
47
|
-
*/
|
|
48
|
-
export function allInfErrs(): AllInfErrs;
|
|
49
|
-
/**
|
|
50
|
-
* @throws if not valid PDA found
|
|
51
|
-
*/
|
|
52
|
-
export function findPoolReservesAta(arg0: Bs58Array): FoundPda;
|
|
53
|
-
/**
|
|
54
|
-
* @throws if not valid PDA found
|
|
55
|
-
*/
|
|
56
|
-
export function findProtocolFeeAccumulatorAta(arg0: Bs58Array): FoundPda;
|
|
57
49
|
/**
|
|
58
50
|
* Returns the pubkeys of the accounts that need ot be fetched to initialize
|
|
59
51
|
* a new {@link Inf} object
|
|
@@ -68,12 +60,60 @@ export function initPks(): Bs58Array[];
|
|
|
68
60
|
* @throws
|
|
69
61
|
*/
|
|
70
62
|
export function init(arg0: AccountMap, arg1: SplPoolAccounts): Inf;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
63
|
+
/**
|
|
64
|
+
* @throws
|
|
65
|
+
*/
|
|
66
|
+
export function tradeExactInIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
67
|
+
/**
|
|
68
|
+
* @throws
|
|
69
|
+
*/
|
|
70
|
+
export function tradeExactOutIx(inf: Inf, arg1: TradeArgs): Instruction;
|
|
71
|
+
|
|
72
|
+
export type ERR_CODE_MSG_SEP = ":";
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* All {@link Error} objects thrown by the SDK have messages of this format
|
|
76
|
+
*/
|
|
77
|
+
export type InfErrMsg = `${InfErr}${ERR_CODE_MSG_SEP}${string}`;
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* All {@link Error} objects thrown by SDK functions will start with
|
|
82
|
+
* `{InfErr}:`, so that the `InfErr` error code can be
|
|
83
|
+
* extracted by splitting on the first colon `:`
|
|
84
|
+
*/
|
|
85
|
+
export type InfErr = "AccDeserErr" | "InternalErr" | "MissingAccErr" | "MissingSplDataErr" | "MissingSvcDataErr" | "NoValidPdaErr" | "PoolErr" | "UnknownPpErr" | "UnknownSvcErr" | "UnsupportedMintErr" | "SizeTooSmallErr" | "SizeTooLargeErr";
|
|
86
|
+
|
|
87
|
+
export type AllInfErrs = [
|
|
88
|
+
"AccDeserErr",
|
|
89
|
+
"InternalErr",
|
|
90
|
+
"MissingAccErr",
|
|
91
|
+
"MissingSplDataErr",
|
|
92
|
+
"MissingSvcDataErr",
|
|
93
|
+
"NoValidPdaErr",
|
|
94
|
+
"PoolErr",
|
|
95
|
+
"UnknownSvcErr",
|
|
96
|
+
"UnsupportedMintErr",
|
|
97
|
+
"SizeTooSmallErr",
|
|
98
|
+
"SizeTooLargeErr",
|
|
99
|
+
];
|
|
100
|
+
|
|
101
|
+
export interface AccountMeta {
|
|
102
|
+
address: B58PK;
|
|
103
|
+
/**
|
|
104
|
+
* Represents the role of an account in a transaction:
|
|
105
|
+
* - Readonly: 0
|
|
106
|
+
* - Writable: 1
|
|
107
|
+
* - ReadonlySigner: 2
|
|
108
|
+
* - WritableSigner: 3
|
|
109
|
+
*/
|
|
110
|
+
role: 0 | 1 | 2 | 3;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export interface Instruction {
|
|
114
|
+
data: Uint8Array;
|
|
115
|
+
accounts: AccountMeta[];
|
|
116
|
+
programAddress: B58PK;
|
|
77
117
|
}
|
|
78
118
|
|
|
79
119
|
export type FeeMint = "inp" | "out";
|
|
@@ -116,12 +156,15 @@ export interface Quote {
|
|
|
116
156
|
mints: PkPair;
|
|
117
157
|
}
|
|
118
158
|
|
|
119
|
-
export
|
|
120
|
-
inp: T;
|
|
121
|
-
out: T;
|
|
122
|
-
}
|
|
159
|
+
export type FoundPda = [B58PK, number];
|
|
123
160
|
|
|
124
|
-
export
|
|
161
|
+
export interface TradeArgs {
|
|
162
|
+
amt: bigint;
|
|
163
|
+
limit: bigint;
|
|
164
|
+
mints: PkPair;
|
|
165
|
+
signer: B58PK;
|
|
166
|
+
tokenAccs: PkPair;
|
|
167
|
+
}
|
|
125
168
|
|
|
126
169
|
export interface Account {
|
|
127
170
|
data: Uint8Array;
|
|
@@ -139,36 +182,12 @@ export type SplPoolAccounts = Map<B58PK, B58PK>;
|
|
|
139
182
|
|
|
140
183
|
export type AccountMap = Map<B58PK, Account>;
|
|
141
184
|
|
|
142
|
-
export
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
* All {@link Error} objects thrown by SDK functions will start with
|
|
146
|
-
* `{InfErr}:`, so that the `InfErr` error code can be
|
|
147
|
-
* extracted by splitting on the first colon `:`
|
|
148
|
-
*/
|
|
149
|
-
export type InfErr = "AccDeserErr" | "InternalErr" | "MissingAccErr" | "MissingSplDataErr" | "MissingSvcDataErr" | "NoValidPdaErr" | "PoolErr" | "UnknownSvcErr" | "UnsupportedMintErr" | "UserErr";
|
|
150
|
-
|
|
151
|
-
export type AllInfErrs = InfErr[];
|
|
152
|
-
|
|
153
|
-
export type FoundPda = [B58PK, number];
|
|
154
|
-
|
|
155
|
-
export interface AccountMeta {
|
|
156
|
-
address: B58PK;
|
|
157
|
-
/**
|
|
158
|
-
* Represents the role of an account in a transaction:
|
|
159
|
-
* - Readonly: 0
|
|
160
|
-
* - Writable: 1
|
|
161
|
-
* - ReadonlySigner: 2
|
|
162
|
-
* - WritableSigner: 3
|
|
163
|
-
*/
|
|
164
|
-
role: 0 | 1 | 2 | 3;
|
|
185
|
+
export interface PkPair {
|
|
186
|
+
inp: B58PK;
|
|
187
|
+
out: B58PK;
|
|
165
188
|
}
|
|
166
189
|
|
|
167
|
-
export
|
|
168
|
-
data: Uint8Array;
|
|
169
|
-
accounts: AccountMeta[];
|
|
170
|
-
programAddress: B58PK;
|
|
171
|
-
}
|
|
190
|
+
export type B58PK = Bs58Array;
|
|
172
191
|
|
|
173
192
|
export type Bs58Array = string
|
|
174
193
|
|
|
@@ -181,20 +200,20 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembl
|
|
|
181
200
|
|
|
182
201
|
export interface InitOutput {
|
|
183
202
|
readonly memory: WebAssembly.Memory;
|
|
184
|
-
readonly
|
|
185
|
-
readonly
|
|
203
|
+
readonly allInfErrs: () => any;
|
|
204
|
+
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
205
|
+
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
186
206
|
readonly appendSplLsts: (a: number, b: any) => void;
|
|
187
207
|
readonly hasSplData: (a: number, b: number, c: number) => [number, number];
|
|
188
208
|
readonly accountsToUpdateForTrade: (a: number, b: any) => [number, number, number, number];
|
|
189
209
|
readonly updateForTrade: (a: number, b: any, c: any) => [number, number];
|
|
190
210
|
readonly quoteTradeExactIn: (a: number, b: any) => [number, number, number];
|
|
191
211
|
readonly quoteTradeExactOut: (a: number, b: any) => [number, number, number];
|
|
192
|
-
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
193
|
-
readonly allInfErrs: () => any;
|
|
194
|
-
readonly findPoolReservesAta: (a: any) => [number, number, number];
|
|
195
|
-
readonly findProtocolFeeAccumulatorAta: (a: any) => [number, number, number];
|
|
196
212
|
readonly initPks: () => [number, number];
|
|
197
213
|
readonly init: (a: any, b: any) => [number, number, number];
|
|
214
|
+
readonly tradeExactInIx: (a: number, b: any) => [number, number, number];
|
|
215
|
+
readonly tradeExactOutIx: (a: number, b: any) => [number, number, number];
|
|
216
|
+
readonly __wbg_inf_free: (a: number, b: number) => void;
|
|
198
217
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
199
218
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
200
219
|
readonly __wbindgen_exn_store: (a: number) => void;
|