@nomicfoundation/hardhat-viem
Version:
Hardhat plugin for viem
32 lines • 1.87 kB
TypeScript
import type { TestClientMode } from "../types.js";
import type { ChainDescriptorConfig, ChainDescriptorsConfig } from "hardhat/types/config";
import type { ChainType } from "hardhat/types/network";
import type { EthereumProvider } from "hardhat/types/providers";
import type { Chain as ViemChain } from "viem";
export declare function getChain<ChainTypeT extends ChainType | string>(provider: EthereumProvider, chainType: ChainTypeT, chainDescriptors: ChainDescriptorsConfig, networkName: string): Promise<ViemChain>;
export declare function getChainId(provider: EthereumProvider): Promise<number>;
export declare function isDevelopmentNetwork(provider: EthereumProvider): Promise<boolean>;
export declare function isHardhatNetwork(provider: EthereumProvider): Promise<boolean>;
export declare function isAnvilNetwork(provider: EthereumProvider): Promise<boolean>;
export declare function getMode(provider: EthereumProvider): Promise<TestClientMode>;
/**
* Resolves a viem chain for a given chain id using the provided chain
* descriptors. If a matching descriptor is found, the chain is enriched with
* the descriptor's name and block explorer. Otherwise, falls back to a minimal
* chain using the network name.
*/
export declare function resolveChain(chainId: number, networkName: string, chainDescriptors: ChainDescriptorsConfig): ViemChain;
/**
* Creates a viem chain with the minimum fields required to satisfy the
* {@link ViemChain} type.
*/
export declare function createMinimalChain(id: number, name: string): ViemChain;
/**
* Returns the default block explorer for a chain descriptor, preferring
* Etherscan over Blockscout. Returns `undefined` if neither is configured.
*/
export declare function getDefaultBlockExplorer(chainDescriptor: ChainDescriptorConfig): {
name: string;
url: string;
} | undefined;
//# sourceMappingURL=chains.d.ts.map