( multiProvider: MultiProvider, - chainId: ChainId, + chainName: string, params: URLSearchParams, useKey = false, ) { - const baseUrl = multiProvider.tryGetExplorerApiUrl(chainId); - if (!baseUrl) throw new Error(`No valid URL found for explorer for chain ${chainId}`); + const baseUrl = multiProvider.tryGetExplorerApiUrl(chainName); + if (!baseUrl) throw new Error(`No valid URL found for explorer for chain ${chainName}`); const url = new URL(baseUrl); for (const [key, val] of params.entries()) { @@ -35,8 +35,8 @@ async function queryExplorer
(
}
if (useKey) {
- const apiKey = config.explorerApiKeys[chainId];
- if (!apiKey) throw new Error(`No API key for explorer for chain ${chainId}`);
+ const apiKey = config.explorerApiKeys[chainName];
+ if (!apiKey) throw new Error(`No API key for explorer for chain ${chainName}`);
url.searchParams.set('apikey', apiKey);
}
@@ -85,13 +85,13 @@ export interface ExplorerLogEntry {
export async function queryExplorerForLogs(
multiProvider: MultiProvider,
- chainId: ChainId,
+ chainName: string,
params: string,
useKey = false,
): Promise