File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
packages/common-ts/src/contracts Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import { L1GraphTokenGateway__factory } from '@graphprotocol/contracts/dist/type
45
45
import { BridgeEscrow__factory } from '@graphprotocol/contracts/dist/types/factories/BridgeEscrow__factory'
46
46
import { L2GraphToken__factory } from '@graphprotocol/contracts/dist/types/factories/L2GraphToken__factory'
47
47
import { L2GraphTokenGateway__factory } from '@graphprotocol/contracts/dist/types/factories/L2GraphTokenGateway__factory'
48
+ import { readFileSync } from 'fs'
48
49
49
50
export const GraphChain = graphChain
50
51
@@ -74,9 +75,13 @@ export interface NetworkContracts {
74
75
export const connectContracts = async (
75
76
providerOrSigner : providers . Provider | Signer ,
76
77
chainId : number ,
78
+ addressBook ?: string ,
77
79
) : Promise < NetworkContracts > => {
78
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
79
- const deployedContracts = ( DEPLOYED_CONTRACTS as any ) [ `${ chainId } ` ]
80
+ const deployedContracts = addressBook
81
+ ? // eslint-disable-next-line @typescript-eslint/no-explicit-any
82
+ JSON . parse ( readFileSync ( addressBook ) . toString ( ) ) [ `${ chainId } ` ]
83
+ : // eslint-disable-next-line @typescript-eslint/no-explicit-any
84
+ ( DEPLOYED_CONTRACTS as any ) [ `${ chainId } ` ]
80
85
if ( ! deployedContracts ) {
81
86
throw new Error ( `chainId: '${ chainId } ' has no deployed contracts` )
82
87
}
You can’t perform that action at this time.
0 commit comments