@@ -46,6 +46,16 @@ import type { Networkish } from "./network.js";
4646//import type { } from "./pagination";
4747import type { TransactionRequest } from "./provider.js" ;
4848
49+ // See: https://docs.etherscan.io/supported-chains
50+ const Supported = (
51+ "1 11155111 17000 560048 2741 11124 33111 33139 42170 " +
52+ "42161 421614 43114 43113 8453 84532 80069 80094 199 1029 81457 " +
53+ "168587773 56 97 42220 11142220 252 2523 100 999 737373 747474 " +
54+ "59144 59141 5000 5003 43521 143 10143 1287 1284 1285 10 " +
55+ "11155420 204 5611 80002 137 534352 534351 1329 1328 146 14601 " +
56+ "988 2201 1923 1924 167013 167000 130 1301 480 4801 51 50 324 300"
57+ ) . split ( / / g) ;
58+
4959const THROTTLE = 2000 ;
5060
5161function isPromise < T = any > ( value : any ) : value is Promise < T > {
@@ -135,12 +145,16 @@ export class EtherscanProvider extends AbstractProvider {
135145 * Creates a new **EtherscanBaseProvider**.
136146 */
137147 constructor ( _network ?: Networkish , _apiKey ?: string ) {
148+
138149 const apiKey = ( _apiKey != null ) ? _apiKey : null ;
139150
140151 super ( ) ;
141152
142153 const network = Network . from ( _network ) ;
143154
155+ assertArgument ( Supported . indexOf ( `${ network . chainId } ` ) >= 0 ,
156+ "unsupported network" , "network" , network ) ;
157+
144158 this . #plugin = network . getPlugin < EtherscanPlugin > ( EtherscanPluginId ) ;
145159
146160 defineProperties < EtherscanProvider > ( this , { apiKey, network } ) ;
0 commit comments