Skip to content

Commit 503cad6

Browse files
committed
add registry support
1 parent 21c00c2 commit 503cad6

File tree

16 files changed

+1098
-964
lines changed

16 files changed

+1098
-964
lines changed

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@
2828
"type-check": "pnpm --filter=@graphprotocol/graph-cli type-check"
2929
},
3030
"devDependencies": {
31+
"@babel/core": "^7.26.0",
32+
"@babel/preset-env": "^7.26.0",
33+
"@babel/preset-typescript": "^7.26.0",
3134
"@changesets/changelog-github": "^0.5.0",
3235
"@changesets/cli": "^2.27.10",
3336
"@theguild/eslint-config": "0.13.1",

packages/cli/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@
3434
"@oclif/plugin-autocomplete": "^3.2.11",
3535
"@oclif/plugin-not-found": "^3.2.29",
3636
"@oclif/plugin-warn-if-update-available": "^3.1.24",
37+
"@pinax/graph-networks-registry": "^0.6.4",
3738
"@whatwg-node/fetch": "^0.10.1",
3839
"assemblyscript": "0.27.31",
3940
"binary-install": "^1.1.0",

packages/cli/src/command-helpers/abi.test.ts

Lines changed: 41 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
11
import { describe, expect, test } from 'vitest';
2-
import { getStartBlockForContract } from './abi.js';
2+
import { NetworksRegistry } from '@pinax/graph-networks-registry';
3+
import { ContractService } from './contracts';
34

45
// An object with some test cases for contract deployment block numbers
56
const TEST_CONTRACT_START_BLOCKS = {
6-
'arbitrum-goerli': {
7-
'0xde438d54c7b75f798985ae38a4d07b5431702077': 4_488_583,
8-
},
97
'arbitrum-one': {
108
'0xF4d73326C13a4Fc5FD7A064217e12780e9Bd62c3': 226_981,
119
},
@@ -18,9 +16,6 @@ const TEST_CONTRACT_START_BLOCKS = {
1816
fantom: {
1917
'0xf731202A3cf7EfA9368C2d7bD613926f7A144dB5': 28_771_200,
2018
},
21-
goerli: {
22-
'0xff02b7d59975E76F67B63b20b813a9Ec0f6AbD60': 226_385,
23-
},
2419
mainnet: {
2520
'0xc2EdaD668740f1aA35E4D8f227fB8E17dcA888Cd': 10_736_242,
2621
},
@@ -36,6 +31,33 @@ const TEST_CONTRACT_START_BLOCKS = {
3631
optimism: {
3732
'0xc35DADB65012eC5796536bD9864eD8773aBc74C4': 7_019_815,
3833
},
34+
celo: {
35+
'0x8084936982D089130e001b470eDf58faCA445008': 10186627,
36+
},
37+
'celo-alfajores': {
38+
'0xc857ea98ab2dae9877c9fd23971152cd2776d0e4': 9_142_263,
39+
},
40+
chapel: {
41+
'0x549fb5626025237351446ac502decdf2f3a4c570': 25_509_955,
42+
},
43+
'fantom-testnet': {
44+
'0xa40f1c7cc67180aa941e9ef66ee32f704e9600a6': 13_679_941,
45+
},
46+
fuji: {
47+
'0x7a2b3f2ca3e0b5867d44ef8bc5ba316f98e05f05': 18_710_858,
48+
},
49+
gnosis: {
50+
'0xdDCbf776dF3dE60163066A5ddDF2277cB445E0F3': 16655565,
51+
},
52+
aurora: {
53+
'0x76FA7f90D3900eB95Cfc58AB12c916984AeC50c8': 77431034,
54+
},
55+
'aurora-testnet': {
56+
'0x76FA7f90D3900eB95Cfc58AB12c916984AeC50c8': 77431034,
57+
},
58+
fuse: {
59+
'0x3dB01570D97631f69bbb0ba39796865456Cf89A5': 1000000,
60+
},
3961

4062
// Skipping these networks for now because they do not support the latest etherscan contracts API or is blockScout based
4163

@@ -87,14 +109,20 @@ const TEST_CONTRACT_START_BLOCKS = {
87109
};
88110

89111
// skip this test since its time consuming
90-
describe.skip('getStartBlockForContract', () => {
112+
describe.sequential('getStartBlockForContract', async () => {
113+
const registry = await NetworksRegistry.fromLatestVersion();
114+
const contractService = new ContractService(registry);
91115
for (const [network, contracts] of Object.entries(TEST_CONTRACT_START_BLOCKS)) {
92116
for (const [contract, startBlockExp] of Object.entries(contracts)) {
93-
test(`Returns the start block ${network} ${contract} ${startBlockExp}`, async () => {
94-
//loop through the TEST_CONTRACT_START_BLOCKS object and test each network
95-
const startBlock = await getStartBlockForContract(network, contract);
96-
expect(startBlock).toBe(startBlockExp);
97-
});
117+
test(
118+
`Returns the start block ${network} ${contract} ${startBlockExp}`,
119+
async () => {
120+
//loop through the TEST_CONTRACT_START_BLOCKS object and test each network
121+
const startBlock = await contractService.getStartBlock(network, contract);
122+
expect(parseInt(startBlock)).toBe(startBlockExp);
123+
},
124+
{ timeout: 10000 },
125+
);
98126
}
99127
}
100128
});

0 commit comments

Comments
 (0)