tronbox-web3

tronbox-web3

tronbox-web3是一个 TronBox 插件,用于跟 Truffle 的项目工程集成。使用 tronbox-web3 插件,可以在为 Truffle 编写的项目中可以使用 TronBox。

Required plugins

使用这个插件前需要先安装 TronBox

Installation

在项目的目录下执行以下命令安装:

npm install tronbox-web3

然后在你的test 目录下的 .js 文件中添加:

const [web3, provider] = require('tronbox-web3')(new Web3(Web3.givenProvider), ganache.provider());

Usage

  1. 在你的 Truffle 项目中,执行 tronbox init。该命令会在根目录生成配置文件tronbox-config.js ,用来设置网络信息以及其他项目相关的设置。
  如果你的项目中没有 package.json,需要先执行 `npm init -y`
  1. 接下来就可以在你的 Truffle 项目中使用 TronBox,例如: tronbox compile
 因波场与以太坊的差异性,在使用 TronBox 执行的过程中,可能会出现兼容性上的错误,需根据报错信息手动去解决。