This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
async function getEtherscanTxs(chain: string, accountAddress: string) { | |
const baseUrl = 'https://api-goerli.etherscan.io' | |
const url = `${baseUrl}/api?module=account&action=txlist&address=${accountAddress}&startblock=0&endblock=99999999&sort=asc&apikey=YourApiKeyToken` | |
const res = await fetch(url) | |
const json = await res.json() | |
const txs = json.result | |
const txHashes = txs.map((tx: any) => tx.hash) | |
return txHashes | |
} |