im使用此方法,但满足503状态代码也看不到来自我的应用程序的任何查询((
const tronWeb = new TronWeb({
fullHost: 'https://api.trongrid.io/',
headers: { "TRON-PRO-API-KEY": 'your api key' },
privateKey: 'your private key'
})
Upd。有趣地想办法解决。Udpate我的tronWeb到3.2.6版本
首先初始化tronweb例如index.js
const TronWeb = require("tronweb");
const tronWeb = new TronWeb({
fullHost: 'https://api.trongrid.io/',
headers: { "TRON-PRO-API-KEY": 'Here is api key' },
privateKey: 'here is pk'
});
然后你应该使用合同方法:
async function f() {
let instance = await tronWeb.contract.at('here is contract address');
let result = await instance.f().call();
console.log(result);
}
f();
其中方法instance.f((-智能合约示例getName()
的方法使用命令node index.js