0

im using this method but meet with 503 statusCode and also can not see any query from my app ((

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

Upd. Funally figure out how to solve. Udpate my tronWeb to 3.2.6 version

user3640561
  • 191
  • 1
  • 6

1 Answers1

0

First you shuld initialize tronweb for example 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'
});

Then you should use contract methods:

async function f() {
    let instance = await tronWeb.contract.at('here is contract address');
    let result = await instance.f().call();
    console.log(result);
}
f();

Where method instance.f() - your method of smart contract example getName() use command node index.js

Denis Deniben
  • 93
  • 2
  • 10