diff --git a/packages/desktop/features/buy-sell.features.ts b/packages/desktop/features/buy-sell.features.ts index 07735ed62c..8d2e1c259f 100644 --- a/packages/desktop/features/buy-sell.features.ts +++ b/packages/desktop/features/buy-sell.features.ts @@ -2,6 +2,9 @@ import { IFeatureFlag } from '@lib/features/interfaces' const buySellFeatures: IFeatureFlag = { enabled: true, + sell: { + enabled: false, + }, } export default buySellFeatures diff --git a/packages/desktop/lib/electron/managers/transak.manager.ts b/packages/desktop/lib/electron/managers/transak.manager.ts index 8bd5498e19..fc0373bff5 100644 --- a/packages/desktop/lib/electron/managers/transak.manager.ts +++ b/packages/desktop/lib/electron/managers/transak.manager.ts @@ -219,14 +219,14 @@ export default class TransakManager implements ITransakManager { } private getUrl(data: ITransakWindowData): string { - const { address, currency, service, amount } = data + const { address, currency, service, amount, paymentMethod } = data const apiKey = process.env.TRANSAK_API_KEY if (typeof apiKey !== 'string') { throw new Error('Undefined Transak API key') } - if (!Object.values(FiatCurrency).includes(currency as FiatCurrency)) { + if (!Object.keys(FiatCurrency).includes(currency)) { throw new Error('Invalid Transak currency') } @@ -243,9 +243,10 @@ export default class TransakManager implements ITransakManager { const queryParams: QueryParameters = { apiKey, - defaultFiatCurrency: currency, - defaultFiatAmount: amount, + fiatCurrency: currency, + fiatAmount: amount, walletAddress: address, + paymentMethod: paymentMethod, productsAvailed: service, cryptoCurrencyCode: 'IOTA', network: 'miota', @@ -256,6 +257,7 @@ export default class TransakManager implements ITransakManager { disablePaymentMethods: ['apple_pay', 'google_pay'], excludeFiatCurrencies: 'USD', colorMode, + hideExchangeScreen: true, } const urlObject = buildUrl({ base: TRANSAK_WIDGET_URL, query: queryParams }) diff --git a/packages/desktop/views/dashboard/buy-sell/BuySell.svelte b/packages/desktop/views/dashboard/buy-sell/BuySell.svelte index d3185a10b6..ac7e6c7e5c 100644 --- a/packages/desktop/views/dashboard/buy-sell/BuySell.svelte +++ b/packages/desktop/views/dashboard/buy-sell/BuySell.svelte @@ -3,10 +3,16 @@ import features from '@features/features' import { BuySellMainView } from './views' import { dashboardRoute, DashboardRoute } from '@core/router' + import { onMount } from 'svelte' + import { updateTransakFiatCurrencies } from '@auxiliary/transak' $: if (features.analytics.dashboardRoute.buySell.enabled && $dashboardRoute === DashboardRoute.BuySell) { Platform.trackEvent('buy-sell-route', { route: $dashboardRoute }) } + + onMount(() => { + void updateTransakFiatCurrencies() + })
diff --git a/packages/desktop/views/dashboard/buy-sell/components/TokenTile.svelte b/packages/desktop/views/dashboard/buy-sell/components/TokenTile.svelte new file mode 100644 index 0000000000..ee3336b5a2 --- /dev/null +++ b/packages/desktop/views/dashboard/buy-sell/components/TokenTile.svelte @@ -0,0 +1,50 @@ + + +{#if token && token.metadata} + +
+ +
+
+ + {token.metadata.name + ? truncateString(token.metadata.name, 13, 0) + : truncateString(token.id, 6, 7)} + + + {token.metadata + ? `≈ ${formatTokenAmount(tokenAmount ?? BigInt(0), token.metadata, { round: false })}` + : '-'} + +
+
+ + {marketPrice ? formatCurrency(marketPrice, currency) : '-'} + + + {fiatValue !== undefined ? formatCurrency(fiatValue ?? '', currency) : '-'} + +
+
+
+
+{/if} diff --git a/packages/desktop/views/dashboard/buy-sell/components/TransakAccountPanel.svelte b/packages/desktop/views/dashboard/buy-sell/components/TransakAccountPanel.svelte deleted file mode 100644 index e4a16a29cb..0000000000 --- a/packages/desktop/views/dashboard/buy-sell/components/TransakAccountPanel.svelte +++ /dev/null @@ -1,49 +0,0 @@ - - - -
-
- - - - IOTA -
- -
-
- - {fiatBalance} -
- -
- - {$selectedAccount?.depositAddress} - -
-
-
diff --git a/packages/desktop/views/dashboard/buy-sell/components/TransakAmountInput.svelte b/packages/desktop/views/dashboard/buy-sell/components/TransakAmountInput.svelte new file mode 100644 index 0000000000..61e8ab3c1d --- /dev/null +++ b/packages/desktop/views/dashboard/buy-sell/components/TransakAmountInput.svelte @@ -0,0 +1,26 @@ + + +
+ + {currency} +
diff --git a/packages/desktop/views/dashboard/buy-sell/components/TransakExchangePanel.svelte b/packages/desktop/views/dashboard/buy-sell/components/TransakExchangePanel.svelte new file mode 100644 index 0000000000..c414ddf300 --- /dev/null +++ b/packages/desktop/views/dashboard/buy-sell/components/TransakExchangePanel.svelte @@ -0,0 +1,198 @@ + + + + +
+ + {#if error} +
+ + {localize('views.buySell.error.title')} + {localize('views.buySell.error.description')} +
+ {:else} +
+ {#if isFeatureEnabled('buySell.sell')} +
+ +
+ {/if} +
+
+ +
+ + +
+ +
+
+
+ {/if} +
+
diff --git a/packages/desktop/views/dashboard/buy-sell/components/TransakWindowPlaceholder.svelte b/packages/desktop/views/dashboard/buy-sell/components/TransakWindowPlaceholder.svelte deleted file mode 100644 index 1abbf927dd..0000000000 --- a/packages/desktop/views/dashboard/buy-sell/components/TransakWindowPlaceholder.svelte +++ /dev/null @@ -1,30 +0,0 @@ - - - - {#if error} - - {localize('views.buySell.error.title')} - {localize('views.buySell.error.description')} -