【问题标题】:contract's address transactions list - Etherscan API合约地址交易列表 - Etherscan API
【发布时间】:2021-08-10 17:47:27
【问题描述】:

有谁知道如何从合约地址获取交易列表 我已经尝试过 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 测试网上。

我需要 Etherscan API 方面的帮助,除非有其他方法可以获取测试网上已部署合约的完整交易列表。 web3.eth ... 找不到任何东西

感谢您的帮助

【问题讨论】:

    标签: blockchain ethereum etherscan


    【解决方案1】:

    Goerli Etherscan 有不同的 API 主机。

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

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

    【讨论】:

    • 有效!!完美的。非常感谢您的帮助!!
    猜你喜欢
    • 2021-06-25
    • 2023-01-14
    • 2022-01-04
    • 2021-11-26
    • 2021-10-14
    • 2022-10-06
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多