Skip to content

Commit

Permalink
feat: format eth in value (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
DhairyaSethi authored Apr 25, 2024
1 parent 5573700 commit 597fc00
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/components/Body/TransactionRequests.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit 597fc00

Please sign in to comment.