Blocking when sendTransaction in Tron
Opened this issue · 1 comments
AnyPang commented
I copy the quick code of the tronweb part in README file and change the network config to tron shasta testnet, then I run it in nodejs.
I success login and get the account from the Scatter wallet, but it seems block when call the sendTransaction and print nothing in the console.
Dose it support the Shasta testnet?
My code is as follows:
import ScatterJS from '@scatterjs/core';
import ScatterTron from '@scatterjs/tron';
import TronWeb from 'tronweb';
ScatterJS.plugins( new ScatterTron() );
const network = ScatterJS.Network.fromJson({
blockchain:'trx',
chainId:'1',
host:'api.shasta.trongrid.io',
port:443,
protocol:'https'
});
const httpProvider = new TronWeb.providers.HttpProvider(network.fullhost());
let tron = new TronWeb(httpProvider, httpProvider, network.fullhost());
tron.setDefaultBlock('latest');
ScatterJS.connect('YourAppName', {network}).then(connected => {
if(!connected) return console.error('no scatter');
tron = ScatterJS.trx(network, tron);
ScatterJS.login().then(id => {
if(!id) return console.error('no identity');
const account = ScatterJS.account('trx');
console.log(account);
tron.trx.sendTransaction('TFwwmGs5YrP9NR7w9RSdxVPGPFrN7jNF6n', 100).then(res => {
console.log('sent: ', res);
}).catch(err => {
console.error('error: ', err);
});
});
});
AnyPang commented
It also has the same problem in the Tron mainnet