JSPM

  • Created
  • Published
  • Downloads 283849
  • Score
    100M100P100Q168169F
  • License MIT

A jssdk that encapsulates the TRON HTTP request

Package Exports

  • tronweb

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (tronweb) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

TronWeb

  • A jssdk that encapsulates the TRON HTTP request
  • It is best to use in Vue or react projects
  • If you want to use it in HTML, you need to execute NPM run build and then UMD modules and ES modules will be generated

Install

  • npm: npm install tronweb
  • bower: bower install tronweb

Example Usage in React or vue

let tronWeb = new TronWeb('http://52.44.75.99:8090');
tronWeb.setEventServer('http://52.44.75.99:18889');
tronWeb.defaultAccount = 'TPL66VK2gCXNCD7EJg9pgJRfqcRazjhUZY';
tronWeb.defaultPk='da146374a75310b9666e834ee4ad0866d6f4035967bfc76217c5a495fff9f0d0'; 

async getBalance(){
        const res = await tronWeb.getBalance(this.account.value);
        this.setState({
            data:res
        })
    }  

GitHub

https://github.com/tronprotocol/tron-web.git

docs

document 官方文档