Skip to content

Blocking when sendTransaction in Tron #168

@AnyPang

Description

@AnyPang

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);
        });
    });
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions