diff --git a/bridge_ui/package-lock.json b/bridge_ui/package-lock.json
index 347a709f..900d012e 100644
--- a/bridge_ui/package-lock.json
+++ b/bridge_ui/package-lock.json
@@ -7,7 +7,6 @@
"": {
"name": "test_ui",
"version": "0.1.0",
- "hasInstallScript": true,
"dependencies": {
"@certusone/wormhole-sdk": "file:..\\sdk\\js",
"@material-ui/core": "^4.12.2",
@@ -36,6 +35,7 @@
"bn.js": "^5.1.3",
"borsh": "^0.4.0",
"bs58": "^4.0.1",
+ "clsx": "^1.1.1",
"ethers": "^5.4.1",
"js-base64": "^3.6.1",
"notistack": "^1.0.10",
@@ -58,7 +58,8 @@
}
},
"../sdk/js": {
- "version": "0.0.2",
+ "name": "@certusone/wormhole-sdk",
+ "version": "0.0.4",
"license": "Apache-2.0",
"dependencies": {
"@improbable-eng/grpc-web": "^0.14.0",
diff --git a/bridge_ui/package.json b/bridge_ui/package.json
index f0b58db4..99b56aa8 100644
--- a/bridge_ui/package.json
+++ b/bridge_ui/package.json
@@ -30,6 +30,7 @@
"bn.js": "^5.1.3",
"borsh": "^0.4.0",
"bs58": "^4.0.1",
+ "clsx": "^1.1.1",
"ethers": "^5.4.1",
"js-base64": "^3.6.1",
"notistack": "^1.0.10",
diff --git a/bridge_ui/src/components/NFT/SourcePreview.tsx b/bridge_ui/src/components/NFT/SourcePreview.tsx
index 7ac099f6..7742f80b 100644
--- a/bridge_ui/src/components/NFT/SourcePreview.tsx
+++ b/bridge_ui/src/components/NFT/SourcePreview.tsx
@@ -50,7 +50,7 @@ export default function SourcePreview() {
{explainerContent}
{sourceParsedTokenAccount ? (
-
+
) : null}
>
);
diff --git a/bridge_ui/src/components/SmartAddress.tsx b/bridge_ui/src/components/SmartAddress.tsx
index 23536d01..da209991 100644
--- a/bridge_ui/src/components/SmartAddress.tsx
+++ b/bridge_ui/src/components/SmartAddress.tsx
@@ -4,13 +4,13 @@ import {
CHAIN_ID_SOLANA,
} from "@certusone/wormhole-sdk";
import { Button, makeStyles, Tooltip, Typography } from "@material-ui/core";
+import { FileCopy, OpenInNew } from "@material-ui/icons";
import { withStyles } from "@material-ui/styles";
-import { useSnackbar } from "notistack";
-import { useCallback } from "react";
+import clsx from "clsx";
+import useCopyToClipboard from "../hooks/useCopyToClipboard";
import { ParsedTokenAccount } from "../store/transferSlice";
import { CLUSTER } from "../utils/consts";
import { shortenAddress } from "../utils/solana";
-import { FileCopy, OpenInNew } from "@material-ui/icons";
const useStyles = makeStyles((theme) => ({
mainTypog: {
@@ -20,20 +20,19 @@ const useStyles = makeStyles((theme) => ({
textDecoration: "underline",
textUnderlineOffset: "2px",
},
+ noGutter: {
+ marginLeft: 0,
+ marginRight: 0,
+ },
+ noUnderline: {
+ textDecoration: "none",
+ },
buttons: {
marginLeft: ".5rem",
marginRight: ".5rem",
},
}));
-function pushToClipboard(content: any) {
- if (!navigator.clipboard) {
- // Clipboard API not available
- return;
- }
- return navigator.clipboard.writeText(content);
-}
-
const tooltipStyles = {
tooltip: {
minWidth: "max-content",
@@ -54,6 +53,8 @@ export default function SmartAddress({
symbol,
tokenName,
variant,
+ noGutter,
+ noUnderline,
}: {
chainId: ChainId;
parsedTokenAccount?: ParsedTokenAccount;
@@ -62,13 +63,14 @@ export default function SmartAddress({
tokenName?: string;
symbol?: string;
variant?: any;
+ noGutter?: boolean;
+ noUnderline?: boolean;
}) {
const classes = useStyles();
const useableAddress = parsedTokenAccount?.mintKey || address || "";
const useableSymbol = parsedTokenAccount?.symbol || symbol || "";
const isNative = parsedTokenAccount?.isNativeAsset || false;
const addressShort = shortenAddress(useableAddress) || "";
- const { enqueueSnackbar } = useSnackbar();
const useableName = isNative
? "Native Currency"
@@ -95,11 +97,7 @@ export default function SmartAddress({
: undefined;
const explorerName = chainId === CHAIN_ID_ETH ? "Etherscan" : "Explorer";
- const copyToClipboard = useCallback(() => {
- pushToClipboard(useableAddress)?.then(() => {
- enqueueSnackbar("Copied address to clipboard.", { variant: "success" });
- });
- }, [useableAddress, enqueueSnackbar]);
+ const copyToClipboard = useCopyToClipboard(useableAddress);
const explorerButton = !explorerAddress ? null : (