From c5e2472af08d172f75cef860eb3a7cd9480a6225 Mon Sep 17 00:00:00 2001 From: Sam Goldman Date: Sat, 5 Nov 2022 19:46:04 -0400 Subject: [PATCH] fix(pg): change `getChainId` from hardhat-deploy to eth-optimism --- .changeset/kind-bats-taste.md | 5 +++++ packages/plugins/src/hardhat/deployments.ts | 3 ++- packages/plugins/src/hardhat/tasks.ts | 6 +++--- 3 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 .changeset/kind-bats-taste.md diff --git a/.changeset/kind-bats-taste.md b/.changeset/kind-bats-taste.md new file mode 100644 index 000000000..7a77df222 --- /dev/null +++ b/.changeset/kind-bats-taste.md @@ -0,0 +1,5 @@ +--- +'@chugsplash/plugins': patch +--- + +Change getChainId call from hardhat-deploy to eth-optimism diff --git a/packages/plugins/src/hardhat/deployments.ts b/packages/plugins/src/hardhat/deployments.ts index 82e3786bb..1dcb283ca 100644 --- a/packages/plugins/src/hardhat/deployments.ts +++ b/packages/plugins/src/hardhat/deployments.ts @@ -1,6 +1,7 @@ import * as path from 'path' import * as fs from 'fs' +import { getChainId } from '@eth-optimism/core-utils' import '@nomiclabs/hardhat-ethers' import { Contract, ethers } from 'ethers' import { @@ -254,7 +255,7 @@ export const getContract = async ( provider: ethers.providers.JsonRpcProvider, referenceName: string ): Promise => { - if ((await hre.getChainId()) !== '31337') { + if ((await getChainId(provider)) !== 31337) { throw new Error('Only the Hardhat Network is currently supported.') } const configsWithFileNames: { diff --git a/packages/plugins/src/hardhat/tasks.ts b/packages/plugins/src/hardhat/tasks.ts index f4c22e46f..90749105a 100644 --- a/packages/plugins/src/hardhat/tasks.ts +++ b/packages/plugins/src/hardhat/tasks.ts @@ -14,7 +14,7 @@ import { TASK_RUN, } from 'hardhat/builtin-tasks/task-names' import { create, IPFSHTTPClient } from 'ipfs-http-client' -import { add0x } from '@eth-optimism/core-utils' +import { add0x, getChainId } from '@eth-optimism/core-utils' import { computeBundleId, makeActionBundleFromConfig, @@ -858,7 +858,7 @@ task(TASK_NODE) runSuper ) => { if (!args.disable) { - if ((await hre.getChainId()) === '31337') { + if ((await getChainId(hre.ethers.provider)) === 31337) { const deployer = await hre.ethers.getSigner() await deployLocalChugSplash(hre, deployer) await deployContracts(hre, args.log, args.hide) @@ -872,7 +872,7 @@ task(TASK_NODE) task(TASK_TEST) .addFlag('show', 'Show ChugSplash deployment information') .setAction(async (args: { show: boolean }, hre: any, runSuper) => { - if ((await hre.getChainId()) === '31337') { + if ((await getChainId(hre.ethers.provider)) === 31337) { try { const snapshotIdPath = path.join( path.basename(hre.config.paths.deployed),