hardhat
hardhat copied to clipboard
`MultipleMatchingNetworksError` in Kairos network
Version of Hardhat
2.22.11
What happened?
When I try to use hre.viem.getContractAt
in kairos network (chainId: 1_001
), this error occur.
MultipleMatchingNetworksError: Multiple networks with chain id 1001 found. You can override the chain by passing it as a parameter to the client getter:
import { someChain } from "viem/chains";
const client = await hre.viem.getPublicClient({
chain: someChain,
...
});
It seems like there is a duplicated chains definition in viem, so this might be happened. I want to find the way how to bypass this issue.
const contract = await hre.viem.getContractAt(
'ContractName',
'0x....',
{
client: {
public: await hre.viem.getPublicClient({
chain: kairos,
}),
},
},
);
I tried this, but this is not helpful
Minimal reproduction steps
Try hre.viem.getContractAt
in Kairos(chainId: 1_001
).
Search terms
No response