MCPcopy Create free account
hub / github.com/circlefin/arc-node / getChain

Function getChain

scripts/hardhat/viem-helper.ts:41–59  ·  view source on GitHub ↗
(hre: HardhatRuntimeEnvironment)

Source from the content-addressed store, hash-verified

39 * We need to load the chain manually.
40 */
41export const getChain = (hre: HardhatRuntimeEnvironment) => {
42 const name = hre.network.name
43 const id = hre.network.config.chainId
44 const url = (hre.network.config as { url?: string }).url
45
46 if (id == null) {
47 throw new Error(`chain ID for network ${name} is required`)
48 }
49 if (url == null || url === '') {
50 throw new Error(`url for network ${name} is required`)
51 }
52
53 return defineChain({
54 ...(chainDefinitions[name as keyof typeof chainDefinitions] ?? localhost),
55 // patch hardhat configurable fields
56 ...(id != null ? { id } : undefined),
57 ...(url != null ? { rpcUrls: { default: { http: [url] } } } : undefined),
58 })
59}
60
61export const createWalletClient = <T extends Account>(hre: HardhatRuntimeEnvironment, account: T) =>
62 viemCreateWalletClient({ account, chain: getChain(hre), transport: http() })

Callers 13

query-fee.tsFile · 0.90
query-state.tsFile · 0.90
getClientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90
clientsFunction · 0.90

Calls

no outgoing calls

Tested by 7

clientsFunction · 0.72
clientsFunction · 0.72
clientsFunction · 0.72
clientsFunction · 0.72
clientsFunction · 0.72
clientsFunction · 0.72
clientsFunction · 0.72