有谁知道如何从合约地址获取交易列表我尝试过 etherscan.io API https://etherscan.io/apis#contracts
我已按照说明接收包含合约地址所有交易列表的响应:使用以下 url = https://api.etherscan.io/api?module=account&action=txlist&address= <CONTRACT_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 ...
谢谢您的帮助