bridge_ui: add terra finder links

Change-Id: I70b9b6ec378c57799e86345d76fde7f49cf3acdb
This commit is contained in:
Evan Gray 2021-10-04 12:36:07 -04:00
parent 057f9d2749
commit 831e96adb5
3 changed files with 35 additions and 5 deletions

View File

@ -2,6 +2,7 @@ import {
ChainId,
CHAIN_ID_ETH,
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA,
} from "@certusone/wormhole-sdk";
import { Button, makeStyles, Typography } from "@material-ui/core";
import { Transaction } from "../store/transferSlice";
@ -28,7 +29,8 @@ export default function ShowTx({
const showExplorerLink =
CLUSTER === "testnet" ||
CLUSTER === "mainnet" ||
(CLUSTER === "devnet" && chainId === CHAIN_ID_SOLANA);
(CLUSTER === "devnet" &&
(chainId === CHAIN_ID_SOLANA || chainId === CHAIN_ID_TERRA));
const explorerAddress =
chainId === CHAIN_ID_ETH
? `https://${CLUSTER === "testnet" ? "goerli." : ""}etherscan.io/tx/${
@ -42,8 +44,21 @@ export default function ShowTx({
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
: ""
}`
: chainId === CHAIN_ID_TERRA
? `https://finder.terra.money/${
CLUSTER === "devnet"
? "localterra"
: CLUSTER === "testnet"
? "bombay-12"
: "columbus-5"
}/tx/${tx?.id}`
: undefined;
const explorerName = chainId === CHAIN_ID_ETH ? "Etherscan" : "Explorer";
const explorerName =
chainId === CHAIN_ID_ETH
? "Etherscan"
: chainId === CHAIN_ID_TERRA
? "Finder"
: "Explorer";
return (
<div className={classes.tx}>

View File

@ -2,6 +2,7 @@ import {
ChainId,
CHAIN_ID_ETH,
CHAIN_ID_SOLANA,
CHAIN_ID_TERRA,
} from "@certusone/wormhole-sdk";
import { Button, makeStyles, Tooltip, Typography } from "@material-ui/core";
import { FileCopy, OpenInNew } from "@material-ui/icons";
@ -79,7 +80,6 @@ export default function SmartAddress({
: tokenName
? tokenName
: "";
//TODO terra
const explorerAddress = isNative
? null
: chainId === CHAIN_ID_ETH
@ -94,8 +94,21 @@ export default function SmartAddress({
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
: ""
}`
: chainId === CHAIN_ID_TERRA
? `https://finder.terra.money/${
CLUSTER === "devnet"
? "localterra"
: CLUSTER === "testnet"
? "bombay-12"
: "columbus-5"
}/address/${useableAddress}`
: undefined;
const explorerName = chainId === CHAIN_ID_ETH ? "Etherscan" : "Explorer";
const explorerName =
chainId === CHAIN_ID_ETH
? "Etherscan"
: chainId === CHAIN_ID_TERRA
? "Finder"
: "Explorer";
const copyToClipboard = useCopyToClipboard(useableAddress);

View File

@ -73,5 +73,7 @@ export function chunks<T>(array: T[], size: number): T[][] {
}
export function shortenAddress(address: string) {
return `${address.slice(0, 4)}...${address.slice(-4)}`;
return address.length > 10
? `${address.slice(0, 4)}...${address.slice(-4)}`
: address;
}