Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: MarketCurrency in Transak #2049

Merged
merged 2 commits into from
Mar 2, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions packages/desktop/lib/electron/managers/transak.manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 }) => {
Expand Down Expand Up @@ -166,7 +171,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')
}

Expand Down
Loading