@tetherto/wdk-wallet 1.0.0-beta.13 → 1.0.0-beta.15
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.js +7 -1
- package/package.json +1 -1
- package/src/errors.js +41 -0
- package/src/protocols/index.js +21 -0
- package/src/protocols/sda-protocol.js +556 -0
- package/src/protocols/swap-protocol.js +1 -0
- package/src/protocols/swidge-protocol.js +5 -2
- package/types/index.d.ts +4 -4
- package/types/src/errors.d.ts +26 -0
- package/types/src/protocols/index.d.ts +19 -0
- package/types/src/protocols/sda-protocol.d.ts +640 -0
- package/types/src/protocols/swap-protocol.d.ts +4 -0
- package/types/src/protocols/swidge-protocol.d.ts +15 -0
|
@@ -85,6 +85,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
85
85
|
*
|
|
86
86
|
* @param {SwapOptions} options - The swap's options.
|
|
87
87
|
* @returns {Promise<SwapResult>} The swap's result.
|
|
88
|
+
* @throws {Error} If no account, or a read-only account was given at construction.
|
|
88
89
|
*/
|
|
89
90
|
swap(options: SwapOptions): Promise<SwapResult>;
|
|
90
91
|
/**
|
|
@@ -92,6 +93,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
92
93
|
*
|
|
93
94
|
* @param {SwapOptions} options - The swap's options.
|
|
94
95
|
* @returns {Promise<Omit<SwapResult, 'hash'>>} The swap's quotes.
|
|
96
|
+
* @throws {Error} If no account was given at construction.
|
|
95
97
|
*/
|
|
96
98
|
quoteSwap(options: SwapOptions): Promise<Omit<SwapResult, "hash">>;
|
|
97
99
|
/**
|
|
@@ -99,6 +101,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
99
101
|
*
|
|
100
102
|
* @param {BridgeOptions} options - The bridge's options.
|
|
101
103
|
* @returns {Promise<BridgeResult>} The bridge's result.
|
|
104
|
+
* @throws {Error} If no account, or a read-only account was given at construction.
|
|
102
105
|
*/
|
|
103
106
|
bridge(options: BridgeOptions): Promise<BridgeResult>;
|
|
104
107
|
/**
|
|
@@ -106,6 +109,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
106
109
|
*
|
|
107
110
|
* @param {BridgeOptions} options - The bridge's options.
|
|
108
111
|
* @returns {Promise<Omit<BridgeResult, 'hash'>>} The bridge's quotes.
|
|
112
|
+
* @throws {Error} If no account was given at construction.
|
|
109
113
|
*/
|
|
110
114
|
quoteBridge(options: BridgeOptions): Promise<Omit<BridgeResult, "hash">>;
|
|
111
115
|
/**
|
|
@@ -116,6 +120,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
116
120
|
* @abstract
|
|
117
121
|
* @param {SwidgeOptions} options - The swidge options.
|
|
118
122
|
* @returns {Promise<SwidgeQuote>} The quoted swidge details.
|
|
123
|
+
* @throws {Error} If no account was given at construction.
|
|
119
124
|
*/
|
|
120
125
|
abstract quoteSwidge(options: SwidgeOptions): Promise<SwidgeQuote>;
|
|
121
126
|
/**
|
|
@@ -125,6 +130,7 @@ export default abstract class SwidgeProtocol implements ISwidgeProtocol, ISwapPr
|
|
|
125
130
|
* @param {SwidgeOptions} options - The swidge options.
|
|
126
131
|
* @param {SwidgeProtocolConfig} [config] - Optional provider-specific execution configuration.
|
|
127
132
|
* @returns {Promise<SwidgeResult>} The swidge execution result.
|
|
133
|
+
* @throws {Error} If no account, or a read-only account was given at construction.
|
|
128
134
|
*/
|
|
129
135
|
abstract swidge(options: SwidgeOptions, config?: SwidgeProtocolConfig): Promise<SwidgeResult>;
|
|
130
136
|
/**
|
|
@@ -199,6 +205,10 @@ export type SwidgeCommonOptions = {
|
|
|
199
205
|
* - The maximum acceptable slippage as a decimal (e.g., 0.01 for 1%).
|
|
200
206
|
*/
|
|
201
207
|
slippage?: number | undefined;
|
|
208
|
+
/**
|
|
209
|
+
* - The minimum acceptable amount of destination tokens to receive (in base unit).
|
|
210
|
+
*/
|
|
211
|
+
minAmountOut?: number | bigint;
|
|
202
212
|
};
|
|
203
213
|
export type SwidgeExactInOptions = {
|
|
204
214
|
/**
|
|
@@ -260,6 +270,11 @@ export type SwidgeTransaction = {
|
|
|
260
270
|
*/
|
|
261
271
|
type?: "other" | "source" | "destination" | "approval" | "refund" | undefined;
|
|
262
272
|
};
|
|
273
|
+
/**
|
|
274
|
+
* Non-binding quote for a swidge operation.
|
|
275
|
+
* Providers that internally decompose the operation into multiple sequential transactions
|
|
276
|
+
* should encapsulate that decomposition behind a single quote.
|
|
277
|
+
*/
|
|
263
278
|
export type SwidgeQuote = {
|
|
264
279
|
/**
|
|
265
280
|
* - The amount of source tokens to spend.
|