在 hardhat 中获取链名称(不是 chainId)
Get chain name in hardhat (not chainId)
在安全帽中,您可以通过调用await getChainId()
获得chainId
。但是,我正在寻找连锁店名称。有没有办法在不自己显式创建映射的情况下获取链名称?
编辑:您只能将此 getChainId
功能与 hardhat-deploy
一起使用
Hardhat 核心包不包含从chainId
到链名的任何映射。
但是:
- 他们在 Etherscan 集成包中有映射 (GitHub source)。
- 您可以根据EIP-155 where the list of chain IDs was first introduced, or the expanded list (anyone can add to this list - GitHub).
在您的应用程序中定义地图
在安全帽中,您可以通过调用await getChainId()
获得chainId
。但是,我正在寻找连锁店名称。有没有办法在不自己显式创建映射的情况下获取链名称?
编辑:您只能将此 getChainId
功能与 hardhat-deploy
Hardhat 核心包不包含从chainId
到链名的任何映射。
但是:
- 他们在 Etherscan 集成包中有映射 (GitHub source)。
- 您可以根据EIP-155 where the list of chain IDs was first introduced, or the expanded list (anyone can add to this list - GitHub). 在您的应用程序中定义地图