Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
deuch13 committed May 17, 2024
1 parent 1d45ab7 commit 9d01357
Show file tree
Hide file tree
Showing 7 changed files with 59 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const baseProps = {
data: transformTransaction(apiTransaction.data[0]),
error: null,
loading: false,
market: { currentPrice: { usd: 1 } },
payload:
"db0794770322802a22905c4364511f3186e6184085f875dbb9f11a3ae914766c020000000000000014bc23b875c67d0dbecfdd45f5964f3fea7188aff2035730c8802",
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,7 @@ exports[`Block Details > renders the Block Details component 1`] = `
<dd
class="details-list__definition"
>
5
DUSK
5,000,000,000
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -301,10 +300,8 @@ exports[`Block Details > renders the Block Details component 1`] = `
<dd
class="details-list__definition"
>
0.000580718
DUSK
580,718
<div
class="dusk-progress-bar block-details__gas-used"
role="progressbar"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,14 @@ exports[`Transaction Details > renders the Transaction Details component 1`] = `
<dd
class="details-list__definition"
>
487,166
<a
class="dusk-anchor transaction-details__list-anchor"
href="/some-base-path/blocks/block?id=3c6e4018cfa86723e50644e33d3990bc27fc794f6b49fbf6290e4d308e07bd2d"
>
487,166
</a>
<!--&lt;Anchor&gt;-->
<!--&lt;AppAnchor&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -215,7 +222,10 @@ exports[`Transaction Details > renders the Transaction Details component 1`] = `
<dd
class="details-list__definition"
>
0.000290766 DUSK ($0.000145383)
0.000290766 DUSK ($0.000290766)
<!--&lt;DataGuard&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -244,6 +254,9 @@ exports[`Transaction Details > renders the Transaction Details component 1`] = `
class="details-list__definition"
>
0.000000001 DUSK ($0.000000001)
<!--&lt;DataGuard&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -437,7 +450,14 @@ exports[`Transaction Details > renders the Transaction Details component with th
<dd
class="details-list__definition"
>
487,166
<a
class="dusk-anchor transaction-details__list-anchor"
href="/some-base-path/blocks/block?id=3c6e4018cfa86723e50644e33d3990bc27fc794f6b49fbf6290e4d308e07bd2d"
>
487,166
</a>
<!--&lt;Anchor&gt;-->
<!--&lt;AppAnchor&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -568,7 +588,10 @@ exports[`Transaction Details > renders the Transaction Details component with th
<dd
class="details-list__definition"
>
0.000290766 DUSK ($0.000145383)
0.000290766 DUSK ($0.000290766)
<!--&lt;DataGuard&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down Expand Up @@ -597,6 +620,9 @@ exports[`Transaction Details > renders the Transaction Details component with th
class="details-list__definition"
>
0.000000001 DUSK ($0.000000001)
<!--&lt;DataGuard&gt;-->
</dd>
<!--&lt;ListItem&gt;-->
<dt
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@
width: 100%;
}

.transaction-details__list-anchor {
text-decoration: none;
}

.transaction-details__list-timestamp {
text-transform: uppercase;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@
/** @type {String | null} */
export let payload;
/** @type {DataStoreContent}*/
/** @type {*}*/
export let market;
const formatter = createValueFormatter("en");
const currencyFormatter = createCurrencyFormatter("en", "usd", 9);
const currencyFormatter = createCurrencyFormatter("en", "usd", 10);
const feeFormatter = createFeeFormatter("en");
/** @type {number} */
Expand Down Expand Up @@ -89,8 +89,12 @@
<!-- BLOCK HEIGHT -->
<ListItem tooltipText="The block height this transaction belongs to">
<svelte:fragment slot="term">block height</svelte:fragment>
<svelte:fragment slot="definition"
>{formatter(data.blockheight)}</svelte:fragment
<svelte:fragment slot="definition">
<AppAnchor
className="transaction-details__list-anchor"
href="/blocks/block?id={data.blockhash}"
>{formatter(data.blockheight)}</AppAnchor
></svelte:fragment
>
</ListItem>

Expand Down Expand Up @@ -133,17 +137,21 @@
<!-- TRANSACTION FEE -->
<ListItem tooltipText="The fee paid for the transaction">
<svelte:fragment slot="term">transaction fee</svelte:fragment>
<svelte:fragment slot="definition"
>{`${feeFormatter(luxToDusk(data.feepaid))} DUSK (${currencyFormatter(luxToDusk(data.feepaid) * 0.5)})`}</svelte:fragment
>
<svelte:fragment slot="definition">
<DataGuard data={market?.currentPrice.usd}>
{`${feeFormatter(luxToDusk(data.feepaid))} DUSK (${currencyFormatter(luxToDusk(data.feepaid) * market.currentPrice.usd)})`}
</DataGuard>
</svelte:fragment>
</ListItem>

<!-- GAS PRICE -->
<ListItem tooltipText="The transaction gas price">
<svelte:fragment slot="term">gas price</svelte:fragment>
<svelte:fragment slot="definition"
>{`${feeFormatter(luxToDusk(data.gasprice))} DUSK (${currencyFormatter(luxToDusk(data.gasprice) * 0.5)})`}</svelte:fragment
>
<svelte:fragment slot="definition">
<DataGuard data={market?.currentPrice.usd}>
{`${feeFormatter(luxToDusk(data.gasprice))} DUSK (${currencyFormatter(luxToDusk(data.gasprice) * market.currentPrice.usd)})`}
</DataGuard>
</svelte:fragment>
</ListItem>

<!-- GAS LIMIT -->
Expand Down
2 changes: 1 addition & 1 deletion explorer/src/lib/dusk/currency/createCurrencyFormatter.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
});
Expand Down
4 changes: 2 additions & 2 deletions explorer/src/routes/transactions/transaction/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 9d01357

Please sign in to comment.