@tetherto/wdk-wallet 1.0.0-beta.2 → 1.0.0-beta.21
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/AGENTS.md +49 -0
- package/README.md +2 -2
- package/bare.js +3 -3
- package/index.js +14 -2
- package/package.json +18 -4
- package/src/disposable.js +26 -0
- package/src/errors.js +318 -3
- package/src/multisig/errors.js +54 -0
- package/src/multisig/index.js +42 -0
- package/src/multisig/multisig-message-signing-read-only.js +63 -0
- package/src/multisig/multisig-message-signing.js +64 -0
- package/src/multisig/multisig-owner-management.js +94 -0
- package/src/multisig/wallet-account-multisig.js +144 -0
- package/src/multisig/wallet-account-read-only-multisig.js +98 -0
- package/src/protocols/bridge-protocol.js +35 -1
- package/src/protocols/errors.js +510 -0
- package/src/protocols/fiat-protocol.js +401 -0
- package/src/protocols/index.js +76 -0
- package/src/protocols/lending-protocol.js +114 -2
- package/src/protocols/sda-protocol.js +643 -0
- package/src/protocols/swap-protocol.js +36 -1
- package/src/protocols/swidge-protocol.js +516 -0
- package/src/signer.js +89 -0
- package/src/wallet-account-read-only-simple.js +162 -0
- package/src/wallet-account-read-only.js +186 -40
- package/src/wallet-account.js +59 -22
- package/src/wallet-manager.js +152 -25
- package/types/index.d.ts +13 -4
- package/types/src/disposable.d.ts +7 -0
- package/types/src/errors.d.ts +220 -2
- package/types/src/multisig/errors.d.ts +33 -0
- package/types/src/multisig/index.d.ts +15 -0
- package/types/src/multisig/multisig-message-signing-read-only.d.ts +53 -0
- package/types/src/multisig/multisig-message-signing.d.ts +40 -0
- package/types/src/multisig/multisig-owner-management.d.ts +65 -0
- package/types/src/multisig/wallet-account-multisig.d.ts +101 -0
- package/types/src/multisig/wallet-account-read-only-multisig.d.ts +83 -0
- package/types/src/protocols/bridge-protocol.d.ts +39 -3
- package/types/src/protocols/errors.d.ts +366 -0
- package/types/src/protocols/fiat-protocol.d.ts +409 -0
- package/types/src/protocols/index.d.ts +64 -0
- package/types/src/protocols/lending-protocol.d.ts +118 -4
- package/types/src/protocols/sda-protocol.d.ts +737 -0
- package/types/src/protocols/swap-protocol.d.ts +44 -4
- package/types/src/protocols/swidge-protocol.d.ts +483 -0
- package/types/src/signer.d.ts +53 -0
- package/types/src/wallet-account-read-only-simple.d.ts +144 -0
- package/types/src/wallet-account-read-only.d.ts +104 -27
- package/types/src/wallet-account.d.ts +55 -20
- package/types/src/wallet-manager.d.ts +109 -17
|
@@ -0,0 +1,366 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Enum for swap error reasons.
|
|
3
|
+
*/
|
|
4
|
+
export type SwapErrorReason = string;
|
|
5
|
+
export namespace SwapErrorReason {
|
|
6
|
+
let INSUFFICIENT_BALANCE: string;
|
|
7
|
+
let INSUFFICIENT_TOKEN_BALANCE: string;
|
|
8
|
+
let COULD_NOT_MET_THRESHOLD: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Enum for bridge error reasons.
|
|
12
|
+
*/
|
|
13
|
+
export type BridgeErrorReason = string;
|
|
14
|
+
export namespace BridgeErrorReason {
|
|
15
|
+
let INSUFFICIENT_BALANCE_1: string;
|
|
16
|
+
export { INSUFFICIENT_BALANCE_1 as INSUFFICIENT_BALANCE };
|
|
17
|
+
let INSUFFICIENT_TOKEN_BALANCE_1: string;
|
|
18
|
+
export { INSUFFICIENT_TOKEN_BALANCE_1 as INSUFFICIENT_TOKEN_BALANCE };
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Enum for supply error reasons.
|
|
22
|
+
*/
|
|
23
|
+
export type SupplyErrorReason = string;
|
|
24
|
+
export namespace SupplyErrorReason {
|
|
25
|
+
let INSUFFICIENT_BALANCE_2: string;
|
|
26
|
+
export { INSUFFICIENT_BALANCE_2 as INSUFFICIENT_BALANCE };
|
|
27
|
+
let INSUFFICIENT_TOKEN_BALANCE_2: string;
|
|
28
|
+
export { INSUFFICIENT_TOKEN_BALANCE_2 as INSUFFICIENT_TOKEN_BALANCE };
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Enum for withdraw error reasons.
|
|
32
|
+
*/
|
|
33
|
+
export type WithdrawErrorReason = string;
|
|
34
|
+
export namespace WithdrawErrorReason {
|
|
35
|
+
let INSUFFICIENT_BALANCE_3: string;
|
|
36
|
+
export { INSUFFICIENT_BALANCE_3 as INSUFFICIENT_BALANCE };
|
|
37
|
+
let INSUFFICIENT_TOKEN_BALANCE_3: string;
|
|
38
|
+
export { INSUFFICIENT_TOKEN_BALANCE_3 as INSUFFICIENT_TOKEN_BALANCE };
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Enum for borrow error reasons.
|
|
42
|
+
*/
|
|
43
|
+
export type BorrowErrorReason = string;
|
|
44
|
+
export namespace BorrowErrorReason {
|
|
45
|
+
let INSUFFICIENT_BALANCE_4: string;
|
|
46
|
+
export { INSUFFICIENT_BALANCE_4 as INSUFFICIENT_BALANCE };
|
|
47
|
+
let INSUFFICIENT_TOKEN_BALANCE_4: string;
|
|
48
|
+
export { INSUFFICIENT_TOKEN_BALANCE_4 as INSUFFICIENT_TOKEN_BALANCE };
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Enum for repay error reasons.
|
|
52
|
+
*/
|
|
53
|
+
export type RepayErrorReason = string;
|
|
54
|
+
export namespace RepayErrorReason {
|
|
55
|
+
let INSUFFICIENT_BALANCE_5: string;
|
|
56
|
+
export { INSUFFICIENT_BALANCE_5 as INSUFFICIENT_BALANCE };
|
|
57
|
+
let INSUFFICIENT_TOKEN_BALANCE_5: string;
|
|
58
|
+
export { INSUFFICIENT_TOKEN_BALANCE_5 as INSUFFICIENT_TOKEN_BALANCE };
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Enum for buy error reasons.
|
|
62
|
+
*/
|
|
63
|
+
export type BuyErrorReason = string;
|
|
64
|
+
export namespace BuyErrorReason {
|
|
65
|
+
let INSUFFICIENT_FUNDS: string;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Enum for sell error reasons.
|
|
69
|
+
*/
|
|
70
|
+
export type SellErrorReason = string;
|
|
71
|
+
export namespace SellErrorReason {
|
|
72
|
+
let INSUFFICIENT_FUNDS_1: string;
|
|
73
|
+
export { INSUFFICIENT_FUNDS_1 as INSUFFICIENT_FUNDS };
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Enum for swidge error reasons.
|
|
77
|
+
*/
|
|
78
|
+
export type SwidgeErrorReason = string;
|
|
79
|
+
export namespace SwidgeErrorReason {
|
|
80
|
+
let INSUFFICIENT_BALANCE_6: string;
|
|
81
|
+
export { INSUFFICIENT_BALANCE_6 as INSUFFICIENT_BALANCE };
|
|
82
|
+
let INSUFFICIENT_TOKEN_BALANCE_6: string;
|
|
83
|
+
export { INSUFFICIENT_TOKEN_BALANCE_6 as INSUFFICIENT_TOKEN_BALANCE };
|
|
84
|
+
let COULD_NOT_MET_THRESHOLD_1: string;
|
|
85
|
+
export { COULD_NOT_MET_THRESHOLD_1 as COULD_NOT_MET_THRESHOLD };
|
|
86
|
+
export let SLIPPAGE_TOO_HIGH: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Enum for SDA error reasons.
|
|
90
|
+
*/
|
|
91
|
+
export type SdaErrorReason = string;
|
|
92
|
+
export namespace SdaErrorReason {
|
|
93
|
+
let ROUTE_NOT_SUPPORTED: string;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Thrown when an operation requires an account to be set.
|
|
97
|
+
*/
|
|
98
|
+
export class AccountRequiredError extends WdkError {
|
|
99
|
+
/**
|
|
100
|
+
* Creates a new account required error.
|
|
101
|
+
*
|
|
102
|
+
* @param {string} message - The error's message.
|
|
103
|
+
*/
|
|
104
|
+
constructor(message: string);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Thrown when an operation requires a read-only account to be set.
|
|
108
|
+
*/
|
|
109
|
+
export class ReadOnlyAccountRequiredError extends AccountRequiredError {
|
|
110
|
+
/**
|
|
111
|
+
* Creates a new read-only account required error.
|
|
112
|
+
*
|
|
113
|
+
* @param {string} message - The error's message.
|
|
114
|
+
*/
|
|
115
|
+
constructor(message: string);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Thrown when a swap fails with an error.
|
|
119
|
+
*/
|
|
120
|
+
export class SwapError extends WdkError {
|
|
121
|
+
/**
|
|
122
|
+
* Creates a new swap error.
|
|
123
|
+
*
|
|
124
|
+
* @param {string} message - The error's message.
|
|
125
|
+
* @param {SwapErrorOptions & ErrorOptions} options - The error's options.
|
|
126
|
+
*/
|
|
127
|
+
constructor(message: string, options: SwapErrorOptions & ErrorOptions);
|
|
128
|
+
/**
|
|
129
|
+
* The error's reason.
|
|
130
|
+
*
|
|
131
|
+
* @type {string}
|
|
132
|
+
*/
|
|
133
|
+
reason: string;
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Thrown when a bridge fails with an error.
|
|
137
|
+
*/
|
|
138
|
+
export class BridgeError extends WdkError {
|
|
139
|
+
/**
|
|
140
|
+
* Creates a new bridge error.
|
|
141
|
+
*
|
|
142
|
+
* @param {string} message - The error's message.
|
|
143
|
+
* @param {BridgeErrorOptions & ErrorOptions} options - The error's options.
|
|
144
|
+
*/
|
|
145
|
+
constructor(message: string, options: BridgeErrorOptions & ErrorOptions);
|
|
146
|
+
/**
|
|
147
|
+
* The error's reason.
|
|
148
|
+
*
|
|
149
|
+
* @type {string}
|
|
150
|
+
*/
|
|
151
|
+
reason: string;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Thrown when a supply fails with an error.
|
|
155
|
+
*/
|
|
156
|
+
export class SupplyError extends WdkError {
|
|
157
|
+
/**
|
|
158
|
+
* Creates a new supply error.
|
|
159
|
+
*
|
|
160
|
+
* @param {string} message - The error's message.
|
|
161
|
+
* @param {SupplyErrorOptions & ErrorOptions} options - The error's options.
|
|
162
|
+
*/
|
|
163
|
+
constructor(message: string, options: SupplyErrorOptions & ErrorOptions);
|
|
164
|
+
/**
|
|
165
|
+
* The error's reason.
|
|
166
|
+
*
|
|
167
|
+
* @type {string}
|
|
168
|
+
*/
|
|
169
|
+
reason: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Thrown when a withdraw fails with an error.
|
|
173
|
+
*/
|
|
174
|
+
export class WithdrawError extends WdkError {
|
|
175
|
+
/**
|
|
176
|
+
* Creates a new withdraw error.
|
|
177
|
+
*
|
|
178
|
+
* @param {string} message - The error's message.
|
|
179
|
+
* @param {WithdrawErrorOptions & ErrorOptions} options - The error's options.
|
|
180
|
+
*/
|
|
181
|
+
constructor(message: string, options: WithdrawErrorOptions & ErrorOptions);
|
|
182
|
+
/**
|
|
183
|
+
* The error's reason.
|
|
184
|
+
*
|
|
185
|
+
* @type {string}
|
|
186
|
+
*/
|
|
187
|
+
reason: string;
|
|
188
|
+
}
|
|
189
|
+
/**
|
|
190
|
+
* Thrown when a borrow fails with an error.
|
|
191
|
+
*/
|
|
192
|
+
export class BorrowError extends WdkError {
|
|
193
|
+
/**
|
|
194
|
+
* Creates a new borrow error.
|
|
195
|
+
*
|
|
196
|
+
* @param {string} message - The error's message.
|
|
197
|
+
* @param {BorrowErrorOptions & ErrorOptions} options - The error's options.
|
|
198
|
+
*/
|
|
199
|
+
constructor(message: string, options: BorrowErrorOptions & ErrorOptions);
|
|
200
|
+
/**
|
|
201
|
+
* The error's reason.
|
|
202
|
+
*
|
|
203
|
+
* @type {string}
|
|
204
|
+
*/
|
|
205
|
+
reason: string;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Thrown when a repay fails with an error.
|
|
209
|
+
*/
|
|
210
|
+
export class RepayError extends WdkError {
|
|
211
|
+
/**
|
|
212
|
+
* Creates a new repay error.
|
|
213
|
+
*
|
|
214
|
+
* @param {string} message - The error's message.
|
|
215
|
+
* @param {RepayErrorOptions & ErrorOptions} options - The error's options.
|
|
216
|
+
*/
|
|
217
|
+
constructor(message: string, options: RepayErrorOptions & ErrorOptions);
|
|
218
|
+
/**
|
|
219
|
+
* The error's reason.
|
|
220
|
+
*
|
|
221
|
+
* @type {string}
|
|
222
|
+
*/
|
|
223
|
+
reason: string;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Thrown when a purchase fails with an error.
|
|
227
|
+
*/
|
|
228
|
+
export class BuyError extends WdkError {
|
|
229
|
+
/**
|
|
230
|
+
* Creates a new buy error.
|
|
231
|
+
*
|
|
232
|
+
* @param {string} message - The error's message.
|
|
233
|
+
* @param {BuyErrorOptions & ErrorOptions} options - The error's options.
|
|
234
|
+
*/
|
|
235
|
+
constructor(message: string, options: BuyErrorOptions & ErrorOptions);
|
|
236
|
+
/**
|
|
237
|
+
* The error's reason.
|
|
238
|
+
*
|
|
239
|
+
* @type {string}
|
|
240
|
+
*/
|
|
241
|
+
reason: string;
|
|
242
|
+
}
|
|
243
|
+
/**
|
|
244
|
+
* Thrown when a sale fails with an error.
|
|
245
|
+
*/
|
|
246
|
+
export class SellError extends WdkError {
|
|
247
|
+
/**
|
|
248
|
+
* Creates a new sell error.
|
|
249
|
+
*
|
|
250
|
+
* @param {string} message - The error's message.
|
|
251
|
+
* @param {SellErrorOptions & ErrorOptions} options - The error's options.
|
|
252
|
+
*/
|
|
253
|
+
constructor(message: string, options: SellErrorOptions & ErrorOptions);
|
|
254
|
+
/**
|
|
255
|
+
* The error's reason.
|
|
256
|
+
*
|
|
257
|
+
* @type {string}
|
|
258
|
+
*/
|
|
259
|
+
reason: string;
|
|
260
|
+
}
|
|
261
|
+
/**
|
|
262
|
+
* Thrown when a swidge fails with an error.
|
|
263
|
+
*/
|
|
264
|
+
export class SwidgeError extends WdkError {
|
|
265
|
+
/**
|
|
266
|
+
* Creates a new swidge error.
|
|
267
|
+
*
|
|
268
|
+
* @param {string} message - The error's message.
|
|
269
|
+
* @param {SwidgeErrorOptions & ErrorOptions} options - The error's options.
|
|
270
|
+
*/
|
|
271
|
+
constructor(message: string, options: SwidgeErrorOptions & ErrorOptions);
|
|
272
|
+
/**
|
|
273
|
+
* The error's reason.
|
|
274
|
+
*
|
|
275
|
+
* @type {string}
|
|
276
|
+
*/
|
|
277
|
+
reason: string;
|
|
278
|
+
}
|
|
279
|
+
/**
|
|
280
|
+
* Thrown when a SDA fails with an error.
|
|
281
|
+
*/
|
|
282
|
+
export class SdaError extends WdkError {
|
|
283
|
+
/**
|
|
284
|
+
* Creates a new SDA error.
|
|
285
|
+
*
|
|
286
|
+
* @param {string} message - The error's message.
|
|
287
|
+
* @param {SdaErrorOptions & ErrorOptions} options - The error's options.
|
|
288
|
+
*/
|
|
289
|
+
constructor(message: string, options: SdaErrorOptions & ErrorOptions);
|
|
290
|
+
/**
|
|
291
|
+
* The error's reason.
|
|
292
|
+
*
|
|
293
|
+
* @type {string}
|
|
294
|
+
*/
|
|
295
|
+
reason: string;
|
|
296
|
+
}
|
|
297
|
+
export type SwapErrorOptions = {
|
|
298
|
+
/**
|
|
299
|
+
* - The error's reason.
|
|
300
|
+
*/
|
|
301
|
+
reason: SwapErrorReason;
|
|
302
|
+
};
|
|
303
|
+
export type BridgeErrorOptions = {
|
|
304
|
+
/**
|
|
305
|
+
* - The error's reason.
|
|
306
|
+
*/
|
|
307
|
+
reason: BridgeErrorReason;
|
|
308
|
+
};
|
|
309
|
+
export type SupplyErrorOptions = {
|
|
310
|
+
/**
|
|
311
|
+
* - The error's reason.
|
|
312
|
+
*/
|
|
313
|
+
reason: SupplyErrorReason;
|
|
314
|
+
};
|
|
315
|
+
export type WithdrawErrorOptions = {
|
|
316
|
+
/**
|
|
317
|
+
* - The error's reason.
|
|
318
|
+
*/
|
|
319
|
+
reason: WithdrawErrorReason;
|
|
320
|
+
};
|
|
321
|
+
export type BorrowErrorOptions = {
|
|
322
|
+
/**
|
|
323
|
+
* - The error's reason.
|
|
324
|
+
*/
|
|
325
|
+
reason: BorrowErrorReason;
|
|
326
|
+
};
|
|
327
|
+
export type RepayErrorOptions = {
|
|
328
|
+
/**
|
|
329
|
+
* - The error's reason.
|
|
330
|
+
*/
|
|
331
|
+
reason: RepayErrorReason;
|
|
332
|
+
};
|
|
333
|
+
export type BuyErrorOptions = {
|
|
334
|
+
/**
|
|
335
|
+
* - The error's reason.
|
|
336
|
+
*/
|
|
337
|
+
reason: BuyErrorReason;
|
|
338
|
+
};
|
|
339
|
+
export type SellErrorOptions = {
|
|
340
|
+
/**
|
|
341
|
+
* - The error's reason.
|
|
342
|
+
*/
|
|
343
|
+
reason: SellErrorReason;
|
|
344
|
+
};
|
|
345
|
+
export type SwidgeErrorOptions = {
|
|
346
|
+
/**
|
|
347
|
+
* - The error's reason.
|
|
348
|
+
*/
|
|
349
|
+
reason: SwidgeErrorReason;
|
|
350
|
+
};
|
|
351
|
+
export type SdaErrorOptions = {
|
|
352
|
+
/**
|
|
353
|
+
* - The error's reason.
|
|
354
|
+
*/
|
|
355
|
+
reason: SdaErrorReason;
|
|
356
|
+
};
|
|
357
|
+
import { InvalidTokenError } from '../errors.js';
|
|
358
|
+
import { MaximumFeeExceededError } from '../errors.js';
|
|
359
|
+
import { NoSuchElementError } from '../errors.js';
|
|
360
|
+
import { NotImplementedError } from '../errors.js';
|
|
361
|
+
import { ProviderError } from '../errors.js';
|
|
362
|
+
import { ProviderRequiredError } from '../errors.js';
|
|
363
|
+
import { UnsupportedOperationError } from '../errors.js';
|
|
364
|
+
import { ValueError } from '../errors.js';
|
|
365
|
+
import { WdkError } from '../errors.js';
|
|
366
|
+
export { InvalidTokenError, MaximumFeeExceededError, NoSuchElementError, NotImplementedError, ProviderError, ProviderRequiredError, UnsupportedOperationError, ValueError, WdkError };
|