我在TronWeb API中使用了getTransactionsRelated()函数来获取所有事务,但是会抛出405错误。参考:https://developers.tron.network/v3.0/reference#tronwebapi。
这里有些奇怪的地方是它在设置和测试api时起作用,但是第二天就起作用了(出现405错误)。
const TronWeb = require('tronweb');
const HttpProvider = TronWeb.providers.HttpProvider;
const fullNode = new HttpProvider(TRON_URL);
const solidityNode = new HttpProvider(TRON_URL);
const eventServer = new HttpProvider(TRON_URL);
const getTransactionHistory = (address, privateKey, offset) => {
const tronWeb = new TronWeb(
fullNode,
solidityNode,
eventServer,
privateKey
);
const transactions = await tronWeb.trx.getTransactionsRelated(address, "all", 10, offset);
console.log('transaction', transaction);
}
预期:给定地址的所有交易。
实际:405“不允许使用方法”