From 9d01357de768d43efd48f21803363b89bcdfa8b5 Mon Sep 17 00:00:00 2001 From: Alex Panturu Date: Fri, 17 May 2024 12:29:46 +0300 Subject: [PATCH] wip --- .../__tests__/TransactionDetails.spec.js | 1 + .../__snapshots__/BlockDetails.spec.js.snap | 9 ++--- .../TransactionDetails.spec.js.snap | 34 ++++++++++++++++--- .../TransactionDetails.css | 4 +++ .../TransactionDetails.svelte | 28 +++++++++------ .../dusk/currency/createCurrencyFormatter.js | 2 +- .../transactions/transaction/+page.svelte | 4 +-- 7 files changed, 59 insertions(+), 23 deletions(-) diff --git a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js index 15a0d379ee..e8d7b827c1 100644 --- a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js +++ b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js @@ -14,6 +14,7 @@ const baseProps = { data: transformTransaction(apiTransaction.data[0]), error: null, loading: false, + market: { currentPrice: { usd: 1 } }, payload: "db0794770322802a22905c4364511f3186e6184085f875dbb9f11a3ae914766c020000000000000014bc23b875c67d0dbecfdd45f5964f3fea7188aff2035730c8802", }; diff --git a/explorer/src/lib/components/__tests__/__snapshots__/BlockDetails.spec.js.snap b/explorer/src/lib/components/__tests__/__snapshots__/BlockDetails.spec.js.snap index 60ab0862ff..9505115d30 100644 --- a/explorer/src/lib/components/__tests__/__snapshots__/BlockDetails.spec.js.snap +++ b/explorer/src/lib/components/__tests__/__snapshots__/BlockDetails.spec.js.snap @@ -272,8 +272,7 @@ exports[`Block Details > renders the Block Details component 1`] = `
- 5 - DUSK + 5,000,000,000
renders the Block Details component 1`] = `
- 0.000580718 - DUSK - - + 580,718 +
renders the Transaction Details component 1`] = `
- 487,166 + + 487,166 + + +
renders the Transaction Details component 1`] = `
- 0.000290766 DUSK ($0.000145383) + 0.000290766 DUSK ($0.000290766) + + +
renders the Transaction Details component 1`] = ` class="details-list__definition" > 0.000000001 DUSK ($0.000000001) + + +
renders the Transaction Details component with th
- 487,166 + + 487,166 + + +
renders the Transaction Details component with th
- 0.000290766 DUSK ($0.000145383) + 0.000290766 DUSK ($0.000290766) + + +
renders the Transaction Details component with th class="details-list__definition" > 0.000000001 DUSK ($0.000000001) + + +
block height - {formatter(data.blockheight)} + {formatter(data.blockheight)} @@ -133,17 +137,21 @@ transaction fee - {`${feeFormatter(luxToDusk(data.feepaid))} DUSK (${currencyFormatter(luxToDusk(data.feepaid) * 0.5)})`} + + + {`${feeFormatter(luxToDusk(data.feepaid))} DUSK (${currencyFormatter(luxToDusk(data.feepaid) * market.currentPrice.usd)})`} + + gas price - {`${feeFormatter(luxToDusk(data.gasprice))} DUSK (${currencyFormatter(luxToDusk(data.gasprice) * 0.5)})`} + + + {`${feeFormatter(luxToDusk(data.gasprice))} DUSK (${currencyFormatter(luxToDusk(data.gasprice) * market.currentPrice.usd)})`} + + diff --git a/explorer/src/lib/dusk/currency/createCurrencyFormatter.js b/explorer/src/lib/dusk/currency/createCurrencyFormatter.js index e2d9694a05..1caa098e6f 100644 --- a/explorer/src/lib/dusk/currency/createCurrencyFormatter.js +++ b/explorer/src/lib/dusk/currency/createCurrencyFormatter.js @@ -12,7 +12,7 @@ const createFormatter = (locale, currency, digits) => { ? new Intl.NumberFormat(locale, { minimumFractionDigits: digits }) : new Intl.NumberFormat(locale, { currency: currency, - maximumFractionDigits: 9, + maximumFractionDigits: 10, minimumFractionDigits: 2, style: "currency", }); diff --git a/explorer/src/routes/transactions/transaction/+page.svelte b/explorer/src/routes/transactions/transaction/+page.svelte index 92eb8c3595..bd7820a370 100644 --- a/explorer/src/routes/transactions/transaction/+page.svelte +++ b/explorer/src/routes/transactions/transaction/+page.svelte @@ -14,14 +14,14 @@ const getTransaction = () => { dataStore.getData($appStore.network, $page.url.searchParams.get("id")); payloadStore.getData($appStore.network, $page.url.searchParams.get("id")); - marketStore.getData(); + marketStore.getData($appStore.network); }; onNetworkChange(getTransaction); $: ({ data, error, isLoading } = $dataStore); $: ({ data: payloadData } = $payloadStore); - $: ({ data: marketData} = $marketData); + $: ({ data: marketData } = $marketStore); onMount(() => { getTransaction();