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 { Alert } from "@material-ui/lab";
|
||||
import { useCallback, useMemo } from "react";
|
||||
|
@ -11,7 +12,6 @@ import {
|
|||
selectAttestTargetChain,
|
||||
} from "../../store/selectors";
|
||||
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import ChainSelect from "../ChainSelect";
|
||||
import KeyAndBalance from "../KeyAndBalance";
|
||||
|
|
|
@ -2,8 +2,8 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import EthereumSignerKey from "./EthereumSignerKey";
|
||||
import SolanaWalletKey from "./SolanaWalletKey";
|
||||
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 { VerifiedUser } from "@material-ui/icons";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -15,7 +15,6 @@ import {
|
|||
selectNFTSourceError,
|
||||
} from "../../store/selectors";
|
||||
import { CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import ChainSelect from "../ChainSelect";
|
||||
import KeyAndBalance from "../KeyAndBalance";
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
hexToNativeString,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { makeStyles, TextField, Typography } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -26,7 +27,6 @@ import {
|
|||
selectNFTTargetError,
|
||||
} from "../../store/selectors";
|
||||
import { CHAINS_BY_ID, CHAINS_WITH_NFT_SUPPORT } from "../../utils/consts";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import ChainSelect from "../ChainSelect";
|
||||
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 { useSelector } from "react-redux";
|
||||
import {
|
||||
|
@ -9,7 +9,6 @@ import {
|
|||
selectNFTTargetChain,
|
||||
selectNFTTransferTx,
|
||||
} from "../../store/selectors";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import { WAITING_FOR_WALLET_AND_CONF } from "../Transfer/WaitingForWalletMessage";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
hexToNativeString,
|
||||
isEVMChain,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
|
@ -42,7 +43,6 @@ import {
|
|||
import {
|
||||
ethNFTToNFTParsedTokenAccount,
|
||||
getEthereumNFT,
|
||||
isEVMChain,
|
||||
isNFT,
|
||||
isValidEthereumAddress,
|
||||
} from "../utils/ethereum";
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
getEmitterAddressTerra,
|
||||
hexToNativeString,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
parseNFTPayload,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
|
@ -54,7 +55,6 @@ import {
|
|||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
WORMHOLE_RPC_HOSTS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
import ButtonWithLoader from "./ButtonWithLoader";
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
|
@ -38,6 +39,10 @@ export default function ShowTx({
|
|||
? `https://${CLUSTER === "testnet" ? "goerli." : ""}etherscan.io/tx/${
|
||||
tx?.id
|
||||
}`
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? `https://${CLUSTER === "testnet" ? "ropsten." : ""}etherscan.io/tx/${
|
||||
tx?.id
|
||||
}`
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? `https://${CLUSTER === "testnet" ? "testnet." : ""}bscscan.com/tx/${
|
||||
tx?.id
|
||||
|
@ -49,7 +54,7 @@ export default function ShowTx({
|
|||
: chainId === CHAIN_ID_SOLANA
|
||||
? `https://explorer.solana.com/tx/${tx?.id}${
|
||||
CLUSTER === "testnet"
|
||||
? "?cluster=testnet"
|
||||
? "?cluster=devnet"
|
||||
: CLUSTER === "devnet"
|
||||
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
||||
: ""
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
|
@ -97,6 +98,10 @@ export default function SmartAddress({
|
|||
? `https://${
|
||||
CLUSTER === "testnet" ? "goerli." : ""
|
||||
}etherscan.io/address/${useableAddress}`
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? `https://${
|
||||
CLUSTER === "testnet" ? "ropsten." : ""
|
||||
}etherscan.io/address/${useableAddress}`
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? `https://${
|
||||
CLUSTER === "testnet" ? "testnet." : ""
|
||||
|
@ -108,7 +113,7 @@ export default function SmartAddress({
|
|||
: chainId === CHAIN_ID_SOLANA
|
||||
? `https://explorer.solana.com/address/${useableAddress}${
|
||||
CLUSTER === "testnet"
|
||||
? "?cluster=testnet"
|
||||
? "?cluster=devnet"
|
||||
: CLUSTER === "devnet"
|
||||
? "?cluster=custom&customUrl=http%3A%2F%2Flocalhost%3A8899"
|
||||
: ""
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
nativeToHexString,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
|
@ -24,7 +25,6 @@ import useMetadata from "../hooks/useMetadata";
|
|||
import useOriginalAsset, { OriginalAssetInfo } from "../hooks/useOriginalAsset";
|
||||
import { COLORS } from "../muiTheme";
|
||||
import { BETA_CHAINS, CHAINS, CHAINS_BY_ID } from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import HeaderText from "./HeaderText";
|
||||
import KeyAndBalance from "./KeyAndBalance";
|
||||
import SmartAddress from "./SmartAddress";
|
||||
|
|
|
@ -15,6 +15,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -49,7 +50,7 @@ const LogoIcon = ({ chainId }: { chainId: ChainId }) =>
|
|||
src={solanaIcon}
|
||||
alt="Solana"
|
||||
/>
|
||||
) : chainId === CHAIN_ID_ETH ? (
|
||||
) : chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN ? (
|
||||
<Avatar
|
||||
style={{
|
||||
backgroundColor: "white",
|
||||
|
@ -380,7 +381,8 @@ export default function NFTViewer({
|
|||
>
|
||||
<div
|
||||
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.solana]: chainId === CHAIN_ID_SOLANA,
|
||||
[classes.polygon]: chainId === CHAIN_ID_POLYGON,
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
//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 { useCallback } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
@ -20,7 +24,6 @@ import {
|
|||
setSourceParsedTokenAccount as setTransferSourceParsedTokenAccount,
|
||||
setSourceWalletAddress as setTransferSourceWalletAddress,
|
||||
} from "../../store/transferSlice";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import EvmTokenPicker from "./EvmTokenPicker";
|
||||
import RefreshButtonWrapper from "./RefreshButtonWrapper";
|
||||
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 { Connection } from "@solana/web3.js";
|
||||
import { useEffect, useState } from "react";
|
||||
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||
import { Transaction } from "../store/transferSlice";
|
||||
import { CHAINS_BY_ID, SOLANA_HOST } from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
root: {
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { isEVMChain } from "@certusone/wormhole-sdk";
|
||||
import { Button, makeStyles } from "@material-ui/core";
|
||||
import detectEthereumProvider from "@metamask/detect-provider";
|
||||
import { useCallback } from "react";
|
||||
|
@ -12,7 +13,6 @@ import { getEvmChainId } from "../../utils/consts";
|
|||
import {
|
||||
ethTokenToParsedTokenAccount,
|
||||
getEthereumToken,
|
||||
isEVMChain,
|
||||
} from "../../utils/ethereum";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
WSOL_ADDRESS,
|
||||
|
@ -14,7 +15,12 @@ import {
|
|||
selectTransferTargetAsset,
|
||||
selectTransferTargetChain,
|
||||
} 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 KeyAndBalance from "../KeyAndBalance";
|
||||
import { SolanaCreateAssociatedAddressAlternate } from "../SolanaCreateAssociatedAddress";
|
||||
|
@ -32,6 +38,10 @@ function Redeem() {
|
|||
targetChain === CHAIN_ID_ETH &&
|
||||
targetAsset &&
|
||||
targetAsset.toLowerCase() === WETH_ADDRESS.toLowerCase();
|
||||
const isEthRopstenNative =
|
||||
targetChain === CHAIN_ID_ETHEREUM_ROPSTEN &&
|
||||
targetAsset &&
|
||||
targetAsset.toLowerCase() === ROPSTEN_WETH_ADDRESS.toLowerCase();
|
||||
const isBscNative =
|
||||
targetChain === CHAIN_ID_BSC &&
|
||||
targetAsset &&
|
||||
|
@ -45,7 +55,11 @@ function Redeem() {
|
|||
targetAsset &&
|
||||
targetAsset === WSOL_ADDRESS;
|
||||
const isNativeEligible =
|
||||
isEthNative || isBscNative || isPolygonNative || isSolNative;
|
||||
isEthNative ||
|
||||
isEthRopstenNative ||
|
||||
isBscNative ||
|
||||
isPolygonNative ||
|
||||
isSolNative;
|
||||
const [useNativeRedeem, setUseNativeRedeem] = useState(true);
|
||||
const toggleNativeRedeem = useCallback(() => {
|
||||
setUseNativeRedeem(!useNativeRedeem);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import { isEVMChain } from "@certusone/wormhole-sdk";
|
||||
import { Checkbox, FormControlLabel } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { ethers } from "ethers";
|
||||
|
@ -18,7 +19,6 @@ import {
|
|||
selectTransferTransferTx,
|
||||
} from "../../store/selectors";
|
||||
import { CHAINS_BY_ID } from "../../utils/consts";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import KeyAndBalance from "../KeyAndBalance";
|
||||
import ShowTx from "../ShowTx";
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
hexToNativeString,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { makeStyles, Typography } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
@ -26,7 +27,6 @@ import {
|
|||
} from "../../store/selectors";
|
||||
import { incrementStep, setTargetChain } from "../../store/transferSlice";
|
||||
import { CHAINS, CHAINS_BY_ID } from "../../utils/consts";
|
||||
import { isEVMChain } from "../../utils/ethereum";
|
||||
import ButtonWithLoader from "../ButtonWithLoader";
|
||||
import ChainSelect from "../ChainSelect";
|
||||
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 { useEffect, useMemo, useState } from "react";
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
|
@ -6,7 +11,6 @@ import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
|||
import { selectTransferIsApproving } from "../store/selectors";
|
||||
import { setIsApproving } from "../store/transferSlice";
|
||||
import { getTokenBridgeAddressForChain } from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
export default function useAllowance(
|
||||
chainId: ChainId,
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
getOriginalAssetEth,
|
||||
getOriginalAssetSol,
|
||||
getOriginalAssetTerra,
|
||||
isEVMChain,
|
||||
uint8ArrayToHex,
|
||||
WormholeWrappedInfo,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -36,7 +37,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
export interface StateSafeWormholeWrappedInfo {
|
||||
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 { useEffect, useMemo, useState } from "react";
|
||||
import {
|
||||
|
@ -6,7 +6,6 @@ import {
|
|||
useEthereumProvider,
|
||||
} from "../contexts/EthereumProviderContext";
|
||||
import { DataWrapper } from "../store/helpers";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
|
||||
export type EvmMetadata = {
|
||||
|
|
|
@ -5,6 +5,7 @@ import {
|
|||
getForeignAssetSolana,
|
||||
getForeignAssetTerra,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
nativeToHexString,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
@ -21,7 +22,6 @@ import {
|
|||
TERRA_HOST,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
|
||||
export type ForeignAssetInfo = {
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
getForeignAssetTerra,
|
||||
hexToNativeString,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import {
|
||||
getForeignAssetEth as getForeignAssetEthNFT,
|
||||
|
@ -50,7 +51,6 @@ import {
|
|||
TERRA_HOST,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
function useFetchTargetAsset(nft?: boolean) {
|
||||
const dispatch = useDispatch();
|
||||
|
|
|
@ -2,9 +2,11 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
WSOL_ADDRESS,
|
||||
WSOL_DECIMALS,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -55,6 +57,8 @@ import {
|
|||
} from "../store/transferSlice";
|
||||
import {
|
||||
COVALENT_GET_TOKENS_URL,
|
||||
ROPSTEN_WETH_ADDRESS,
|
||||
ROPSTEN_WETH_DECIMALS,
|
||||
SOLANA_HOST,
|
||||
WBNB_ADDRESS,
|
||||
WBNB_DECIMALS,
|
||||
|
@ -63,7 +67,6 @@ import {
|
|||
WMATIC_ADDRESS,
|
||||
WMATIC_DECIMALS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import {
|
||||
ExtractedMintInfo,
|
||||
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 = (
|
||||
provider: Provider,
|
||||
signerAddress: string | undefined
|
||||
|
@ -608,6 +634,40 @@ function useGetAvailableTokens(nft: boolean = false) {
|
|||
};
|
||||
}, [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
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
TokenImplementation__factory,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Connection, PublicKey } from "@solana/web3.js";
|
||||
|
@ -17,7 +18,6 @@ import {
|
|||
} from "../store/selectors";
|
||||
import { setTargetParsedTokenAccount } from "../store/transferSlice";
|
||||
import { getEvmChainId, SOLANA_HOST, TERRA_HOST } from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { createParsedTokenAccount } from "./useGetSourceParsedTokenAccounts";
|
||||
import useMetadata from "./useMetadata";
|
||||
|
||||
|
|
|
@ -8,6 +8,7 @@ import {
|
|||
getEmitterAddressEth,
|
||||
getEmitterAddressSolana,
|
||||
getEmitterAddressTerra,
|
||||
isEVMChain,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
parseSequenceFromLogTerra,
|
||||
|
@ -46,7 +47,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
|
|
|
@ -9,6 +9,7 @@ import {
|
|||
updateWrappedOnTerra,
|
||||
updateWrappedOnSolana,
|
||||
postVaaSolana,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { WalletContextState } from "@solana/wallet-adapter-react";
|
||||
import { Connection } from "@solana/web3.js";
|
||||
|
@ -35,7 +36,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
|
|
@ -3,6 +3,7 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
getClaimAddressSolana,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
parseNFTPayload,
|
||||
postVaaSolana,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -31,7 +32,6 @@ import {
|
|||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { getMetadataAddress } from "../utils/metaplex";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
|
|
|
@ -4,6 +4,7 @@ import {
|
|||
getEmitterAddressEth,
|
||||
getEmitterAddressSolana,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
uint8ArrayToHex,
|
||||
|
@ -46,7 +47,6 @@ import {
|
|||
SOL_BRIDGE_ADDRESS,
|
||||
SOL_NFT_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
postVaaSolana,
|
||||
redeemAndUnwrapOnSolana,
|
||||
redeemOnEth,
|
||||
|
@ -34,7 +35,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
getEmitterAddressSolana,
|
||||
getEmitterAddressTerra,
|
||||
hexToUint8Array,
|
||||
isEVMChain,
|
||||
parseSequenceFromLogEth,
|
||||
parseSequenceFromLogSolana,
|
||||
parseSequenceFromLogTerra,
|
||||
|
@ -55,7 +56,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_TOKEN_BRIDGE_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { getSignedVAAWithRetry } from "../utils/getSignedVAAWithRetry";
|
||||
import parseError from "../utils/parseError";
|
||||
import { signSendAndConfirm } from "../utils/solana";
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { hexlify, hexStripZeros } from "@ethersproject/bytes";
|
||||
import { useConnectedWallet } from "@terra-money/wallet-provider";
|
||||
|
@ -9,7 +10,6 @@ import { useCallback, useMemo } from "react";
|
|||
import { useEthereumProvider } from "../contexts/EthereumProviderContext";
|
||||
import { useSolanaWallet } from "../contexts/SolanaWalletContext";
|
||||
import { CLUSTER, getEvmChainId } from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
const createWalletStatus = (
|
||||
isReady: boolean,
|
||||
|
|
|
@ -2,11 +2,11 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { TokenInfo } from "@solana/spl-token-registry";
|
||||
import { useMemo } from "react";
|
||||
import { DataWrapper, getEmptyDataWrapper } from "../store/helpers";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import { Metadata } from "../utils/metaplex";
|
||||
import useEvmMetadata, { EvmMetadata } from "./useEvmMetadata";
|
||||
import useMetaplexData from "./useMetaplexData";
|
||||
|
|
|
@ -6,6 +6,7 @@ import {
|
|||
getOriginalAssetSol,
|
||||
getOriginalAssetTerra,
|
||||
hexToNativeString,
|
||||
isEVMChain,
|
||||
uint8ArrayToHex,
|
||||
uint8ArrayToNative,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -33,7 +34,6 @@ import {
|
|||
SOL_TOKEN_BRIDGE_ADDRESS,
|
||||
TERRA_HOST,
|
||||
} from "../utils/consts";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
|
||||
export type OriginalAssetInfo = {
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
canonicalAddress,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
uint8ArrayToHex,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { arrayify, zeroPad } from "@ethersproject/bytes";
|
||||
|
@ -25,7 +26,6 @@ import {
|
|||
selectTransferTargetParsedTokenAccount,
|
||||
} from "../store/selectors";
|
||||
import { setTargetAddressHex as setTransferTargetAddressHex } from "../store/transferSlice";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
function useSyncTargetAddress(shouldFire: boolean, nft?: boolean) {
|
||||
const dispatch = useDispatch();
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
isEVMChain,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { Provider } from "@certusone/wormhole-sdk/node_modules/@ethersproject/abstract-provider";
|
||||
import { formatUnits } from "@ethersproject/units";
|
||||
|
@ -19,7 +20,6 @@ import { getMultipleAccountsRPC } from "../utils/solana";
|
|||
import { NATIVE_TERRA_DECIMALS } from "../utils/terra";
|
||||
import useIsWalletReady from "./useIsWalletReady";
|
||||
import { LCDClient } from "@terra-money/terra.js";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
export type GasEstimate = {
|
||||
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 { parseUnits } from "ethers/lib/utils";
|
||||
import { RootState } from ".";
|
||||
import { isEVMChain } from "../utils/ethereum";
|
||||
|
||||
/*
|
||||
* Attest
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
|
@ -64,7 +65,12 @@ export const CHAINS =
|
|||
},
|
||||
{
|
||||
id: CHAIN_ID_ETH,
|
||||
name: "Ethereum",
|
||||
name: "Ethereum (Goerli)",
|
||||
logo: ethIcon,
|
||||
},
|
||||
{
|
||||
id: CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
name: "Ethereum (Ropsten)",
|
||||
logo: ethIcon,
|
||||
},
|
||||
{
|
||||
|
@ -110,6 +116,7 @@ export const CHAINS_WITH_NFT_SUPPORT = CHAINS.filter(
|
|||
({ id }) =>
|
||||
id === CHAIN_ID_BSC ||
|
||||
id === CHAIN_ID_ETH ||
|
||||
id === CHAIN_ID_ETHEREUM_ROPSTEN ||
|
||||
id === CHAIN_ID_POLYGON ||
|
||||
id === CHAIN_ID_SOLANA
|
||||
);
|
||||
|
@ -121,7 +128,7 @@ export const CHAINS_BY_ID: ChainsById = CHAINS.reduce((obj, chain) => {
|
|||
export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_SOLANA
|
||||
? "SOL"
|
||||
: chainId === CHAIN_ID_ETH
|
||||
: chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? "ETH"
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? "BNB"
|
||||
|
@ -131,7 +138,7 @@ export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
|||
? "MATIC"
|
||||
: "";
|
||||
export const getExplorerName = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_ETH
|
||||
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? "Etherscan"
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? "BscScan"
|
||||
|
@ -155,6 +162,8 @@ export const WORMHOLE_RPC_HOSTS =
|
|||
: ["http://localhost:7071"];
|
||||
export const ETH_NETWORK_CHAIN_ID =
|
||||
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 =
|
||||
CLUSTER === "mainnet" ? 56 : CLUSTER === "testnet" ? 97 : 1397;
|
||||
export const POLYGON_NETWORK_CHAIN_ID =
|
||||
|
@ -162,6 +171,8 @@ export const POLYGON_NETWORK_CHAIN_ID =
|
|||
export const getEvmChainId = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_ETH
|
||||
? ETH_NETWORK_CHAIN_ID
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_NETWORK_CHAIN_ID
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? BSC_NETWORK_CHAIN_ID
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
|
@ -197,63 +208,63 @@ export const ETH_BRIDGE_ADDRESS = getAddress(
|
|||
CLUSTER === "mainnet"
|
||||
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x62a7343b7cF1dC590c983F6A376DCfD3978fC058"
|
||||
? "0x706abc4E45D419950511e474C7B9Ed348A4a716c"
|
||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||
);
|
||||
export const ETH_NFT_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x6FFd7EdE62328b3Af38FCD61461Bbfc52F5651fE"
|
||||
: CLUSTER === "testnet"
|
||||
? "0xCD83eCbf3ACCeaD559d297b55a5eF97b8575fb28"
|
||||
? "0xD8E4C2DbDd2e2bd8F1336EA691dBFF6952B1a6eB"
|
||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||
);
|
||||
export const ETH_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x3ee18B2214AFF97000D974cf647E7C347E8fa585"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x2Ea77593966FF0D3A1aa9ed07B87396AB4604988"
|
||||
? "0xF890982f9310df57d00f659cf4fd87e65adEd8d7"
|
||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||
);
|
||||
export const BSC_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x98f3c9e6E3fAce36bAAd05FE09d375Ef1464288B"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x61D9309dC73CcAC3c639aeC497A11320C5A72074"
|
||||
? "0x68605AD7b15c732a30b1BbC62BE8F2A509D74b4D"
|
||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||
);
|
||||
export const BSC_NFT_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x55A525D72f4b08762991e4ECDB1aDb5Ab55dFf37"
|
||||
? "0xcD16E5613EF35599dc82B24Cb45B5A93D779f1EE"
|
||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||
);
|
||||
export const BSC_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0xB6F6D86a8f9879A9c87f643768d9efc38c1Da6E7"
|
||||
: CLUSTER === "testnet"
|
||||
? "0xC708B76f0C28040A0f852DbacB26375eDB071c1D"
|
||||
? "0x9dcF9D205C9De35334D646BeE44b2D2859712A09"
|
||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||
);
|
||||
export const POLYGON_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x7A4B5a56256163F07b2C80A7cA55aBE66c4ec4d7"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x7809224E0477e821C3c4Ee25Ef47538b90f66455"
|
||||
? "0x0CBE91CF822c73C2315FB05100C2F714765d5c20"
|
||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||
);
|
||||
export const POLYGON_NFT_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x90BBd86a6Fe93D3bc3ed6335935447E75fAb7fCf"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x765b15a2694B93dD755c769510eaC175350BAd37"
|
||||
? "0x51a02d0dcb5e52F5b92bdAA38FA013C91c7309A9"
|
||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||
);
|
||||
export const POLYGON_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x5a58505a96D1dbf8dF91cB21B54419FC36e93fdE"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x83Fb84F047B31e7C6C78E73AE4D0e1B240995A0e"
|
||||
? "0x377D55a7928c046E18eEbb61977e714d2a76472a"
|
||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||
);
|
||||
export const SOL_BRIDGE_ADDRESS =
|
||||
|
@ -272,8 +283,29 @@ export const SOL_TOKEN_BRIDGE_ADDRESS =
|
|||
CLUSTER === "mainnet"
|
||||
? "wormDTUJ6AWPNvk59vGQbDvGJmqbDTdgWgAqcLBCgUb"
|
||||
: CLUSTER === "testnet"
|
||||
? "8GDCQWxKn94g4pWEucCY98TdwS671Thg7jALitKd3vmt"
|
||||
? "DZnkkTmCiFWfYTfT41X3Rd1kDgozqzxWaHqsw6W4x2oe"
|
||||
: "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 =
|
||||
"GugU1tP7doLeTw9hQP51xRJyS8Da1fWxuiy2rVrnMD2m";
|
||||
|
@ -305,6 +337,8 @@ export const getBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? TERRA_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? POLYGON_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_BRIDGE_ADDRESS
|
||||
: "";
|
||||
export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_SOLANA
|
||||
|
@ -315,6 +349,8 @@ export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? BSC_NFT_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? POLYGON_NFT_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_NFT_BRIDGE_ADDRESS
|
||||
: "";
|
||||
export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_SOLANA
|
||||
|
@ -327,6 +363,8 @@ export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? TERRA_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? 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
|
||||
|
@ -344,7 +382,7 @@ export const COVALENT_GET_TOKENS_URL = (
|
|||
noNftMetadata?: boolean
|
||||
) => {
|
||||
const chainNum =
|
||||
chainId === CHAIN_ID_ETH
|
||||
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? COVALENT_ETHEREUM
|
||||
: chainId === CHAIN_ID_BSC
|
||||
? COVALENT_BSC
|
||||
|
@ -363,7 +401,7 @@ export const WETH_ADDRESS =
|
|||
CLUSTER === "mainnet"
|
||||
? "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x0000000000000000000000000000000000000000"
|
||||
? "0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6"
|
||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||
export const WETH_DECIMALS = 18;
|
||||
|
||||
|
@ -371,7 +409,7 @@ export const WBNB_ADDRESS =
|
|||
CLUSTER === "mainnet"
|
||||
? "0xbb4CdB9CBd36B01bD1cBaEBF2De08d9173bc095c"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x0000000000000000000000000000000000000000"
|
||||
? "0xae13d989dac2f0debff460ac112a837c89baa7cd"
|
||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||
export const WBNB_DECIMALS = 18;
|
||||
|
||||
|
@ -379,10 +417,18 @@ export const WMATIC_ADDRESS =
|
|||
CLUSTER === "mainnet"
|
||||
? "0x0d500b1d8e8ef31e21c99d1db9a6444d3adf1270"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x0000000000000000000000000000000000000000"
|
||||
? "0x9c3c9283d3e44854697cd22d3faa240cfb032889"
|
||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||
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 =
|
||||
CLUSTER === "mainnet"
|
||||
? "0xf92cD566Ea4864356C5491c177A430C222d7e678"
|
||||
|
|
|
@ -1,8 +1,4 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_POLYGON,
|
||||
NFTImplementation,
|
||||
NFTImplementation__factory,
|
||||
TokenImplementation,
|
||||
|
@ -15,11 +11,6 @@ import {
|
|||
createParsedTokenAccount,
|
||||
} 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.
|
||||
export async function getEthereumToken(
|
||||
tokenAddress: string,
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
# Changelog
|
||||
|
||||
## 0.1.1
|
||||
|
||||
### Added
|
||||
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
|
||||
## 0.1.0
|
||||
|
||||
### Added
|
||||
|
|
|
@ -31,7 +31,7 @@ export const hexToNativeString = (h: string | undefined, c: ChainId) => {
|
|||
? undefined
|
||||
: c === CHAIN_ID_SOLANA
|
||||
? 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)
|
||||
: c === CHAIN_ID_TERRA
|
||||
? isHexNativeTerra(h)
|
||||
|
|
Loading…
Reference in New Issue