Skip to content

HardhatError: HHE40000: No network with chain id "9876" found. #7763

@wisehalvdan

Description

@wisehalvdan

Version of Hardhat

3.0.17

What happened?

When using ignitions, there is no way to use chains not supported by viem.

Even if we override the network passed in to network.connect() I think ignition still has some dependency to viem and tries to look for chainid in viem network lists.

It can work by monkey patching the viem but since it is pulled in compiled, patching typescript and adding the new chain is not enough and resulting js files also needs to be monkey patched which defeats the purpose.

Also just passing the custom object in a network.connect() breaks the hardhat usual --network flow and makes scripts / ignitions only work on set chain.

Minimal reproduction steps


const gccnet = {
    id: 9876,
    name: "GCCNET",
    network: "gccnet",
    nativeCurrency: {
        name: "GCC",
        symbol: "GCC",
        decimals: 18,
    },
    rpcUrls: {
        default: {
            http: ["https://gccnet.com"],
        },
    },
    blockExplorers: {
        default: {
            name: "explorer",
            url: "https://gccscanner.com",
        },
    },
};

const gccnetChain = defineChain(gccnet)
const { viem, networkName, ignition } = await network.connect(gccnetChain);
const wallets = await viem.getWalletClients(
    {
        chain: gccnetChain,
    }
);


const wallet = wallets[0];

async function main() {
    console.log(`Deploying to ${networkName}... on wallet ${wallet.account!.address}`);

    const { airdropper } = await ignition.deploy(AirdropperModule);
}

Search terms

No response

Metadata

Metadata

Assignees

Labels

Type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions