Skip to content

Commit 21e8695

Browse files
committed
feat: add support for local nitro networks
Signed-off-by: Tomás Migone <[email protected]>
1 parent 3a22a27 commit 21e8695

File tree

4 files changed

+20
-4
lines changed

4 files changed

+20
-4
lines changed

cli/commands/migrate.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ export const migrate = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<vo
7272

7373
if (chainId == 1337) {
7474
allContracts = ['EthereumDIDRegistry', ...allContracts]
75-
await (cli.wallet.provider as providers.JsonRpcProvider).send('evm_setAutomine', [true])
75+
await setAutoMine(cli.wallet.provider as providers.JsonRpcProvider, true)
7676
} else if (chainIdIsL2(chainId)) {
7777
allContracts = l2Contracts
7878
}
@@ -167,7 +167,15 @@ export const migrate = async (cli: CLIEnvironment, cliArgs: CLIArgs): Promise<vo
167167
logger.info(`Sent ${nTx} transaction${nTx === 1 ? '' : 's'} & spent ${EtherSymbol} ${spent}`)
168168

169169
if (chainId == 1337) {
170-
await (cli.wallet.provider as providers.JsonRpcProvider).send('evm_setAutomine', [false])
170+
await setAutoMine(cli.wallet.provider as providers.JsonRpcProvider, false)
171+
}
172+
}
173+
174+
const setAutoMine = async (provider: providers.JsonRpcProvider, automine: boolean) => {
175+
try {
176+
await provider.send('evm_setAutomine', [automine])
177+
} catch (error) {
178+
logger.warn('The method evm_setAutomine does not exist/is not available!')
171179
}
172180
}
173181

cli/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { addCustomNetwork } from '@arbitrum/sdk'
21
import { Contract, Wallet, providers } from 'ethers'
32

43
import { loadArtifact } from './artifacts'
@@ -7,6 +6,7 @@ export const l1ToL2ChainIdMap = {
76
'1': '42161',
87
'4': '421611',
98
'5': '421613',
9+
'1337': '412346',
1010
}
1111

1212
export const l2ChainIds = Object.values(l1ToL2ChainIdMap).map(Number)

config/graph.arbitrum-localhost.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ contracts:
125125
subgraphAvailabilityOracle: *availabilityOracle
126126
AllocationExchange:
127127
init:
128-
graphToken: "${{GraphToken.address}}"
128+
graphToken: "${{L2GraphToken.address}}"
129129
staking: "${{Staking.address}}"
130130
governor: *allocationExchangeOwner
131131
authority: *authority

hardhat.config.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,14 @@ const config: HardhatUserConfig = {
146146
accounts:
147147
process.env.FORK === 'true' ? getAccountsKeys() : { mnemonic: DEFAULT_TEST_MNEMONIC },
148148
},
149+
localnitrol1: {
150+
url: 'http://localhost:8545',
151+
accounts: { mnemonic: DEFAULT_TEST_MNEMONIC },
152+
},
153+
localnitrol2: {
154+
url: 'http://localhost:8547',
155+
accounts: { mnemonic: DEFAULT_TEST_MNEMONIC },
156+
},
149157
},
150158
etherscan: {
151159
apiKey: process.env.ETHERSCAN_API_KEY,

0 commit comments

Comments
 (0)