From 39fdd3f9d40ea8c13ccb542986e3f8330551f665 Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Fri, 1 Mar 2024 13:42:47 -0300 Subject: [PATCH 1/2] fix: MarketCurrency in Transak --- packages/desktop/lib/electron/managers/transak.manager.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/desktop/lib/electron/managers/transak.manager.ts b/packages/desktop/lib/electron/managers/transak.manager.ts index 3437873b63..2b5a407ada 100644 --- a/packages/desktop/lib/electron/managers/transak.manager.ts +++ b/packages/desktop/lib/electron/managers/transak.manager.ts @@ -5,7 +5,7 @@ import { ITransakManager, ITransakWindowData } from '@core/app' import path from 'path' import { TRANSAK_WIDGET_URL } from '@auxiliary/transak/constants' import { buildQueryParametersFromObject } from '@core/utils/url' -import { Currency } from '@core/utils/enums' +import { MarketCurrency } from '@core/market/enums/market-currency.enum' export default class TransakManager implements ITransakManager { private rect: Electron.Rectangle @@ -166,7 +166,7 @@ export default class TransakManager implements ITransakManager { const { address, currency, service } = data const apiKey = process.env.TRANSAK_API_KEY - if (Object.values(Currency).includes(currency as Currency)) { + if (Object.values(MarketCurrency).includes(currency as MarketCurrency)) { throw new Error('Invalid Transak currency') } From f83d217b965a374d85ab7570f1ff772f85e862c3 Mon Sep 17 00:00:00 2001 From: Jean Ribeiro Date: Fri, 1 Mar 2024 13:44:29 -0300 Subject: [PATCH 2/2] fix: adds try/catch block for URL --- packages/desktop/lib/electron/managers/transak.manager.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packages/desktop/lib/electron/managers/transak.manager.ts b/packages/desktop/lib/electron/managers/transak.manager.ts index 2b5a407ada..3e54ffa1a3 100644 --- a/packages/desktop/lib/electron/managers/transak.manager.ts +++ b/packages/desktop/lib/electron/managers/transak.manager.ts @@ -84,7 +84,12 @@ export default class TransakManager implements ITransakManager { } }) - const initialUrl = this.getUrl(data) + let initialUrl: string + try { + initialUrl = this.getUrl(data) + } catch (err) { + console.error(err) + } void windows.transak.loadURL(initialUrl) windows.transak.webContents.setWindowOpenHandler(({ url }) => {