Upgrade to 1.0.0-beta2

Remove values and images now in SDK
pull/24/head
J M Rossy 2 years ago
parent 9a239efe83
commit c9809c6356
  1. 4
      package.json
  2. 119
      src/components/icons/ChainIcon.tsx
  3. 26
      src/components/search/SearchFilterBar.tsx
  4. 1
      src/consts/addresses.ts
  5. 344
      src/consts/chains.ts
  6. 1
      src/consts/environments.ts
  7. 14
      src/features/deliveryStatus/fetchDeliveryStatus.ts
  8. 14
      src/features/messages/cards/TimelineCard.tsx
  9. 1
      src/images/logos/chains-color/arbitrum.svg
  10. 1
      src/images/logos/chains-color/avalanche.svg
  11. 1
      src/images/logos/chains-color/bsc.svg
  12. 1
      src/images/logos/chains-color/celo.svg
  13. 1
      src/images/logos/chains-color/ethereum.svg
  14. 1
      src/images/logos/chains-color/moonbeam.svg
  15. 1
      src/images/logos/chains-color/optimism.svg
  16. 1
      src/images/logos/chains-color/polygon.svg
  17. 1
      src/images/logos/chains-mono/arbitrum.svg
  18. 1
      src/images/logos/chains-mono/avalanche.svg
  19. 1
      src/images/logos/chains-mono/bsc.svg
  20. 1
      src/images/logos/chains-mono/celo.svg
  21. 8
      src/images/logos/chains-mono/ethereum.svg
  22. 3
      src/images/logos/chains-mono/moonbeam.svg
  23. 1
      src/images/logos/chains-mono/near.svg
  24. 1
      src/images/logos/chains-mono/optimism.svg
  25. 1
      src/images/logos/chains-mono/polygon.svg
  26. 5
      src/pages/api/latest-nonce.ts
  27. 19
      src/utils/chains.ts
  28. 25
      src/utils/explorers.ts
  29. 32
      yarn.lock

@ -1,10 +1,10 @@
{
"name": "@hyperlane-xyz/explorer",
"description": "An interchain explorer for the Hyperlane protocol and network.",
"version": "0.1.0",
"version": "1.0.0",
"author": "J M Rossy",
"dependencies": {
"@hyperlane-xyz/sdk": "^1.0.0-beta1",
"@hyperlane-xyz/sdk": "^1.0.0-beta2",
"@metamask/jazzicon": "https://github.com/jmrossy/jazzicon#7a8df28974b4e81129bfbe3cab76308b889032a6",
"@rainbow-me/rainbowkit": "^0.8.0",
"@tanstack/react-query": "^4.18.0",

@ -1,84 +1,65 @@
import Image from 'next/image';
import { memo } from 'react';
import { chain } from 'wagmi';
import {
alfajoresChain,
auroraTestnetChain,
avalancheChain,
bscChain,
bscTestnetChain,
celoMainnetChain,
fujiTestnetChain,
moonbaseAlphaChain,
moonbeamChain,
} from '../../consts/chains';
import { chainMetadata } from '@hyperlane-xyz/sdk';
import ArbitrumMono from '@hyperlane-xyz/sdk/logos/black/arbitrum.svg';
import AvalancheMono from '@hyperlane-xyz/sdk/logos/black/avalanche.svg';
import BscMono from '@hyperlane-xyz/sdk/logos/black/bsc.svg';
import CeloMono from '@hyperlane-xyz/sdk/logos/black/celo.svg';
import EthereumMono from '@hyperlane-xyz/sdk/logos/black/ethereum.svg';
import MoonbeamMono from '@hyperlane-xyz/sdk/logos/black/moonbeam.svg';
import OptimismMono from '@hyperlane-xyz/sdk/logos/black/optimism.svg';
import PolygonMono from '@hyperlane-xyz/sdk/logos/black/polygon.svg';
import ArbitrumColor from '@hyperlane-xyz/sdk/logos/color/arbitrum.svg';
import AvalancheColor from '@hyperlane-xyz/sdk/logos/color/avalanche.svg';
import BscColor from '@hyperlane-xyz/sdk/logos/color/bsc.svg';
import CeloColor from '@hyperlane-xyz/sdk/logos/color/celo.svg';
import EthereumColor from '@hyperlane-xyz/sdk/logos/color/ethereum.svg';
import MoonbeamColor from '@hyperlane-xyz/sdk/logos/color/moonbeam.svg';
import OptimismColor from '@hyperlane-xyz/sdk/logos/color/optimism.svg';
import PolygonColor from '@hyperlane-xyz/sdk/logos/color/polygon.svg';
import QuestionMark from '../../images/icons/question-mark.svg';
import ArbitrumColor from '../../images/logos/chains-color/arbitrum.svg';
import AvalancheColor from '../../images/logos/chains-color/avalanche.svg';
import BscColor from '../../images/logos/chains-color/bsc.svg';
import CeloColor from '../../images/logos/chains-color/celo.svg';
import EthereumColor from '../../images/logos/chains-color/ethereum.svg';
import MoonbeamColor from '../../images/logos/chains-color/moonbeam.svg';
import OptimismColor from '../../images/logos/chains-color/optimism.svg';
import PolygonColor from '../../images/logos/chains-color/polygon.svg';
import ArbitrumMono from '../../images/logos/chains-mono/arbitrum.svg';
import AvalancheMono from '../../images/logos/chains-mono/avalanche.svg';
import BscMono from '../../images/logos/chains-mono/bsc.svg';
import CeloMono from '../../images/logos/chains-mono/celo.svg';
import EthereumMono from '../../images/logos/chains-mono/ethereum.svg';
import MoonbeamMono from '../../images/logos/chains-mono/moonbeam.svg';
import Near from '../../images/logos/chains-mono/near.svg';
import OptimismMono from '../../images/logos/chains-mono/optimism.svg';
import PolygonMono from '../../images/logos/chains-mono/polygon.svg';
import { getChainDisplayName } from '../../utils/chains';
// Keep up to date as new chains are added or
// icon will fallback to default
const CHAIN_TO_MONOCHROME_ICON = {
// Prod chains
[chain.mainnet.id]: EthereumMono,
[chain.arbitrum.id]: ArbitrumMono,
[chain.optimism.id]: OptimismMono,
[chain.polygon.id]: PolygonMono,
[avalancheChain.id]: AvalancheMono,
[bscChain.id]: BscMono,
[celoMainnetChain.id]: CeloMono,
[moonbeamChain.id]: MoonbeamMono,
// Test chains
[chain.goerli.id]: EthereumMono,
[chain.arbitrumGoerli.id]: ArbitrumMono,
[chain.optimismGoerli.id]: OptimismMono,
[chain.polygonMumbai.id]: PolygonMono,
[fujiTestnetChain.id]: AvalancheMono,
[bscTestnetChain.id]: BscMono,
[alfajoresChain.id]: CeloMono,
[auroraTestnetChain.id]: Near,
[moonbaseAlphaChain.id]: MoonbeamMono,
[chainMetadata.alfajores.id]: CeloMono,
[chainMetadata.arbitrum.id]: ArbitrumMono,
[chainMetadata.arbitrumgoerli.id]: ArbitrumMono,
[chainMetadata.avalanche.id]: AvalancheMono,
[chainMetadata.bsc.id]: BscMono,
[chainMetadata.bsctestnet.id]: BscMono,
[chainMetadata.celo.id]: CeloMono,
[chainMetadata.ethereum.id]: EthereumMono,
[chainMetadata.fuji.id]: AvalancheMono,
[chainMetadata.goerli.id]: EthereumMono,
[chainMetadata.moonbasealpha.id]: MoonbeamMono,
[chainMetadata.moonbeam.id]: MoonbeamMono,
[chainMetadata.mumbai.id]: PolygonMono,
[chainMetadata.optimism.id]: OptimismMono,
[chainMetadata.optimismgoerli.id]: OptimismMono,
[chainMetadata.polygon.id]: PolygonMono,
};
const CHAIN_TO_COLOR_ICON = {
// Prod chains
[chain.mainnet.id]: EthereumColor,
[chain.arbitrum.id]: ArbitrumColor,
[chain.optimism.id]: OptimismColor,
[chain.polygon.id]: PolygonColor,
[avalancheChain.id]: AvalancheColor,
[bscChain.id]: BscColor,
[celoMainnetChain.id]: CeloColor,
[moonbeamChain.id]: MoonbeamColor,
// Test chains
[chain.goerli.id]: EthereumColor,
[chain.arbitrumGoerli.id]: ArbitrumColor,
[chain.optimismGoerli.id]: OptimismColor,
[chain.polygonMumbai.id]: PolygonColor,
[fujiTestnetChain.id]: AvalancheColor,
[bscTestnetChain.id]: BscColor,
[alfajoresChain.id]: CeloColor,
[auroraTestnetChain.id]: Near,
[moonbaseAlphaChain.id]: MoonbeamColor,
[chainMetadata.alfajores.id]: CeloColor,
[chainMetadata.arbitrum.id]: ArbitrumColor,
[chainMetadata.arbitrumgoerli.id]: ArbitrumColor,
[chainMetadata.avalanche.id]: AvalancheColor,
[chainMetadata.bsc.id]: BscColor,
[chainMetadata.bsctestnet.id]: BscColor,
[chainMetadata.celo.id]: CeloColor,
[chainMetadata.ethereum.id]: EthereumColor,
[chainMetadata.fuji.id]: AvalancheColor,
[chainMetadata.goerli.id]: EthereumColor,
[chainMetadata.moonbasealpha.id]: MoonbeamColor,
[chainMetadata.moonbeam.id]: MoonbeamColor,
[chainMetadata.mumbai.id]: PolygonColor,
[chainMetadata.optimism.id]: OptimismColor,
[chainMetadata.optimismgoerli.id]: OptimismColor,
[chainMetadata.polygon.id]: PolygonColor,
};
interface Props {

@ -1,9 +1,9 @@
import Image from 'next/image';
import { useState } from 'react';
import useDropdownMenu from 'react-accessible-dropdown-menu-hook';
import { Chain } from 'wagmi';
import { mainnetAndTestChains, mainnetChains, testnetChains } from '../../consts/chains';
import { ChainMetadata, mainnetChainsMetadata, testnetChainsMetadata } from '@hyperlane-xyz/sdk';
import FunnelIcon from '../../images/icons/funnel.svg';
import { getChainDisplayName } from '../../utils/chains';
import { arrayToObject } from '../../utils/objects';
@ -15,6 +15,8 @@ import { XIcon } from '../icons/XIcon';
import { CheckBox } from '../input/Checkbox';
import { DatetimeField } from '../input/DatetimeField';
const mainnetAndTestChains = [...mainnetChainsMetadata, ...testnetChainsMetadata];
interface Props {
originChain: string | null;
onChangeOrigin: (value: string | null) => void;
@ -93,7 +95,7 @@ function ChainMultiSelector({
value ? arrayToObject(value.split(',')) : arrayToObject(mainnetAndTestChains.map((c) => c.id)),
);
const hasAnyUncheckedChain = (chains: Chain[]) => {
const hasAnyUncheckedChain = (chains: ChainMetadata[]) => {
for (const c of chains) {
if (!checkedChains[c.id]) return true;
}
@ -111,7 +113,7 @@ function ChainMultiSelector({
};
};
const onToggleSection = (chains: Chain[]) => {
const onToggleSection = (chains: ChainMetadata[]) => {
return () => {
const chainIds = chains.map((c) => c.id);
if (hasAnyUncheckedChain(chains)) {
@ -181,19 +183,19 @@ function ChainMultiSelector({
<div className="flex flex-col">
<div className="pb-1.5">
<CheckBox
checked={!hasAnyUncheckedChain(mainnetChains)}
onToggle={onToggleSection(mainnetChains)}
checked={!hasAnyUncheckedChain(mainnetChainsMetadata)}
onToggle={onToggleSection(mainnetChainsMetadata)}
name="mainnet-chains"
>
<h4 className="ml-2 text-gray-700">Mainnet Chains</h4>
</CheckBox>
</div>
{mainnetChains.map((c) => (
{mainnetChainsMetadata.map((c) => (
<CheckBox
key={c.name}
checked={!!checkedChains[c.id]}
onToggle={onToggle(c.id)}
name={c.network}
name={c.name}
>
<div className="py-0.5 ml-2 text-sm flex items-center">
<span className="mr-2">{getChainDisplayName(c.id, true)}</span>
@ -206,19 +208,19 @@ function ChainMultiSelector({
<div className="flex flex-col">
<div className="pb-1.5">
<CheckBox
checked={!hasAnyUncheckedChain(testnetChains)}
onToggle={onToggleSection(testnetChains)}
checked={!hasAnyUncheckedChain(testnetChainsMetadata)}
onToggle={onToggleSection(testnetChainsMetadata)}
name="testnet-chains"
>
<h4 className="ml-2 text-gray-700">Testnet Chains</h4>
</CheckBox>
</div>
{testnetChains.map((c) => (
{testnetChainsMetadata.map((c) => (
<CheckBox
key={c.name}
checked={!!checkedChains[c.id]}
onToggle={onToggle(c.id)}
name={c.network}
name={c.name}
>
<div className="py-0.5 ml-2 text-sm flex items-center">
<span className="mr-2">{getChainDisplayName(c.id, true)}</span>

@ -1,4 +1,5 @@
// TODO hard-coding TestRecipient contract address here for now.
// From typescript/infra/config/environments/mainnet/testrecipient/addresses.json
// Moving to SDK doesn't quite feel right since it's not useful to others
// Must be updated when contracts get re-deployed
export const TEST_RECIPIENT_ADDRESS = '0xBC3cFeca7Df5A45d61BC60E7898E63670e1654aE';

@ -1,344 +0,0 @@
import { Chain, allChains as allChainsWagmi, chain } from 'wagmi';
export const alfajoresChain: Chain = {
id: 44787,
name: 'Alfajores',
network: 'alfajores',
nativeCurrency: {
decimals: 18,
name: 'CELO',
symbol: 'CELO',
},
rpcUrls: {
default: 'https://alfajores-forno.celo-testnet.org',
},
blockExplorers: {
etherscan: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
blockscout: {
name: 'Blockscout',
url: 'https://explorer.celo.org/alfajores',
},
default: { name: 'CeloScan', url: 'https://alfajores.celoscan.io' },
},
testnet: true,
};
// Override to set name to just Arbitrum
const arbitrumChain = {
...chain.arbitrum,
name: 'Arbitrum',
};
export const auroraTestnetChain: Chain = {
id: 1313161555,
name: 'Aurora',
network: 'auroraTestnet',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: 'https://testnet.aurora.dev',
},
blockExplorers: {
etherscan: {
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
},
default: {
name: 'AuroraScan',
url: 'https://testnet.aurorascan.dev',
},
},
testnet: true,
};
export const avalancheChain: Chain = {
id: 43114,
name: 'Avalanche',
network: 'avalanche',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
},
rpcUrls: {
default: 'https://api.avax.network/ext/bc/C/rpc',
},
blockExplorers: {
default: { name: 'SnowTrace', url: 'https://snowtrace.io' },
},
testnet: false,
};
export const bscChain: Chain = {
id: 56,
name: 'Binance Smart Chain',
network: 'bsc',
nativeCurrency: {
decimals: 18,
name: 'BNB',
symbol: 'BNB',
},
rpcUrls: {
default: 'https://bsc-dataseed.binance.org',
},
blockExplorers: {
etherscan: { name: 'BscScan', url: 'https://bscscan.com' },
default: { name: 'BscScan', url: 'https://bscscan.com' },
},
testnet: false,
};
export const bscTestnetChain: Chain = {
id: 97,
name: 'Bsc Testnet',
network: 'bscTestnet',
nativeCurrency: {
decimals: 18,
name: 'BNB',
symbol: 'BNB',
},
rpcUrls: {
default: 'https://data-seed-prebsc-1-s3.binance.org:8545',
},
blockExplorers: {
etherscan: { name: 'BscScan', url: 'https://testnet.bscscan.com' },
default: { name: 'BscScan', url: 'https://testnet.bscscan.com' },
},
testnet: true,
};
export const celoMainnetChain: Chain = {
id: 42220,
name: 'Celo',
network: 'celo',
nativeCurrency: {
decimals: 18,
name: 'CELO',
symbol: 'CELO',
},
rpcUrls: {
default: 'https://forno.celo.org',
},
blockExplorers: {
etherscan: { name: 'CeloScan', url: 'https://celoscan.io' },
blockscout: {
name: 'Blockscout',
url: 'https://explorer.celo.org',
},
default: { name: 'CeloScan', url: 'https://celoscan.io' },
},
testnet: false,
};
export const fujiTestnetChain: Chain = {
id: 43113,
name: 'Fuji',
network: 'fuji',
nativeCurrency: {
decimals: 18,
name: 'Avalanche',
symbol: 'AVAX',
},
rpcUrls: {
default: 'https://api.avax-test.network/ext/bc/C/rpc',
},
blockExplorers: {
default: {
name: 'Snowtrace',
url: 'https://testnet.snowtrace.io',
},
},
testnet: true,
};
export const moonbaseAlphaChain: Chain = {
id: 1287,
name: 'Moonbase Alpha',
network: 'moonbaseAlpha',
nativeCurrency: {
decimals: 18,
name: 'DEV',
symbol: 'DEV',
},
rpcUrls: {
default: 'https://rpc.api.moonbase.moonbeam.network',
},
blockExplorers: {
etherscan: {
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
},
default: {
name: 'MoonScan',
url: 'https://moonbase.moonscan.io',
},
},
testnet: true,
};
export const moonbeamChain: Chain = {
id: 1284,
name: 'Moonbeam',
network: 'moonbeam',
nativeCurrency: {
decimals: 18,
name: 'GLMR',
symbol: 'GLMR',
},
rpcUrls: {
default: 'https://rpc.api.moonbeam.network',
},
blockExplorers: {
etherscan: {
name: 'MoonScan',
url: 'https://moonscan.io',
},
default: {
name: 'MoonScan',
url: 'https://moonscan.io',
},
},
testnet: false,
};
// Override to set name to just Mumbai
const polygonMumbaiChain = {
...chain.polygonMumbai,
name: 'Mumbai',
};
export const zksync2testnetChain: Chain = {
id: 280,
name: 'ZkSync Testnet',
network: 'zksync2testnet',
nativeCurrency: {
decimals: 18,
name: 'ETH',
symbol: 'ETH',
},
rpcUrls: {
default: 'https://zksync2-testnet.zksync.dev',
},
blockExplorers: {
etherscan: {
name: 'ZkScan',
url: 'https://zksync2-testnet.zkscan.io',
},
default: {
name: 'ZkScan',
url: 'https://zksync2-testnet.zkscan.io',
},
},
testnet: true,
};
// SDK uses name, wagmi uses ID, so this maps id to name
// Would be nice to use wagmi's chain 'name' or 'network' prop
// But doesn't match SDK
export const chainIdToName = {
44787: 'alfajores',
42161: 'arbitrum',
421611: 'arbitrumrinkeby',
421613: 'arbitrumgoerli',
1313161555: 'auroratestnet',
43114: 'avalanche',
56: 'bsc',
97: 'bsctestnet',
42220: 'celo',
1: 'ethereum',
43113: 'fuji',
5: 'goerli',
42: 'kovan',
1287: 'moonbasealpha',
1284: 'moonbeam',
80001: 'mumbai',
10: 'optimism',
420: 'optimismgoerli',
69: 'optimismkovan',
137: 'polygon',
280: 'zksync2testnet',
};
export const chainIdToBlockTime = {
44787: 5,
42161: 3, // Fake
421611: 3, // Fake
421613: 3, // Fake
1313161555: 3, // Fake
43114: 2,
56: 3,
97: 3,
42220: 5,
1: 13,
43113: 2,
5: 15,
42: 8,
1287: 12,
1284: 12,
80001: 5,
10: 3, // Fake
420: 3, // Fake
69: 3, // Fake
137: 2,
280: 2, // Closer to 1.2 actually
};
// Some block explorers use diff urls for their explorer
// api vs the ui, so setting overrides here
export const chainIdToExplorerApi = {
44787: 'https://alfajores.celoscan.io',
42161: 'https://api.arbiscan.io',
421611: 'https://api-testnet.arbiscan.io',
421613: 'https://api-goerli.arbiscan.io',
43114: 'https://api.snowtrace.io',
56: 'https://api.bscscan.com',
97: 'https://api-testnet.bscscan.com',
42220: 'https://api.celoscan.io',
1: 'https://api.etherscan.io',
43113: 'https://api-testnet.snowtrace.io',
5: 'https://api-goerli.etherscan.io',
42: 'https://api-kovan.etherscan.io',
1287: 'https://api-moonbase.moonscan.io',
1284: 'https://api-moonbeam.moonscan.io',
80001: 'https://api-testnet.polygonscan.com',
10: 'https://api-optimistic.etherscan.io',
420: 'https://api-goerli-optimism.etherscan.io',
69: 'https://api-kovan-optimistic.etherscan.io',
137: 'https://api.polygonscan.com',
};
export const mainnetChains = [
arbitrumChain,
avalancheChain,
bscChain,
celoMainnetChain,
chain.mainnet,
moonbeamChain,
chain.optimism,
chain.polygon,
];
export const testnetChains = [
alfajoresChain,
chain.arbitrumGoerli,
auroraTestnetChain,
bscTestnetChain,
fujiTestnetChain,
chain.goerli,
moonbaseAlphaChain,
chain.optimismGoerli,
polygonMumbaiChain,
// zksync2testnetChain,
];
export const mainnetAndTestChains = [...mainnetChains, ...testnetChains];
export const allChains = [...allChainsWagmi, ...mainnetAndTestChains];
export const chainIdToChain = allChains.reduce<Record<number, Chain>>((result, chain) => {
result[chain.id] = chain;
return result;
}, {});

@ -9,6 +9,7 @@ export const environments = Object.values(Environment);
export const envDisplayValue = {
[Environment.Mainnet]: 'Mainnet',
[Environment.Testnet2]: 'Testnet',
[Environment.Testnet3]: 'Testnet',
};
export const MAILBOX_VERSION = 0;

@ -1,8 +1,7 @@
import { constants } from 'ethers';
import { hyperlaneCoreAddresses } from '@hyperlane-xyz/sdk';
import { chainIdToMetadata, hyperlaneCoreAddresses } from '@hyperlane-xyz/sdk';
import { chainIdToName } from '../../consts/chains';
import { Message, MessageStatus } from '../../types';
import { ensureLeading0x, validateAddress } from '../../utils/addresses';
import { getChainEnvironment } from '../../utils/chains';
@ -57,7 +56,7 @@ export async function fetchDeliveryStatus(
} else {
const { originChainId, originTransaction, nonce } = message;
const originTxHash = originTransaction.transactionHash;
const originName = chainIdToName[originChainId];
const originName = chainIdToMetadata[originChainId].name;
const environment = getChainEnvironment(originName);
const originTxReceipt = await queryExplorerForTxReceipt(originChainId, originTxHash);
// TODO currently throwing this over the fence to the debugger script
@ -98,8 +97,8 @@ async function fetchExplorerLogsForMessage(message: Message) {
const { msgId, originChainId, originTransaction, destinationChainId } = message;
logger.debug(`Searching for delivery logs for tx ${originTransaction.transactionHash}`);
const originName = chainIdToName[originChainId];
const destName = chainIdToName[destinationChainId];
const originName = chainIdToMetadata[originChainId].name;
const destName = chainIdToMetadata[destinationChainId].name;
const destMailboxAddr = hyperlaneCoreAddresses[destName]?.mailbox;
if (!destMailboxAddr)
@ -138,8 +137,9 @@ function validateMessage(message: Message) {
if (!destinationDomainId) throw new Error(`Invalid dest domain ${destinationDomainId}`);
if (!originChainId) throw new Error(`Invalid origin chain ${originChainId}`);
if (!destinationChainId) throw new Error(`Invalid dest chain ${destinationChainId}`);
if (!chainIdToName[originChainId]) throw new Error(`No name found for chain ${originChainId}`);
if (!chainIdToName[destinationChainId])
if (!chainIdToMetadata[originChainId]?.name)
throw new Error(`No name found for chain ${originChainId}`);
if (!chainIdToMetadata[destinationChainId]?.name)
throw new Error(`No name found for chain ${destinationChainId}`);
if (!nonce) throw new Error(`Invalid nonce ${nonce}`);
if (!originTransaction?.transactionHash) throw new Error(`Invalid or missing origin tx`);

@ -4,11 +4,10 @@ import Image from 'next/image';
import { useEffect } from 'react';
import { toast } from 'react-toastify';
import { ChainName, chainMetadata } from '@hyperlane-xyz/sdk';
import { chainIdToMetadata } from '@hyperlane-xyz/sdk';
import { WideChevronIcon } from '../../../components/icons/WideChevron';
import { Card } from '../../../components/layout/Card';
import { chainIdToBlockTime, chainIdToName } from '../../../consts/chains';
import EnvelopeIcon from '../../../images/icons/envelope-check.svg';
import LockIcon from '../../../images/icons/lock.svg';
import AirplaneIcon from '../../../images/icons/paper-airplane.svg';
@ -226,9 +225,12 @@ function useMessageStage(
return null;
}
const relayEstimate = Math.floor(chainIdToBlockTime[destChainId] * 1.5);
const relayEstimate = Math.floor(
chainIdToMetadata[destChainId].blocks.estimateBlockTime * 1.5,
);
const finalityBlocks = getFinalityBlocks(originChainId);
const finalityEstimate = finalityBlocks * (chainIdToBlockTime[originChainId] || 3);
const finalityEstimate =
finalityBlocks * (chainIdToMetadata[originChainId].blocks.estimateBlockTime || 3);
if (status === MessageStatus.Delivered && destinationTimestamp) {
// For delivered messages, just to rough estimates for stages
@ -307,9 +309,7 @@ function useMessageStage(
}
function getFinalityBlocks(chainId: number) {
const chainName = chainIdToName[chainId] as ChainName;
const metadata = chainMetadata[chainName];
const finalityBlocks = metadata?.finalityBlocks || 0;
const finalityBlocks = chainIdToMetadata[chainId]?.blocks.confirmations || 0;
return Math.max(finalityBlocks, 1);
}

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="177.5 53.2 287 322.18" xml:space="preserve"><path fill="#2D374B" d="m357.3 200.8 23.7-40.1 63.8 99.3v19.1l-.2-131.2a9.9 9.9 0 0 0-4.6-7.9L325.2 74a10.1 10.1 0 0 0-9.8.6l-.4.3-111.5 64.6-.4.2c-.6.2-1.2.5-1.7 1a9.9 9.9 0 0 0-4.1 7.3l.2 107 59.4-92.1c7.5-12.2 23.8-16.2 38.9-16l17.8.5-104.7 167.8 12.4 7L327 147.7l46.8-.2-105.6 179.1 44 25.3 5.3 3c2.2 1 4.8 1 7 .2L441 287.6l-22.2 13-61.6-99.7zm9 130L322 261.2l27.1-46 58.4 92-41 23.8z"/><path fill="#28A0F0" d="m321.9 261.1 44.4 69.8 41.1-23.8-58.4-92z"/><path fill="#28A0F0" d="M444.8 279.1v-19L381 160.6l-23.7 40.1 61.6 99.6 22.2-12.9a9.9 9.9 0 0 0 3.7-7.2V279z"/><path fill="#FFF" d="m177.5 297 31.4 18.2 104.7-167.8-17.8-.5c-15.1-.2-31.4 3.8-39 16l-59.3 92-20 30.8V297z"/><path fill="#FFF" d="m373.9 147.4-46.8.2-105.8 174.7 37 21.3 10-17.1z"/><path fill="#96BEDC" d="M464.5 147.2a29.8 29.8 0 0 0-14-24L334.2 56.3a30.3 30.3 0 0 0-26.7 0 90105.1 90105.1 0 0 0-117.6 68.2 29.6 29.6 0 0 0-12.4 22.6v138.6l20-30.7-.2-107a9.8 9.8 0 0 1 4.1-7.4l115-66.6c2.7-1.3 6-1.3 8.8 0L440 140a9.9 9.9 0 0 1 4.6 7.9v132.4a9.7 9.7 0 0 1-3.5 7.2l-22.2 13-11.5 6.6-41 23.8-41.7 24.1a10 10 0 0 1-7.1-.1l-49.3-28.4-10 17.1 44.2 25.5a1045.3 1045.3 0 0 0 7 4 31.4 31.4 0 0 0 22.7.3l121-70c6.9-5.4 11-13.5 11.3-22.3V147z"/></svg>

Before

Width:  |  Height:  |  Size: 1.3 KiB

@ -1 +0,0 @@
<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1503 1504"><path fill="#fff" d="M287 258h928v844H287z"/><path fill-rule="evenodd" clip-rule="evenodd" d="M1502.5 752a751 751 0 1 1-1502 0 751 751 0 0 1 1502 0Zm-963.8 298.9H392.9c-30.6 0-45.7 0-55-6a37 37 0 0 1-16.7-29c-.6-10.8 7-24 22.1-50.6l359.9-634.4c15.3-26.9 23-40.4 32.8-45.3 10.5-5.4 23-5.4 33.6 0 9.8 5 17.5 18.4 32.8 45.3l74 129.2.4.6c16.5 29 25 43.6 28.6 59 4 16.8 4 34.5 0 51.3-3.7 15.5-12 30.2-28.8 59.5l-189 334.2-.5.9c-16.7 29-25.1 43.9-36.8 55a110 110 0 0 1-44.8 26c-15.3 4.3-32.5 4.3-66.8 4.3Zm368 0h208.9c30.8 0 46.3 0 55.5-6.1a37 37 0 0 0 16.8-29.2c.5-10.5-6.9-23.3-21.4-48.3l-1.5-2.6-104.6-179-1.2-2c-14.7-24.8-22-37.4-31.6-42.2a36.7 36.7 0 0 0-33.4 0c-9.6 5-17.3 18-32.7 44.4L857.3 965l-.4.6c-15.2 26.3-22.8 39.5-22.3 50.3a37.4 37.4 0 0 0 16.8 29.2c9 5.9 24.5 5.9 55.4 5.9Z" fill="#E84142"/></svg>

Before

Width:  |  Height:  |  Size: 883 B

@ -1 +0,0 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="169.1 68.9 461.4 461.4" xml:space="preserve"><g fill-rule="evenodd" clip-rule="evenodd"><circle cx="399.8" cy="299.6" r="230.7" fill="#f3ba2f"/><path d="m459.63 324.13 34.8 34.7-94.6 94.5-94.5-94.5 34.8-34.7 59.7 59.7 59.8-59.7zm-59.8-59.8 35.3 35.3-35.3 35.3-35.2-35.2v-.1l6.2-6.2 3-3 26-26.1zm-119 .5 34.8 34.8-34.8 34.7-34.8-34.8 34.8-34.7zm238 0 34.8 34.8-34.8 34.7-34.8-34.8 34.8-34.7zm-119-119 94.5 94.5-34.8 34.8-59.7-59.8-59.7 59.7-34.8-34.7 94.5-94.5z" fill="#FFF"/></g></svg>

Before

Width:  |  Height:  |  Size: 548 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 950 950"><path d="M375 850a275 275 0 100-550 275 275 0 000 550zm0 100a375 375 0 110-750 375 375 0 010 750z" fill="#fbcc5c"/><path d="M575 650a275 275 0 100-550 275 275 0 000 550zm0 100a375 375 0 110-750 375 375 0 010 750z" fill="#35d07f"/><path d="M587.4 750a274.4 274.4 0 0054.5-108A274.4 274.4 0 00750 587.3a373.6 373.6 0 01-29.2 133.4A373.6 373.6 0 01587.4 750zM308 308A274.4 274.4 0 00200 362.7a373.6 373.6 0 0129.2-133.4A373.6 373.6 0 01362.6 200a274.4 274.4 0 00-54.5 108z" fill="#5ea33b"/></svg>

Before

Width:  |  Height:  |  Size: 555 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" fill-rule="evenodd" clip-rule="evenodd" viewBox="-150 0 1100 1277.4"><g fill-rule="nonzero"><path fill="#343434" d="m392.1 0-8.6 29.1v844.6l8.6 8.6 392-231.8z"/><path fill="#8C8C8C" d="M392.1 0 0 650.5l392.1 231.8v-410z"/><path fill="#3C3C3B" d="m392.1 956.5-4.9 5.9v300.9l4.9 14.1 392.3-552.5z"/><path fill="#8C8C8C" d="M392.1 1277.4V956.5L0 724.9z"/><path fill="#141414" d="m392.1 882.3 392-231.8-392-178.2z"/><path fill="#393939" d="m0 650.5 392.1 231.8v-410z"/></g></svg>

Before

Width:  |  Height:  |  Size: 536 B

@ -1 +0,0 @@
<svg version="1.0" xmlns="http://www.w3.org/2000/svg" viewBox="0 1.61 487.64 436.39"><path d="M278 2.1c-51.9 4.3-98.8 37-122.6 85.4-10.8 22.1-16 41.7-17.1 64-.5 12.1-.4 13.2 1.5 15.5l2 2.5 147.7.3 147.6.2 3-2.9c3.4-3.4 3.5-5.6 1.8-22.2-5.2-51.3-33.7-97-76.2-122.3C339.1 6.7 308.6-.4 278 2.1z" fill="#53cbc8"/><path d="M74.9 200.9c-2.3 2.3-2.9 3.8-2.9 7.1 0 5.6 3.4 9 9 9s9-3.4 9-9c0-5.3-4.2-10-9-10-2.2 0-4.1.9-6.1 2.9z" fill="#e1147b"/><path d="M108.7 200c-4.7 3.7-4.4 13.5.4 16 1.1.6 68.4 1 181.7 1h179.9l2.1-2.3c4.6-4.9 3.2-13.6-2.4-15.7-1.6-.6-69.7-1-180.8-1-178.1 0-178.3 0-180.9 2z" fill="#e1147b"/><path d="M5.3 243c-2.5 1-5.3 5.8-5.3 9 0 3.8 2.8 7.8 6.3 8.9 6.4 2.1 12.2-2.2 12.2-9.1 0-3.3-.6-4.5-3.3-6.9-3.3-3-6-3.5-9.9-1.9z" fill="#e1147b"/><path d="M37.9 243.5c-5.5 3-6.1 11-1.3 15.6l2.6 2.4 130.8.3c82.4.1 131.8-.1 133.4-.7 3.4-1.4 5.8-5.3 5.8-9.8 0-2.9-.7-4.3-3.1-6.5L303 242H171.7c-111.4.1-131.6.3-133.8 1.5z" fill="#e1147b"/><path d="M77.4 287c-5.6 2.3-7.2 10.8-3 15.7a8.9 8.9 0 0 0 13.2 0c6.5-7.6-1.3-19.5-10.2-15.7z" fill="#e1147b"/><path d="M110.1 287.4c-6.8 3.8-6.4 14.6.6 17.5 2.1.8 43.1 1.1 160.6.9l157.9-.3 2.4-2.8c3.5-4.1 3.3-9.9-.5-13.8l-2.9-2.9H270.3c-129.1.1-158.2.3-160.2 1.4z" fill="#e1147b"/><path d="M24.5 330.9c-3.7 1.6-6 5.1-6 9.3 0 3.3.6 4.5 3.3 6.9 1.8 1.6 4.1 2.9 5.2 2.9 5.3 0 10-4.9 10-10.4 0-3.2-4.6-8.4-8-9-1.4-.3-3.4-.1-4.5.3z" fill="#e1147b"/><path d="M57.4 331c-4.7 1.9-6.9 9.2-4.4 14.1 2.7 4.9 2.5 4.9 69.5 4.9s66.8 0 69.5-4.9c2.6-4.9-.1-12.2-5.1-14-3.9-1.3-126.2-1.4-129.5-.1z" fill="#e1147b"/><path d="M217.4 331c-5.6 2.3-7.2 10.8-3 15.7l2.4 2.8 132.1.3 132 .2 3.3-2.9c4.4-3.9 4.6-9.8.5-13.8l-2.7-2.8-131.3-.2c-72.7-.1-132.2.2-133.3.7z" fill="#e1147b"/><path d="M235.3 375.5c-6.1 2.6-7.4 10.6-2.4 15.6 4 3.9 8.2 3.9 12.2 0 5-5.1 3.7-13-2.6-15.7-4-1.6-3.2-1.7-7.2.1z" fill="#e1147b"/><path d="M268.3 375.5c-3.7 1.6-5.3 4.2-5.3 8.5 0 4.2 1.5 6.7 5 8.5 2.5 1.3 13.6 1.5 83.7 1.5 78.3 0 80.9-.1 84-2 6.1-3.7 5.3-13.8-1.3-16.6-4.9-2.1-161.4-2-166.1.1z" fill="#e1147b"/><path d="M135.5 421.5c-5.7 5.6-1.6 16.5 6.2 16.5 8.9 0 12.6-12.2 5.4-17.7-2.8-2.2-8.9-1.6-11.6 1.2z" fill="#e1147b"/><path d="M170.2 419.7c-1.9.7-4.2 5.8-4.2 9.3 0 2.1.9 4.1 2.9 6.1l2.9 2.9h165.1l2.6-2.3c1.7-1.4 2.8-3.6 3.2-6.3.4-3.3.1-4.5-2.2-7.2l-2.7-3.2-83.1.1c-45.8 0-83.8.3-84.5.6z" fill="#e1147b"/></svg>

Before

Width:  |  Height:  |  Size: 2.3 KiB

@ -1 +0,0 @@
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 500 500" xml:space="preserve"><circle cx="250" cy="250" r="250" fill="#ff0420"/><path fill="#fff" d="M177.1 316.4a60.1 60.1 0 0 1-36.6-10.5 36 36 0 0 1-14.1-30.4c0-2.8.3-6.1.9-10.1 1.6-9 3.9-19.8 6.9-32.5 8.5-34.4 30.5-51.6 65.9-51.6 9.6 0 18.3 1.6 25.9 4.9a38.3 38.3 0 0 1 24.6 36.8c0 2.6-.3 5.9-.9 9.9-1.9 11.1-4.1 22-6.8 32.5a69 69 0 0 1-22.7 38.5c-10.7 8.4-25.1 12.5-43.1 12.5zm2.7-27c7 0 12.9-2.1 17.8-6.2 5-4.1 8.6-10.4 10.7-19 2.9-11.8 5.1-22 6.6-30.8.5-2.6.8-5.3.8-8.1 0-11.4-5.9-17.1-17.8-17.1-7 0-13 2.1-18 6.2a34.6 34.6 0 0 0-10.5 19c-2.3 8.4-4.5 18.6-6.8 30.8a40 40 0 0 0-.8 7.9c-.1 11.6 6 17.3 18 17.3z"/><path fill="#fff" d="M259.3 314.6c-1.4 0-2.4-.4-3.2-1.3-.6-1-.8-2.1-.6-3.4l25.9-122a5 5 0 0 1 2.1-3.4 5.5 5.5 0 0 1 3.6-1.3H337c13.9 0 25 2.9 33.4 8.6a28.4 28.4 0 0 1 12.8 25 49 49 0 0 1-1.1 9.8 50.4 50.4 0 0 1-19 31.9 64.2 64.2 0 0 1-38.7 10.3h-25.3l-8.6 41.1a5.4 5.4 0 0 1-2.1 3.4 5.5 5.5 0 0 1-3.6 1.3h-25.5zm66.4-71.7c5.3 0 9.8-1.4 13.7-4.3 4-2.9 6.6-7 7.9-12.4.4-2.1.6-4 .6-5.6 0-3.6-1.1-6.4-3.2-8.3-2.1-2-5.8-3-10.9-3h-22.5l-7.1 33.6h21.5z"/></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -0.1 38.3 33.7" xml:space="preserve"><path d="M29 10.2c-.7-.4-1.6-.4-2.4 0L21 13.5l-3.8 2.1-5.5 3.3c-.7.4-1.6.4-2.4 0L5 16.3c-.7-.4-1.2-1.2-1.2-2.1v-5c0-.8.4-1.6 1.2-2.1l4.3-2.5c.7-.4 1.6-.4 2.4 0L16 7.2c.7.4 1.2 1.2 1.2 2.1v3.3l3.8-2.2V7c0-.8-.4-1.6-1.2-2.1l-8-4.7c-.7-.4-1.6-.4-2.4 0L1.2 5C.4 5.4 0 6.2 0 7v9.4c0 .8.4 1.6 1.2 2.1l8.1 4.7c.7.4 1.6.4 2.4 0l5.5-3.2 3.8-2.2 5.5-3.2c.7-.4 1.6-.4 2.4 0l4.3 2.5c.7.4 1.2 1.2 1.2 2.1v5c0 .8-.4 1.6-1.2 2.1L29 28.8c-.7.4-1.6.4-2.4 0l-4.3-2.5c-.7-.4-1.2-1.2-1.2-2.1V21l-3.8 2.2v3.3c0 .8.4 1.6 1.2 2.1l8.1 4.7c.7.4 1.6.4 2.4 0l8.1-4.7c.7-.4 1.2-1.2 1.2-2.1V17c0-.8-.4-1.6-1.2-2.1L29 10.2z" fill="#8247e5"/></svg>

Before

Width:  |  Height:  |  Size: 705 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 432.5 485.6"><g fill="#010101"><path d="m284.5 418.4-67-105.1 41-69.4 87.9 138.6-61.9 35.9Z"/><path d="m217.6 313.3 66.9 105.1 61.9-35.9-88-138.6z"/><path d="M402.7 340.4v-28.8L306.6 162l-35.7 60.5 92.8 150 33.5-19.4c3.3-2.7 5.3-6.6 5.5-10.9v-1.8Z"/><path d="m0 367.5 47.4 27.2L205 142l-26.7-.7c-22.8-.3-47.4 5.6-58.7 24L30.1 304 0 350.3v17.2Z"/><path d="m296 141.9-70.5.3L66 405.4l55.7 32.1 15.2-25.7z"/><path d="M432.4 141.6a45 45 0 0 0-21-36.1L236 4.7a45.6 45.6 0 0 0-40.3 0L25.4 103.4a45 45 0 0 0-25.4 38v208.9L30.1 304 30 142.9c0-.6 0-1.2.2-1.7.6-3.8 2.8-7.2 6-9.5.7-.6 172.6-100 173.2-100.3 4-2 9.2-2 13.2 0l173 99.4c4.1 2.6 6.7 7 7 11.9v199.5a15 15 0 0 1-5.3 10.9l-33.5 19.4-17.3 10-61.9 35.9-62.7 36.3a15.2 15.2 0 0 1-10.7-.2L137 411.8l-15.2 25.7 66.7 38.5a1156 1156 0 0 0 10.6 5.9 44.6 44.6 0 0 0 34 .6l182.3-105.6a44.6 44.6 0 0 0 17.1-33.6V141.6Z"/></g></svg>

Before

Width:  |  Height:  |  Size: 922 B

@ -1 +0,0 @@
<svg viewBox="451.97 346.93 767.35 681.07" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M644.6 1028h-129c-27.2 0-40.5 0-48.7-5.2A32.8 32.8 0 0 1 452 997c-.5-9.6 6.2-21.4 19.6-44.9l318.6-561.5c13.5-23.8 20.4-35.7 29-40.1a32.9 32.9 0 0 1 29.8 0c8.6 4.4 15.5 16.3 29 40.1L943.5 505c14.9 26 22.4 39 25.7 52.8a97 97 0 0 1 0 45.4c-3.3 13.7-10.7 26.8-25.5 52.7L776.4 951.7c-15 26.3-22.6 39.6-33 49.5a97.3 97.3 0 0 1-39.7 23c-13.6 3.8-28.8 3.8-59.1 3.8Z" fill="#010101"/><path d="M1155.2 1028H970.4c-27.3 0-41 0-49-5.2a33.1 33.1 0 0 1-14.9-25.8c-.5-9.7 6.4-21.4 20.1-45.1l92.3-158.4c13.5-23.4 20.4-35 28.9-39.4a32.5 32.5 0 0 1 29.5 0c8.7 4.4 15.4 16 29.1 39.2l92.6 158.4c13.7 23.7 20.8 35.5 20.3 45.1-.5 10.5-6 20.1-14.9 25.8-8.2 5.4-21.9 5.4-49.2 5.4Z" fill="#010101"/></svg>

Before

Width:  |  Height:  |  Size: 779 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" xml:space="preserve" viewBox="0 0 126.6 126.6"><path fill="#010101" d="m38.2 53.2 24.6-24.6 24.6 24.6 14.3-14.3L62.8 0 23.9 38.9z"/><path fill="#010101" d="M13.7 49 28 63.3 13.7 77.5-.6 63.3z"/><path fill="#010101" d="M38.2 73.4 62.8 98l24.6-24.6 14.3 14.3-38.9 38.9-38.9-38.9h-.1z"/><path fill="#010101" d="m126 63.3-14.2 14.3-14.3-14.3L111.8 49z"/><path fill="#010101" d="M77.3 63.3 62.8 48.8 52 59.5l-1.2 1.2-2.5 2.6h-.1.1l14.5 14.5 14.5-14.5z"/></svg>

Before

Width:  |  Height:  |  Size: 495 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 950 950"><defs><style>.cls-1{fill:#010101;}</style></defs><path id="Bottom_Ring" data-name="Bottom Ring" class="cls-1" d="M375,850c151.88,0,275-123.12,275-275S526.88,300,375,300,100,423.12,100,575,223.12,850,375,850Zm0,100C167.9,950,0,782.1,0,575S167.9,200,375,200,750,367.9,750,575,582.1,950,375,950Z"></path><path id="Top_Ring" data-name="Top Ring" class="cls-1" d="M575,650c151.88,0,275-123.12,275-275S726.88,100,575,100,300,223.12,300,375,423.12,650,575,650Zm0,100c-207.1,0-375-167.9-375-375S367.9,0,575,0,950,167.9,950,375,782.1,750,575,750Z"></path></svg>

Before

Width:  |  Height:  |  Size: 614 B

@ -1,8 +0,0 @@
<svg viewBox="-5 0 29 33" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M10.4969 0L10.2676 0.751799V22.5673L10.4969 22.788L20.9937 16.8023L10.4969 0Z" fill="#010101"/>
<path d="M10.4969 0L0 16.8023L10.4969 22.7881V12.1996V0Z" fill="#010101"/>
<path d="M10.4969 24.7054L10.3677 24.8573V32.6285L10.4969 32.9926L21 18.7227L10.4969 24.7054Z" fill="#010101"/>
<path d="M10.4969 32.9925V24.7053L0 18.7226L10.4969 32.9925Z" fill="#010101"/>
<path d="M10.4966 22.788L20.9933 16.8023L10.4966 12.1996V22.788Z" fill="#010101"/>
<path d="M0 16.8024L10.4967 22.7881V12.1996L0 16.8024Z" fill="#010101"/>
</svg>

Before

Width:  |  Height:  |  Size: 608 B

@ -1,3 +0,0 @@
<svg width="182" height="100" viewBox="0 0 182 100" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M172 100C177.523 100 182.048 95.5134 181.545 90.0135C179.459 67.1595 170.257 45.6742 155.347 29.2893C138.281 10.5357 115.135 2.00233e-06 91 0C66.8653 -2.00233e-06 43.7191 10.5357 26.6533 29.2893C11.743 45.6742 2.54129 67.1595 0.454628 90.0135C-0.0475417 95.5134 4.47715 100 10 100L91 100H172Z" fill="#010101"/>
</svg>

Before

Width:  |  Height:  |  Size: 427 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="72 72.5 144 144"><path d="m187.6 79.8-30.1 44.7a3.2 3.2 0 0 0 4.7 4.2L192 103a1.2 1.2 0 0 1 2 1v80.4a1.2 1.2 0 0 1-2.2.7L102.2 78a15.3 15.3 0 0 0-11.7-5.4h-3.2A15.3 15.3 0 0 0 72 87.8v113.4a15.3 15.3 0 0 0 15.3 15.3 15.3 15.3 0 0 0 13.1-7.3l30.1-44.7a3.2 3.2 0 0 0-4.7-4.2L96 186a1.2 1.2 0 0 1-2-1v-80.4a1.2 1.2 0 0 1 2.2-.8l89.5 107.3a15.3 15.3 0 0 0 11.7 5.4h3.2a15.3 15.3 0 0 0 15.3-15.3V87.8a15.3 15.3 0 0 0-15.3-15.3 15.3 15.3 0 0 0-13.1 7.3Z" /></svg>

Before

Width:  |  Height:  |  Size: 506 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="30.8 44.2 62.6 33"><path data-name="Path 139" d="M43.2 77.2a14.7 14.7 0 0 1-9-2.6 8.8 8.8 0 0 1-3.4-7.4 16.4 16.4 0 0 1 .3-2.5q.6-3.3 1.7-7.9 3-12.6 16-12.6a16 16 0 0 1 6.3 1.2 9.6 9.6 0 0 1 4.4 3.5 9.3 9.3 0 0 1 1.6 5.5 16.3 16.3 0 0 1-.2 2.4l-1.6 8Q57.7 71 53.7 74q-4 3-10.5 3Zm.6-6.6a6.5 6.5 0 0 0 4.4-1.5 8.4 8.4 0 0 0 2.6-4.6l1.6-7.6a10.5 10.5 0 0 0 .2-2q0-4-4.4-4a6.7 6.7 0 0 0-4.4 1.4 8.6 8.6 0 0 0-2.5 4.6q-.8 3.1-1.7 7.6a9.8 9.8 0 0 0-.2 1.9q0 4.2 4.4 4.2Z" fill="#010101"/><path data-name="Path 140" d="M63.2 76.7a1 1 0 0 1-.7-.3 1.1 1.1 0 0 1-.2-.8l6.3-29.8a1.3 1.3 0 0 1 .5-.8 1.4 1.4 0 0 1 1-.3h12a14.1 14.1 0 0 1 8.2 2 6.9 6.9 0 0 1 3.1 6.2 11 11 0 0 1-.2 2.4 12.4 12.4 0 0 1-4.7 7.7q-3.4 2.6-9.4 2.6H73l-2 10a1.3 1.3 0 0 1-.6.8 1.4 1.4 0 0 1-.8.3Zm16.2-17.5a5.5 5.5 0 0 0 3.4-1 5 5 0 0 0 2-3 8 8 0 0 0 0-1.4 2.5 2.5 0 0 0-.7-2 3.8 3.8 0 0 0-2.7-.8H76l-1.7 8.2Z" fill="#010101"/></svg>

Before

Width:  |  Height:  |  Size: 948 B

@ -1 +0,0 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38.4 33.5" xml:space="preserve"><path d="M29 10.2c-.7-.4-1.6-.4-2.4 0L21 13.5l-3.8 2.1-5.5 3.3c-.7.4-1.6.4-2.4 0L5 16.3a2.4 2.4 0 0 1-1.2-2.1v-5c0-.8.4-1.6 1.2-2.1l4.3-2.5c.7-.4 1.6-.4 2.4 0L16 7.2c.7.4 1.2 1.2 1.2 2.1v3.3l3.8-2.2V7c0-.8-.4-1.6-1.2-2.1l-8-4.7c-.7-.4-1.6-.4-2.4 0L1.2 5C.4 5.4 0 6.2 0 7v9.4c0 .8.4 1.6 1.2 2.1l8.1 4.7c.7.4 1.6.4 2.4 0l5.5-3.2 3.8-2.2 5.5-3.2c.7-.4 1.6-.4 2.4 0l4.3 2.5c.7.4 1.2 1.2 1.2 2.1v5c0 .8-.4 1.6-1.2 2.1L29 28.8c-.7.4-1.6.4-2.4 0l-4.3-2.5a2.4 2.4 0 0 1-1.2-2.1V21l-3.8 2.2v3.3c0 .8.4 1.6 1.2 2.1l8.1 4.7c.7.4 1.6.4 2.4 0l8.1-4.7c.7-.4 1.2-1.2 1.2-2.1V17c0-.8-.4-1.6-1.2-2.1L29 10.2z" fill="#010101"/></svg>

Before

Width:  |  Height:  |  Size: 700 B

@ -1,9 +1,8 @@
import { BigNumber } from 'ethers';
import type { NextApiRequest, NextApiResponse } from 'next';
import type { ChainName } from '@hyperlane-xyz/sdk';
import { chainIdToMetadata } from '@hyperlane-xyz/sdk';
import { chainIdToName } from '../../consts/chains';
import { getChainEnvironment } from '../../utils/chains';
import { logger } from '../../utils/logger';
import { fetchWithTimeout } from '../../utils/timeout';
@ -37,7 +36,7 @@ async function fetchLatestNonce(chainId: number) {
// Partly copied from https://github.com/hyperlane-xyz/hyperlane-monorepo/blob/1fc65f3b7f31f86722204a9de08506f212720a52/typescript/infra/config/environments/mainnet/validators.ts#L12
function getS3BucketUrl(chainId: number) {
const chainName = chainIdToName[chainId] as ChainName;
const chainName = chainIdToMetadata[chainId].name;
const environment = getChainEnvironment(chainId);
const bucketName = `hyperlane-${environment}-${chainName}-validator-0`;
return `https://${bucketName}.s3.us-east-1.amazonaws.com/checkpoint_latest_index.json`;

@ -1,26 +1,19 @@
import { chain } from 'wagmi';
import { ChainName, Chains, Mainnets, chainIdToMetadata } from '@hyperlane-xyz/sdk';
import { ChainName, Chains, Mainnets } from '@hyperlane-xyz/sdk';
import { bscChain, chainIdToChain, chainIdToName, moonbaseAlphaChain } from '../consts/chains';
import { Environment } from '../consts/environments';
import { logger } from './logger';
import { toTitleCase } from './string';
export function getChainDisplayName(chainId?: number, shortName = false) {
if (!chainId) return 'Unknown';
if (shortName && chainId === bscChain.id) return 'Binance';
if (shortName && chainId === moonbaseAlphaChain.id) return 'Moonbase';
if (shortName && chainId === chain.optimismGoerli.id) return 'Opt. Goerli';
if (shortName && chainId === chain.arbitrumGoerli.id) return 'Arb. Goerli';
return toTitleCase(chainIdToChain[chainId]?.name || 'Unknown');
if (!chainId || !chainIdToMetadata[chainId]) return 'Unknown';
const metadata = chainIdToMetadata[chainId];
return shortName ? metadata.displayNameShort || metadata.displayName : metadata.displayName;
}
export function getChainEnvironment(chain: number | string) {
let chainName: ChainName;
if (typeof chain === 'number' && chainIdToName[chain]) {
chainName = chainIdToName[chain];
if (typeof chain === 'number' && chainIdToMetadata[chain]) {
chainName = chainIdToMetadata[chain].name;
} else if (typeof chain === 'string' && Object.keys(Chains).includes(chain)) {
chainName = chain as ChainName;
} else {

@ -1,6 +1,7 @@
import { BigNumber, providers } from 'ethers';
import { chainIdToChain, chainIdToExplorerApi } from '../consts/chains';
import { chainIdToMetadata } from '@hyperlane-xyz/sdk';
import { config } from '../consts/config';
import { logger } from './logger';
@ -14,25 +15,15 @@ export interface ExplorerQueryResponse<R> {
}
export function getExplorerUrl(chainId: number) {
if (!chainId) return null;
const chain = chainIdToChain[chainId];
if (!chain?.blockExplorers) return null;
if (chain.blockExplorers.etherscan) {
return chain.blockExplorers.etherscan.url;
}
if (chain.blockExplorers.default) {
return chain.blockExplorers.default.url;
}
return null;
const chain = chainIdToMetadata[chainId];
if (!chain?.blockExplorers?.length) return null;
return chain.blockExplorers[0].url;
}
export function getExplorerApiUrl(chainId: number) {
if (chainIdToExplorerApi[chainId]) {
return chainIdToExplorerApi[chainId];
}
return getExplorerUrl(chainId);
const chain = chainIdToMetadata[chainId];
if (!chain?.blockExplorers?.length) return null;
return chain.blockExplorers[0].apiUrl || chain.blockExplorers[0].url;
}
export function getTxExplorerUrl(chainId: number, hash?: string) {

@ -980,14 +980,14 @@ __metadata:
languageName: node
linkType: hard
"@hyperlane-xyz/core@npm:1.0.0-beta1":
version: 1.0.0-beta1
resolution: "@hyperlane-xyz/core@npm:1.0.0-beta1"
"@hyperlane-xyz/core@npm:1.0.0-beta2":
version: 1.0.0-beta2
resolution: "@hyperlane-xyz/core@npm:1.0.0-beta2"
dependencies:
"@hyperlane-xyz/utils": 1.0.0-beta1
"@hyperlane-xyz/utils": 1.0.0-beta2
"@openzeppelin/contracts": ^4.8.0
"@openzeppelin/contracts-upgradeable": ^4.8.0
checksum: c5c30dddd7a1856d7883ae33e1d70ce93ecb2c3866b31d1838d92e88bef2a4f6f831e8b45085094745ced895a9d1eb6d8d8281e4aaa93d59f43ab98d7a852e9b
checksum: 5f26ffef2dfee9bfa094d6072de76c46fdce92a185c2f2369b5747abb0c8d82f8230efee3754fe8bfd0c9a7de01bf4857846a9089c88c63f6c5ff15b97d456f1
languageName: node
linkType: hard
@ -995,7 +995,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "@hyperlane-xyz/explorer@workspace:."
dependencies:
"@hyperlane-xyz/sdk": ^1.0.0-beta1
"@hyperlane-xyz/sdk": ^1.0.0-beta2
"@metamask/jazzicon": "https://github.com/jmrossy/jazzicon#7a8df28974b4e81129bfbe3cab76308b889032a6"
"@rainbow-me/rainbowkit": ^0.8.0
"@tanstack/react-query": ^4.18.0
@ -1029,28 +1029,28 @@ __metadata:
languageName: unknown
linkType: soft
"@hyperlane-xyz/sdk@npm:^1.0.0-beta1":
version: 1.0.0-beta1
resolution: "@hyperlane-xyz/sdk@npm:1.0.0-beta1"
"@hyperlane-xyz/sdk@npm:^1.0.0-beta2":
version: 1.0.0-beta2
resolution: "@hyperlane-xyz/sdk@npm:1.0.0-beta2"
dependencies:
"@hyperlane-xyz/celo-ethers-provider": ^0.1.1
"@hyperlane-xyz/core": 1.0.0-beta1
"@hyperlane-xyz/utils": 1.0.0-beta1
"@hyperlane-xyz/core": 1.0.0-beta2
"@hyperlane-xyz/utils": 1.0.0-beta2
"@types/debug": ^4.1.7
coingecko-api: ^1.0.10
cross-fetch: ^3.1.5
debug: ^4.3.4
ethers: ^5.6.8
checksum: 7461ad3bae090dcb8f04c1e475cab08a8a48b5f2c53f81d6f3435a7b8716f1f510d84f209d0b0be907fbafcea5208a9481b7e62ee03d522d268ce886b39c243d
checksum: bbb5396c8b40083923f45233b0901a63d1959eba9d1f1e3c57e5d7f382223cc06d27f9a877f97e621e438db9fd9622c7ded91dd0f9c692f48641c61da9cab21a
languageName: node
linkType: hard
"@hyperlane-xyz/utils@npm:1.0.0-beta1":
version: 1.0.0-beta1
resolution: "@hyperlane-xyz/utils@npm:1.0.0-beta1"
"@hyperlane-xyz/utils@npm:1.0.0-beta2":
version: 1.0.0-beta2
resolution: "@hyperlane-xyz/utils@npm:1.0.0-beta2"
dependencies:
ethers: ^5.6.8
checksum: fc7fa9f413913e8a0e6495d8a76c3dcff8b94dd6e1c016fb89498e5f09fd4103fedc7b8a3d6e0956c5e1958cd92e4208482dc1c5557440b2bc735664fa1f28b6
checksum: 252c74091fb0d743fd5fc5b3fd6cbb2d98abfc648e82dcb6a624d1ebda47635e7e44601270b92d4094704b884bc0c10b05f331828fd5b5fa51c3fa40811b339d
languageName: node
linkType: hard

Loading…
Cancel
Save