bridge_ui: add polygon TVL stats
Change-Id: I63cb04feadfc7da33a9acd52ac3b1af4a292f4ef
This commit is contained in:
parent
be244f4632
commit
c600686677
|
@ -1,6 +1,7 @@
|
|||
import {
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -60,6 +61,12 @@ const CustodyAddresses: React.FC<any> = () => {
|
|||
tokenAddress: getTokenBridgeAddressForChain(CHAIN_ID_TERRA),
|
||||
nftAddress: null,
|
||||
},
|
||||
{
|
||||
chainName: "Polygon",
|
||||
chainId: CHAIN_ID_POLYGON,
|
||||
tokenAddress: getTokenBridgeAddressForChain(CHAIN_ID_POLYGON),
|
||||
nftAddress: getNFTBridgeAddressForChain(CHAIN_ID_POLYGON),
|
||||
},
|
||||
];
|
||||
}, []);
|
||||
|
||||
|
|
|
@ -86,7 +86,10 @@ const useStyles = makeStyles((theme) => ({
|
|||
},
|
||||
}));
|
||||
|
||||
const BLACKLIST = ["D9cX654dGb4GFzqq3RY7rhZbRkQqUkfggDZdnYxqv97g"];
|
||||
const BLACKLIST = [
|
||||
"D9cX654dGb4GFzqq3RY7rhZbRkQqUkfggDZdnYxqv97g",
|
||||
"0xfeA43A080297B02F2eBB88a27Cb0FA6DB1b33B1d",
|
||||
];
|
||||
|
||||
const NFTStats: React.FC<any> = () => {
|
||||
const classes = useStyles();
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
import { TOKEN_PROGRAM_ID } from "@solana/spl-token";
|
||||
|
@ -20,6 +21,7 @@ import {
|
|||
COVALENT_GET_TOKENS_URL,
|
||||
ETH_NFT_BRIDGE_ADDRESS,
|
||||
getNFTBridgeAddressForChain,
|
||||
POLYGON_NFT_BRIDGE_ADDRESS,
|
||||
SOLANA_HOST,
|
||||
SOL_NFT_CUSTODY_ADDRESS,
|
||||
} from "../utils/consts";
|
||||
|
@ -122,6 +124,11 @@ const useNFTTVL = (): DataWrapper<NFTTVL[]> => {
|
|||
const [bscCovalentIsLoading, setBscCovalentIsLoading] = useState(false);
|
||||
const [bscCovalentError, setBscCovalentError] = useState("");
|
||||
|
||||
const [polygonCovalentData, setPolygonCovalentData] = useState(undefined);
|
||||
const [polygonCovalentIsLoading, setPolygonCovalentIsLoading] =
|
||||
useState(false);
|
||||
const [polygonCovalentError, setPolygonCovalentError] = useState("");
|
||||
|
||||
const [solanaCustodyTokens, setSolanaCustodyTokens] = useState<
|
||||
{ pubkey: PublicKey; account: AccountInfo<ParsedAccountData> }[] | undefined
|
||||
>(undefined);
|
||||
|
@ -154,6 +161,11 @@ const useNFTTVL = (): DataWrapper<NFTTVL[]> => {
|
|||
[bscCovalentData]
|
||||
);
|
||||
|
||||
const polygonTVL = useMemo(
|
||||
() => calcEvmTVL(polygonCovalentData, CHAIN_ID_POLYGON),
|
||||
[polygonCovalentData]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setEthCovalentIsLoading(true);
|
||||
|
@ -210,6 +222,34 @@ const useNFTTVL = (): DataWrapper<NFTTVL[]> => {
|
|||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setPolygonCovalentIsLoading(true);
|
||||
axios
|
||||
.get(
|
||||
COVALENT_GET_TOKENS_URL(
|
||||
CHAIN_ID_POLYGON,
|
||||
POLYGON_NFT_BRIDGE_ADDRESS,
|
||||
true,
|
||||
false
|
||||
)
|
||||
)
|
||||
.then(
|
||||
(results) => {
|
||||
if (!cancelled) {
|
||||
setPolygonCovalentData(results.data);
|
||||
setPolygonCovalentIsLoading(false);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
if (!cancelled) {
|
||||
setPolygonCovalentError("Unable to retrieve Polygon TVL.");
|
||||
setPolygonCovalentIsLoading(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const connection = new Connection(SOLANA_HOST, "confirmed");
|
||||
|
@ -237,14 +277,19 @@ const useNFTTVL = (): DataWrapper<NFTTVL[]> => {
|
|||
}, []);
|
||||
|
||||
return useMemo(() => {
|
||||
const tvlArray = [...ethTVL, ...bscTVL, ...solanaTVL];
|
||||
const tvlArray = [...ethTVL, ...bscTVL, ...polygonTVL, ...solanaTVL];
|
||||
|
||||
return {
|
||||
isFetching:
|
||||
ethCovalentIsLoading ||
|
||||
bscCovalentIsLoading ||
|
||||
polygonCovalentIsLoading ||
|
||||
solanaCustodyTokensLoading,
|
||||
error: ethCovalentError || bscCovalentError || solanaCustodyTokensError,
|
||||
error:
|
||||
ethCovalentError ||
|
||||
bscCovalentError ||
|
||||
polygonCovalentError ||
|
||||
solanaCustodyTokensError,
|
||||
receivedAt: null,
|
||||
data: tvlArray,
|
||||
};
|
||||
|
@ -253,6 +298,9 @@ const useNFTTVL = (): DataWrapper<NFTTVL[]> => {
|
|||
ethCovalentIsLoading,
|
||||
bscCovalentError,
|
||||
bscCovalentIsLoading,
|
||||
polygonTVL,
|
||||
polygonCovalentError,
|
||||
polygonCovalentIsLoading,
|
||||
ethTVL,
|
||||
bscTVL,
|
||||
solanaTVL,
|
||||
|
|
|
@ -2,6 +2,7 @@ import {
|
|||
ChainId,
|
||||
CHAIN_ID_BSC,
|
||||
CHAIN_ID_ETH,
|
||||
CHAIN_ID_POLYGON,
|
||||
CHAIN_ID_SOLANA,
|
||||
CHAIN_ID_TERRA,
|
||||
} from "@certusone/wormhole-sdk";
|
||||
|
@ -22,6 +23,7 @@ import {
|
|||
CHAINS_BY_ID,
|
||||
COVALENT_GET_TOKENS_URL,
|
||||
ETH_TOKEN_BRIDGE_ADDRESS,
|
||||
POLYGON_TOKEN_BRIDGE_ADDRESS,
|
||||
SOLANA_HOST,
|
||||
SOL_CUSTODY_ADDRESS,
|
||||
TERRA_SWAPRATE_URL,
|
||||
|
@ -276,6 +278,11 @@ const useTVL = (): DataWrapper<TVL[]> => {
|
|||
const [bscCovalentIsLoading, setBscCovalentIsLoading] = useState(false);
|
||||
const [bscCovalentError, setBscCovalentError] = useState("");
|
||||
|
||||
const [polygonCovalentData, setPolygonCovalentData] = useState(undefined);
|
||||
const [polygonCovalentIsLoading, setPolygonCovalentIsLoading] =
|
||||
useState(false);
|
||||
const [polygonCovalentError, setPolygonCovalentError] = useState("");
|
||||
|
||||
const [solanaCustodyTokens, setSolanaCustodyTokens] = useState<
|
||||
{ pubkey: PublicKey; account: AccountInfo<ParsedAccountData> }[] | undefined
|
||||
>(undefined);
|
||||
|
@ -311,6 +318,10 @@ const useTVL = (): DataWrapper<TVL[]> => {
|
|||
() => calcEvmTVL(bscCovalentData, CHAIN_ID_BSC),
|
||||
[bscCovalentData]
|
||||
);
|
||||
const polygonTVL = useMemo(
|
||||
() => calcEvmTVL(polygonCovalentData, CHAIN_ID_POLYGON),
|
||||
[polygonCovalentData]
|
||||
);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
|
@ -358,6 +369,33 @@ const useTVL = (): DataWrapper<TVL[]> => {
|
|||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
setPolygonCovalentIsLoading(true);
|
||||
axios
|
||||
.get(
|
||||
COVALENT_GET_TOKENS_URL(
|
||||
CHAIN_ID_POLYGON,
|
||||
POLYGON_TOKEN_BRIDGE_ADDRESS,
|
||||
false
|
||||
)
|
||||
)
|
||||
.then(
|
||||
(results) => {
|
||||
if (!cancelled) {
|
||||
setPolygonCovalentData(results.data);
|
||||
setPolygonCovalentIsLoading(false);
|
||||
}
|
||||
},
|
||||
(error) => {
|
||||
if (!cancelled) {
|
||||
setPolygonCovalentError("Unable to retrieve Polygon TVL.");
|
||||
setPolygonCovalentIsLoading(false);
|
||||
}
|
||||
}
|
||||
);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
let cancelled = false;
|
||||
const connection = new Connection(SOLANA_HOST, "confirmed");
|
||||
|
@ -385,15 +423,26 @@ const useTVL = (): DataWrapper<TVL[]> => {
|
|||
}, []);
|
||||
|
||||
return useMemo(() => {
|
||||
const tvlArray = [...ethTVL, ...bscTVL, ...solanaTVL, ...terraTVL];
|
||||
const tvlArray = [
|
||||
...ethTVL,
|
||||
...bscTVL,
|
||||
...polygonTVL,
|
||||
...solanaTVL,
|
||||
...terraTVL,
|
||||
];
|
||||
|
||||
return {
|
||||
isFetching:
|
||||
ethCovalentIsLoading ||
|
||||
bscCovalentIsLoading ||
|
||||
polygonCovalentIsLoading ||
|
||||
solanaCustodyTokensLoading ||
|
||||
isTerraLoading,
|
||||
error: ethCovalentError || bscCovalentError || solanaCustodyTokensError,
|
||||
error:
|
||||
ethCovalentError ||
|
||||
bscCovalentError ||
|
||||
polygonCovalentError ||
|
||||
solanaCustodyTokensError,
|
||||
receivedAt: null,
|
||||
data: tvlArray,
|
||||
};
|
||||
|
@ -402,6 +451,9 @@ const useTVL = (): DataWrapper<TVL[]> => {
|
|||
ethCovalentIsLoading,
|
||||
bscCovalentError,
|
||||
bscCovalentIsLoading,
|
||||
polygonCovalentError,
|
||||
polygonCovalentIsLoading,
|
||||
polygonTVL,
|
||||
ethTVL,
|
||||
bscTVL,
|
||||
solanaTVL,
|
||||
|
|
|
@ -625,6 +625,8 @@ export const VAA_EMITTER_ADDRESSES = [
|
|||
`${CHAIN_ID_TERRA}:0000000000000000000000007cf7b764e38a0a5e967972c1df77d432510564e2`, //terra
|
||||
`${CHAIN_ID_BSC}:000000000000000000000000b6f6d86a8f9879a9c87f643768d9efc38c1da6e7`, //bsc
|
||||
`${CHAIN_ID_BSC}:0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde`, //bsc nft
|
||||
`${CHAIN_ID_POLYGON}:0000000000000000000000005a58505a96d1dbf8df91cb21b54419fc36e93fde`, //Polygon
|
||||
`${CHAIN_ID_POLYGON}:00000000000000000000000090bbd86a6fe93d3bc3ed6335935447e75fab7fcf`, //Polygon nft
|
||||
];
|
||||
|
||||
export const WORMHOLE_EXPLORER_BASE = "https://wormholenetwork.com/en/explorer";
|
||||
|
|
Loading…
Reference in New Issue