簡體   English   中英

合約地址交易列表 - Etherscan API

[英]contract's address transactions list - Etherscan API

有誰知道如何從合約地址獲取交易列表我試過 etherscan.io API https://etherscan.io/apis#contracts

我已按照說明接收包含合約地址的所有交易列表的響應:使用以下 url = https://api.etherscan.io/api?module=account&action=txlist&address= <CONTRACT_ADDRESS>&startblock=0 99999999&sort=asc&apikey=

下面,我的 http 請求 Etherscan API =

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...

謝謝您的幫助

Goerli Etherscan 有不同的 API 主機。

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

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM