Skip to content

v3.0.0

Choose a tag to compare

@llwslc llwslc released this 21 Oct 08:37
· 600 commits to master since this release
3e38651
  • Bump tronweb from 4.0.1 to 4.3.0
  • Add support for Solidity compiler 0.8.7 and 0.8.11
  • Add tronWrap.send function to test environment for supporting tronbox/tre docker image.
  • Add tre_setAccountBalance RPC method. The method can set the given account's balance to the specified SUN value.
  • Add tre_setAccountCode RPC method. The method can set the given account's code to the specified value.
  • Add tre_setAccountStorageAt RPC method. The method can set the given account's storage slot to the specified data.
  • Add tre_blockTime RPC method. The method can set the blockTime in seconds for automatic mining. A blockTime of 0 enables "instamine mode", where new executable transactions will be mined instantly.
  • Add tre_mine RPC method. The method can mine exactly blocks number of blocks.
  • Add tre_unlockedAccounts RPC method. The method can set up any arbitrary account to impersonate during development.

tre_setAccountBalance:

const address = "TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL";
const balance = "0x3e8";
const result = await tronWrap.send("tre_setAccountBalance", [address, balance]);
console.log(result);

tre_setAccountCode:

const address = "TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL";
const data = "0xbaddad42";
const result = await tronWrap.send("tre_setAccountCode", [address, data]);
console.log(result);

tre_setAccountStorageAt:

const address = "TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL";
const slot = "0x0000000000000000000000000000000000000000000000000000000000000005";
const data = "0xbaddad42";
const result = await tronWrap.send("tre_setAccountStorageAt", [address, slot, data]);
console.log(result);

tre_blockTime:

const result = await tronWrap.send("tre_blockTime", [3]);
console.log(result);

tre_mine:

const result = await tronWrap.send("tre_mine", [{ blocks: 5}]);
console.log(result);

tre_unlockedAccounts:

const result = await tronWrap.send("tre_unlockedAccounts", [["TNPeeaaFB7K9cmo4uQpcU32zGK8G1NYqeL"]]);
console.log(result);