feat: format eth in value (#21)

This commit is contained in:
Dhairya Sethi
2024-04-25 12:15:36 +05:30
committed by GitHub
parent 557370042a
commit 597fc00ac9

View File

@@ -26,6 +26,7 @@ import {
import CopyToClipboard from "./CopyToClipboard";
import { TxnDataType } from "../../types";
import { useEffect } from "react";
import { ethers } from "ethers";
export const slicedText = (txt: string) => {
return txt.length > 6
@@ -43,6 +44,16 @@ const TD = ({ txt }: { txt: string }) => (
</HStack>
</Td>
);
const ValueTD = ({ txt }: { txt: string }) => (
<Td>
<HStack>
<Tooltip label={`${txt} Wei`} hasArrow placement="top">
<Text>{ethers.utils.formatEther(txt)} ETH</Text>
</Tooltip>
<CopyToClipboard txt={txt} />
</HStack>
</Td>
);
const TData = ({
calldata,
@@ -151,7 +162,7 @@ function TransactionRequests({
<TD txt={d.from} />
<TD txt={d.to} />
<TData calldata={d.data} address={d.to} networkId={networkId} />
<TD txt={d.value} />
<ValueTD txt={d.value} />
</Tr>
))}
</Tbody>