From 0c4c89ff4a2af6d7b52f0c19e85c283dd3538b48 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 16 Mar 2021 11:47:43 -0700 Subject: [PATCH] explorer: display wormhole bridge details (#15833) * feat: display wormhole bridge details * fix: add rel noopener noreferrer * fix: extract eth address properly * feat: copyable bridge contract address --- .../account/TokenAccountSection.tsx | 29 +++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/explorer/src/components/account/TokenAccountSection.tsx b/explorer/src/components/account/TokenAccountSection.tsx index 943dfef2eb..35f6db3041 100644 --- a/explorer/src/components/account/TokenAccountSection.tsx +++ b/explorer/src/components/account/TokenAccountSection.tsx @@ -16,6 +16,7 @@ import { addressLabel } from "utils/tx"; import { reportError } from "utils/sentry"; import { useTokenRegistry } from "providers/mints/token-registry"; import { BigNumber } from "bignumber.js"; +import { Copyable } from "components/common/Copyable"; export function TokenAccountSection({ account, @@ -60,6 +61,18 @@ function MintAccountCard({ const refresh = () => fetchInfo(account.pubkey); const tokenInfo = tokenRegistry.get(mintAddress); + + let bridgeContractAddress = tokenInfo?.extensions?.address; + if (tokenInfo?.extensions?.bridgeContract && !bridgeContractAddress) { + const extractEth = tokenInfo.extensions.bridgeContract.match( + /0x[a-fA-F0-9]{40,64}/ + ); + + if (extractEth) { + bridgeContractAddress = extractEth[0]; + } + } + return (
@@ -130,6 +143,22 @@ function MintAccountCard({ Uninitialized )} + {tokenInfo?.extensions?.bridgeContract && bridgeContractAddress && ( + + Wormhole Bridge Contract + + + + {bridgeContractAddress} + + + + + )}
);