Skip to content

Commit

Permalink
fix(ui-ux): fix displayed amount in transaction list (#342)
Browse files Browse the repository at this point in the history
* fix(ui-ux): fix displayed amount in transaction list

* remove resolved todos
  • Loading branch information
lykalabrada authored Nov 1, 2023
1 parent c930a44 commit b87cd3b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/pages/block/[id].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -153,14 +153,14 @@ export default function Block({
GWEI_DECIMAL
).toString()}
decimalScale={9}
suffix=" Gwei" // TODO: Confirm if this is Gwei, DFI or ETH
suffix=" Gwei"
/>
<DetailRow
testId="burnt-fee"
label="Burnt fee"
value={formatEther(BigInt(block.burnt_fees ?? "0"))}
decimalScale={10}
suffix=" DFI" // TODO: Confirm if this is DFI or ETH
suffix=" DFI"
/>
<DetailRow
testId="gas-limit"
Expand Down
13 changes: 1 addition & 12 deletions src/shared/transactionDataHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,6 @@ import { getTimeAgo } from "./durationHelper";
* @returns formatted tx data
*/
export const transformTransactionData = (tx: RawTransactionI): TransactionI => {
// TODO: Revisit the amount/value format once actual tx data is available
const amountIndex = tx.decoded_input?.parameters?.findIndex(
(p) => p.name === "amount"
);
let dfiAmount = "0";
if (amountIndex && amountIndex > -1) {
dfiAmount = formatEther(
BigInt((tx.decoded_input?.parameters[amountIndex].value as string) ?? "0")
);
}

const fromHash = tx.from.hash ?? BURN_ADDRESS_HASH;
const toHash = tx.to?.hash ?? tx.created_contract?.hash ?? BURN_ADDRESS_HASH;
const isFromContract = tx.from.is_contract;
Expand All @@ -53,7 +42,7 @@ export const transformTransactionData = (tx: RawTransactionI): TransactionI => {
transactionType,
type: tx.type,
hash: tx.hash,
amount: dfiAmount,
amount: formatEther(BigInt(tx.value ?? "0")),
symbol: DFI_TOKEN_SYMBOL, // TODO: Revisit tx symbol
from: fromHash,
to: toHash,
Expand Down

0 comments on commit b87cd3b

Please sign in to comment.