From bc0b1a831b9f5e8b3b65c58b807d7af854ff7048 Mon Sep 17 00:00:00 2001 From: lserra-iov Date: Thu, 7 Nov 2024 14:56:02 -0300 Subject: [PATCH] Remove warnings --- src/pegin/store/FlyoverPegin/actions.ts | 18 ++++++------------ src/pegout/store/FlyoverPegout/actions.ts | 18 ++++++------------ tests/unit/common/PeginQuote.spec.ts | 6 ++++-- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/src/pegin/store/FlyoverPegin/actions.ts b/src/pegin/store/FlyoverPegin/actions.ts index 824df8f7..08e58f7a 100644 --- a/src/pegin/store/FlyoverPegin/actions.ts +++ b/src/pegin/store/FlyoverPegin/actions.ts @@ -31,13 +31,10 @@ export const actions: ActionTree = { result = constants.FlyoverCallResult.SUCCESS; resolve(commit(constants.FLYOVER_PEGIN_SET_PROVIDERS, providers)); } catch (e) { - reject(); + reject(new Error('Error getting liquidity providers')); } finally { - try { - await ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall); - } catch (e) { - console.error(`Error registering flyover ${flyoverCallPayload.functionType} call: ${e}`); - } + ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall) + .catch(() => null); } })(); }), @@ -84,13 +81,10 @@ export const actions: ActionTree = { result = constants.FlyoverCallResult.SUCCESS; resolve(commit(constants.FLYOVER_PEGIN_SET_QUOTES, quotesByProvider)); } catch (e) { - reject(e); + reject(new Error('Error getting quotes')); } finally { - try { - await ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall); - } catch (e) { - console.error(`Error registering flyover ${flyoverCallPayload.functionType} call: ${e}`); - } + ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall) + .catch(() => null); } })(); }), diff --git a/src/pegout/store/FlyoverPegout/actions.ts b/src/pegout/store/FlyoverPegout/actions.ts index 32a870aa..830f6593 100644 --- a/src/pegout/store/FlyoverPegout/actions.ts +++ b/src/pegout/store/FlyoverPegout/actions.ts @@ -34,13 +34,10 @@ export const actions: ActionTree = { result = constants.FlyoverCallResult.SUCCESS; resolve(commit(constants.FLYOVER_PEGOUT_SET_PROVIDERS, providers)); } catch (e) { - reject(); + reject(new Error('Error getting providers')); } finally { - try { - await ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall); - } catch (e) { - console.error(`Error registering flyover ${flyoverCallPayload.functionType} call: ${e}`); - } + ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall) + .catch(() => null); } })(); }), @@ -92,13 +89,10 @@ export const actions: ActionTree = { commit(constants.FLYOVER_PEGOUT_SET_QUOTES, quotesByProvider); resolve(); } catch (e) { - reject(); + reject(new Error('Error getting quotes')); } finally { - try { - await ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall); - } catch (e) { - console.error(`Error registering flyover ${flyoverCallPayload.functionType} call: ${e}`); - } + ApiService.registerFlyoverCall({ ...flyoverCallPayload, result } as FlyoverCall) + .catch(() => null); } })(); }); diff --git a/tests/unit/common/PeginQuote.spec.ts b/tests/unit/common/PeginQuote.spec.ts index 7887df19..eb9564b1 100644 --- a/tests/unit/common/PeginQuote.spec.ts +++ b/tests/unit/common/PeginQuote.spec.ts @@ -67,12 +67,14 @@ describe('PeginQuote', () => { it('should calculate totalQuoteFee correctly', () => { const btcNetworkFee = new SatoshiBig(100000000, 'satoshi'); const expectedTotalQuoteFee = peginQuote.providerFee.plus(btcNetworkFee); - expect(peginQuote.getTotalQuoteFee(btcNetworkFee).toString()).toEqual(expectedTotalQuoteFee.toString()); + expect(peginQuote.getTotalQuoteFee(btcNetworkFee).toString()) + .toEqual(expectedTotalQuoteFee.toString()); }); it('should calculate totalTxAmount correctly', () => { const btcNetworkFee = new SatoshiBig(100000000, 'satoshi'); const expectedTotalTxAmount = peginQuote.valueToTransfer.plus(btcNetworkFee); - expect(peginQuote.getTotalTxAmount(btcNetworkFee).toString()).toEqual(expectedTotalTxAmount.toString()); + expect(peginQuote.getTotalTxAmount(btcNetworkFee).toString()) + .toEqual(expectedTotalTxAmount.toString()); }); });