diff --git a/src/components/InternalSelfDestruct.tsx b/src/components/InternalSelfDestruct.tsx index 862eac8..bc8eba8 100644 --- a/src/components/InternalSelfDestruct.tsx +++ b/src/components/InternalSelfDestruct.tsx @@ -1,15 +1,15 @@ -import React from "react"; +import React, { useContext } from "react"; import { ethers } from "ethers"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faAngleRight, - faBomb, - faCoins, -} from "@fortawesome/free-solid-svg-icons"; +import { faAngleRight, faBomb } from "@fortawesome/free-solid-svg-icons"; import AddressHighlighter from "./AddressHighlighter"; -import AddressLink from "./AddressLink"; +import DecoratedAddressLink from "./DecoratedAddressLink"; +import { RuntimeContext } from "../useRuntime"; import { TransactionData, Transfer } from "../types"; +const CHI_ADDRESS = "0x0000000000004946c0e9F43F4Dee607b0eF1fA1c"; +const GST2_ADDRESS = "0x0000000000b3F879cb30FE243b4Dfee438691c04"; + type InternalSelfDestructProps = { txData: TransactionData; transfer: Transfer; @@ -19,8 +19,9 @@ const InternalSelfDestruct: React.FC = ({ txData, transfer, }) => { - const fromMiner = - txData.miner !== undefined && transfer.from === txData.miner; + const { provider } = useContext(RuntimeContext); + const network = provider?.network; + const toMiner = txData.miner !== undefined && transfer.to === txData.miner; return ( @@ -35,20 +36,15 @@ const InternalSelfDestruct: React.FC = ({ Contract
-
- {fromMiner && ( - - - - )} - -
+
+ {network?.chainId === 1 && transfer.to === CHI_ADDRESS && ( + (CHI Gastoken) + )} + {network?.chainId === 1 && transfer.to === GST2_ADDRESS && ( + (GST2 Gastoken) + )} {!transfer.value.isZero() && (
@@ -64,12 +60,7 @@ const InternalSelfDestruct: React.FC = ({ toMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - {toMiner && ( - - - - )} - +
diff --git a/src/components/InternalTransfer.tsx b/src/components/InternalTransfer.tsx index 64e8953..af101e0 100644 --- a/src/components/InternalTransfer.tsx +++ b/src/components/InternalTransfer.tsx @@ -1,7 +1,7 @@ import React from "react"; import { ethers } from "ethers"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faAngleRight, faCoins } from "@fortawesome/free-solid-svg-icons"; +import { faAngleRight } from "@fortawesome/free-solid-svg-icons"; import AddressHighlighter from "./AddressHighlighter"; import DecoratedAddressLink from "./DecoratedAddressLink"; import { TransactionData, Transfer } from "../types"; @@ -33,12 +33,7 @@ const InternalTransfer: React.FC = ({ fromMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - {fromMiner && ( - - - - )} - + @@ -50,12 +45,7 @@ const InternalTransfer: React.FC = ({ toMiner ? "rounded px-2 py-1 bg-yellow-100" : "" }`} > - {toMiner && ( - - - - )} - + diff --git a/src/transaction/Details.tsx b/src/transaction/Details.tsx index 1863b33..441226a 100644 --- a/src/transaction/Details.tsx +++ b/src/transaction/Details.tsx @@ -84,18 +84,14 @@ const Details: React.FC = ({ {internalTransfers && ( - <> -
- {internalTransfers.transfers.map((t, i) => ( - - ))} -
-
- {internalTransfers.selfDestructs.map((t, i) => ( - - ))} -
- +
+ {internalTransfers.transfers.map((t, i) => ( + + ))} + {internalTransfers.selfDestructs.map((t, i) => ( + + ))} +
)} diff --git a/src/useErigonHooks.ts b/src/useErigonHooks.ts index 589ec34..0ca4a06 100644 --- a/src/useErigonHooks.ts +++ b/src/useErigonHooks.ts @@ -24,6 +24,8 @@ export const useInternalTransfers = ( txData ); for (const s of _selfDestructs) { + s.from = provider.formatter.address(s.from); + s.to = provider.formatter.address(s.to); s.value = provider.formatter.bigNumber(s.value); } setIntTransfers({ transfers: _transfers, selfDestructs: _selfDestructs });