Skip to content

Commit c759833

Browse files
committed
Use TS import for contract addresses
This change supports swapping the contracts module using yalc.
1 parent 4ca7265 commit c759833

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/common-ts/src/contracts/index.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import { providers, Signer } from 'ethers'
22

33
// Contract addresses
4-
// eslint-disable-next-line @typescript-eslint/no-var-requires
5-
const DEPLOYED_CONTRACTS = require('@graphprotocol/contracts/addresses.json')
4+
import * as DEPLOYED_CONTRACTS from '@graphprotocol/contracts/addresses.json'
65

76
// Contract ABIs
87
import { Curation } from '@graphprotocol/contracts/dist/types/Curation'
@@ -42,8 +41,8 @@ export const connectContracts = async (
4241
providerOrSigner: providers.Provider | Signer,
4342
chainId: number,
4443
): Promise<NetworkContracts> => {
45-
const deployedContracts = DEPLOYED_CONTRACTS[`${chainId}`]
46-
44+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
45+
const deployedContracts = (DEPLOYED_CONTRACTS as any)[`${chainId}`]
4746
return {
4847
curation: Curation__factory.connect(
4948
deployedContracts.Curation.address,

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
"paths": {
55
"@graphprotocol/*": ["./*/src"]
66
},
7+
"resolveJsonModule": true,
78
"skipLibCheck": true,
89
}
910
}

0 commit comments

Comments
 (0)