合约地址交易列表 - Etherscan API

问题描述

有谁知道如何从合约地址获取交易列表 我已经尝试过 etherscan.io API https://etherscan.io/apis#contracts

我已按照说明接收包含合约地址的所有交易列表的响应: 使用以下网址 = https://api.etherscan.io/api?module=account&action=txlist&address=&startblock=0&endblock=99999999&sort=asc&apikey=

下面,我对 Etherscan API 的 http 请求 =

export const fetchTransactions = () => {
  return (dispatch,_,{ TaskCounter: { _address } }) => {
    const MYAPIKEY = "XXXXX";
    dispatch(fetchTransactionsPending());
    axios
      .get(
        `https://api.etherscan.io/api?module=account&action=txlist&address=${_address}&startblock=0&endblock=99999999&sort=asc&apikey=${MYAPIKEY}`
      )
      .then(console.dir)
      .catch(console.error);
  };
};

而且,我收到状态为 200 的响应:

config: {url: "https://api.etherscan.io/api?module=account&action…ort=asc&apikey=13QNDPDD3AU1FY7K9V96S628AAPPRZK5T1",method: "get",headers: {…},transformRequest: Array(1),transformResponse: Array(1),…}
data: {status: "0",message: "No transactions found",result: Array(0)}
headers: {cache-control: "private",content-length: "172",content-type: "application/json; charset=utf-8"}
request: XMLHttpRequest {readyState: 4,timeout: 0,withCredentials: false,upload: XMLHttpRequestUpload,onreadystatechange: ƒ,…}
status: 200
  • “未找到交易”
  • 结果 = []

这很奇怪,虽然我的合约在访问 goerli etherscan 时有交易可见。合约部署在Goerli tesnet上。

我需要 Etherscan API 方面的帮助,除非有不同的方法获取测试网上已部署合约的完整交易列表。我用 web3.eth ...

找不到任何东西

感谢您的帮助

解决方法

Goerli Etherscan 有不同的 API 主机。

您需要使用 https://api-goerli.etherscan.io/ 而不是 https://api.etherscan.io/

来源:https://goerli.etherscan.io/apis#accounts

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...