Skip to content

Commit

Permalink
fix(pg): change getChainId from hardhat-deploy to eth-optimism
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-goldman committed Nov 5, 2022
1 parent 4262614 commit c5e2472
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/kind-bats-taste.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@chugsplash/plugins': patch
---

Change getChainId call from hardhat-deploy to eth-optimism
3 changes: 2 additions & 1 deletion packages/plugins/src/hardhat/deployments.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down Expand Up @@ -254,7 +255,7 @@ export const getContract = async (
provider: ethers.providers.JsonRpcProvider,
referenceName: string
): Promise<ethers.Contract> => {
if ((await hre.getChainId()) !== '31337') {
if ((await getChainId(provider)) !== 31337) {
throw new Error('Only the Hardhat Network is currently supported.')
}
const configsWithFileNames: {
Expand Down
6 changes: 3 additions & 3 deletions packages/plugins/src/hardhat/tasks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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)
Expand All @@ -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),
Expand Down

0 comments on commit c5e2472

Please sign in to comment.