Skip to content

Commit efa9444

Browse files
authoredJan 18, 2024
fix: zksync sepolia public rpc url (#1568)
1 parent 950f48f commit efa9444

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed
 

‎.changeset/eight-houses-tie.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
add zk sync sepolia RPC url

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

+16-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
11
import immutable from 'immutable';
22
import { GRAPH_CLI_SHARED_HEADERS } from '../constants';
3+
import debugFactory from '../debug';
34
import fetch from '../fetch';
45
import ABI from '../protocols/ethereum/abi';
56
import { withSpinner } from './spinner';
67

8+
const logger = debugFactory('graph-cli:abi-helpers');
9+
710
export const loadAbiFromEtherscan = async (
811
ABICtor: typeof ABI,
912
network: string,
@@ -51,7 +54,9 @@ export const fetchDeployContractTransactionFromEtherscan = async (
5154
5,
5255
);
5356
if (json.status === '1') {
54-
return json.result[0].txHash;
57+
const hash = json.result[0].txHash;
58+
logger('Successfully fetchDeployContractTransactionFromEtherscan. txHash: %s', hash);
59+
return hash;
5560
}
5661

5762
throw new Error(`Failed to fetch deploy contract transaction`);
@@ -70,6 +75,7 @@ export const fetchContractCreationHashWithRetry = async (
7075
return json;
7176
}
7277
} catch (error) {
78+
logger('Failed to fetchContractCreationHashWithRetry: %O', error);
7379
/* empty */
7480
}
7581
}
@@ -100,6 +106,7 @@ export const fetchTransactionByHashFromRPC = async (
100106
json = await result.json();
101107
return json;
102108
} catch (error) {
109+
logger('Failed to fetchTransactionByHashFromRPC: %O', error);
103110
throw new Error('Failed to fetch contract creation transaction');
104111
}
105112
};
@@ -111,8 +118,11 @@ export const getStartBlockForContract = async (
111118
try {
112119
const transactionHash = await fetchDeployContractTransactionFromEtherscan(network, address);
113120
const txn = await fetchTransactionByHashFromRPC(network, transactionHash);
114-
return parseInt(txn.result.blockNumber, 16);
121+
const blockNumber = parseInt(txn.result.blockNumber, 16);
122+
logger('Successfully getStartBlockForContract. blockNumber: %s', blockNumber);
123+
return blockNumber;
115124
} catch (error) {
125+
logger('Failed to fetch getStartBlockForContract: %O', error);
116126
throw new Error(error?.message);
117127
}
118128
};
@@ -139,8 +149,10 @@ export const loadAbiFromBlockScout = async (
139149
// a `result` field. The `status` is '0' in case of errors and '1' in
140150
// case of success
141151
if (json.status === '1') {
152+
logger('Successfully loadAbiFromBlockScout. address: %s', address);
142153
return new ABICtor('Contract', undefined, immutable.fromJS(JSON.parse(json.result)));
143154
}
155+
logger('Failed to loadAbiFromBlockScout. address: %s', address);
144156
throw new Error('ABI not found, try loading it from a local file');
145157
},
146158
);
@@ -285,6 +297,8 @@ const getPublicRPCEndpoint = (network: string) => {
285297
return 'https://mainnet.era.zksync.io';
286298
case 'zksync-era-testnet':
287299
return 'https://testnet.era.zksync.dev';
300+
case 'zksync-era-sepolia':
301+
return 'https://sepolia.era.zksync.dev';
288302
case 'sepolia':
289303
return 'https://rpc.ankr.com/eth_sepolia';
290304
case 'scroll-sepolia':

0 commit comments

Comments
 (0)