diff --git a/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts b/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts index 05c672e283..8e98f4b81b 100644 --- a/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts +++ b/libs/remix-ui/run-tab/src/lib/actions/evmmap.ts @@ -17,7 +17,7 @@ type HardFork = | 'spuriousDragon' | 'tangarineWhistle'; -const evmMap: Map = new Map([ +export const evmMap: Map = new Map([ ['berlin', { chainId: [ { id: 1, name: "Ethereum Mainnet" }, @@ -127,6 +127,18 @@ const evmMap: Map = new Map([ { id: 1, name: "Ethereum Mainnet" } ] }] -]); +]) -export default evmMap +export function getCompatibleChains(fork: HardFork): ChainInfo[] { + const forkData = evmMap.get(fork); + return forkData ? forkData.chainId : []; +} + +export function isChainCompatible(fork: HardFork, chainId: number): boolean { + const compatibleChains = getCompatibleChains(fork); + return compatibleChains.some(chain => chain.id === chainId); +} + +export function isChainCompatibleWithAnyFork(chainId: number, forks: HardFork[]): boolean { + return forks.some(fork => isChainCompatible(fork, chainId)); +}