From cff62080b411961fa544cfca8726c4bbaafbce0c Mon Sep 17 00:00:00 2001 From: Alex Panturu Date: Fri, 17 May 2024 11:34:21 +0300 Subject: [PATCH] explorer: fix currency types --- .../__tests__/TransactionDetails.spec.js | 6 ++- .../__snapshots__/BlockDetails.spec.js.snap | 9 ++--- .../TransactionDetails.spec.js.snap | 38 ++++++++++++++++--- .../block-details/BlockDetails.svelte | 4 +- .../TransactionDetails.css | 4 ++ .../TransactionDetails.svelte | 31 ++++++++++----- .../dusk/currency/createCurrencyFormatter.js | 2 +- .../transactions/transaction/+page.svelte | 4 ++ 8 files changed, 72 insertions(+), 26 deletions(-) diff --git a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js index 15a0d379ee..652f110763 100644 --- a/explorer/src/lib/components/__tests__/TransactionDetails.spec.js +++ b/explorer/src/lib/components/__tests__/TransactionDetails.spec.js @@ -1,6 +1,6 @@ import { afterAll, afterEach, describe, expect, it, vi } from "vitest"; import { cleanup, fireEvent, render } from "@testing-library/svelte"; -import { apiTransaction } from "$lib/mock-data"; +import { apiMarketData, apiTransaction } from "$lib/mock-data"; import { transformTransaction } from "$lib/chain-info"; import { TransactionDetails } from "../"; @@ -14,6 +14,10 @@ const baseProps = { data: transformTransaction(apiTransaction.data[0]), error: null, loading: false, + market: { + currentPrice: apiMarketData.market_data.current_price, + marketCap: apiMarketData.market_data.market_cap, + }, 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 c4c919f1fb..1c5ae8ea67 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.0001071037) + + +
renders the Transaction Details component 1`] = `
- 0.000000001 DUSK ($0.000000001) + 0.000000001 DUSK ($0.0000000004) + + +
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.0001071037) + + +
renders the Transaction Details component with th
- 0.000000001 DUSK ($0.000000001) + 0.000000001 DUSK ($0.0000000004) + + +
block gas limit {formatter(luxToDusk(data.transactions.stats.gasLimit))} DUSK{formatter(data.transactions.stats.gasLimit)} @@ -145,7 +145,7 @@ gas used - {formatter(luxToDusk(data.transactions.stats.gasUsed))} DUSK + {formatter(data.transactions.stats.gasUsed)}