Skip to content

Commit 498fcde

Browse files
committed
feat: add support for local nitro networks (#674)
Signed-off-by: Tomás Migone <[email protected]>
1 parent 8212114 commit 498fcde

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
@@ -73,8 +73,8 @@ export const migrate = async (
7373
if (!sure) return
7474

7575
if (chainId == 1337) {
76-
await (cli.wallet.provider as providers.JsonRpcProvider).send('evm_setAutomine', [true])
7776
allContracts = ['EthereumDIDRegistry', ...allContracts]
77+
await setAutoMine(cli.wallet.provider as providers.JsonRpcProvider, true)
7878
} else if (chainIdIsL2(chainId)) {
7979
allContracts = l2Contracts
8080
}
@@ -169,7 +169,15 @@ export const migrate = async (
169169
logger.info(`Sent ${nTx} transaction${nTx === 1 ? '' : 's'} & spent ${EtherSymbol} ${spent}`)
170170

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

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
@@ -152,6 +152,14 @@ const config: HardhatUserConfig = {
152152
accounts:
153153
process.env.FORK === 'true' ? getAccountsKeys() : { mnemonic: DEFAULT_TEST_MNEMONIC },
154154
},
155+
localnitrol1: {
156+
url: 'http://localhost:8545',
157+
accounts: { mnemonic: DEFAULT_TEST_MNEMONIC },
158+
},
159+
localnitrol2: {
160+
url: 'http://localhost:8547',
161+
accounts: { mnemonic: DEFAULT_TEST_MNEMONIC },
162+
},
155163
},
156164
graph: {
157165
addressBook: process.env.ADDRESS_BOOK ?? 'addresses.json',

0 commit comments

Comments
 (0)