6
6
DepositAddressRequest ,
7
7
DepositAddressResponse ,
8
8
QuoteRequest ,
9
- QuoteResponse ,
9
+ QuoteResponseV2 ,
10
10
} from '@chainflip/sdk/swap'
11
11
12
12
class SwapSDK {
@@ -159,7 +159,7 @@ class SwapSDK {
159
159
throw Error ( 'Can not get deposit address' )
160
160
}
161
161
162
- async getQuote ( { srcAsset, srcChain, destAsset, destChain, amount } : QuoteRequest ) : Promise < QuoteResponse > {
162
+ async getQuote ( { srcAsset, srcChain, destAsset, destChain, amount } : QuoteRequest ) : Promise < QuoteResponseV2 > {
163
163
if (
164
164
srcChain === 'Ethereum' &&
165
165
srcAsset === 'ETH' &&
@@ -168,52 +168,59 @@ class SwapSDK {
168
168
amount === '10000000000000000'
169
169
) {
170
170
return {
171
- srcAsset ,
171
+ amount ,
172
172
srcChain,
173
- destAsset ,
173
+ srcAsset ,
174
174
destChain,
175
- amount,
176
- quote : {
177
- type : 'REGULAR' ,
178
- intermediateAmount : '36115119' ,
179
- egressAmount : '51193' ,
180
- includedFees : [
181
- {
182
- type : 'INGRESS' ,
183
- chain : 'Ethereum' ,
184
- asset : 'ETH' ,
185
- amount : '689176257450000' ,
186
- } ,
187
- {
188
- type : 'NETWORK' ,
189
- chain : 'Ethereum' ,
190
- asset : 'USDC' ,
191
- amount : '36115' ,
192
- } ,
193
- {
194
- type : 'NETWORK' ,
195
- chain : 'Ethereum' ,
196
- asset : 'ETH' ,
197
- amount : '4655411871275' ,
198
- } ,
199
- {
200
- type : 'NETWORK' ,
201
- chain : 'Ethereum' ,
202
- asset : 'USDC' ,
203
- amount : '18057' ,
204
- } ,
205
- {
206
- type : 'EGRESS' ,
207
- chain : 'Bitcoin' ,
208
- asset : 'BTC' ,
209
- amount : '1599' ,
210
- } ,
211
- ] ,
212
- lowLiquidityWarning : false ,
213
- estimatedDurationSeconds : 702 ,
214
- poolInfo : [ ] ,
215
- estimatedPrice : '2300' ,
216
- } ,
175
+ destAsset,
176
+ quotes : [
177
+ {
178
+ srcAsset : { chain : 'Ethereum' , asset : 'ETH' } ,
179
+ destAsset : { chain : 'Bitcoin' , asset : 'BTC' } ,
180
+ depositAmount : '1000000' ,
181
+ type : 'REGULAR' ,
182
+ intermediateAmount : '36115119' ,
183
+ estimatedDurationsSeconds : { deposit : 1800 , swap : 264 , egress : 12 } ,
184
+ egressAmount : '51193' ,
185
+ includedFees : [
186
+ {
187
+ type : 'INGRESS' ,
188
+ chain : 'Ethereum' ,
189
+ asset : 'ETH' ,
190
+ amount : '689176257450000' ,
191
+ } ,
192
+ {
193
+ type : 'NETWORK' ,
194
+ chain : 'Ethereum' ,
195
+ asset : 'USDC' ,
196
+ amount : '36115' ,
197
+ } ,
198
+ {
199
+ type : 'NETWORK' ,
200
+ chain : 'Ethereum' ,
201
+ asset : 'ETH' ,
202
+ amount : '4655411871275' ,
203
+ } ,
204
+ {
205
+ type : 'NETWORK' ,
206
+ chain : 'Ethereum' ,
207
+ asset : 'USDC' ,
208
+ amount : '18057' ,
209
+ } ,
210
+ {
211
+ type : 'EGRESS' ,
212
+ chain : 'Bitcoin' ,
213
+ asset : 'BTC' ,
214
+ amount : '1599' ,
215
+ } ,
216
+ ] ,
217
+ lowLiquidityWarning : false ,
218
+ estimatedDurationSeconds : 702 ,
219
+ recommendedSlippageTolerancePercent : 1 ,
220
+ poolInfo : [ ] ,
221
+ estimatedPrice : '2300' ,
222
+ } ,
223
+ ] ,
217
224
}
218
225
}
219
226
@@ -225,40 +232,59 @@ class SwapSDK {
225
232
amount === '20000000'
226
233
) {
227
234
return {
228
- srcAsset ,
235
+ amount ,
229
236
srcChain,
230
- destAsset ,
237
+ srcAsset ,
231
238
destChain,
232
- amount,
233
- quote : {
234
- type : 'REGULAR' ,
235
- intermediateAmount : '13560635' ,
236
- egressAmount : '2063188201000691' ,
237
- includedFees : [
238
- {
239
- type : 'INGRESS' ,
240
- chain : 'Ethereum' ,
241
- asset : 'USDT' ,
242
- amount : '6433935' ,
243
- } ,
244
- {
245
- type : 'NETWORK' ,
246
- chain : 'Ethereum' ,
247
- asset : 'USDC' ,
248
- amount : '13560' ,
249
- } ,
250
- {
251
- type : 'EGRESS' ,
252
- chain : 'Ethereum' ,
253
- asset : 'ETH' ,
254
- amount : '1447621978320000' ,
255
- } ,
256
- ] ,
257
- lowLiquidityWarning : false ,
258
- estimatedDurationSeconds : 114 ,
259
- poolInfo : [ ] ,
260
- estimatedPrice : '1' ,
261
- } ,
239
+ destAsset,
240
+ quotes : [
241
+ {
242
+ srcAsset : { chain : 'Ethereum' , asset : 'USDT' } ,
243
+ destAsset : { chain : 'Ethereum' , asset : 'ETH' } ,
244
+ depositAmount : '2000000' ,
245
+ type : 'REGULAR' ,
246
+ intermediateAmount : '36115119' ,
247
+ estimatedDurationsSeconds : { deposit : 1800 , swap : 264 , egress : 12 } ,
248
+ egressAmount : '51193' ,
249
+ includedFees : [
250
+ {
251
+ type : 'INGRESS' ,
252
+ chain : 'Ethereum' ,
253
+ asset : 'ETH' ,
254
+ amount : '689176257450000' ,
255
+ } ,
256
+ {
257
+ type : 'NETWORK' ,
258
+ chain : 'Ethereum' ,
259
+ asset : 'USDC' ,
260
+ amount : '36115' ,
261
+ } ,
262
+ {
263
+ type : 'NETWORK' ,
264
+ chain : 'Ethereum' ,
265
+ asset : 'ETH' ,
266
+ amount : '4655411871275' ,
267
+ } ,
268
+ {
269
+ type : 'NETWORK' ,
270
+ chain : 'Ethereum' ,
271
+ asset : 'USDC' ,
272
+ amount : '18057' ,
273
+ } ,
274
+ {
275
+ type : 'EGRESS' ,
276
+ chain : 'Ethereum' ,
277
+ asset : 'ETH' ,
278
+ amount : '1599' ,
279
+ } ,
280
+ ] ,
281
+ lowLiquidityWarning : false ,
282
+ estimatedDurationSeconds : 702 ,
283
+ recommendedSlippageTolerancePercent : 1 ,
284
+ poolInfo : [ ] ,
285
+ estimatedPrice : '2300' ,
286
+ } ,
287
+ ] ,
262
288
}
263
289
}
264
290
@@ -270,44 +296,51 @@ class SwapSDK {
270
296
amount === '10000000000000000'
271
297
) {
272
298
return {
273
- srcAsset ,
299
+ amount ,
274
300
srcChain,
275
- destAsset ,
301
+ srcAsset ,
276
302
destChain,
277
- amount,
278
- quote : {
279
- type : 'REGULAR' ,
280
- intermediateAmount : '33919877' ,
281
- egressAmount : '24884030' ,
282
- includedFees : [
283
- {
284
- type : 'INGRESS' ,
285
- chain : 'Ethereum' ,
286
- asset : 'ETH' ,
287
- amount : '1284811335100000' ,
288
- } ,
289
- {
290
- type : 'NETWORK' ,
291
- chain : 'Ethereum' ,
292
- asset : 'USDC' ,
293
- amount : '33919' ,
294
- } ,
295
- {
296
- type : 'EGRESS' ,
297
- chain : 'Ethereum' ,
298
- asset : 'USDT' ,
299
- amount : '8988369' ,
300
- } ,
301
- ] ,
302
- lowLiquidityWarning : false ,
303
- estimatedDurationSeconds : 114 ,
304
- poolInfo : [ ] ,
305
- estimatedPrice : '2300' ,
306
- } ,
303
+ destAsset,
304
+ quotes : [
305
+ {
306
+ srcAsset : { chain : 'Ethereum' , asset : 'ETH' } ,
307
+ destAsset : { chain : 'Ethereum' , asset : 'USDT' } ,
308
+ depositAmount : '1000000' ,
309
+ type : 'REGULAR' ,
310
+ intermediateAmount : '33919877' ,
311
+ estimatedDurationsSeconds : { deposit : 1800 , swap : 114 , egress : 12 } ,
312
+ egressAmount : '24884030' ,
313
+ includedFees : [
314
+ {
315
+ type : 'INGRESS' ,
316
+ chain : 'Ethereum' ,
317
+ asset : 'ETH' ,
318
+ amount : '1284811335100000' ,
319
+ } ,
320
+ {
321
+ type : 'NETWORK' ,
322
+ chain : 'Ethereum' ,
323
+ asset : 'USDC' ,
324
+ amount : '33919' ,
325
+ } ,
326
+ {
327
+ type : 'EGRESS' ,
328
+ chain : 'Ethereum' ,
329
+ asset : 'USDT' ,
330
+ amount : '8988369' ,
331
+ } ,
332
+ ] ,
333
+ lowLiquidityWarning : false ,
334
+ estimatedDurationSeconds : 114 ,
335
+ recommendedSlippageTolerancePercent : 1 ,
336
+ poolInfo : [ ] ,
337
+ estimatedPrice : '2300' ,
338
+ } ,
339
+ ] ,
307
340
}
308
341
}
342
+
309
343
throw Error ( 'Quote not mocked' )
310
344
}
311
345
}
312
-
313
346
export { SwapSDK , Asset , AssetData , Chains }
0 commit comments