bridge_ui: add ropsten to testnet
Change-Id: I54f0dd7955f01b383f42f4521360acc5b4a185e5
This commit is contained in:
parent
b08565da67
commit
78e1244177
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { makeStyles, Typography } from "@material-ui/core";
|
import { makeStyles, Typography } from "@material-ui/core";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
import { useCallback, useMemo } from "react";
|
import { useCallback, useMemo } from "react";
|
||||||
|
@ -11,7 +12,6 @@ import {
|
||||||
selectAttestTargetChain,
|
selectAttestTargetChain,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import ChainSelect from "../ChainSelect";
|
import ChainSelect from "../ChainSelect";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
|
|
|
@ -2,8 +2,8 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import EthereumSignerKey from "./EthereumSignerKey";
|
import EthereumSignerKey from "./EthereumSignerKey";
|
||||||
import SolanaWalletKey from "./SolanaWalletKey";
|
import SolanaWalletKey from "./SolanaWalletKey";
|
||||||
import TerraWalletKey from "./TerraWalletKey";
|
import TerraWalletKey from "./TerraWalletKey";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
import { CHAIN_ID_SOLANA, isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { Button, makeStyles } from "@material-ui/core";
|
import { Button, makeStyles } from "@material-ui/core";
|
||||||
import { VerifiedUser } from "@material-ui/icons";
|
import { VerifiedUser } from "@material-ui/icons";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
|
@ -15,7 +15,6 @@ import {
|
||||||
selectNFTSourceError,
|
selectNFTSourceError,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
import { CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import ChainSelect from "../ChainSelect";
|
import ChainSelect from "../ChainSelect";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { makeStyles, TextField, Typography } from "@material-ui/core";
|
import { makeStyles, TextField, Typography } from "@material-ui/core";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
|
@ -26,7 +27,6 @@ import {
|
||||||
selectNFTTargetError,
|
selectNFTTargetError,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { CHAINS_BY_ID, CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
import { CHAINS_BY_ID, CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import ChainSelect from "../ChainSelect";
|
import ChainSelect from "../ChainSelect";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
import { CHAIN_ID_SOLANA, isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { makeStyles, Typography } from "@material-ui/core";
|
import { makeStyles, Typography } from "@material-ui/core";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
import {
|
import {
|
||||||
|
@ -9,7 +9,6 @@ import {
|
||||||
selectNFTTargetChain,
|
selectNFTTargetChain,
|
||||||
selectNFTTransferTx,
|
selectNFTTransferTx,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import { WAITING_FOR_WALLET_AND_CONF } from "../Transfer/WaitingForWalletMessage";
|
import { WAITING_FOR_WALLET_AND_CONF } from "../Transfer/WaitingForWalletMessage";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
|
isEVMChain,
|
||||||
uint8ArrayToHex,
|
uint8ArrayToHex,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import {
|
import {
|
||||||
|
@ -42,7 +43,6 @@ import {
|
||||||
import {
|
import {
|
||||||
ethNFTToNFTParsedTokenAccount,
|
ethNFTToNFTParsedTokenAccount,
|
||||||
getEthereumNFT,
|
getEthereumNFT,
|
||||||
isEVMChain,
|
|
||||||
isNFT,
|
isNFT,
|
||||||
isValidEthereumAddress,
|
isValidEthereumAddress,
|
||||||
} from "../utils/ethereum";
|
} from "../utils/ethereum";
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
getEmitterAddressTerra,
|
getEmitterAddressTerra,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
parseNFTPayload,
|
parseNFTPayload,
|
||||||
parseSequenceFromLogEth,
|
parseSequenceFromLogEth,
|
||||||
parseSequenceFromLogSolana,
|
parseSequenceFromLogSolana,
|
||||||
|
@ -54,7 +55,6 @@ import {
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
WORMHOLE_RPC_HOSTS,
|
WORMHOLE_RPC_HOSTS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import ButtonWithLoader from "./ButtonWithLoader";
|
import ButtonWithLoader from "./ButtonWithLoader";
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
@ -38,6 +39,10 @@ export default function ShowTx({
|
||||||
? `https://${CLUSTER === "testnet" ? "goerli." : ""}etherscan.io/tx/${
|
? `https://${CLUSTER === "testnet" ? "goerli." : ""}etherscan.io/tx/${
|
||||||
tx?.id
|
tx?.id
|
||||||
}`
|
}`
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? `https://${CLUSTER === "testnet" ? "ropsten." : ""}etherscan.io/tx/${
|
||||||
|
tx?.id
|
||||||
|
}`
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? `https://${CLUSTER === "testnet" ? "testnet." : ""}bscscan.com/tx/${
|
? `https://${CLUSTER === "testnet" ? "testnet." : ""}bscscan.com/tx/${
|
||||||
tx?.id
|
tx?.id
|
||||||
|
@ -49,7 +54,7 @@ export default function ShowTx({
|
||||||
: chainId === CHAIN_ID_SOLANA
|
: chainId === CHAIN_ID_SOLANA
|
||||||
? `https://explorer.solana.com/tx/${tx?.id}${
|
? `https://explorer.solana.com/tx/${tx?.id}${
|
||||||
CLUSTER === "testnet"
|
CLUSTER === "testnet"
|
||||||
? "?cluster=testnet"
|
? "?cluster=devnet"
|
||||||
: CLUSTER === "devnet"
|
: CLUSTER === "devnet"
|
||||||
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
||||||
: ""
|
: ""
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
@ -97,6 +98,10 @@ export default function SmartAddress({
|
||||||
? `https://${
|
? `https://${
|
||||||
CLUSTER === "testnet" ? "goerli." : ""
|
CLUSTER === "testnet" ? "goerli." : ""
|
||||||
}etherscan.io/address/${useableAddress}`
|
}etherscan.io/address/${useableAddress}`
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? `https://${
|
||||||
|
CLUSTER === "testnet" ? "ropsten." : ""
|
||||||
|
}etherscan.io/address/${useableAddress}`
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? `https://${
|
? `https://${
|
||||||
CLUSTER === "testnet" ? "testnet." : ""
|
CLUSTER === "testnet" ? "testnet." : ""
|
||||||
|
@ -108,7 +113,7 @@ export default function SmartAddress({
|
||||||
: chainId === CHAIN_ID_SOLANA
|
: chainId === CHAIN_ID_SOLANA
|
||||||
? `https://explorer.solana.com/address/${useableAddress}${
|
? `https://explorer.solana.com/address/${useableAddress}${
|
||||||
CLUSTER === "testnet"
|
CLUSTER === "testnet"
|
||||||
? "?cluster=testnet"
|
? "?cluster=devnet"
|
||||||
: CLUSTER === "devnet"
|
: CLUSTER === "devnet"
|
||||||
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
||||||
: ""
|
: ""
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
nativeToHexString,
|
nativeToHexString,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import {
|
import {
|
||||||
|
@ -24,7 +25,6 @@ import useMetadata from "../hooks/useMetadata";
|
||||||
import useOriginalAsset, { OriginalAssetInfo } from "../hooks/useOriginalAsset";
|
import useOriginalAsset, { OriginalAssetInfo } from "../hooks/useOriginalAsset";
|
||||||
import { COLORS } from "../muiTheme";
|
import { COLORS } from "../muiTheme";
|
||||||
import { BETA_CHAINS, CHAINS, CHAINS_BY_ID } from "../utils/consts";
|
import { BETA_CHAINS, CHAINS, CHAINS_BY_ID } from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import HeaderText from "./HeaderText";
|
import HeaderText from "./HeaderText";
|
||||||
import KeyAndBalance from "./KeyAndBalance";
|
import KeyAndBalance from "./KeyAndBalance";
|
||||||
import SmartAddress from "./SmartAddress";
|
import SmartAddress from "./SmartAddress";
|
||||||
|
|
|
@ -15,6 +15,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
|
@ -49,7 +50,7 @@ const LogoIcon = ({ chainId }: { chainId: ChainId }) =>
|
||||||
src={solanaIcon}
|
src={solanaIcon}
|
||||||
alt="Solana"
|
alt="Solana"
|
||||||
/>
|
/>
|
||||||
) : chainId === CHAIN_ID_ETH ? (
|
) : chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN ? (
|
||||||
<Avatar
|
<Avatar
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: "white",
|
backgroundColor: "white",
|
||||||
|
@ -380,7 +381,8 @@ export default function NFTViewer({
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
className={clsx(classes.cardInset, {
|
className={clsx(classes.cardInset, {
|
||||||
[classes.eth]: chainId === CHAIN_ID_ETH,
|
[classes.eth]:
|
||||||
|
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
[classes.bsc]: chainId === CHAIN_ID_BSC,
|
[classes.bsc]: chainId === CHAIN_ID_BSC,
|
||||||
[classes.solana]: chainId === CHAIN_ID_SOLANA,
|
[classes.solana]: chainId === CHAIN_ID_SOLANA,
|
||||||
[classes.polygon]: chainId === CHAIN_ID_POLYGON,
|
[classes.polygon]: chainId === CHAIN_ID_POLYGON,
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
//import Autocomplete from '@material-ui/lab/Autocomplete';
|
//import Autocomplete from '@material-ui/lab/Autocomplete';
|
||||||
import { CHAIN_ID_SOLANA, CHAIN_ID_TERRA } from "@certusone/wormhole-sdk";
|
import {
|
||||||
|
CHAIN_ID_SOLANA,
|
||||||
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
|
} from "@certusone/wormhole-sdk";
|
||||||
import { TextField, Typography } from "@material-ui/core";
|
import { TextField, Typography } from "@material-ui/core";
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
@ -20,7 +24,6 @@ import {
|
||||||
setSourceParsedTokenAccount as setTransferSourceParsedTokenAccount,
|
setSourceParsedTokenAccount as setTransferSourceParsedTokenAccount,
|
||||||
setSourceWalletAddress as setTransferSourceWalletAddress,
|
setSourceWalletAddress as setTransferSourceWalletAddress,
|
||||||
} from "../../store/transferSlice";
|
} from "../../store/transferSlice";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import EvmTokenPicker from "./EvmTokenPicker";
|
import EvmTokenPicker from "./EvmTokenPicker";
|
||||||
import RefreshButtonWrapper from "./RefreshButtonWrapper";
|
import RefreshButtonWrapper from "./RefreshButtonWrapper";
|
||||||
import SolanaTokenPicker from "./SolanaTokenPicker";
|
import SolanaTokenPicker from "./SolanaTokenPicker";
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
import { ChainId, CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
import { ChainId, CHAIN_ID_SOLANA, isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { LinearProgress, makeStyles, Typography } from "@material-ui/core";
|
import { LinearProgress, makeStyles, Typography } from "@material-ui/core";
|
||||||
import { Connection } from "@solana/web3.js";
|
import { Connection } from "@solana/web3.js";
|
||||||
import { useEffect, useState } from "react";
|
import { useEffect, useState } from "react";
|
||||||
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||||
import { Transaction } from "../store/transferSlice";
|
import { Transaction } from "../store/transferSlice";
|
||||||
import { CHAINS_BY_ID, SOLANA_HOST } from "../utils/consts";
|
import { CHAINS_BY_ID, SOLANA_HOST } from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
root: {
|
root: {
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { Button, makeStyles } from "@material-ui/core";
|
import { Button, makeStyles } from "@material-ui/core";
|
||||||
import detectEthereumProvider from "@metamask/detect-provider";
|
import detectEthereumProvider from "@metamask/detect-provider";
|
||||||
import { useCallback } from "react";
|
import { useCallback } from "react";
|
||||||
|
@ -12,7 +13,6 @@ import { getEvmChainId } from "../../utils/consts";
|
||||||
import {
|
import {
|
||||||
ethTokenToParsedTokenAccount,
|
ethTokenToParsedTokenAccount,
|
||||||
getEthereumToken,
|
getEthereumToken,
|
||||||
isEVMChain,
|
|
||||||
} from "../../utils/ethereum";
|
} from "../../utils/ethereum";
|
||||||
|
|
||||||
const useStyles = makeStyles((theme) => ({
|
const useStyles = makeStyles((theme) => ({
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
WSOL_ADDRESS,
|
WSOL_ADDRESS,
|
||||||
|
@ -14,7 +15,12 @@ import {
|
||||||
selectTransferTargetAsset,
|
selectTransferTargetAsset,
|
||||||
selectTransferTargetChain,
|
selectTransferTargetChain,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { WBNB_ADDRESS, WETH_ADDRESS, WMATIC_ADDRESS } from "../../utils/consts";
|
import {
|
||||||
|
ROPSTEN_WETH_ADDRESS,
|
||||||
|
WBNB_ADDRESS,
|
||||||
|
WETH_ADDRESS,
|
||||||
|
WMATIC_ADDRESS,
|
||||||
|
} from "../../utils/consts";
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
import { SolanaCreateAssociatedAddressAlternate } from "../SolanaCreateAssociatedAddress";
|
import { SolanaCreateAssociatedAddressAlternate } from "../SolanaCreateAssociatedAddress";
|
||||||
|
@ -32,6 +38,10 @@ function Redeem() {
|
||||||
targetChain === CHAIN_ID_ETH &&
|
targetChain === CHAIN_ID_ETH &&
|
||||||
targetAsset &&
|
targetAsset &&
|
||||||
targetAsset.toLowerCase() === WETH_ADDRESS.toLowerCase();
|
targetAsset.toLowerCase() === WETH_ADDRESS.toLowerCase();
|
||||||
|
const isEthRopstenNative =
|
||||||
|
targetChain === CHAIN_ID_ETHEREUM_ROPSTEN &&
|
||||||
|
targetAsset &&
|
||||||
|
targetAsset.toLowerCase() === ROPSTEN_WETH_ADDRESS.toLowerCase();
|
||||||
const isBscNative =
|
const isBscNative =
|
||||||
targetChain === CHAIN_ID_BSC &&
|
targetChain === CHAIN_ID_BSC &&
|
||||||
targetAsset &&
|
targetAsset &&
|
||||||
|
@ -45,7 +55,11 @@ function Redeem() {
|
||||||
targetAsset &&
|
targetAsset &&
|
||||||
targetAsset === WSOL_ADDRESS;
|
targetAsset === WSOL_ADDRESS;
|
||||||
const isNativeEligible =
|
const isNativeEligible =
|
||||||
isEthNative || isBscNative || isPolygonNative || isSolNative;
|
isEthNative ||
|
||||||
|
isEthRopstenNative ||
|
||||||
|
isBscNative ||
|
||||||
|
isPolygonNative ||
|
||||||
|
isSolNative;
|
||||||
const [useNativeRedeem, setUseNativeRedeem] = useState(true);
|
const [useNativeRedeem, setUseNativeRedeem] = useState(true);
|
||||||
const toggleNativeRedeem = useCallback(() => {
|
const toggleNativeRedeem = useCallback(() => {
|
||||||
setUseNativeRedeem(!useNativeRedeem);
|
setUseNativeRedeem(!useNativeRedeem);
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { Checkbox, FormControlLabel } from "@material-ui/core";
|
import { Checkbox, FormControlLabel } from "@material-ui/core";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
|
@ -18,7 +19,6 @@ import {
|
||||||
selectTransferTransferTx,
|
selectTransferTransferTx,
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { CHAINS_BY_ID } from "../../utils/consts";
|
import { CHAINS_BY_ID } from "../../utils/consts";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
import ShowTx from "../ShowTx";
|
import ShowTx from "../ShowTx";
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { makeStyles, Typography } from "@material-ui/core";
|
import { makeStyles, Typography } from "@material-ui/core";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
|
@ -26,7 +27,6 @@ import {
|
||||||
} from "../../store/selectors";
|
} from "../../store/selectors";
|
||||||
import { incrementStep, setTargetChain } from "../../store/transferSlice";
|
import { incrementStep, setTargetChain } from "../../store/transferSlice";
|
||||||
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
||||||
import { isEVMChain } from "../../utils/ethereum";
|
|
||||||
import ButtonWithLoader from "../ButtonWithLoader";
|
import ButtonWithLoader from "../ButtonWithLoader";
|
||||||
import ChainSelect from "../ChainSelect";
|
import ChainSelect from "../ChainSelect";
|
||||||
import KeyAndBalance from "../KeyAndBalance";
|
import KeyAndBalance from "../KeyAndBalance";
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import { approveEth, ChainId, getAllowanceEth } from "@certusone/wormhole-sdk";
|
import {
|
||||||
|
approveEth,
|
||||||
|
ChainId,
|
||||||
|
getAllowanceEth,
|
||||||
|
isEVMChain,
|
||||||
|
} from "@certusone/wormhole-sdk";
|
||||||
import { BigNumber } from "ethers";
|
import { BigNumber } from "ethers";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
@ -6,7 +11,6 @@ import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||||
import { selectTransferIsApproving } from "../store/selectors";
|
import { selectTransferIsApproving } from "../store/selectors";
|
||||||
import { setIsApproving } from "../store/transferSlice";
|
import { setIsApproving } from "../store/transferSlice";
|
||||||
import { getTokenBridgeAddressForChain } from "../utils/consts";
|
import { getTokenBridgeAddressForChain } from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
export default function useAllowance(
|
export default function useAllowance(
|
||||||
chainId: ChainId,
|
chainId: ChainId,
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
getOriginalAssetEth,
|
getOriginalAssetEth,
|
||||||
getOriginalAssetSol,
|
getOriginalAssetSol,
|
||||||
getOriginalAssetTerra,
|
getOriginalAssetTerra,
|
||||||
|
isEVMChain,
|
||||||
uint8ArrayToHex,
|
uint8ArrayToHex,
|
||||||
WormholeWrappedInfo,
|
WormholeWrappedInfo,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
|
@ -36,7 +37,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_HOST,
|
TERRA_HOST,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
export interface StateSafeWormholeWrappedInfo {
|
export interface StateSafeWormholeWrappedInfo {
|
||||||
isWrapped: boolean;
|
isWrapped: boolean;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import { ChainId } from "@certusone/wormhole-sdk";
|
import { ChainId, isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { ethers } from "@certusone/wormhole-sdk/node_modules/ethers";
|
import { ethers } from "@certusone/wormhole-sdk/node_modules/ethers";
|
||||||
import { useEffect, useMemo, useState } from "react";
|
import { useEffect, useMemo, useState } from "react";
|
||||||
import {
|
import {
|
||||||
|
@ -6,7 +6,6 @@ import {
|
||||||
useEthereumProvider,
|
useEthereumProvider,
|
||||||
} from "../contexts/EthereumProviderContext";
|
} from "../contexts/EthereumProviderContext";
|
||||||
import { DataWrapper } from "../store/helpers";
|
import { DataWrapper } from "../store/helpers";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import useIsWalletReady from "./useIsWalletReady";
|
import useIsWalletReady from "./useIsWalletReady";
|
||||||
|
|
||||||
export type EvmMetadata = {
|
export type EvmMetadata = {
|
||||||
|
|
|
@ -5,6 +5,7 @@ import {
|
||||||
getForeignAssetSolana,
|
getForeignAssetSolana,
|
||||||
getForeignAssetTerra,
|
getForeignAssetTerra,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
nativeToHexString,
|
nativeToHexString,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { Connection } from "@solana/web3.js";
|
import { Connection } from "@solana/web3.js";
|
||||||
|
@ -21,7 +22,6 @@ import {
|
||||||
TERRA_HOST,
|
TERRA_HOST,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import useIsWalletReady from "./useIsWalletReady";
|
import useIsWalletReady from "./useIsWalletReady";
|
||||||
|
|
||||||
export type ForeignAssetInfo = {
|
export type ForeignAssetInfo = {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import {
|
||||||
getForeignAssetTerra,
|
getForeignAssetTerra,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import {
|
import {
|
||||||
getForeignAssetEth as getForeignAssetEthNFT,
|
getForeignAssetEth as getForeignAssetEthNFT,
|
||||||
|
@ -50,7 +51,6 @@ import {
|
||||||
TERRA_HOST,
|
TERRA_HOST,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
function useFetchTargetAsset(nft?: boolean) {
|
function useFetchTargetAsset(nft?: boolean) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
|
@ -2,9 +2,11 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
WSOL_ADDRESS,
|
WSOL_ADDRESS,
|
||||||
WSOL_DECIMALS,
|
WSOL_DECIMALS,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
|
@ -55,6 +57,8 @@ import {
|
||||||
} from "../store/transferSlice";
|
} from "../store/transferSlice";
|
||||||
import {
|
import {
|
||||||
COVALENT_GET_TOKENS_URL,
|
COVALENT_GET_TOKENS_URL,
|
||||||
|
ROPSTEN_WETH_ADDRESS,
|
||||||
|
ROPSTEN_WETH_DECIMALS,
|
||||||
SOLANA_HOST,
|
SOLANA_HOST,
|
||||||
WBNB_ADDRESS,
|
WBNB_ADDRESS,
|
||||||
WBNB_DECIMALS,
|
WBNB_DECIMALS,
|
||||||
|
@ -63,7 +67,6 @@ import {
|
||||||
WMATIC_ADDRESS,
|
WMATIC_ADDRESS,
|
||||||
WMATIC_DECIMALS,
|
WMATIC_DECIMALS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import {
|
import {
|
||||||
ExtractedMintInfo,
|
ExtractedMintInfo,
|
||||||
extractMintInfo,
|
extractMintInfo,
|
||||||
|
@ -217,6 +220,29 @@ const createNativeEthParsedTokenAccount = (
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const createNativeEthRopstenParsedTokenAccount = (
|
||||||
|
provider: Provider,
|
||||||
|
signerAddress: string | undefined
|
||||||
|
) => {
|
||||||
|
return !(provider && signerAddress)
|
||||||
|
? Promise.reject()
|
||||||
|
: provider.getBalance(signerAddress).then((balanceInWei) => {
|
||||||
|
const balanceInEth = ethers.utils.formatEther(balanceInWei);
|
||||||
|
return createParsedTokenAccount(
|
||||||
|
signerAddress, //public key
|
||||||
|
ROPSTEN_WETH_ADDRESS, //Mint key, On the other side this will be WETH, so this is hopefully a white lie.
|
||||||
|
balanceInWei.toString(), //amount, in wei
|
||||||
|
ROPSTEN_WETH_DECIMALS, //Luckily both ETH and WETH have 18 decimals, so this should not be an issue.
|
||||||
|
parseFloat(balanceInEth), //This loses precision, but is a limitation of the current datamodel. This field is essentially deprecated
|
||||||
|
balanceInEth.toString(), //This is the actual display field, which has full precision.
|
||||||
|
"ETH", //A white lie for display purposes
|
||||||
|
"Ethereum", //A white lie for display purposes
|
||||||
|
ethIcon,
|
||||||
|
true //isNativeAsset
|
||||||
|
);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
const createNativeBscParsedTokenAccount = (
|
const createNativeBscParsedTokenAccount = (
|
||||||
provider: Provider,
|
provider: Provider,
|
||||||
signerAddress: string | undefined
|
signerAddress: string | undefined
|
||||||
|
@ -608,6 +634,40 @@ function useGetAvailableTokens(nft: boolean = false) {
|
||||||
};
|
};
|
||||||
}, [lookupChain, provider, signerAddress, nft, ethNativeAccount]);
|
}, [lookupChain, provider, signerAddress, nft, ethNativeAccount]);
|
||||||
|
|
||||||
|
//Ethereum (Ropsten) native asset load
|
||||||
|
useEffect(() => {
|
||||||
|
let cancelled = false;
|
||||||
|
if (
|
||||||
|
signerAddress &&
|
||||||
|
lookupChain === CHAIN_ID_ETHEREUM_ROPSTEN &&
|
||||||
|
!ethNativeAccount &&
|
||||||
|
!nft
|
||||||
|
) {
|
||||||
|
setEthNativeAccountLoading(true);
|
||||||
|
createNativeEthRopstenParsedTokenAccount(provider, signerAddress).then(
|
||||||
|
(result) => {
|
||||||
|
console.log("create native account returned with value", result);
|
||||||
|
if (!cancelled) {
|
||||||
|
setEthNativeAccount(result);
|
||||||
|
setEthNativeAccountLoading(false);
|
||||||
|
setEthNativeAccountError("");
|
||||||
|
}
|
||||||
|
},
|
||||||
|
(error) => {
|
||||||
|
if (!cancelled) {
|
||||||
|
setEthNativeAccount(undefined);
|
||||||
|
setEthNativeAccountLoading(false);
|
||||||
|
setEthNativeAccountError("Unable to retrieve your ETH balance.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return () => {
|
||||||
|
cancelled = true;
|
||||||
|
};
|
||||||
|
}, [lookupChain, provider, signerAddress, nft, ethNativeAccount]);
|
||||||
|
|
||||||
//Binance Smart Chain native asset load
|
//Binance Smart Chain native asset load
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import {
|
import {
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
TokenImplementation__factory,
|
TokenImplementation__factory,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { Connection, PublicKey } from "@solana/web3.js";
|
import { Connection, PublicKey } from "@solana/web3.js";
|
||||||
|
@ -17,7 +18,6 @@ import {
|
||||||
} from "../store/selectors";
|
} from "../store/selectors";
|
||||||
import { setTargetParsedTokenAccount } from "../store/transferSlice";
|
import { setTargetParsedTokenAccount } from "../store/transferSlice";
|
||||||
import { getEvmChainId, SOLANA_HOST, TERRA_HOST } from "../utils/consts";
|
import { getEvmChainId, SOLANA_HOST, TERRA_HOST } from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { createParsedTokenAccount } from "./useGetSourceParsedTokenAccounts";
|
import { createParsedTokenAccount } from "./useGetSourceParsedTokenAccounts";
|
||||||
import useMetadata from "./useMetadata";
|
import useMetadata from "./useMetadata";
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ import {
|
||||||
getEmitterAddressEth,
|
getEmitterAddressEth,
|
||||||
getEmitterAddressSolana,
|
getEmitterAddressSolana,
|
||||||
getEmitterAddressTerra,
|
getEmitterAddressTerra,
|
||||||
|
isEVMChain,
|
||||||
parseSequenceFromLogEth,
|
parseSequenceFromLogEth,
|
||||||
parseSequenceFromLogSolana,
|
parseSequenceFromLogSolana,
|
||||||
parseSequenceFromLogTerra,
|
parseSequenceFromLogTerra,
|
||||||
|
@ -46,7 +47,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
|
|
|
@ -9,6 +9,7 @@ import {
|
||||||
updateWrappedOnTerra,
|
updateWrappedOnTerra,
|
||||||
updateWrappedOnSolana,
|
updateWrappedOnSolana,
|
||||||
postVaaSolana,
|
postVaaSolana,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { WalletContextState } from "@solana/wallet-adapter-react";
|
import { WalletContextState } from "@solana/wallet-adapter-react";
|
||||||
import { Connection } from "@solana/web3.js";
|
import { Connection } from "@solana/web3.js";
|
||||||
|
@ -35,7 +36,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
|
|
|
@ -3,6 +3,7 @@ import {
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
getClaimAddressSolana,
|
getClaimAddressSolana,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
parseNFTPayload,
|
parseNFTPayload,
|
||||||
postVaaSolana,
|
postVaaSolana,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
|
@ -31,7 +32,6 @@ import {
|
||||||
SOL_BRIDGE_ADDRESS,
|
SOL_BRIDGE_ADDRESS,
|
||||||
SOL_NFT_BRIDGE_ADDRESS,
|
SOL_NFT_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { getMetadataAddress } from "../utils/metaplex";
|
import { getMetadataAddress } from "../utils/metaplex";
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
|
|
|
@ -4,6 +4,7 @@ import {
|
||||||
getEmitterAddressEth,
|
getEmitterAddressEth,
|
||||||
getEmitterAddressSolana,
|
getEmitterAddressSolana,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
parseSequenceFromLogEth,
|
parseSequenceFromLogEth,
|
||||||
parseSequenceFromLogSolana,
|
parseSequenceFromLogSolana,
|
||||||
uint8ArrayToHex,
|
uint8ArrayToHex,
|
||||||
|
@ -46,7 +47,6 @@ import {
|
||||||
SOL_BRIDGE_ADDRESS,
|
SOL_BRIDGE_ADDRESS,
|
||||||
SOL_NFT_BRIDGE_ADDRESS,
|
SOL_NFT_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
postVaaSolana,
|
postVaaSolana,
|
||||||
redeemAndUnwrapOnSolana,
|
redeemAndUnwrapOnSolana,
|
||||||
redeemOnEth,
|
redeemOnEth,
|
||||||
|
@ -34,7 +35,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
import { Alert } from "@material-ui/lab";
|
import { Alert } from "@material-ui/lab";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getEmitterAddressSolana,
|
getEmitterAddressSolana,
|
||||||
getEmitterAddressTerra,
|
getEmitterAddressTerra,
|
||||||
hexToUint8Array,
|
hexToUint8Array,
|
||||||
|
isEVMChain,
|
||||||
parseSequenceFromLogEth,
|
parseSequenceFromLogEth,
|
||||||
parseSequenceFromLogSolana,
|
parseSequenceFromLogSolana,
|
||||||
parseSequenceFromLogTerra,
|
parseSequenceFromLogTerra,
|
||||||
|
@ -55,7 +56,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||||
import parseError from "../utils/parseError";
|
import parseError from "../utils/parseError";
|
||||||
import { signSendAndConfirm } from "../utils/solana";
|
import { signSendAndConfirm } from "../utils/solana";
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { hexlify, hexStripZeros } from "@ethersproject/bytes";
|
import { hexlify, hexStripZeros } from "@ethersproject/bytes";
|
||||||
import { useConnectedWallet } from "@terra-money/wallet-provider";
|
import { useConnectedWallet } from "@terra-money/wallet-provider";
|
||||||
|
@ -9,7 +10,6 @@ import { useCallback, useMemo } from "react";
|
||||||
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||||
import { useSolanaWallet } from "../contexts/SolanaWalletContext";
|
import { useSolanaWallet } from "../contexts/SolanaWalletContext";
|
||||||
import { CLUSTER, getEvmChainId } from "../utils/consts";
|
import { CLUSTER, getEvmChainId } from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
const createWalletStatus = (
|
const createWalletStatus = (
|
||||||
isReady: boolean,
|
isReady: boolean,
|
||||||
|
|
|
@ -2,11 +2,11 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { TokenInfo } from "@solana/spl-token-registry";
|
import { TokenInfo } from "@solana/spl-token-registry";
|
||||||
import { useMemo } from "react";
|
import { useMemo } from "react";
|
||||||
import { DataWrapper, getEmptyDataWrapper } from "../store/helpers";
|
import { DataWrapper, getEmptyDataWrapper } from "../store/helpers";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import { Metadata } from "../utils/metaplex";
|
import { Metadata } from "../utils/metaplex";
|
||||||
import useEvmMetadata, { EvmMetadata } from "./useEvmMetadata";
|
import useEvmMetadata, { EvmMetadata } from "./useEvmMetadata";
|
||||||
import useMetaplexData from "./useMetaplexData";
|
import useMetaplexData from "./useMetaplexData";
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getOriginalAssetSol,
|
getOriginalAssetSol,
|
||||||
getOriginalAssetTerra,
|
getOriginalAssetTerra,
|
||||||
hexToNativeString,
|
hexToNativeString,
|
||||||
|
isEVMChain,
|
||||||
uint8ArrayToHex,
|
uint8ArrayToHex,
|
||||||
uint8ArrayToNative,
|
uint8ArrayToNative,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
|
@ -33,7 +34,6 @@ import {
|
||||||
SOL_TOKEN_BRIDGE_ADDRESS,
|
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||||
TERRA_HOST,
|
TERRA_HOST,
|
||||||
} from "../utils/consts";
|
} from "../utils/consts";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
import useIsWalletReady from "./useIsWalletReady";
|
import useIsWalletReady from "./useIsWalletReady";
|
||||||
|
|
||||||
export type OriginalAssetInfo = {
|
export type OriginalAssetInfo = {
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
canonicalAddress,
|
canonicalAddress,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
uint8ArrayToHex,
|
uint8ArrayToHex,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { arrayify, zeroPad } from "@ethersproject/bytes";
|
import { arrayify, zeroPad } from "@ethersproject/bytes";
|
||||||
|
@ -25,7 +26,6 @@ import {
|
||||||
selectTransferTargetParsedTokenAccount,
|
selectTransferTargetParsedTokenAccount,
|
||||||
} from "../store/selectors";
|
} from "../store/selectors";
|
||||||
import { setTargetAddressHex as setTransferTargetAddressHex } from "../store/transferSlice";
|
import { setTargetAddressHex as setTransferTargetAddressHex } from "../store/transferSlice";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
function useSyncTargetAddress(shouldFire: boolean, nft?: boolean) {
|
function useSyncTargetAddress(shouldFire: boolean, nft?: boolean) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
isEVMChain,
|
||||||
} from "@certusone/wormhole-sdk";
|
} from "@certusone/wormhole-sdk";
|
||||||
import { Provider } from "@certusone/wormhole-sdk/node_modules/@ethersproject/abstract-provider";
|
import { Provider } from "@certusone/wormhole-sdk/node_modules/@ethersproject/abstract-provider";
|
||||||
import { formatUnits } from "@ethersproject/units";
|
import { formatUnits } from "@ethersproject/units";
|
||||||
|
@ -19,7 +20,6 @@ import { getMultipleAccountsRPC } from "../utils/solana";
|
||||||
import { NATIVE_TERRA_DECIMALS } from "../utils/terra";
|
import { NATIVE_TERRA_DECIMALS } from "../utils/terra";
|
||||||
import useIsWalletReady from "./useIsWalletReady";
|
import useIsWalletReady from "./useIsWalletReady";
|
||||||
import { LCDClient } from "@terra-money/terra.js";
|
import { LCDClient } from "@terra-money/terra.js";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
export type GasEstimate = {
|
export type GasEstimate = {
|
||||||
currentGasPrice: string;
|
currentGasPrice: string;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
import { CHAIN_ID_SOLANA } from "@certusone/wormhole-sdk";
|
import { CHAIN_ID_SOLANA, isEVMChain } from "@certusone/wormhole-sdk";
|
||||||
import { ethers } from "ethers";
|
import { ethers } from "ethers";
|
||||||
import { parseUnits } from "ethers/lib/utils";
|
import { parseUnits } from "ethers/lib/utils";
|
||||||
import { RootState } from ".";
|
import { RootState } from ".";
|
||||||
import { isEVMChain } from "../utils/ethereum";
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Attest
|
* Attest
|
||||||
|
|
|
@ -2,6 +2,7 @@ import {
|
||||||
ChainId,
|
ChainId,
|
||||||
CHAIN_ID_BSC,
|
CHAIN_ID_BSC,
|
||||||
CHAIN_ID_ETH,
|
CHAIN_ID_ETH,
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
CHAIN_ID_POLYGON,
|
CHAIN_ID_POLYGON,
|
||||||
CHAIN_ID_SOLANA,
|
CHAIN_ID_SOLANA,
|
||||||
CHAIN_ID_TERRA,
|
CHAIN_ID_TERRA,
|
||||||
|
@ -64,7 +65,12 @@ export const CHAINS =
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: CHAIN_ID_ETH,
|
id: CHAIN_ID_ETH,
|
||||||
name: "Ethereum",
|
name: "Ethereum (Goerli)",
|
||||||
|
logo: ethIcon,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id: CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||||
|
name: "Ethereum (Ropsten)",
|
||||||
logo: ethIcon,
|
logo: ethIcon,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -110,6 +116,7 @@ export const CHAINS_WITH_NFT_SUPPORT = CHAINS.filter(
|
||||||
({ id }) =>
|
({ id }) =>
|
||||||
id === CHAIN_ID_BSC ||
|
id === CHAIN_ID_BSC ||
|
||||||
id === CHAIN_ID_ETH ||
|
id === CHAIN_ID_ETH ||
|
||||||
|
id === CHAIN_ID_ETHEREUM_ROPSTEN ||
|
||||||
id === CHAIN_ID_POLYGON ||
|
id === CHAIN_ID_POLYGON ||
|
||||||
id === CHAIN_ID_SOLANA
|
id === CHAIN_ID_SOLANA
|
||||||
);
|
);
|
||||||
|
@ -121,7 +128,7 @@ export const CHAINS_BY_ID: ChainsById = CHAINS.reduce((obj, chain) => {
|
||||||
export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
||||||
chainId === CHAIN_ID_SOLANA
|
chainId === CHAIN_ID_SOLANA
|
||||||
? "SOL"
|
? "SOL"
|
||||||
: chainId === CHAIN_ID_ETH
|
: chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
? "ETH"
|
? "ETH"
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? "BNB"
|
? "BNB"
|
||||||
|
@ -131,7 +138,7 @@ export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
||||||
? "MATIC"
|
? "MATIC"
|
||||||
: "";
|
: "";
|
||||||
export const getExplorerName = (chainId: ChainId) =>
|
export const getExplorerName = (chainId: ChainId) =>
|
||||||
chainId === CHAIN_ID_ETH
|
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
? "Etherscan"
|
? "Etherscan"
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? "BscScan"
|
? "BscScan"
|
||||||
|
@ -155,6 +162,8 @@ export const WORMHOLE_RPC_HOSTS =
|
||||||
: ["http://localhost:7071"];
|
: ["http://localhost:7071"];
|
||||||
export const ETH_NETWORK_CHAIN_ID =
|
export const ETH_NETWORK_CHAIN_ID =
|
||||||
CLUSTER === "mainnet" ? 1 : CLUSTER === "testnet" ? 5 : 1337;
|
CLUSTER === "mainnet" ? 1 : CLUSTER === "testnet" ? 5 : 1337;
|
||||||
|
export const ROPSTEN_ETH_NETWORK_CHAIN_ID =
|
||||||
|
CLUSTER === "mainnet" ? 1 : CLUSTER === "testnet" ? 3 : 1337;
|
||||||
export const BSC_NETWORK_CHAIN_ID =
|
export const BSC_NETWORK_CHAIN_ID =
|
||||||
CLUSTER === "mainnet" ? 56 : CLUSTER === "testnet" ? 97 : 1397;
|
CLUSTER === "mainnet" ? 56 : CLUSTER === "testnet" ? 97 : 1397;
|
||||||
export const POLYGON_NETWORK_CHAIN_ID =
|
export const POLYGON_NETWORK_CHAIN_ID =
|
||||||
|
@ -162,6 +171,8 @@ export const POLYGON_NETWORK_CHAIN_ID =
|
||||||
export const getEvmChainId = (chainId: ChainId) =>
|
export const getEvmChainId = (chainId: ChainId) =>
|
||||||
chainId === CHAIN_ID_ETH
|
chainId === CHAIN_ID_ETH
|
||||||
? ETH_NETWORK_CHAIN_ID
|
? ETH_NETWORK_CHAIN_ID
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? ROPSTEN_ETH_NETWORK_CHAIN_ID
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? BSC_NETWORK_CHAIN_ID
|
? BSC_NETWORK_CHAIN_ID
|
||||||
: chainId === CHAIN_ID_POLYGON
|
: chainId === CHAIN_ID_POLYGON
|
||||||
|
@ -197,63 +208,63 @@ export const ETH_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x62a7343b7cF1dC590c983F6A376DCfD3978fC058"
|
? "0x706abc4E45D419950511e474C7B9Ed348A4a716c"
|
||||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||||
);
|
);
|
||||||
export const ETH_NFT_BRIDGE_ADDRESS = getAddress(
|
export const ETH_NFT_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x6FFd7EdE62328b3Af38FCD61461Bbfc52F5651fE"
|
? "0x6FFd7EdE62328b3Af38FCD61461Bbfc52F5651fE"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0xCD83eCbf3ACCeaD559d297b55a5eF97b8575fb28"
|
? "0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB"
|
||||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||||
);
|
);
|
||||||
export const ETH_TOKEN_BRIDGE_ADDRESS = getAddress(
|
export const ETH_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
? "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x2Ea77593966FF0D3A1aa9ed07B87396AB4604988"
|
? "0xF890982f9310df57d00f659cf4fd87e65adEd8d7"
|
||||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||||
);
|
);
|
||||||
export const BSC_BRIDGE_ADDRESS = getAddress(
|
export const BSC_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x61D9309dC73CcAC3c639aeC497A11320C5A72074"
|
? "0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D"
|
||||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||||
);
|
);
|
||||||
export const BSC_NFT_BRIDGE_ADDRESS = getAddress(
|
export const BSC_NFT_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x55A525D72f4b08762991e4ECDB1aDb5Ab55dFf37"
|
? "0xcD16E5613EF35599dc82B24Cb45B5A93D779f1EE"
|
||||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||||
);
|
);
|
||||||
export const BSC_TOKEN_BRIDGE_ADDRESS = getAddress(
|
export const BSC_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7"
|
? "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0xC708B76f0C28040A0f852DbacB26375eDB071c1D"
|
? "0x9dcF9D205C9De35334D646BeE44b2D2859712A09"
|
||||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||||
);
|
);
|
||||||
export const POLYGON_BRIDGE_ADDRESS = getAddress(
|
export const POLYGON_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"
|
? "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x7809224E0477e821C3c4Ee25Ef47538b90f66455"
|
? "0x0CBE91CF822c73C2315FB05100C2F714765d5c20"
|
||||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||||
);
|
);
|
||||||
export const POLYGON_NFT_BRIDGE_ADDRESS = getAddress(
|
export const POLYGON_NFT_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x90BBd86a6Fe93D3bc3ed6335935447E75fAb7fCf"
|
? "0x90BBd86a6Fe93D3bc3ed6335935447E75fAb7fCf"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x765b15a2694B93dD755c769510eaC175350BAd37"
|
? "0x51a02d0dcb5e52F5b92bdAA38FA013C91c7309A9"
|
||||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||||
);
|
);
|
||||||
export const POLYGON_TOKEN_BRIDGE_ADDRESS = getAddress(
|
export const POLYGON_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x83Fb84F047B31e7C6C78E73AE4D0e1B240995A0e"
|
? "0x377D55a7928c046E18eEbb61977e714d2a76472a"
|
||||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||||
);
|
);
|
||||||
export const SOL_BRIDGE_ADDRESS =
|
export const SOL_BRIDGE_ADDRESS =
|
||||||
|
@ -272,8 +283,29 @@ export const SOL_TOKEN_BRIDGE_ADDRESS =
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
|
? "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "8GDCQWxKn94g4pWEucCY98TdwS671Thg7jALitKd3vmt"
|
? "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe"
|
||||||
: "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE";
|
: "B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE";
|
||||||
|
export const ROPSTEN_ETH_BRIDGE_ADDRESS = getAddress(
|
||||||
|
CLUSTER === "mainnet"
|
||||||
|
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
||||||
|
: CLUSTER === "testnet"
|
||||||
|
? "0x210c5F5e2AF958B4defFe715Dc621b7a3BA888c5"
|
||||||
|
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||||
|
);
|
||||||
|
export const ROPSTEN_ETH_NFT_BRIDGE_ADDRESS = getAddress(
|
||||||
|
CLUSTER === "mainnet"
|
||||||
|
? "0x6FFd7EdE62328b3Af38FCD61461Bbfc52F5651fE"
|
||||||
|
: CLUSTER === "testnet"
|
||||||
|
? "0x2b048Da40f69c8dc386a56705915f8E966fe1eba"
|
||||||
|
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||||
|
);
|
||||||
|
export const ROPSTEN_ETH_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||||
|
CLUSTER === "mainnet"
|
||||||
|
? "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
||||||
|
: CLUSTER === "testnet"
|
||||||
|
? "0xF174F9A837536C449321df1Ca093Bb96948D5386"
|
||||||
|
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||||
|
);
|
||||||
|
|
||||||
export const SOL_CUSTODY_ADDRESS =
|
export const SOL_CUSTODY_ADDRESS =
|
||||||
"GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m";
|
"GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m";
|
||||||
|
@ -305,6 +337,8 @@ export const getBridgeAddressForChain = (chainId: ChainId) =>
|
||||||
? TERRA_BRIDGE_ADDRESS
|
? TERRA_BRIDGE_ADDRESS
|
||||||
: chainId === CHAIN_ID_POLYGON
|
: chainId === CHAIN_ID_POLYGON
|
||||||
? POLYGON_BRIDGE_ADDRESS
|
? POLYGON_BRIDGE_ADDRESS
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? ROPSTEN_ETH_BRIDGE_ADDRESS
|
||||||
: "";
|
: "";
|
||||||
export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
||||||
chainId === CHAIN_ID_SOLANA
|
chainId === CHAIN_ID_SOLANA
|
||||||
|
@ -315,6 +349,8 @@ export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
||||||
? BSC_NFT_BRIDGE_ADDRESS
|
? BSC_NFT_BRIDGE_ADDRESS
|
||||||
: chainId === CHAIN_ID_POLYGON
|
: chainId === CHAIN_ID_POLYGON
|
||||||
? POLYGON_NFT_BRIDGE_ADDRESS
|
? POLYGON_NFT_BRIDGE_ADDRESS
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? ROPSTEN_ETH_NFT_BRIDGE_ADDRESS
|
||||||
: "";
|
: "";
|
||||||
export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
||||||
chainId === CHAIN_ID_SOLANA
|
chainId === CHAIN_ID_SOLANA
|
||||||
|
@ -327,6 +363,8 @@ export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
||||||
? TERRA_TOKEN_BRIDGE_ADDRESS
|
? TERRA_TOKEN_BRIDGE_ADDRESS
|
||||||
: chainId === CHAIN_ID_POLYGON
|
: chainId === CHAIN_ID_POLYGON
|
||||||
? POLYGON_TOKEN_BRIDGE_ADDRESS
|
? POLYGON_TOKEN_BRIDGE_ADDRESS
|
||||||
|
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
? ROPSTEN_ETH_TOKEN_BRIDGE_ADDRESS
|
||||||
: "";
|
: "";
|
||||||
|
|
||||||
export const COVALENT_API_KEY = process.env.REACT_APP_COVALENT_API_KEY
|
export const COVALENT_API_KEY = process.env.REACT_APP_COVALENT_API_KEY
|
||||||
|
@ -344,7 +382,7 @@ export const COVALENT_GET_TOKENS_URL = (
|
||||||
noNftMetadata?: boolean
|
noNftMetadata?: boolean
|
||||||
) => {
|
) => {
|
||||||
const chainNum =
|
const chainNum =
|
||||||
chainId === CHAIN_ID_ETH
|
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
? COVALENT_ETHEREUM
|
? COVALENT_ETHEREUM
|
||||||
: chainId === CHAIN_ID_BSC
|
: chainId === CHAIN_ID_BSC
|
||||||
? COVALENT_BSC
|
? COVALENT_BSC
|
||||||
|
@ -363,7 +401,7 @@ export const WETH_ADDRESS =
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
? "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x0000000000000000000000000000000000000000"
|
? "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"
|
||||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||||
export const WETH_DECIMALS = 18;
|
export const WETH_DECIMALS = 18;
|
||||||
|
|
||||||
|
@ -371,7 +409,7 @@ export const WBNB_ADDRESS =
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
|
? "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x0000000000000000000000000000000000000000"
|
? "0xae13d989dac2f0debff460ac112a837c89baa7cd"
|
||||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||||
export const WBNB_DECIMALS = 18;
|
export const WBNB_DECIMALS = 18;
|
||||||
|
|
||||||
|
@ -379,10 +417,18 @@ export const WMATIC_ADDRESS =
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"
|
? "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"
|
||||||
: CLUSTER === "testnet"
|
: CLUSTER === "testnet"
|
||||||
? "0x0000000000000000000000000000000000000000"
|
? "0x9c3c9283d3e44854697cd22d3faa240cfb032889"
|
||||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||||
export const WMATIC_DECIMALS = 18;
|
export const WMATIC_DECIMALS = 18;
|
||||||
|
|
||||||
|
export const ROPSTEN_WETH_ADDRESS =
|
||||||
|
CLUSTER === "mainnet"
|
||||||
|
? "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||||
|
: CLUSTER === "testnet"
|
||||||
|
? "0xc778417e063141139fce010982780140aa0cd5ab"
|
||||||
|
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||||
|
export const ROPSTEN_WETH_DECIMALS = 18;
|
||||||
|
|
||||||
export const WORMHOLE_V1_ETH_ADDRESS =
|
export const WORMHOLE_V1_ETH_ADDRESS =
|
||||||
CLUSTER === "mainnet"
|
CLUSTER === "mainnet"
|
||||||
? "0xf92cD566Ea4864356C5491c177A430C222d7e678"
|
? "0xf92cD566Ea4864356C5491c177A430C222d7e678"
|
||||||
|
|
|
@ -1,8 +1,4 @@
|
||||||
import {
|
import {
|
||||||
ChainId,
|
|
||||||
CHAIN_ID_BSC,
|
|
||||||
CHAIN_ID_ETH,
|
|
||||||
CHAIN_ID_POLYGON,
|
|
||||||
NFTImplementation,
|
NFTImplementation,
|
||||||
NFTImplementation__factory,
|
NFTImplementation__factory,
|
||||||
TokenImplementation,
|
TokenImplementation,
|
||||||
|
@ -15,11 +11,6 @@ import {
|
||||||
createParsedTokenAccount,
|
createParsedTokenAccount,
|
||||||
} from "../hooks/useGetSourceParsedTokenAccounts";
|
} from "../hooks/useGetSourceParsedTokenAccounts";
|
||||||
|
|
||||||
export const isEVMChain = (chainId: ChainId) =>
|
|
||||||
chainId === CHAIN_ID_ETH ||
|
|
||||||
chainId === CHAIN_ID_BSC ||
|
|
||||||
chainId === CHAIN_ID_POLYGON;
|
|
||||||
|
|
||||||
//This is a valuable intermediate step to the parsed token account, as the token has metadata information on it.
|
//This is a valuable intermediate step to the parsed token account, as the token has metadata information on it.
|
||||||
export async function getEthereumToken(
|
export async function getEthereumToken(
|
||||||
tokenAddress: string,
|
tokenAddress: string,
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.1.1
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
CHAIN_ID_ETHEREUM_ROPSTEN
|
||||||
|
|
||||||
## 0.1.0
|
## 0.1.0
|
||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
|
@ -31,7 +31,7 @@ export const hexToNativeString = (h: string | undefined, c: ChainId) => {
|
||||||
? undefined
|
? undefined
|
||||||
: c === CHAIN_ID_SOLANA
|
: c === CHAIN_ID_SOLANA
|
||||||
? new PublicKey(hexToUint8Array(h)).toString()
|
? new PublicKey(hexToUint8Array(h)).toString()
|
||||||
: c === CHAIN_ID_ETH || c === CHAIN_ID_BSC || c === CHAIN_ID_POLYGON || c === CHAIN_ID_ETHEREUM_ROPSTEN
|
: isEVMChain(c)
|
||||||
? hexZeroPad(hexValue(hexToUint8Array(h)), 20)
|
? hexZeroPad(hexValue(hexToUint8Array(h)), 20)
|
||||||
: c === CHAIN_ID_TERRA
|
: c === CHAIN_ID_TERRA
|
||||||
? isHexNativeTerra(h)
|
? isHexNativeTerra(h)
|
||||||
|
|
Loading…
Reference in New Issue