diff --git a/src/modules/generic-details/index.ts b/src/modules/generic-details/index.ts index 3ec66cd..8e89234 100644 --- a/src/modules/generic-details/index.ts +++ b/src/modules/generic-details/index.ts @@ -25,38 +25,21 @@ type ServerReturnType = { >; }; -type ReturnType = R extends 'pool' - ? Pick< - SkybridgeParams, - | 'addressDeposit' - | 'addressReceiving' - | 'amountDeposit' - | 'amountReceiving' - | 'currencyDeposit' - | 'currencyReceiving' - | 'hash' - | 'status' - | 'timestamp' - > & { - txDepositId: SkybridgeParams['txDepositId'] | null; - } - : Pick< - SkybridgeParams, - | 'addressDeposit' - | 'addressReceiving' - | 'amountDeposit' - | 'amountReceiving' - | 'currencyDeposit' - | 'currencyReceiving' - | 'feeTotal' - | 'feeCurrency' - | 'hash' - | 'status' - | 'timestamp' - > & { - txDepositId: SkybridgeParams['txDepositId'] | null; - txReceivingId: SkybridgeParams['txReceivingId'] | null; - }; +type ReturnType = Pick< + SkybridgeParams, + | 'addressDeposit' + | 'addressReceiving' + | 'amountDeposit' + | 'amountReceiving' + | 'currencyDeposit' + | 'currencyReceiving' + | 'hash' + | 'status' + | 'timestamp' +> & { + txDepositId: SkybridgeParams['txDepositId'] | null; + txReceivingId: SkybridgeParams['txReceivingId'] | null; +} & (R extends 'pool' ? {} : Pick, 'feeTotal' | 'feeCurrency'>); const bridgeCache = new Map(); @@ -125,7 +108,17 @@ export const getDetails = async ; + } as unknown) as ReturnType; }; diff --git a/src/modules/pool/getFloatDetails/index.test.ts b/src/modules/pool/getFloatDetails/index.test.ts index d3c68ce..d631bab 100644 --- a/src/modules/pool/getFloatDetails/index.test.ts +++ b/src/modules/pool/getFloatDetails/index.test.ts @@ -6,7 +6,7 @@ import { getFloatDetails } from './'; jest.mock('../../context/buildContext'); it.each, 'hash'>>([ - { hash: 'dniUX39yLjKMPixHawxeyreUYpgaDafFlpP1YN4BK_o=' }, + { hash: 'bWRloGO3ah3p9jJ_MKNZLF6x3Nr4rgp0fh0D5RIYo5E=' }, ])('gets float details for %O', async ({ hash }) => { expect.assertions(1); @@ -14,18 +14,16 @@ it.each, 'hash'>>([ const result = await getFloatDetails({ context, hash }); return expect(result).toMatchObject({ - addressReceiving: '0x3F4341a0599f63F444B6f1e0c7C5cAf81b5843Cc', + addressReceiving: '0x3f4341a0599f63f444b6f1e0c7c5caf81b5843cc', addressDeposit: 'msEKP7ZSma3rQtWSQBBZCiJAvjAaowf2c6', - amountDeposit: '0.00099747', - amountReceiving: null, + amountDeposit: '0.00099019', + amountReceiving: '0.00099019', currencyDeposit: 'BTC', currencyReceiving: 'sbBTC', - feeCurrency: null, - feeTotal: null, hash, status: 'COMPLETED', - txDepositId: 'd5680247e9a7a1b2551831ec3b4b942970041448d02999a2af8cdd49473681f3', + txDepositId: '1bca4204aed84e083e7f0207b0018e844b8087c5d45158568643c79df268f4ef', txReceivingId: null, - timestamp: new Date('2020-12-21T09:00:07.000Z'), + timestamp: new Date('2020-12-22T15:51:17.000Z'), }); }); diff --git a/src/modules/swap/getSwapDetails/index.test.ts b/src/modules/swap/getSwapDetails/index.test.ts index 016ddf9..08c1509 100644 --- a/src/modules/swap/getSwapDetails/index.test.ts +++ b/src/modules/swap/getSwapDetails/index.test.ts @@ -6,7 +6,7 @@ import { getSwapDetails } from './'; jest.mock('../../context/buildContext'); it.each, 'hash'>>([ - { hash: 'D6ffXDodsQevLWS0EX_Od4i120TNvbAdCRAjAouKDXg=' }, + { hash: 'sQmT1Q1RROVwVLxs2wJWa5ZVa49zFIBr-9jC_wJsyqM=' }, ])('gets swaps details for %O', async ({ hash }) => { expect.assertions(1); @@ -14,24 +14,24 @@ it.each, 'hash'>>([ const result = await getSwapDetails({ context, hash }); return expect(result).toMatchObject({ - addressReceiving: 'tb1q8hk7wlqgtvdrvtmjll4xtxkpjdf5svtcgmacep', + addressReceiving: '0x3f4341a0599f63f444b6f1e0c7c5caf81b5843cc', addressDeposit: 'msEKP7ZSma3rQtWSQBBZCiJAvjAaowf2c6', - amountDeposit: '0.00099717', - amountReceiving: '0.00074517', + amountDeposit: '0.00099289', + amountReceiving: '0.0007409', currencyDeposit: 'BTC', - currencyReceiving: 'BTC', - feeCurrency: 'BTC', - feeTotal: '0.000252', + currencyReceiving: 'WBTC', + feeCurrency: 'WBTC', + feeTotal: '0.00025199', hash, - status: 'REFUNDED', - txDepositId: 'b025316d9f6f4c1b111f525988ebcdc2ad67a798c0b276ffb9be7e48e8ba814b', - txReceivingId: 'd0b7fae62c5c5ef281fd021eac9da9dbd6340324d642cddb5e76fbc61a995a9a', - timestamp: new Date('2020-12-21T08:31:56.000Z'), + status: 'COMPLETED', + txDepositId: 'e474cb45766526d71a08ad3e31efecb27d4bc17cfed93a9bc864102a4ce6f831', + txReceivingId: '0x18140256bab379b282a152d93effd8ace0301bbefb48d3cd41e8a0d51daab79f', + timestamp: new Date('2020-12-22T15:48:48.000Z'), }); }); it.each, 'hash'>>([ - { hash: 'wV5XmpgMgU9T9S-3wiaaYJN32RV9bNpLGB7XM78khj8=' }, + { hash: 't2CaqiS60g0wEyGXgrYi4nwKWw8F7dJRNQPAceWVx8I=' }, ])('throws for withdrawal %O', async ({ hash }) => { expect.assertions(1); diff --git a/src/modules/withdrawal/getWithdrawalDetails/index.test.ts b/src/modules/withdrawal/getWithdrawalDetails/index.test.ts index aa65385..6724dd8 100644 --- a/src/modules/withdrawal/getWithdrawalDetails/index.test.ts +++ b/src/modules/withdrawal/getWithdrawalDetails/index.test.ts @@ -6,7 +6,7 @@ import { getWithdrawalDetails } from './'; jest.mock('../../context/buildContext'); it.each, 'hash'>>([ - { hash: 'wV5XmpgMgU9T9S-3wiaaYJN32RV9bNpLGB7XM78khj8=' }, + { hash: 't2CaqiS60g0wEyGXgrYi4nwKWw8F7dJRNQPAceWVx8I=' }, ])('gets withdrawal details for %O', async ({ hash }) => { expect.assertions(1); @@ -15,23 +15,23 @@ it.each, 'hash'>>([ return expect(result).toMatchObject({ addressReceiving: '0x3f4341a0599f63f444b6f1e0c7c5caf81b5843cc', - addressDeposit: '0xe06ff2b69b822807b8ac14479ff4386fe051e242', - amountDeposit: '0.00098766', - amountReceiving: '0.00073568', + addressDeposit: '0xF963E81109186B933F1bA674beC7A74186C20740', + amountDeposit: '0.00098851', + amountReceiving: '0.00073653', currencyDeposit: 'sbBTC', currencyReceiving: 'WBTC', feeCurrency: 'WBTC', feeTotal: '0.00025198', hash, - status: 'SENDING', - txDepositId: '0x207cb67ff5aa3e435444dd6ffb900232ed2e5abb94c90b4a4b3d7d8e4e5787ce', + status: 'COMPLETED', + txDepositId: '0xa772b0ec48c436f82739e69ed624f8f5427afac6bbaa70361a67490340b762fc', txReceivingId: null, - timestamp: new Date('2020-12-21T14:13:48.000Z'), + timestamp: new Date('2020-12-22T16:26:08.000Z'), }); }); it.each, 'hash'>>([ - { hash: 'D6ffXDodsQevLWS0EX_Od4i120TNvbAdCRAjAouKDXg=' }, + { hash: 'sQmT1Q1RROVwVLxs2wJWa5ZVa49zFIBr-9jC_wJsyqM=' }, ])('throws for normal swap %O', async ({ hash }) => { expect.assertions(1);