Skip to content

Commit 04bd901

Browse files
authored
Fix matic endpoint and improve error message (#1756)
Closes #1755
1 parent 08914a8 commit 04bd901

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.changeset/pretty-shrimps-kick.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@graphprotocol/graph-cli': patch
3+
---
4+
5+
Fix `matic` RPC endpoint and improve error message

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ export const fetchTransactionByHashFromRPC = async (
100100
transactionHash: string,
101101
): Promise<any> => {
102102
let json: any;
103+
const RPCURL = getPublicRPCEndpoint(network);
103104
try {
104-
const RPCURL = getPublicRPCEndpoint(network);
105105
if (!RPCURL) throw new Error(`Unable to fetch RPC URL for ${network}`);
106106
const result = await fetch(String(RPCURL), {
107107
method: 'POST',
@@ -120,7 +120,9 @@ export const fetchTransactionByHashFromRPC = async (
120120
return json;
121121
} catch (error) {
122122
logger('Failed to fetchTransactionByHashFromRPC: %O', error);
123-
throw new Error('Failed to fetch contract creation transaction');
123+
throw new Error(
124+
`Failed to run \`eth_getTransactionByHash\` on RPC (${RPCURL}) (run with env \`DEBUG=*\` for full error).`,
125+
);
124126
}
125127
};
126128

@@ -387,7 +389,7 @@ const getPublicRPCEndpoint = (network: string) => {
387389
case 'mainnet':
388390
return 'https://rpc.ankr.com/eth';
389391
case 'matic':
390-
return 'https://rpc-mainnet.maticvigil.com';
392+
return 'https://polygon-rpc.com/';
391393
case 'mbase':
392394
return 'https://rpc.moonbase.moonbeam.network';
393395
case 'mumbai':

0 commit comments

Comments
 (0)