Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NetworkNotFoundError: No network with chain id 9998 found. You can override the chain by passing it as a parameter to the client getter: #5187

Open
phpmac opened this issue May 8, 2024 · 4 comments
Assignees
Labels
status:needs-more-info There's not enough information to start working on this issue

Comments

@phpmac
Copy link

phpmac commented May 8, 2024

Describe the feature

hardhat.config.ts


// ztc
ztc: {
  chainId: 9998,
  url: "https://zitcoin.us",
  accounts: [vars.get("PRIVATE_KEY")],
},

const [owner] = await hre.viem.getWalletClients();
const contract = await hre.viem.getContractAt(
  "MyNFT",
  vars.get("CONTRACT") as Address
);

const tx = await contract.write.mint([owner.account.address]);
console.log(tx);

How to solve the problem of not supporting other evm networks

Search terms

No response

@kanej
Copy link
Member

kanej commented May 9, 2024

Hardhat lets you specify alternate network configurations to connect to: https://hardhat.org/hardhat-runner/docs/config#networks-configuration

We have no experience with zitcoin, but the error indicates that on connection to the remote node at the url https://zitcoin.us, it got a failed repsonse when checking the chainId, or that the chainId did not match.

@kanej kanej added status:needs-more-info There's not enough information to start working on this issue and removed status:triaging labels May 9, 2024
@phpmac
Copy link
Author

phpmac commented May 13, 2024

In fact, the chainId returned by the node is indeed 9998. How to solve it?

@phpmac
Copy link
Author

phpmac commented May 13, 2024

Hardhat lets you specify alternate network configurations to connect to: https://hardhat.org/hardhat-runner/docs/config#networks-configuration

We have no experience with zitcoin, but the error indicates that on connection to the remote node at the url https://zitcoin.us, it got a failed repsonse when checking the chainId, or that the chainId did not match.

can you look at this

Error HH101: Hardhat was set to use chain id 1, but connected to a chain with id 9998.

HardhatError: HH101: Hardhat was set to use chain id 1, but connected to a chain with id 9998.
    at ChainIdValidatorProvider.request (/Users/a/Downloads/hardhat/node_modules/hardhat/src/internal/core/providers/chainId.ts:57:15)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/a/Downloads/hardhat/node_modules/@nomicfoundation/hardhat-viem/src/internal/chains.ts:71:10
    at async getChain (/Users/a/Downloads/hardhat/node_modules/@nomicfoundation/hardhat-viem/src/internal/chains.ts:15:19)
    at async getWalletClients (/Users/a/Downloads/hardhat/node_modules/@nomicfoundation/hardhat-viem/src/internal/clients.ts:69:47)
    at async SimpleTaskDefinition.action (/Users/a/Downloads/hardhat/hardhat.config.ts:141:33)
    at async Environment._runTaskDefinition (/Users/a/Downloads/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:359:14)
    at async Environment.run (/Users/a/Downloads/hardhat/node_modules/hardhat/src/internal/core/runtime-environment.ts:192:14)
    at async main (/Users/a/Downloads/hardhat/node_modules/hardhat/src/internal/cli/cli.ts:323:7)
    
    

@phpmac
Copy link
Author

phpmac commented May 13, 2024

Error in plugin @nomicfoundation/hardhat-viem: No network with chain id 9998 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,
  ...
});

You can find a list of supported networks here: https://github.com/wevm/viem/blob/main/src/chains/index.ts

For more info run Hardhat with --show-stack-traces

It still says that it is not supported, how to solve it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status:needs-more-info There's not enough information to start working on this issue
Projects
Status: Backlog
Development

No branches or pull requests

3 participants