File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed
Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { OutDir } from '@subsquid/util-internal-code-printer'
1010
1111const LOG = createLogger ( 'sqd:evm-typegen' )
1212const PROXY_ETHERSCAN = 'https://cloud.sqd.dev/chains/api/v1/evm/abi'
13+ const ORIGIN_ETHERSCAN = 'https://api.etherscan.io/v2/api'
1314
1415runProgram (
1516 async function ( ) {
@@ -131,11 +132,11 @@ async function fetchFromEtherscan(
131132 config : EtherscanAPIConfig ,
132133) : Promise < any > {
133134 let api : string
134- if ( config . api === PROXY_ETHERSCAN ) {
135- api = config . api
135+ if ( config . api === PROXY_ETHERSCAN && config . apiKey ) {
136+ api = ORIGIN_ETHERSCAN
136137 }
137138 else {
138- api = config . api + ( config . api . endsWith ( '/' ) ? '' : '/' ) + 'api'
139+ api = config . api
139140 }
140141 let url = new URL ( api )
141142
@@ -175,7 +176,7 @@ async function fetchFromEtherscan(
175176 return JSON . parse ( response . result )
176177 } else {
177178 throw new Error (
178- `Failed to fetch contract ABI from ${ config . api } : ${ response . result } ` ,
179+ `Failed to fetch contract ABI from ${ api } : ${ response . result } ` ,
179180 )
180181 }
181182}
You can’t perform that action at this time.
0 commit comments