Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Blocking when sendTransaction in Tron #168

Open
AnyPang opened this issue Apr 8, 2020 · 1 comment
Open

Blocking when sendTransaction in Tron #168

AnyPang opened this issue Apr 8, 2020 · 1 comment

Comments

@AnyPang
Copy link

AnyPang commented Apr 8, 2020

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
Copy link
Author

AnyPang commented Apr 8, 2020

It also has the same problem in the Tron mainnet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant