bridge_ui: add avalanche to testnet / beta
This commit is contained in:
parent
29d77cda1e
commit
f74faba94a
|
@ -8,7 +8,7 @@
|
|||
"name": "test_ui",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.1.3",
|
||||
"@certusone/wormhole-sdk": "^0.1.4",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
@ -2002,9 +2002,9 @@
|
|||
}
|
||||
},
|
||||
"node_modules/@certusone/wormhole-sdk": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.1.3.tgz",
|
||||
"integrity": "sha512-rVUnxwqzF1mpG2YFZGBjUr4jCisyuU7nD4YzmzY6zO+F4ZyRKcq8NDDcdShMohm9ae9x9GwwgVx/g/JRp8VK3Q==",
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.1.4.tgz",
|
||||
"integrity": "sha512-C9GXZJ3vjBDU1Ytk6Sk5SYS3oJFjUa7vEq1NlOwHCwt5CL0vFwdrBq3WER8h1+i+/4AaGreOyCpxct0tXeasXg==",
|
||||
"dependencies": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
|
@ -45479,9 +45479,9 @@
|
|||
}
|
||||
},
|
||||
"@certusone/wormhole-sdk": {
|
||||
"version": "0.1.3",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.1.3.tgz",
|
||||
"integrity": "sha512-rVUnxwqzF1mpG2YFZGBjUr4jCisyuU7nD4YzmzY6zO+F4ZyRKcq8NDDcdShMohm9ae9x9GwwgVx/g/JRp8VK3Q==",
|
||||
"version": "0.1.4",
|
||||
"resolved": "https://registry.npmjs.org/@certusone/wormhole-sdk/-/wormhole-sdk-0.1.4.tgz",
|
||||
"integrity": "sha512-C9GXZJ3vjBDU1Ytk6Sk5SYS3oJFjUa7vEq1NlOwHCwt5CL0vFwdrBq3WER8h1+i+/4AaGreOyCpxct0tXeasXg==",
|
||||
"requires": {
|
||||
"@improbable-eng/grpc-web": "^0.14.0",
|
||||
"@solana/spl-token": "^0.1.8",
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
"version": "0.1.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"@certusone/wormhole-sdk": "^0.1.3",
|
||||
"@certusone/wormhole-sdk": "^0.1.4",
|
||||
"@material-ui/core": "^4.12.2",
|
||||
"@material-ui/icons": "^4.11.2",
|
||||
"@material-ui/lab": "^4.0.0-alpha.60",
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_POLYGON,
|
||||
|
@ -330,6 +331,17 @@ export default function NFTOriginVerifier() {
|
|||
>
|
||||
View on OpenSea
|
||||
</Button>
|
||||
) : originInfo.chainId === CHAIN_ID_AVAX ? (
|
||||
<Button
|
||||
href={`https://snowtrace.io/token/${readableAddress}?a=${originInfo.tokenId}`}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
endIcon={<Launch />}
|
||||
className={classes.viewButton}
|
||||
variant="outlined"
|
||||
>
|
||||
View on Snowtrace
|
||||
</Button>
|
||||
) : (
|
||||
<Button
|
||||
href={`https://opensea.io/assets/${readableAddress}/${originInfo.tokenId}`}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -51,6 +52,10 @@ export default function ShowTx({
|
|||
? `https://${CLUSTER === "testnet" ? "mumbai." : ""}polygonscan.com/tx/${
|
||||
tx?.id
|
||||
}`
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? `https://${CLUSTER === "testnet" ? "testnet." : ""}snowtrace.io/tx/${
|
||||
tx?.id
|
||||
}`
|
||||
: chainId === CHAIN_ID_SOLANA
|
||||
? `https://explorer.solana.com/tx/${tx?.id}${
|
||||
CLUSTER === "testnet"
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -110,6 +111,10 @@ export default function SmartAddress({
|
|||
? `https://${
|
||||
CLUSTER === "testnet" ? "mumbai." : ""
|
||||
}polygonscan.com/address/${useableAddress}`
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? `https://${
|
||||
CLUSTER === "testnet" ? "testnet." : ""
|
||||
}snowtrace.io/address/${useableAddress}`
|
||||
: chainId === CHAIN_ID_SOLANA
|
||||
? `https://explorer.solana.com/address/${useableAddress}${
|
||||
CLUSTER === "testnet"
|
||||
|
|
|
@ -13,6 +13,7 @@ import { NFTParsedTokenAccount } from "../../store/nftSlice";
|
|||
import clsx from "clsx";
|
||||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -20,6 +21,7 @@ import {
|
|||
CHAIN_ID_SOLANA,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import SmartAddress from "../SmartAddress";
|
||||
import avaxIcon from "../../icons/avax.svg";
|
||||
import bscIcon from "../../icons/bsc.svg";
|
||||
import ethIcon from "../../icons/eth.svg";
|
||||
import solanaIcon from "../../icons/solana.svg";
|
||||
|
@ -85,6 +87,18 @@ const LogoIcon = ({ chainId }: { chainId: ChainId }) =>
|
|||
src={polygonIcon}
|
||||
alt="Polygon"
|
||||
/>
|
||||
) : chainId === CHAIN_ID_AVAX ? (
|
||||
<Avatar
|
||||
style={{
|
||||
backgroundColor: "black",
|
||||
height: "1em",
|
||||
width: "1em",
|
||||
marginLeft: "4px",
|
||||
padding: "3px",
|
||||
}}
|
||||
src={avaxIcon}
|
||||
alt="Avalanche"
|
||||
/>
|
||||
) : null;
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
|
@ -374,7 +388,9 @@ export default function NFTViewer({
|
|||
<Card
|
||||
className={clsx(classes.card, {
|
||||
[classes.silverBorder]:
|
||||
chainId === CHAIN_ID_SOLANA || chainId === CHAIN_ID_POLYGON,
|
||||
chainId === CHAIN_ID_SOLANA ||
|
||||
chainId === CHAIN_ID_POLYGON ||
|
||||
chainId === CHAIN_ID_AVAX,
|
||||
[classes.hidden]: isLoading,
|
||||
})}
|
||||
elevation={10}
|
||||
|
@ -382,7 +398,9 @@ export default function NFTViewer({
|
|||
<div
|
||||
className={clsx(classes.cardInset, {
|
||||
[classes.eth]:
|
||||
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
chainId === CHAIN_ID_ETH ||
|
||||
chainId === CHAIN_ID_ETHEREUM_ROPSTEN ||
|
||||
chainId === CHAIN_ID_AVAX, //TODO: give avax it's own bg
|
||||
[classes.bsc]: chainId === CHAIN_ID_BSC,
|
||||
[classes.solana]: chainId === CHAIN_ID_SOLANA,
|
||||
[classes.polygon]: chainId === CHAIN_ID_POLYGON,
|
||||
|
@ -407,7 +425,9 @@ export default function NFTViewer({
|
|||
<CardMedia
|
||||
className={clsx(classes.mediaContent, {
|
||||
[classes.silverMediaBorder]:
|
||||
chainId === CHAIN_ID_SOLANA || chainId === CHAIN_ID_POLYGON,
|
||||
chainId === CHAIN_ID_SOLANA ||
|
||||
chainId === CHAIN_ID_POLYGON ||
|
||||
chainId === CHAIN_ID_AVAX,
|
||||
})}
|
||||
>
|
||||
{media}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import {
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -17,6 +18,7 @@ import {
|
|||
} from "../../store/selectors";
|
||||
import {
|
||||
ROPSTEN_WETH_ADDRESS,
|
||||
WAVAX_ADDRESS,
|
||||
WBNB_ADDRESS,
|
||||
WETH_ADDRESS,
|
||||
WMATIC_ADDRESS,
|
||||
|
@ -50,6 +52,10 @@ function Redeem() {
|
|||
targetChain === CHAIN_ID_POLYGON &&
|
||||
targetAsset &&
|
||||
targetAsset.toLowerCase() === WMATIC_ADDRESS.toLowerCase();
|
||||
const isAvaxNative =
|
||||
targetChain === CHAIN_ID_AVAX &&
|
||||
targetAsset &&
|
||||
targetAsset.toLowerCase() === WAVAX_ADDRESS.toLowerCase();
|
||||
const isSolNative =
|
||||
targetChain === CHAIN_ID_SOLANA &&
|
||||
targetAsset &&
|
||||
|
@ -59,6 +65,7 @@ function Redeem() {
|
|||
isEthRopstenNative ||
|
||||
isBscNative ||
|
||||
isPolygonNative ||
|
||||
isAvaxNative ||
|
||||
isSolNative;
|
||||
const [useNativeRedeem, setUseNativeRedeem] = useState(true);
|
||||
const toggleNativeRedeem = useCallback(() => {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -61,6 +62,8 @@ import {
|
|||
ROPSTEN_WETH_ADDRESS,
|
||||
ROPSTEN_WETH_DECIMALS,
|
||||
SOLANA_HOST,
|
||||
WAVAX_ADDRESS,
|
||||
WAVAX_DECIMALS,
|
||||
WBNB_ADDRESS,
|
||||
WBNB_DECIMALS,
|
||||
WETH_ADDRESS,
|
||||
|
@ -73,6 +76,7 @@ import {
|
|||
extractMintInfo,
|
||||
getMultipleAccountsRPC,
|
||||
} from "../utils/solana";
|
||||
import avaxIcon from "../icons/avax.svg";
|
||||
import bnbIcon from "../icons/bnb.svg";
|
||||
import ethIcon from "../icons/eth.svg";
|
||||
import polygonIcon from "../icons/polygon.svg";
|
||||
|
@ -290,6 +294,29 @@ const createNativePolygonParsedTokenAccount = (
|
|||
});
|
||||
};
|
||||
|
||||
const createNativeAvaxParsedTokenAccount = (
|
||||
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
|
||||
WAVAX_ADDRESS, //Mint key, On the other side this will be wavax, so this is hopefully a white lie.
|
||||
balanceInWei.toString(), //amount, in wei
|
||||
WAVAX_DECIMALS,
|
||||
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.
|
||||
"AVAX", //A white lie for display purposes
|
||||
"Avalanche", //A white lie for display purposes
|
||||
avaxIcon,
|
||||
true //isNativeAsset
|
||||
);
|
||||
});
|
||||
};
|
||||
|
||||
const createNFTParsedTokenAccountFromCovalent = (
|
||||
walletAddress: string,
|
||||
covalent: CovalentData,
|
||||
|
@ -737,6 +764,41 @@ function useGetAvailableTokens(nft: boolean = false) {
|
|||
};
|
||||
}, [lookupChain, provider, signerAddress, nft, ethNativeAccount]);
|
||||
|
||||
//TODO refactor all these into an isEVM effect
|
||||
//avax native asset load
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
if (
|
||||
signerAddress &&
|
||||
lookupChain === CHAIN_ID_AVAX &&
|
||||
!ethNativeAccount &&
|
||||
!nft
|
||||
) {
|
||||
setEthNativeAccountLoading(true);
|
||||
createNativeAvaxParsedTokenAccount(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 AVAX balance.");
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [lookupChain, provider, signerAddress, nft, ethNativeAccount]);
|
||||
|
||||
//Ethereum covalent accounts load
|
||||
useEffect(() => {
|
||||
//const testWallet = "0xf60c2ea62edbfe808163751dd0d8693dcb30019c";
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 24.0.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 254 254" style="enable-background:new 0 0 254 254;" xml:space="preserve">
|
||||
<style type="text/css">
|
||||
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#E84142;}
|
||||
.st1{fill:#FFFFFF;}
|
||||
</style>
|
||||
<g>
|
||||
<circle class="st0" cx="127" cy="127" r="127"/>
|
||||
<path class="st1" d="M171.8,130.3c4.4-7.6,11.5-7.6,15.9,0l27.4,48.1c4.4,7.6,0.8,13.8-8,13.8h-55.2c-8.7,0-12.3-6.2-8-13.8
|
||||
L171.8,130.3z M118.8,37.7c4.4-7.6,11.4-7.6,15.8,0l6.1,11L155.1,74c3.5,7.2,3.5,15.7,0,22.9l-48.3,83.7
|
||||
c-4.4,6.8-11.7,11.1-19.8,11.6H46.9c-8.8,0-12.4-6.1-8-13.8L118.8,37.7z"/>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 825 B |
|
@ -1,5 +1,6 @@
|
|||
import {
|
||||
ChainId,
|
||||
CHAIN_ID_AVAX,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_ETHEREUM_ROPSTEN,
|
||||
|
@ -9,12 +10,13 @@ import {
|
|||
} from "@certusone/wormhole-sdk";
|
||||
import { clusterApiUrl } from "@solana/web3.js";
|
||||
import { getAddress } from "ethers/lib/utils";
|
||||
import avaxIcon from "../icons/avax.svg";
|
||||
import bscIcon from "../icons/bsc.svg";
|
||||
import ethIcon from "../icons/eth.svg";
|
||||
import oasisIcon from "../icons/oasis-network-rose-logo.svg";
|
||||
import polygonIcon from "../icons/polygon.svg";
|
||||
import solanaIcon from "../icons/solana.svg";
|
||||
import terraIcon from "../icons/terra.svg";
|
||||
import oasisIcon from "../icons/oasis-network-rose-logo.svg";
|
||||
|
||||
export type Cluster = "devnet" | "testnet" | "mainnet";
|
||||
export const CLUSTER: Cluster =
|
||||
|
@ -31,6 +33,11 @@ export interface ChainInfo {
|
|||
export const CHAINS =
|
||||
CLUSTER === "mainnet"
|
||||
? [
|
||||
{
|
||||
id: CHAIN_ID_AVAX,
|
||||
name: "Avalanche",
|
||||
logo: avaxIcon,
|
||||
},
|
||||
{
|
||||
id: CHAIN_ID_BSC,
|
||||
name: "Binance Smart Chain",
|
||||
|
@ -59,6 +66,11 @@ export const CHAINS =
|
|||
]
|
||||
: CLUSTER === "testnet"
|
||||
? [
|
||||
{
|
||||
id: CHAIN_ID_AVAX,
|
||||
name: "Avalanche",
|
||||
logo: avaxIcon,
|
||||
},
|
||||
{
|
||||
id: CHAIN_ID_BSC,
|
||||
name: "Binance Smart Chain",
|
||||
|
@ -112,9 +124,11 @@ export const CHAINS =
|
|||
logo: terraIcon,
|
||||
},
|
||||
];
|
||||
export const BETA_CHAINS: ChainId[] = CLUSTER === "mainnet" ? [] : [];
|
||||
export const BETA_CHAINS: ChainId[] =
|
||||
CLUSTER === "mainnet" ? [CHAIN_ID_AVAX] : [];
|
||||
export const CHAINS_WITH_NFT_SUPPORT = CHAINS.filter(
|
||||
({ id }) =>
|
||||
id === CHAIN_ID_AVAX ||
|
||||
id === CHAIN_ID_BSC ||
|
||||
id === CHAIN_ID_ETH ||
|
||||
id === CHAIN_ID_ETHEREUM_ROPSTEN ||
|
||||
|
@ -145,6 +159,8 @@ export const getDefaultNativeCurrencySymbol = (chainId: ChainId) =>
|
|||
? "LUNA"
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? "MATIC"
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? "AVAX"
|
||||
: "";
|
||||
export const getExplorerName = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_ETH || chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
|
@ -155,6 +171,8 @@ export const getExplorerName = (chainId: ChainId) =>
|
|||
? "Finder"
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? "Polygonscan"
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? "Snowtrace"
|
||||
: "Explorer";
|
||||
export const WORMHOLE_RPC_HOSTS =
|
||||
CLUSTER === "mainnet"
|
||||
|
@ -177,6 +195,8 @@ export const BSC_NETWORK_CHAIN_ID =
|
|||
CLUSTER === "mainnet" ? 56 : CLUSTER === "testnet" ? 97 : 1397;
|
||||
export const POLYGON_NETWORK_CHAIN_ID =
|
||||
CLUSTER === "mainnet" ? 137 : CLUSTER === "testnet" ? 80001 : 1381;
|
||||
export const AVAX_NETWORK_CHAIN_ID =
|
||||
CLUSTER === "mainnet" ? 43114 : CLUSTER === "testnet" ? 43113 : 1381;
|
||||
export const getEvmChainId = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_ETH
|
||||
? ETH_NETWORK_CHAIN_ID
|
||||
|
@ -186,6 +206,8 @@ export const getEvmChainId = (chainId: ChainId) =>
|
|||
? BSC_NETWORK_CHAIN_ID
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? POLYGON_NETWORK_CHAIN_ID
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? AVAX_NETWORK_CHAIN_ID
|
||||
: undefined;
|
||||
export const SOLANA_HOST = process.env.REACT_APP_SOLANA_API_URL
|
||||
? process.env.REACT_APP_SOLANA_API_URL
|
||||
|
@ -276,6 +298,27 @@ export const POLYGON_TOKEN_BRIDGE_ADDRESS = getAddress(
|
|||
? "0x377D55a7928c046E18eEbb61977e714d2a76472a"
|
||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||
);
|
||||
export const AVAX_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x54a8e5f9c4CbA08F9943965859F6c34eAF03E26c"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x7bbcE28e64B3F8b84d876Ab298393c38ad7aac4C"
|
||||
: "0xC89Ce4735882C9F0f0FE26686c53074E09B0D550"
|
||||
);
|
||||
export const AVAX_NFT_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0xf7B6737Ca9c4e08aE573F75A97B73D7a813f5De5"
|
||||
: CLUSTER === "testnet"
|
||||
? "0xD601BAf2EEE3C028344471684F6b27E789D9075D"
|
||||
: "0x26b4afb60d6c903165150c6f0aa14f8016be4aec"
|
||||
);
|
||||
export const AVAX_TOKEN_BRIDGE_ADDRESS = getAddress(
|
||||
CLUSTER === "mainnet"
|
||||
? "0x0e082F06FF657D94310cB8cE8B0D9a04541d8052"
|
||||
: CLUSTER === "testnet"
|
||||
? "0x61E44E506Ca5659E6c0bba9b678586fA2d729756"
|
||||
: "0x0290FB167208Af455bB137780163b7B7a9a10C16"
|
||||
);
|
||||
export const SOL_BRIDGE_ADDRESS =
|
||||
CLUSTER === "mainnet"
|
||||
? "worm2ZoG2kUd4vFXhvjh93UUH596ayRfgQ2MgjNMTth"
|
||||
|
@ -348,6 +391,8 @@ export const getBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? POLYGON_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? AVAX_BRIDGE_ADDRESS
|
||||
: "";
|
||||
export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_SOLANA
|
||||
|
@ -360,6 +405,8 @@ export const getNFTBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? POLYGON_NFT_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_NFT_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? AVAX_NFT_BRIDGE_ADDRESS
|
||||
: "";
|
||||
export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
||||
chainId === CHAIN_ID_SOLANA
|
||||
|
@ -374,6 +421,8 @@ export const getTokenBridgeAddressForChain = (chainId: ChainId) =>
|
|||
? POLYGON_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_ETHEREUM_ROPSTEN
|
||||
? ROPSTEN_ETH_TOKEN_BRIDGE_ADDRESS
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? AVAX_TOKEN_BRIDGE_ADDRESS
|
||||
: "";
|
||||
|
||||
export const COVALENT_API_KEY = process.env.REACT_APP_COVALENT_API_KEY
|
||||
|
@ -384,6 +433,7 @@ export const COVALENT_ETHEREUM = 1; // Covalent only supports mainnet and Kovan
|
|||
export const COVALENT_BSC = CLUSTER === "devnet" ? 56 : BSC_NETWORK_CHAIN_ID;
|
||||
export const COVALENT_POLYGON =
|
||||
CLUSTER === "devnet" ? 137 : POLYGON_NETWORK_CHAIN_ID;
|
||||
export const COVALENT_AVAX = CLUSTER === "devnet" ? 137 : AVAX_NETWORK_CHAIN_ID;
|
||||
export const COVALENT_GET_TOKENS_URL = (
|
||||
chainId: ChainId,
|
||||
walletAddress: string,
|
||||
|
@ -397,6 +447,8 @@ export const COVALENT_GET_TOKENS_URL = (
|
|||
? COVALENT_BSC
|
||||
: chainId === CHAIN_ID_POLYGON
|
||||
? COVALENT_POLYGON
|
||||
: chainId === CHAIN_ID_AVAX
|
||||
? COVALENT_AVAX
|
||||
: "";
|
||||
// https://www.covalenthq.com/docs/api/#get-/v1/{chain_id}/address/{address}/balances_v2/
|
||||
return `https://api.covalenthq.com/v1/${chainNum}/address/${walletAddress}/balances_v2/?key=${COVALENT_API_KEY}${
|
||||
|
@ -438,6 +490,14 @@ export const ROPSTEN_WETH_ADDRESS =
|
|||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||
export const ROPSTEN_WETH_DECIMALS = 18;
|
||||
|
||||
export const WAVAX_ADDRESS =
|
||||
CLUSTER === "mainnet"
|
||||
? "0xb31f66aa3c1e785363f0875a1b74e27b85fd66c7"
|
||||
: CLUSTER === "testnet"
|
||||
? "0xd00ae08403b9bbb9124bb305c09058e32c39a48c"
|
||||
: "0xDDb64fE46a91D46ee29420539FC25FD07c5FEa3E";
|
||||
export const WAVAX_DECIMALS = 18;
|
||||
|
||||
export const WORMHOLE_V1_ETH_ADDRESS =
|
||||
CLUSTER === "mainnet"
|
||||
? "0xf92cD566Ea4864356C5491c177A430C222d7e678"
|
||||
|
|
Loading…
Reference in New Issue