From 8bfd2d38403a7d81d2b93b7888d15d23fc8f5b5c Mon Sep 17 00:00:00 2001 From: Bruce Riley Date: Mon, 13 Jan 2025 16:05:54 -0600 Subject: [PATCH] Add Monad support --- core/base/src/constants/chains.ts | 1 + core/base/src/constants/contracts/core.ts | 1 + core/base/src/constants/finality.ts | 2 ++ core/base/src/constants/nativeChainIds.ts | 1 + core/base/src/constants/platforms.ts | 1 + core/base/src/constants/rpc.ts | 1 + core/icons/scripts/genIcons.ts | 4 +++- core/icons/src/constants/chainIcons.ts | 10 +++++----- .../src/images/chains/{MonadDevnet.svg => Monad.svg} | 0 9 files changed, 15 insertions(+), 6 deletions(-) rename core/icons/src/images/chains/{MonadDevnet.svg => Monad.svg} (100%) diff --git a/core/base/src/constants/chains.ts b/core/base/src/constants/chains.ts index bef43c774..8467b1c05 100644 --- a/core/base/src/constants/chains.ts +++ b/core/base/src/constants/chains.ts @@ -52,6 +52,7 @@ const chainIdAndChainEntries = [ [ 45, "Worldchain" ], [ 46, "Ink" ], [ 47, "HyperEVM" ], + [ 48, "Monad" ], [ 3104, "Wormchain" ], [ 4000, "Cosmoshub" ], [ 4001, "Evmos" ], diff --git a/core/base/src/constants/contracts/core.ts b/core/base/src/constants/contracts/core.ts index 951b95b09..b8eb4a491 100644 --- a/core/base/src/constants/contracts/core.ts +++ b/core/base/src/constants/contracts/core.ts @@ -93,6 +93,7 @@ export const coreBridgeContracts = [[ ["HyperEVM", "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd"], ["Xlayer", "0xA31aa3FDb7aF7Db93d18DDA4e19F811342EDF780"], ["Linea", "0x79A1027a6A159502049F10906D333EC57E95F083"], + ["Monad", "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd"], ["MonadDevnet", "0xBB73cB66C26740F31d1FabDC6b7A46a038A300dd"], ]], [ "Devnet", [ diff --git a/core/base/src/constants/finality.ts b/core/base/src/constants/finality.ts index 6f9d59633..671a83842 100644 --- a/core/base/src/constants/finality.ts +++ b/core/base/src/constants/finality.ts @@ -65,6 +65,7 @@ const finalityThresholds = [ ["Unichain", 512], ["Ink", 512], ["HyperEVM", 1], + ["Monad", 1], ["Cosmoshub", 0], ["Evmos", 0], ["Kujira", 0], @@ -116,6 +117,7 @@ const blockTimeMilliseconds = [ ["Kujira", 3_000], ["Mantle", 2_000], ["Moonbeam", 12_000], + ["Monad", 1_000], ["MonadDevnet", 1_000], ["Near", 1_500], ["Neon", 30_000], diff --git a/core/base/src/constants/nativeChainIds.ts b/core/base/src/constants/nativeChainIds.ts index 05712d5e4..a99585ca4 100644 --- a/core/base/src/constants/nativeChainIds.ts +++ b/core/base/src/constants/nativeChainIds.ts @@ -116,6 +116,7 @@ const chainNetworkNativeChainIdEntries = [ ["HyperEVM", 998n], ["Xlayer", 195n], ["Linea", 59141n], // Sepolia + ["Monad", 10143n], ["MonadDevnet", 41454n], ], ], diff --git a/core/base/src/constants/platforms.ts b/core/base/src/constants/platforms.ts index 8faf44463..1a645abfd 100644 --- a/core/base/src/constants/platforms.ts +++ b/core/base/src/constants/platforms.ts @@ -41,6 +41,7 @@ const platformAndChainsEntries = [[ "Worldchain", "Ink", "HyperEVM", + "Monad", "MonadDevnet", ]], [ "Solana", [ diff --git a/core/base/src/constants/rpc.ts b/core/base/src/constants/rpc.ts index 8c894cf55..5dcc42ac6 100644 --- a/core/base/src/constants/rpc.ts +++ b/core/base/src/constants/rpc.ts @@ -96,6 +96,7 @@ const rpcConfig = [[ ["Worldchain", "https://worldchain-sepolia.g.alchemy.com/public"], ["Ink", "https://rpc-qnd-sepolia.inkonchain.com"], ["HyperEVM", "https://api.hyperliquid-testnet.xyz/evm"], + ["Monad", ""], // TODO: No public rpc is currently available, override with a custom rpc for now. ["MonadDevnet", ""], // TODO: No public rpc is currently available, override with a custom rpc for now. ["Noble", "https://noble-testnet-rpc.polkachu.com/"], ]], [ diff --git a/core/icons/scripts/genIcons.ts b/core/icons/scripts/genIcons.ts index 58d9ad33f..a59ee5f59 100644 --- a/core/icons/scripts/genIcons.ts +++ b/core/icons/scripts/genIcons.ts @@ -21,7 +21,9 @@ const makeChainCondition = (chain: Chain): string => { return `(chain === "${chain}" || chain === "${chain}Sepolia")`; } else if (chain === "Sei") { return `(chain === "${chain}" || chain === "${chain}evm")`; - } else if (chain.includes("Sepolia") || chain.includes("Holesky") || chain === "Seievm") { + } else if (chain === "Monad") { + return `(chain === "${chain}" || chain === "${chain}Devnet")`; + } else if (chain.includes("Sepolia") || chain.includes("Holesky") || chain === "Seievm" || chain === "MonadDevnet") { return ""; } else { return `(chain === "${chain}")`; diff --git a/core/icons/src/constants/chainIcons.ts b/core/icons/src/constants/chainIcons.ts index 63ea5c953..c5ddf560a 100644 --- a/core/icons/src/constants/chainIcons.ts +++ b/core/icons/src/constants/chainIcons.ts @@ -215,6 +215,11 @@ export function chainToIcon(chain: Chain): string { PREFIX + "PHN2ZyB3aWR0aD0iMTQ0IiBoZWlnaHQ9IjE0NCIgdmlld0JveD0iMCAwIDE0NCAxNDQiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTE0NCA3MS42OTkxQzE0NCAxMTkuMzA2IDExNC44NjYgMTM0LjU4MiA5OS41MTU2IDEyMC45OEM4Ni44ODA0IDEwOS44ODkgODMuMTIxMSA4Ni40NTIxIDY0LjExNiA4NC4wNDU2QzM5Ljk5NDIgODEuMDExMyAzNy45MDU3IDExMy4xMzMgMjIuMDMzNCAxMTMuMTMzQzMuNTUwNCAxMTMuMTMzIDAgODYuMjQyOCAwIDcyLjQzMTVDMCA1OC4zMDYzIDMuOTY4MDkgMzkuMDU0MiAxOS43MzYgMzkuMDU0MkMzOC4xMTQ2IDM5LjA1NDIgMzkuMTU4OCA2Ni41NzIyIDYyLjEzMiA2NS4xMDczQzg1LjAwMDcgNjMuNTM3OSA4NS40MTg0IDM0Ljg2ODkgMTAwLjI0NyAyMi42MjcxQzExMy4xOTUgMTIuMDU5MyAxNDQgMjMuNDY0MSAxNDQgNzEuNjk5MVoiIGZpbGw9IiM5N0ZDRTQiLz48L3N2Zz4=" ); + } else if (chain === "Monad" || chain === "MonadDevnet") { + return ( + PREFIX + + "PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIHZpZXdCb3g9IjAgMCAzMiAzMiIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj48cGF0aCBkPSJNMTUuOTk5OSAwQzExLjM3OTUgMCAwIDExLjM3OTIgMCAxNS45OTk5QzAgMjAuNjIwNiAxMS4zNzk1IDMyIDE1Ljk5OTkgMzJDMjAuNjIwMyAzMiAzMiAyMC42MjA0IDMyIDE1Ljk5OTlDMzIgMTEuMzc5NCAyMC42MjA1IDAgMTUuOTk5OSAwWk0xMy41MDY2IDI1LjE0OTJDMTEuNTU4MiAyNC42MTgzIDYuMzE5ODEgMTUuNDU1IDYuODUwODMgMTMuNTA2NkM3LjM4MTg1IDExLjU1ODEgMTYuNTQ1IDYuMzE5NzkgMTguNDkzMyA2Ljg1MDhDMjAuNDQxOCA3LjM4MTczIDI1LjY4MDIgMTYuNTQ0OSAyNS4xNDkyIDE4LjQ5MzRDMjQuNjE4MiAyMC40NDE4IDE1LjQ1NSAyNS42ODAyIDEzLjUwNjYgMjUuMTQ5MloiIGZpbGw9IiM4MzZFRjkiLz48L3N2Zz4=" + ); } else if (chain === "Wormchain") { return ( PREFIX + @@ -270,11 +275,6 @@ export function chainToIcon(chain: Chain): string { PREFIX + "PHN2ZyB3aWR0aD0iNjAwIiBoZWlnaHQ9IjYwMCIgdmlld0JveD0iMCAwIDYwMCA2MDAiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHJlY3Qgd2lkdGg9IjYwMCIgaGVpZ2h0PSI2MDAiIHJ4PSIzMDAiIGZpbGw9IiMwMjA0MTgiLz48cGF0aCBkPSJNNDQyLjkyO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ODEgMTYuNTQ1IDYuMzE5NzkgMTguNDkzMyA2Ljg1MDhDMjAuNDQxOCA3LjM4MTczIDI1LjY4MDIgMTYuNTQ0OSAyNS4xNDkyIDE4LjQ5MzRDMjQuNjE4MiAyMC40NDE4IDE1LjQ1NSAyNS42ODAyIDEzLjUwNjYgMjUuMTQ5MloiIGZpbGw9IiM4MzZFRjkiLz48L3N2Zz4=" - ); } else { // This case is never reached const _: never = chain; diff --git a/core/icons/src/images/chains/MonadDevnet.svg b/core/icons/src/images/chains/Monad.svg similarity index 100% rename from core/icons/src/images/chains/MonadDevnet.svg rename to core/icons/src/images/chains/Monad.svg