使用 trongrid api 密钥,不影响仪表板查询计数

问题描述

我正在使用这种方法,但遇到了 503 statusCode 并且也看不到我的应用程序中的任何查询((

const tronWeb = new TronWeb({
    fullHost: 'https://api.trongrid.io/',headers: { "TRON-PRO-API-KEY": 'your api key' },privateKey: 'your private key'
})

更新。顺便想想怎么解决。 将我的 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();

Where 方法 instance.f() - 你的智能合约方法示例 getName() 使用命令 node index.js

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...