From 98cfc88011863e50d57d23ba6ee928300d99d3c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rube=CC=81n?= Date: Mon, 29 Mar 2021 11:21:09 +0200 Subject: [PATCH] feat: Added `addressSending` property to swap and float details --- src/modules/common-params/index.ts | 2 ++ src/modules/generic-details/index.ts | 2 ++ .../getMinimumWithdrawal/index.test.ts | 17 ++++++++++------- 3 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/modules/common-params/index.ts b/src/modules/common-params/index.ts index 9189b32..e026012 100644 --- a/src/modules/common-params/index.ts +++ b/src/modules/common-params/index.ts @@ -25,6 +25,8 @@ export type SkybridgeParams< hash: string; /** Address where the user will receive their funds after the swap. */ addressReceiving: string; + /** Address where the user sends funds from to start a swap. */ + addressSending: string | null; /** Address that users have to send funds to to initiate a swap. */ addressDeposit: string; /** Amount that users type in the UI. */ diff --git a/src/modules/generic-details/index.ts b/src/modules/generic-details/index.ts index fa9d372..bbd90cf 100644 --- a/src/modules/generic-details/index.ts +++ b/src/modules/generic-details/index.ts @@ -38,6 +38,7 @@ type ReturnType = Pick< | 'timestamp' | 'feeTotal' | 'feeCurrency' + | 'addressSending' > & { txDepositId: SkybridgeParams['txDepositId'] | null; txReceivingId: SkybridgeParams['txReceivingId'] | null; @@ -109,6 +110,7 @@ export const getDetails = async , 'amountDesired' | 'currencyReceiving'> & { bridge: SkybridgeBridge; }, - { minimumWithdrawal: string; minimumWithdrawalCurrency: SkybridgeCoin }, + { minimumWithdrawalCurrency: SkybridgeCoin }, ] >([ [ { bridge: 'btc_erc', amountDesired: '0', currencyReceiving: 'BTC' }, - { minimumWithdrawal: '0.0003006', minimumWithdrawalCurrency: 'BTC' }, + { minimumWithdrawalCurrency: 'BTC' }, ], [ { bridge: 'btc_erc', amountDesired: '0', currencyReceiving: 'WBTC' }, - { minimumWithdrawal: '0.0001503', minimumWithdrawalCurrency: 'WBTC' }, + { minimumWithdrawalCurrency: 'WBTC' }, ], [ { bridge: 'btc_erc', amountDesired: '200', currencyReceiving: 'WBTC' }, - { minimumWithdrawal: '0.0001503', minimumWithdrawalCurrency: 'WBTC' }, + { minimumWithdrawalCurrency: 'WBTC' }, ], [ { bridge: 'btc_bep20', amountDesired: '200', currencyReceiving: 'BTCB.BEP20' }, - { minimumWithdrawal: '0.00001503', minimumWithdrawalCurrency: 'BTCB.BEP20' }, + { minimumWithdrawalCurrency: 'BTCB.BEP20' }, ], [ { bridge: 'btc_bep20', amountDesired: '200', currencyReceiving: 'BTC' }, - { minimumWithdrawal: '0.0002004', minimumWithdrawalCurrency: 'BTC' }, + { minimumWithdrawalCurrency: 'BTC' }, ], ])( 'gets minimum withdrawal for %O', @@ -48,6 +48,9 @@ it.each< currencyReceiving, }); - return expect(result).toMatchObject(expected); + return expect(result).toMatchObject({ + ...expected, + minimumWithdrawal: expect.stringMatching(/\d+(\.\d+)?/), + }); }, );