From c59fa6930e43e9ed3f4aae461d75866207afdaec Mon Sep 17 00:00:00 2001 From: giulianoconti Date: Thu, 12 Dec 2024 15:24:53 -0300 Subject: [PATCH 1/4] Support for Worldchain --- .../blockchains/colorless/worldchain.svg | 5 + src/icons/blockchains/worldchain.svg | 6 + src/utils/filterUtils.tsx | 2 + src/utils/wormhole.ts | 745 +++++++++--------- 4 files changed, 395 insertions(+), 363 deletions(-) create mode 100644 src/icons/blockchains/colorless/worldchain.svg create mode 100644 src/icons/blockchains/worldchain.svg diff --git a/src/icons/blockchains/colorless/worldchain.svg b/src/icons/blockchains/colorless/worldchain.svg new file mode 100644 index 00000000..ea8642ba --- /dev/null +++ b/src/icons/blockchains/colorless/worldchain.svg @@ -0,0 +1,5 @@ + + + \ No newline at end of file diff --git a/src/icons/blockchains/worldchain.svg b/src/icons/blockchains/worldchain.svg new file mode 100644 index 00000000..84f60f96 --- /dev/null +++ b/src/icons/blockchains/worldchain.svg @@ -0,0 +1,6 @@ + + + + \ No newline at end of file diff --git a/src/utils/filterUtils.tsx b/src/utils/filterUtils.tsx index 8f82dfe0..8fd048cb 100644 --- a/src/utils/filterUtils.tsx +++ b/src/utils/filterUtils.tsx @@ -106,6 +106,7 @@ export const ChainFilterMainnet = [ chainToChainId("Sui"), chainToChainId("Terra"), chainToChainId("Terra2"), + chainToChainId("Worldchain"), chainToChainId("Wormchain"), chainToChainId("Xlayer"), chainToChainId("Xpla"), @@ -149,6 +150,7 @@ export const ChainFilterTestnet = [ chainToChainId("Terra"), chainToChainId("Terra2"), chainToChainId("Unichain"), + chainToChainId("Worldchain"), chainToChainId("Wormchain"), chainToChainId("Xlayer"), chainToChainId("Xpla"), diff --git a/src/utils/wormhole.ts b/src/utils/wormhole.ts index d0564bb2..87c52ee8 100644 --- a/src/utils/wormhole.ts +++ b/src/utils/wormhole.ts @@ -43,6 +43,7 @@ import TerraClassicIcon from "src/icons/blockchains/terra-classic.svg"; import TerraIcon from "src/icons/blockchains/terra.svg"; import TronIcon from "src/icons/blockchains/tron.svg"; import UnichainIcon from "src/icons/blockchains/unichain.svg"; +import WorldchainIcon from "src/icons/blockchains/worldchain.svg"; import WormChainIcon from "src/icons/blockchains/wormchain.svg"; import XLayerIcon from "src/icons/blockchains/xlayer.svg"; import XplaIcon from "src/icons/blockchains/xpla.svg"; @@ -92,6 +93,7 @@ import TerraClassicColorlessIcon from "src/icons/blockchains/colorless/terra-cla import TerraColorlessIcon from "src/icons/blockchains/colorless/terra.svg"; import TronColorlessIcon from "src/icons/blockchains/colorless/tron.svg"; import UniChainColorlessIcon from "src/icons/blockchains/colorless/unichain.svg"; +import WorldchainColorlessIcon from "src/icons/blockchains/colorless/worldchain.svg"; import WormChainColorlessIcon from "src/icons/blockchains/colorless/wormchain.svg"; import XLayerColorlessIcon from "src/icons/blockchains/colorless/xlayer.svg"; import XplaColorlessIcon from "src/icons/blockchains/colorless/xpla.svg"; @@ -120,182 +122,6 @@ const WORMHOLE_CHAINS: any = { return ""; }, }, - [chainToChainId("Sui")]: { - name: "Sui", - icon: SuiIcon, - colorlessIcon: SuiColorlessIcon, - explorer: { - Testnet: "https://testnet.suivision.xyz", - Devnet: "https://devnet.suivision.xyz", - Mainnet: "https://suivision.xyz", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/account/" + value; - if (base === "token") - return ( - this.explorer?.[network] + - "/coin/" + - // the SUI native token comes as this following address because of wormhole encoding, - // we need to hardcode the SUI token address for the explorer to work - (value === "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3" - ? "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI" - : value) - ); - return this.explorer?.[network] + "/txblock/" + value; - }, - }, - [chainToChainId("Pythnet")]: { - name: "PythNet", - icon: PythIcon, - colorlessIcon: PythColorlessIcon, - explorer: { - Testnet: "", - Devnet: "", - Mainnet: "", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return ""; - if (base === "token") return ""; - return ""; - }, - }, - [chainToChainId("MonadDevnet")]: { - name: "MonadDevnet", - icon: MonadIcon, - colorlessIcon: MonadColorlessIcon, - explorer: { - Testnet: "", - Devnet: "", - Mainnet: "", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return ""; - if (base === "token") return ""; - return ""; - }, - }, - [chainToChainId("Snaxchain")]: { - name: "SnaxChain", - icon: SnaxChainIcon, - colorlessIcon: SnaxChainColorlessIcon, - explorer: { - Testnet: "https://testnet-explorer.snaxchain.io/", - Mainnet: "https://explorer.snaxchain.io/", - Devnet: "", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + value; - return this.explorer?.[network] + "/tx/" + value; - }, - }, - [chainToChainId("Btc")]: { - name: "Btc", - icon: BtcIcon, - colorlessIcon: BtcColorlessIcon, - explorer: { - Testnet: "", - Devnet: "", - Mainnet: "", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return ""; - if (base === "token") return ""; - return ""; - }, - }, - [chainToChainId("Wormchain")]: { - name: "WH Gateway", - icon: WormChainIcon, - colorlessIcon: WormChainColorlessIcon, - explorer: { - Testnet: "", - Devnet: "", - Mainnet: "https://bigdipper.live/wormhole", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/accounts/" + value; - if (base === "token") return ""; - return this.explorer?.[network] + "/transactions/" + value; - }, - }, - [chainToChainId("Osmosis")]: { - name: "Osmosis", - icon: OsmosisIcon, - colorlessIcon: OsmosisColorlessIcon, - explorer: { - Testnet: "https://Testnet.mintscan.io/osmosis-Testnet", - Devnet: "https://Testnet.mintscan.io/osmosis-Testnet", - Mainnet: "https://www.mintscan.io/osmosis", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (network === "Mainnet") { - if (base === "address") return this.explorer?.[network] + "/accounts/" + value; - if (base === "token") - return this.explorer?.[network] + "/assets/ibc/" + btoa(value.replace("ibc/", "")); - return this.explorer?.[network] + "/transactions/" + value; - } else { - if (base === "address") return this.explorer?.[network] + "/account/" + value; - if (base === "token") return this.explorer?.[network] + "/assets"; - return this.explorer?.[network] + "/txs/" + value; - } - }, - }, - [chainToChainId("Evmos")]: { - name: "Evmos", - icon: EvmosIcon, - colorlessIcon: EvmosColorlessIcon, - explorer: { - Testnet: "https://Testnet.mintscan.io/evmos-Testnet", - Devnet: "https://Testnet.mintscan.io/evmos-Testnet", - Mainnet: "https://www.mintscan.io/evmos", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (network === "Mainnet") { - if (base === "address") return this.explorer?.[network] + "/accounts/" + value; - if (base === "token") - return this.explorer?.[network] + "/assets/ibc/" + btoa(value.replace("ibc/", "")); - return this.explorer?.[network] + "/transactions/" + value; - } else { - if (base === "address") return this.explorer?.[network] + "/account/" + value; - if (base === "token") return this.explorer?.[network] + "/assets"; - return this.explorer?.[network] + "/txs/" + value; - } - }, - }, - [chainToChainId("Kujira")]: { - name: "Kujira", - icon: KujiraIcon, - colorlessIcon: KujiraColorlessIcon, - explorer: { - Testnet: "https://finder.kujira.network/harpoon-4", - Devnet: "https://finder.kujira.network/harpoon-4", - Mainnet: "https://finder.kujira.network/kaiyo-1", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + encodeURIComponent(value); - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; - }, - }, - [chainToChainId("Dymension")]: { - name: "Dymension", - icon: DymensionIcon, - colorlessIcon: DymensionColorlessIcon, - explorer: { - Testnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS - Devnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS - Mainnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + btoa(value); - if (base === "token") - return this.explorer?.[network] + "/assets"; /* + encodeURIComponent(value); */ - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; - }, - }, [chainToChainId("Acala")]: { name: "Acala", icon: AcalaIcon, @@ -417,15 +243,15 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Bsc")]: { - name: "BNB Smart Chain", - acronym: "BSC", - icon: BSCIcon, - colorlessIcon: BSCColorlessIcon, + [chainToChainId("Base")]: { + name: "Base", + nameTestnet: "Base Goerli", + icon: BaseIcon, + colorlessIcon: BaseColorlessIcon, explorer: { - Testnet: "https://Testnet.bscscan.com", - Devnet: "https://Testnet.bscscan.com", - Mainnet: "https://bscscan.com", + Testnet: "https://goerli.basescan.org", + Devnet: "https://goerli.basescan.org", + Mainnet: "https://basescan.org", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -434,15 +260,15 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Celo")]: { - name: "Celo", - nameTestnet: "Alfajores", - icon: CeloIcon, - colorlessIcon: CeloColorlessIcon, + [chainToChainId("BaseSepolia")]: { + name: "Base", + nameTestnet: "Base Sepolia", + icon: BaseIcon, + colorlessIcon: BaseColorlessIcon, explorer: { - Testnet: "https://alfajores.celoscan.io", - Devnet: "https://alfajores.celoscan.io", - Mainnet: "https://explorer.celo.org/mainnet", + Testnet: "https://sepolia.basescan.org", + Devnet: "https://sepolia.basescan.org", + Mainnet: "https://basescan.org", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -451,16 +277,14 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Ethereum")]: { - name: "Ethereum", - nameTestnet: "Goerli", - acronym: "ETH", - icon: EthereumIcon, - colorlessIcon: EthereumColorlessIcon, + [chainToChainId("Blast")]: { + name: "Blast", + icon: BlastIcon, + colorlessIcon: BlastColorlessIcon, explorer: { - Testnet: "https://goerli.etherscan.io", - Devnet: "https://goerli.etherscan.io", - Mainnet: "https://etherscan.io", + Testnet: "https://Testnet.blastscan.io", + Devnet: "https://Testnet.blastscan.io", + Mainnet: "https://blastscan.io", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -469,14 +293,15 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Fantom")]: { - name: "Fantom", - icon: FantomIcon, - colorlessIcon: FantomColorlessIcon, + [chainToChainId("Bsc")]: { + name: "BNB Smart Chain", + acronym: "BSC", + icon: BSCIcon, + colorlessIcon: BSCColorlessIcon, explorer: { - Testnet: "https://Testnet.ftmscan.com", - Devnet: "https://Testnet.ftmscan.com", - Mainnet: "https://ftmscan.com", + Testnet: "https://Testnet.bscscan.com", + Devnet: "https://Testnet.bscscan.com", + Mainnet: "https://bscscan.com", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -485,19 +310,140 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Injective")]: { - name: "Injective", - acronym: "INJ", - icon: InjectiveIcon, - colorlessIcon: InjectiveColorlessIcon, + [chainToChainId("Btc")]: { + name: "Btc", + icon: BtcIcon, + colorlessIcon: BtcColorlessIcon, explorer: { - Testnet: "https://Testnet.explorer.injective.network", - Devnet: "https://Testnet.explorer.injective.network", - Mainnet: "https://explorer.injective.network", + Testnet: "", + Devnet: "", + Mainnet: "", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/account/" + value; - if (base === "token") + if (base === "address") return ""; + if (base === "token") return ""; + return ""; + }, + }, + [chainToChainId("Celo")]: { + name: "Celo", + nameTestnet: "Alfajores", + icon: CeloIcon, + colorlessIcon: CeloColorlessIcon, + explorer: { + Testnet: "https://alfajores.celoscan.io", + Devnet: "https://alfajores.celoscan.io", + Mainnet: "https://explorer.celo.org/mainnet", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Dymension")]: { + name: "Dymension", + icon: DymensionIcon, + colorlessIcon: DymensionColorlessIcon, + explorer: { + Testnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS + Devnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS + Mainnet: "https://www.mintscan.io/dymension", // TODO: EXPLORER CHANGES WHEN EXISTS + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + btoa(value); + if (base === "token") + return this.explorer?.[network] + "/assets"; /* + encodeURIComponent(value); */ + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Ethereum")]: { + name: "Ethereum", + nameTestnet: "Goerli", + acronym: "ETH", + icon: EthereumIcon, + colorlessIcon: EthereumColorlessIcon, + explorer: { + Testnet: "https://goerli.etherscan.io", + Devnet: "https://goerli.etherscan.io", + Mainnet: "https://etherscan.io", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Evmos")]: { + name: "Evmos", + icon: EvmosIcon, + colorlessIcon: EvmosColorlessIcon, + explorer: { + Testnet: "https://Testnet.mintscan.io/evmos-Testnet", + Devnet: "https://Testnet.mintscan.io/evmos-Testnet", + Mainnet: "https://www.mintscan.io/evmos", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (network === "Mainnet") { + if (base === "address") return this.explorer?.[network] + "/accounts/" + value; + if (base === "token") + return this.explorer?.[network] + "/assets/ibc/" + btoa(value.replace("ibc/", "")); + return this.explorer?.[network] + "/transactions/" + value; + } else { + if (base === "address") return this.explorer?.[network] + "/account/" + value; + if (base === "token") return this.explorer?.[network] + "/assets"; + return this.explorer?.[network] + "/txs/" + value; + } + }, + }, + [chainToChainId("Fantom")]: { + name: "Fantom", + icon: FantomIcon, + colorlessIcon: FantomColorlessIcon, + explorer: { + Testnet: "https://Testnet.ftmscan.com", + Devnet: "https://Testnet.ftmscan.com", + Mainnet: "https://ftmscan.com", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Holesky")]: { + name: "Holesky", + icon: EthereumIcon, + colorlessIcon: EthereumColorlessIcon, + explorer: { + Testnet: "https://holesky.etherscan.io", + Devnet: "https://holesky.etherscan.io", + Mainnet: "https://holesky.etherscan.io", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Injective")]: { + name: "Injective", + acronym: "INJ", + icon: InjectiveIcon, + colorlessIcon: InjectiveColorlessIcon, + explorer: { + Testnet: "https://Testnet.explorer.injective.network", + Devnet: "https://Testnet.explorer.injective.network", + Mainnet: "https://explorer.injective.network", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/account/" + value; + if (base === "token") return ( this.explorer?.[network] + (value.toLowerCase().startsWith("ibc/") @@ -540,6 +486,69 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, + [chainToChainId("Kujira")]: { + name: "Kujira", + icon: KujiraIcon, + colorlessIcon: KujiraColorlessIcon, + explorer: { + Testnet: "https://finder.kujira.network/harpoon-4", + Devnet: "https://finder.kujira.network/harpoon-4", + Mainnet: "https://finder.kujira.network/kaiyo-1", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + encodeURIComponent(value); + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Linea")]: { + name: "Linea", + icon: LineaIcon, + colorlessIcon: LineaColorlessIcon, + explorer: { + Testnet: "https://sepolia.lineascan.build", + Devnet: "https://sepolia.lineascan.build", + Mainnet: "https://lineascan.build", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("Mantle")]: { + name: "Mantle", + icon: MantleIcon, + colorlessIcon: MantleColorlessIcon, + explorer: { + Testnet: "https://sepolia.mantlescan.xyz", + Devnet: "https://sepolia.mantlescan.xyz", + Mainnet: "https://explorer.mantle.xyz", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/address/" + value; + if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; + return this.explorer?.[network] + "/tx/" + value; + }, + }, + [chainToChainId("MonadDevnet")]: { + name: "MonadDevnet", + icon: MonadIcon, + colorlessIcon: MonadColorlessIcon, + explorer: { + Testnet: "", + Devnet: "", + Mainnet: "", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return ""; + if (base === "token") return ""; + return ""; + }, + }, [chainToChainId("Moonbeam")]: { name: "Moonbeam", nameTestnet: "Moonbase Alpha", @@ -639,6 +648,28 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, + [chainToChainId("Osmosis")]: { + name: "Osmosis", + icon: OsmosisIcon, + colorlessIcon: OsmosisColorlessIcon, + explorer: { + Testnet: "https://Testnet.mintscan.io/osmosis-Testnet", + Devnet: "https://Testnet.mintscan.io/osmosis-Testnet", + Mainnet: "https://www.mintscan.io/osmosis", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (network === "Mainnet") { + if (base === "address") return this.explorer?.[network] + "/accounts/" + value; + if (base === "token") + return this.explorer?.[network] + "/assets/ibc/" + btoa(value.replace("ibc/", "")); + return this.explorer?.[network] + "/transactions/" + value; + } else { + if (base === "address") return this.explorer?.[network] + "/account/" + value; + if (base === "token") return this.explorer?.[network] + "/assets"; + return this.explorer?.[network] + "/txs/" + value; + } + }, + }, [chainToChainId("Polygon")]: { name: "Polygon", nameTestnet: "Mumbai", @@ -656,51 +687,15 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Solana")]: { - name: "Solana", - acronym: "SOL", - icon: SolanaIcon, - colorlessIcon: SolanaColorlessIcon, - explorer: { - Testnet: "https://solscan.io", - Devnet: "https://solscan.io", - Mainnet: "https://solscan.io", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - // Wormhole uses Solana's devnet as their 'Testnet' - const solNetwork = network === "Mainnet" ? "" : "devnet"; - - if (base === "address") - return this.explorer?.[network] + "/account/" + value + "?cluster=" + solNetwork; - if (base === "token") - return this.explorer?.[network] + "/token/" + value + "?cluster=" + solNetwork; - return this.explorer?.[network] + "/tx/" + value + "?cluster=" + solNetwork; - }, - }, - [chainToChainId("Terra")]: { - name: "Terra", - icon: TerraClassicIcon, - colorlessIcon: TerraClassicColorlessIcon, - explorer: { - Testnet: "https://finder.terra.money/columbus-5", - Devnet: "https://finder.terra.money/columbus-5", - Mainnet: "https://finder.terra.money/columbus-5", - }, - getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + value; - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; - }, - }, - [chainToChainId("Terra2")]: { - name: "Terra2", - icon: TerraIcon, - colorlessIcon: TerraColorlessIcon, + [chainToChainId("PolygonSepolia")]: { + name: "Polygon", + nameTestnet: "Amoy", + icon: PolygonIcon, + colorlessIcon: PolygonColorlessIcon, explorer: { - Testnet: "https://finder.terra.money/pisco-1", - Devnet: "https://finder.terra.money/pisco-1", - Mainnet: "https://finder.terra.money/phoenix-1", + Testnet: "https://amoy.polygonscan.com", + Devnet: "https://amoy.polygonscan.com", + Mainnet: "https://polygonscan.com", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -709,30 +704,29 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Xpla")]: { - name: "Xpla", - icon: XplaIcon, - colorlessIcon: XplaColorlessIcon, + [chainToChainId("Pythnet")]: { + name: "PythNet", + icon: PythIcon, + colorlessIcon: PythColorlessIcon, explorer: { - Testnet: "https://explorer.xpla.io/Testnet", - Devnet: "https://explorer.xpla.io/Testnet", - Mainnet: "https://explorer.xpla.io/Mainnet", + Testnet: "", + Devnet: "", + Mainnet: "", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + value; - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; + if (base === "address") return ""; + if (base === "token") return ""; + return ""; }, }, - [chainToChainId("Xlayer")]: { - name: "XLayer", - icon: XLayerIcon, - colorlessIcon: XLayerColorlessIcon, + [chainToChainId("Scroll")]: { + name: "Scroll", + icon: ScrollIcon, + colorlessIcon: ScrollColorlessIcon, explorer: { - Testnet: "https://www.okx.com/web3/explorer/xlayer-test", - Devnet: "https://www.okx.com/web3/explorer/xlayer-test", - Mainnet: "https://www.okx.com/web3/explorer/xlayer", + Testnet: "https://sepolia.scrollscan.com", + Devnet: "https://sepolia.scrollscan.com", + Mainnet: "https://scrollscan.com", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -757,14 +751,14 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/txs/" + value; }, }, - [chainToChainId("Scroll")]: { - name: "Scroll", - icon: ScrollIcon, - colorlessIcon: ScrollColorlessIcon, + [chainToChainId("Sepolia")]: { + name: "Sepolia", + icon: EthereumIcon, + colorlessIcon: EthereumColorlessIcon, explorer: { - Testnet: "https://sepolia.scrollscan.com", - Devnet: "https://sepolia.scrollscan.com", - Mainnet: "https://scrollscan.com", + Testnet: "https://sepolia.etherscan.io", + Devnet: "https://sepolia.etherscan.io", + Mainnet: "https://sepolia.etherscan.io", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -773,64 +767,74 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Mantle")]: { - name: "Mantle", - icon: MantleIcon, - colorlessIcon: MantleColorlessIcon, + [chainToChainId("Snaxchain")]: { + name: "SnaxChain", + icon: SnaxChainIcon, + colorlessIcon: SnaxChainColorlessIcon, explorer: { - Testnet: "https://sepolia.mantlescan.xyz", - Devnet: "https://sepolia.mantlescan.xyz", - Mainnet: "https://explorer.mantle.xyz", + Testnet: "https://testnet-explorer.snaxchain.io/", + Mainnet: "https://explorer.snaxchain.io/", + Devnet: "", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; if (base === "token") return this.explorer?.[network] + "/token/" + value; - if (base === "block") return this.explorer?.[network] + "/block/" + value; return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Blast")]: { - name: "Blast", - icon: BlastIcon, - colorlessIcon: BlastColorlessIcon, + [chainToChainId("Solana")]: { + name: "Solana", + acronym: "SOL", + icon: SolanaIcon, + colorlessIcon: SolanaColorlessIcon, explorer: { - Testnet: "https://Testnet.blastscan.io", - Devnet: "https://Testnet.blastscan.io", - Mainnet: "https://blastscan.io", + Testnet: "https://solscan.io", + Devnet: "https://solscan.io", + Mainnet: "https://solscan.io", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + value; - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; + // Wormhole uses Solana's devnet as their 'Testnet' + const solNetwork = network === "Mainnet" ? "" : "devnet"; + + if (base === "address") + return this.explorer?.[network] + "/account/" + value + "?cluster=" + solNetwork; + if (base === "token") + return this.explorer?.[network] + "/token/" + value + "?cluster=" + solNetwork; + return this.explorer?.[network] + "/tx/" + value + "?cluster=" + solNetwork; }, }, - [chainToChainId("Base")]: { - name: "Base", - nameTestnet: "Base Goerli", - icon: BaseIcon, - colorlessIcon: BaseColorlessIcon, + [chainToChainId("Sui")]: { + name: "Sui", + icon: SuiIcon, + colorlessIcon: SuiColorlessIcon, explorer: { - Testnet: "https://goerli.basescan.org", - Devnet: "https://goerli.basescan.org", - Mainnet: "https://basescan.org", + Testnet: "https://testnet.suivision.xyz", + Devnet: "https://devnet.suivision.xyz", + Mainnet: "https://suivision.xyz", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { - if (base === "address") return this.explorer?.[network] + "/address/" + value; - if (base === "token") return this.explorer?.[network] + "/token/" + value; - if (base === "block") return this.explorer?.[network] + "/block/" + value; - return this.explorer?.[network] + "/tx/" + value; + if (base === "address") return this.explorer?.[network] + "/account/" + value; + if (base === "token") + return ( + this.explorer?.[network] + + "/coin/" + + // the SUI native token comes as this following address because of wormhole encoding, + // we need to hardcode the SUI token address for the explorer to work + (value === "0x9258181f5ceac8dbffb7030890243caed69a9599d2886d957a9cb7656af3bdb3" + ? "0x0000000000000000000000000000000000000000000000000000000000000002::sui::SUI" + : value) + ); + return this.explorer?.[network] + "/txblock/" + value; }, }, - [chainToChainId("BaseSepolia")]: { - name: "Base", - nameTestnet: "Base Sepolia", - icon: BaseIcon, - colorlessIcon: BaseColorlessIcon, + [chainToChainId("Terra")]: { + name: "Terra", + icon: TerraClassicIcon, + colorlessIcon: TerraClassicColorlessIcon, explorer: { - Testnet: "https://sepolia.basescan.org", - Devnet: "https://sepolia.basescan.org", - Mainnet: "https://basescan.org", + Testnet: "https://finder.terra.money/columbus-5", + Devnet: "https://finder.terra.money/columbus-5", + Mainnet: "https://finder.terra.money/columbus-5", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -839,14 +843,14 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Sepolia")]: { - name: "Sepolia", - icon: EthereumIcon, - colorlessIcon: EthereumColorlessIcon, + [chainToChainId("Terra2")]: { + name: "Terra2", + icon: TerraIcon, + colorlessIcon: TerraColorlessIcon, explorer: { - Testnet: "https://sepolia.etherscan.io", - Devnet: "https://sepolia.etherscan.io", - Mainnet: "https://sepolia.etherscan.io", + Testnet: "https://finder.terra.money/pisco-1", + Devnet: "https://finder.terra.money/pisco-1", + Mainnet: "https://finder.terra.money/phoenix-1", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -855,14 +859,15 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Holesky")]: { - name: "Holesky", - icon: EthereumIcon, - colorlessIcon: EthereumColorlessIcon, + [chainToChainId("Unichain")]: { + name: "Unichain", + nameTestnet: "Unichain", + icon: UnichainIcon, + colorlessIcon: UniChainColorlessIcon, explorer: { - Testnet: "https://holesky.etherscan.io", - Devnet: "https://holesky.etherscan.io", - Mainnet: "https://holesky.etherscan.io", + Testnet: "https://unichain-sepolia.blockscout.com", + Devnet: "https://unichain-sepolia.blockscout.com", + Mainnet: "https://unichain-sepolia.blockscout.com", // TODO: mainnet when exists }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -871,15 +876,14 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("PolygonSepolia")]: { - name: "Polygon", - nameTestnet: "Amoy", - icon: PolygonIcon, - colorlessIcon: PolygonColorlessIcon, + [chainToChainId("Worldchain")]: { + name: "Worldchain", + icon: WorldchainIcon, + colorlessIcon: WorldchainColorlessIcon, explorer: { - Testnet: "https://amoy.polygonscan.com", - Devnet: "https://amoy.polygonscan.com", - Mainnet: "https://polygonscan.com", + Testnet: "https://worldchain-sepolia.explorer.alchemy.com", + Devnet: "https://worldchain-sepolia.explorer.alchemy.com", + Mainnet: "https://worldscan.org", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -888,15 +892,29 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Unichain")]: { - name: "Unichain", - nameTestnet: "Unichain", - icon: UnichainIcon, - colorlessIcon: UniChainColorlessIcon, + [chainToChainId("Wormchain")]: { + name: "WH Gateway", + icon: WormChainIcon, + colorlessIcon: WormChainColorlessIcon, explorer: { - Testnet: "https://unichain-sepolia.blockscout.com", - Devnet: "https://unichain-sepolia.blockscout.com", - Mainnet: "https://unichain-sepolia.blockscout.com", // TODO: mainnet when exists + Testnet: "", + Devnet: "", + Mainnet: "https://bigdipper.live/wormhole", + }, + getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { + if (base === "address") return this.explorer?.[network] + "/accounts/" + value; + if (base === "token") return ""; + return this.explorer?.[network] + "/transactions/" + value; + }, + }, + [chainToChainId("Xlayer")]: { + name: "XLayer", + icon: XLayerIcon, + colorlessIcon: XLayerColorlessIcon, + explorer: { + Testnet: "https://www.okx.com/web3/explorer/xlayer-test", + Devnet: "https://www.okx.com/web3/explorer/xlayer-test", + Mainnet: "https://www.okx.com/web3/explorer/xlayer", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; @@ -905,18 +923,19 @@ const WORMHOLE_CHAINS: any = { return this.explorer?.[network] + "/tx/" + value; }, }, - [chainToChainId("Linea")]: { - name: "Linea", - icon: LineaIcon, - colorlessIcon: LineaColorlessIcon, + [chainToChainId("Xpla")]: { + name: "Xpla", + icon: XplaIcon, + colorlessIcon: XplaColorlessIcon, explorer: { - Testnet: "https://sepolia.lineascan.build", - Devnet: "https://sepolia.lineascan.build", - Mainnet: "https://lineascan.build", + Testnet: "https://explorer.xpla.io/Testnet", + Devnet: "https://explorer.xpla.io/Testnet", + Mainnet: "https://explorer.xpla.io/Mainnet", }, getExplorerBaseURL: function ({ network = "Mainnet", value, base }: ExplorerBaseURLInput) { if (base === "address") return this.explorer?.[network] + "/address/" + value; if (base === "token") return this.explorer?.[network] + "/token/" + value; + if (base === "block") return this.explorer?.[network] + "/block/" + value; return this.explorer?.[network] + "/tx/" + value; }, }, From 1ec15456137c0034aa2a5c8b06d910b48a659595 Mon Sep 17 00:00:00 2001 From: giulianoconti Date: Thu, 12 Dec 2024 15:42:10 -0300 Subject: [PATCH 2/4] near txs fixed --- src/icons/blockchains/near.svg | 10 ++++------ src/icons/blockchains/worldchain.svg | 2 +- src/pages/Tx/index.tsx | 8 +++++++- 3 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/icons/blockchains/near.svg b/src/icons/blockchains/near.svg index 9e4c7e71..1923b2c1 100644 --- a/src/icons/blockchains/near.svg +++ b/src/icons/blockchains/near.svg @@ -1,6 +1,4 @@ - - - + + + \ No newline at end of file diff --git a/src/icons/blockchains/worldchain.svg b/src/icons/blockchains/worldchain.svg index 84f60f96..282e9611 100644 --- a/src/icons/blockchains/worldchain.svg +++ b/src/icons/blockchains/worldchain.svg @@ -1,5 +1,5 @@ - + diff --git a/src/pages/Tx/index.tsx b/src/pages/Tx/index.tsx index a7221901..fae2a6bc 100644 --- a/src/pages/Tx/index.tsx +++ b/src/pages/Tx/index.tsx @@ -543,7 +543,13 @@ const Tx = () => { })); const { emitterAddress, hash, sequence, emitterChain } = parsedVaa || {}; - const parsedEmitterAddress = emitterAddress.toNative(emitterChain).toString(); + let parsedEmitterAddress = ""; + try { + parsedEmitterAddress = emitterAddress.toNative(emitterChain).toString(); + } catch (error) { + console.error("Error converting emitter address to native:", error); + parsedEmitterAddress = ""; + } const parsedHash = Buffer.from(hash).toString("hex"); const parsedSequence = Number(sequence); const parsedGuardianSignatures = guardianSignatures?.map(({ index, signature }) => ({ From 59ca0d52d13981049f786a2e8c39a7b48dcd17cf Mon Sep 17 00:00:00 2001 From: giulianoconti Date: Thu, 12 Dec 2024 15:47:28 -0300 Subject: [PATCH 3/4] unnecessary line removed --- src/pages/Tx/index.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pages/Tx/index.tsx b/src/pages/Tx/index.tsx index fae2a6bc..bf6cc81d 100644 --- a/src/pages/Tx/index.tsx +++ b/src/pages/Tx/index.tsx @@ -548,7 +548,6 @@ const Tx = () => { parsedEmitterAddress = emitterAddress.toNative(emitterChain).toString(); } catch (error) { console.error("Error converting emitter address to native:", error); - parsedEmitterAddress = ""; } const parsedHash = Buffer.from(hash).toString("hex"); const parsedSequence = Number(sequence); From 1670ed570b48e38f332a9d94fea309436ba3ec67 Mon Sep 17 00:00:00 2001 From: giulianoconti Date: Thu, 12 Dec 2024 17:17:22 -0300 Subject: [PATCH 4/4] worldchain for portal txs --- src/consts.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/consts.ts b/src/consts.ts index e124ceda..c82f7b72 100644 --- a/src/consts.ts +++ b/src/consts.ts @@ -240,6 +240,7 @@ const targetChainsSupportedMainnet: { [key: string]: ChainId[] } = { chainToChainId("Sui"), chainToChainId("Terra"), chainToChainId("Terra2"), + chainToChainId("Worldchain"), chainToChainId("Wormchain"), chainToChainId("Xlayer"), chainToChainId("Xpla"), @@ -377,6 +378,7 @@ const targetChainsSupportedTestnet: { [key: string]: ChainId[] } = { chainToChainId("Berachain"), chainToChainId("Unichain"), chainToChainId("MonadDevnet"), + chainToChainId("Worldchain"), ], [CCTP_APP_ID]: [ chainToChainId("Sepolia"),