diff --git a/CHANGELOG.md b/CHANGELOG.md
new file mode 100644
index 00000000..ee8753e1
--- /dev/null
+++ b/CHANGELOG.md
@@ -0,0 +1,207 @@
+Change Log
+=========
+
+__6.0.0-beta.2__
+- Bump ethers from 6.8.0 to 6.11.1
+- Bump ethereum-cryptography from 2.1.2 to 2.1.3
+- Bump axios from 1.6.2 to 1.6.8
+
+__6.0.0-beta.1__
+- Support [TIP586](https://github.com/tronprotocol/tips/blob/master/tip-586.md) with `trx.getBandwidthPrices` and `trx.getEnergyPrices`.
+- Support custom block header info when creating transaction.
+
+__6.0.0-beta.0__
+- Add full type definition for Typescript.
+- Change Default exports to Named exports.
+- Change `TronWeb.createRandom(options)` to `TronWeb.createRandom(password, path, wordlist)`.
+- Change `TronWeb.fromMnemonic(mnemonic, path, wordlist)` to `TronWeb.fromMnemonic(mnemonic, path, password, wordlist)`.
+- All methods in `Trx` and `TransactionBuilder` perform an strict check for type and position of parameters.
+- All methods in TronWeb will throw an `Error` instance instead of a string. `e.message` should be used to access error information.
+- Update `TronWeb#event` API with new backend service([#422](https://github.com/tronprotocol/tronweb/issues/422)).
+- Remove `Contract#watch()` method.
+- Support multi-dimension address array parameters in `TransactionBuilder#triggerSmartContract()`([#433](https://github.com/tronprotocol/tronweb/issues/433)).
+
+__5.3.2__
+- Add custom block header argument for building transactions locally in `transactionBuilder` lib
+- Support [TIP586](https://github.com/tronprotocol/tips/blob/master/tip-586.md) by `trx.getBandwidthPrices` and `trx.getEnergyPrices`
+- Support recover transaction signer address by `trx.ecRecover`
+- Support multi-dimension address array such as `address[][]` for ABI params encoding in `triggerSmartContract` and `createSmartContract` [#433](https://github.com/tronprotocol/tronweb/issues/433)
+- Fix error when `triggerSmartContract` with error address due to the undefined callback [#429](https://github.com/tronprotocol/tronweb/issues/429)
+- Bump axios from 0.26.1 to 1.6.2 [#445](https://github.com/tronprotocol/tronweb/issues/445)
+
+__5.3.1__
+- Fix `getBlockRange()` error for range of 1 ([#398](https://github.com/tronprotocol/tronweb/issues/398)).
+- Add support for `estimateenergy` in `TransactionBuilder#deployConstantContract()` API.
+
+__5.3.0__
+- Replace `elliptic` with `ethereum-cryptography/secp256k1`
+- Bump ethers to ^6.6.0
+- Optimize argument validation for `createToken`, `updateToken` and `applyForSR`
+- callValue can be 0 when the contract constructor is payable
+- Support shouldPollResponse to customize poll times ([#368](https://github.com/tronprotocol/tronweb/issues/368))
+- Support [Tip541](https://github.com/tronprotocol/tips/issues/541) by `transactionBuilder.cancelUnfreezeBalanceV2`
+- Support [Tip542](https://github.com/tronprotocol/tips/issues/542) by adding a parameter in `transactionBuilder.delegateResource`
+- Support estimate the energy used in contract deployment by `transactionBuilder.deployConstantContract`
+
+__5.2.0__
+- Support build transactions locally with protobuf
+- Support multi-sign for `setAccountId`, `updateBrokerage`, `clearABI`, `updateAccountPermissions` function in `transactionBuilder` lib
+
+__5.1.0__
+- Add `freezeBalanceV2`, `unfreezeBalanceV2`, `delegateResource`, `undelegateResource` and `withdrawExpireUnfreeze` function in transactiobBuiler lib to support stakeV2
+- Support `tronWeb.transactionBuilder.estimateEnergy` to estimate energy for triggersmartcontract transaction
+- Add `getDelegatedResourceV2`, `getDelegatedResourceAccountIndexV2`, `getCanDelegatedMaxSize`, `getAvailableUnfreezeCount` and `getCanWithdrawUnfreezeAmount` function to query account resource info
+
+__5.0.0__
+- Add `tronWeb.utils.transaction` lib to serialize and deserialize transaction
+- Add `tronWeb.utils.transaction.txJsonToPb` function to convert transaction json to protobuf
+- Add `tronWeb.utils.transaction.txPbToTxID` function to get txID from transaction protobuf
+- Support new transaction builder `createAccount`
+
+__4.4.0__
+- Support `createRandom` and `fromMnemonic` function
+- Add `tronWeb.utils.message` lib, which includes `hashMessage`, `signMessage` and `verifyMessage`
+- Add `signMessageV2` and `verifyMessageV2` in `tronWeb.trx` lib which can support plain text signature and verification
+- Add `size` filter for event watch
+
+__4.3.0__
+- Support `_signTypedData`
+
+__4.2.0__
+- Add the name key when the `call()` and `send()` methods has only one return value
+- Optimize the `TriggerConstantContract()` method
+- Update `axios` to version 0.26.1
+- Update `karma` to version 6.3.17
+- Update `puppeteer` to version 13.5.1
+
+__4.1.0__
+- Add `encodeParamsV2ByABI` and `decodeParamsV2ByABI` functions in `tronWeb.utils.abi` lib
+- Support abi v2 for `triggerSmartContract`, `createSmartContract`, `call` and `send` methods
+- Update `validator` to version 13.7.0
+- Update `axios` to version 0.24.0
+- Update discord group link
+
+__4.0.1__
+- Set _isConstant as true for call method
+- Ignore max feeLimit check
+- Change git repository url
+
+__4.0.0__
+- Support `broadcastHex` method
+- Ignore fullnode version check when calling `createToken` method
+- Update dependencies version
+- Add strict mode for `pkToAddress` method
+
+__3.2.7__
+- Add options `rawParameter` that format of the parameters method and args when creating or triggering a contract
+- Update `elliptic` to the latest version 6.5.4
+- Update `validator` to the latest version 13.6.0
+
+__3.2.6__
+- Add setHeader function
+
+__3.2.5__
+- Set feeLimit max value as 5000 TRX
+
+__3.2.4__
+- Set feeLimit default value as 150 TRX
+
+__3.2.3__
+- Support triggerSmartContract function with empty character functionSelector and empty array parameters
+- The triggerSmartContract function Support for anonymous contract parameter incoming
+
+__3.2.2__
+- Set feeLimit default value as 40 TRX
+- The `createToken` method supports 0 in its precision
+
+__3.1.0__
+- Update `elliptic` to the latest version 6.5.3
+- Update `ethers` to the latest version 5.0.8
+- Fix `loadAbi()`
+
+__3.0.0__
+- Support sidechain for SunNetwork
+- Set feeLimit default value as 20 TRX
+
+__2.10.2__
+- Support toHex function with a space and empty character as parameter
+- The sign function supports visible as true.
+- Fix delete the private key in test files
+- Fix start method returned from watch is undefined #45
+
+__2.10.1__
+* Fix `trx.listExchangesPaginated`
+
+__2.10.0__
+* Fix `trx.getTokenListByName`
+
+__2.9.0__
+* Support smart contracts with function that requires an array of addresses as a parameter, included the constructor during the deployment
+
+__2.8.1__
+* Add options `keepTxID` to show also the txID when triggering a contract with `shouldPollResponse`
+
+__2.8.0__
+* Improve in the plugin architecture allows someone to implement a full lib at the same level of Trx and TransactionBuilder
+
+__2.7.4__
+* Fix bugs of trx.getBrokerage and trx.getReward function
+
+__2.7.3__
+* Support new apis related to Java-Tron 3.6.5
+* Original withdrawBlockRewards method support to withdraw user's reward
+
+__2.6.8__
+* Support extension of transaction expiration
+* Allow to add data to the transaction
+* Many minor changes and fixes
+
+__2.6.3__
+* Support get unconfirmed transaction function
+
+__2.6.0__
+* Support trigger constant contract, clear abi and add account by id
+* Add permission id option in functions related to creating transaction
+* Support multi-sign without permission id
+
+__2.5.6__
+* Reverse PR #6
+
+__2.5.5__
+* Ignore `receiverAddress` during `freezeBalance` and `unfreezeBalance` if it is equal to the owner address
+
+__2.5.4__
+* Adds cache in Trx to cache Contracts locally and make the process more efficient
+
+__2.5.2__
+* Adds static methods `Trx.signString` and `Trx.verifySignature`
+
+__2.5.0__
+* Allows freeBandwidth, freeBandwidthLimit, frozenAmount and frozenDuration to be zero
+
+__2.3.7__
+* Get rid of jssha to reduce the size of the package a little bit.
+
+__2.3.6__
+* Supports `/wallet/getapprovedlist` and `/wallet/getsignweight` JavaTron API.
+* Adds test for multi-sign workflow.
+
+__2.3.5__
+* Fixes a typo in `#event.getEventsByContractAddress` naming.
+
+__2.3.4__
+* Adds options to `#plugin.register` to pass parameters to `pluginInterface`.
+
+__2.3.3__
+* Adds filters during event watching.
+
+__2.3.2__
+* Removes mixed approach instantiating tronWeb. Before you could pass the servers as an object, and the privateKey as a separate parameter. Now, you pass them either in the options object or in the params.
+
+__2.3.1__
+* Adds support for not-tld domain, like http://localhost
+* Improve the new format, allow passing the privateKey as a property in the option object
+
+__2.3.0__
+* Introduces new format to instantiate tronWeb, passing an options object instead that `fullNode`, `solidityNode` and `eventServer` as separate params
+* Fixes bug in `_watch` which causes a continuous update of the `since` parameter
diff --git a/README.md b/README.md
index 7cc04a6a..45067d89 100644
--- a/README.md
+++ b/README.md
@@ -28,13 +28,13 @@
## What is TronWeb?
-[TronWeb](https://tronweb.network) aims to deliver a unified, seamless development experience influenced by Ethereum's [Web3](https://github.com/ethereum/web3.js/) implementation. We have taken the core ideas and expanded upon it to unlock the functionality of TRON's unique feature set along with offering new tools for integrating DApps in the browser, Node.js and IoT devices.
+[TronWeb](https://tronweb.network) aims to deliver a unified, seamless development experience influenced by Ethereum's [Web3](https://github.com/ethereum/web3.js/) implementation. We have taken the core ideas and expanded upon them to unlock the functionality of TRON's unique feature set along with offering new tools for integrating DApps in the browser, Node.js and IoT devices.
Please note that this version is an experimental beta version. To better support its use in TypeScript projects, we have rewritten the entire library in TypeScript. And to make the TronWeb API more secure and consistent, there are some breaking changes. Please check out [6.x API documentation](https://tronweb.network/docu/docs/intro/) for detailed changes so you can start using the new TypeScript version of TronWeb early. Any questions or feedback are welcome [here](https://github.com/tronprotocol/tronweb/issues/new).
**Project scope**
-Any new TRON feature will be incorporated into TronWeb. Changes to the API to improve quality-of-life are in-scope for the project. We will not necessarilly maintain feature parity with Web3.js going forward as this is a separate project, not a synchronized fork.
+Any new TRON feature will be incorporated into TronWeb. Changes to the API to improve quality-of-life are in-scope for the project. We will not necessarily maintain feature parity with Web3.js going forward as this is a separate project, not a synchronized fork.
## HomePage
@@ -53,6 +53,13 @@ TronWeb is also compatible with frontend frameworks such as:
You can also ship TronWeb in a Chrome extension.
+## Recent History
+
+For recent history, see the [CHANGELOG](https://github.com/tronprotocol/tronweb/blob/master/CHANGELOG.md). You can check it out for:
+- New features
+- Dependencies update
+- Bug fix
+
## Installation
### Node.js
@@ -66,7 +73,7 @@ yarn add tronweb@beta
### Browser
-Then easiest way to use TronWeb in a browser is to install it as above and copy the dist file to your working folder. For example:
+The easiest way to use TronWeb in a browser is to install it as above and copy the dist file to your working folder. For example:
```
cp node_modules/tronweb/dist/TronWeb.js ./js/tronweb.js
```
@@ -175,200 +182,6 @@ In order to contribute you can
Contact the team at https://cn.developers.tron.network/docs/online-technical-support
-## Recent History
-
-__6.0.0-beta.1__
-- Support [TIP586](https://github.com/tronprotocol/tips/blob/master/tip-586.md) with `trx.getBandwidthPrices` and `trx.getEnergyPrices`.
-- Support custom block header info when creating transaction.
-
-__6.0.0-beta.0__
-- Add full type definition for Typescript.
-- Change Default exports to Named exports.
-- Change `TronWeb.createRandom(options)` to `TronWeb.createRandom(password, path, wordlist)`.
-- Change `TronWeb.fromMnemonic(mnemonic, path, wordlist)` to `TronWeb.fromMnemonic(mnemonic, path, password, wordlist)`.
-- All methods in `Trx` and `TransactionBuilder` perform an strict check for type and position of parameters.
-- All methods in TronWeb will throw an `Error` instance instead of a string. `e.message` should be used to access error information.
-- Update `TronWeb#event` API with new backend service([#422](https://github.com/tronprotocol/tronweb/issues/422)).
-- Remove `Contract#watch()` method.
-- Support multi-dimension address array parameters in `TransactionBuilder#triggerSmartContract()`([#433](https://github.com/tronprotocol/tronweb/issues/433)).
-
-__5.3.1__
-- Fix `getBlockRange()` error for range of 1 ([#398](https://github.com/tronprotocol/tronweb/issues/398)).
-- Add support for `estimateenergy` in `TransactionBuilder#deployConstantContract()` API.
-
-
-__5.3.0__
-- Replace `elliptic` with `ethereum-cryptography/secp256k1`
-- Bump ethers to ^6.6.0
-- Optimize argument validation for `createToken`, `updateToken` and `applyForSR`
-- callValue can be 0 when the contract constructor is payable
-- Support shouldPollResponse to customize poll times ([#368](https://github.com/tronprotocol/tronweb/issues/368))
-- Support [Tip541](https://github.com/tronprotocol/tips/issues/541) by `transactionBuilder.cancelUnfreezeBalanceV2`
-- Support [Tip542](https://github.com/tronprotocol/tips/issues/542) by adding a parameter in `transactionBuilder.delegateResource`
-- Support estimate the energy used in contract deployment by `transactionBuilder.deployConstantContract`
-
-__5.2.0__
-- Support build transactions locally with protobuf
-- Support multi-sign for `setAccountId`, `updateBrokerage`, `clearABI`, `updateAccountPermissions` function in `transactionBuilder` lib
-
-__5.1.0__
-- Add `freezeBalanceV2`, `unfreezeBalanceV2`, `delegateResource`, `undelegateResource` and `withdrawExpireUnfreeze` function in transactiobBuiler lib to support stakeV2
-- Support `tronWeb.transactionBuilder.estimateEnergy` to estimate energy for triggersmartcontract transaction
-- Add `getDelegatedResourceV2`, `getDelegatedResourceAccountIndexV2`, `getCanDelegatedMaxSize`, `getAvailableUnfreezeCount` and `getCanWithdrawUnfreezeAmount` function to query account resource info
-
-__5.0.0__
-- Add `tronWeb.utils.transaction` lib to serialize and deserialize transaction
-- Add `tronWeb.utils.transaction.txJsonToPb` function to convert transaction json to protobuf
-- Add `tronWeb.utils.transaction.txPbToTxID` function to get txID from transaction protobuf
-- Support new transaction builder `createAccount`
-
-__4.4.0__
-- Support `createRandom` and `fromMnemonic` function
-- Add `tronWeb.utils.message` lib, which includes `hashMessage`, `signMessage` and `verifyMessage`
-- Add `signMessageV2` and `verifyMessageV2` in `tronWeb.trx` lib which can support plain text signature and verification
-- Add `size` filter for event watch
-
-__4.3.0__
-- Support `_signTypedData`
-
-__4.2.0__
-- Add the name key when the `call()` and `send()` methods has only one return value
-- Optimize the `TriggerConstantContract()` method
-- Update `axios` to version 0.26.1
-- Update `karma` to version 6.3.17
-- Update `puppeteer` to version 13.5.1
-
-__4.1.0__
-- Add `encodeParamsV2ByABI` and `decodeParamsV2ByABI` functions in `tronWeb.utils.abi` lib
-- Support abi v2 for `triggerSmartContract`, `createSmartContract`, `call` and `send` methods
-- Update `validator` to version 13.7.0
-- Update `axios` to version 0.24.0
-- Update discord group link
-
-__4.0.1__
-- Set _isConstant as true for call method
-- Ignore max feeLimit check
-- Change git repository url
-
-__4.0.0__
-- Support `broadcastHex` method
-- Ignore fullnode version check when calling `createToken` method
-- Update dependencies version
-- Add strict mode for `pkToAddress` method
-
-__3.2.7__
-- Add options `rawParameter` that format of the parameters method and args when creating or triggering a contract
-- Update `elliptic` to the latest version 6.5.4
-- Update `validator` to the latest version 13.6.0
-
-__3.2.6__
-- Add setHeader function
-
-__3.2.5__
-- Set feeLimit max value as 5000 TRX
-
-__3.2.4__
-- Set feeLimit default value as 150 TRX
-
-__3.2.3__
-- Support triggerSmartContract function with empty character functionSelector and empty array parameters
-- The triggerSmartContract function Support for anonymous contract parameter incoming
-
-__3.2.2__
-- Set feeLimit default value as 40 TRX
-- The `createToken` method supports 0 in its precision
-
-__3.1.0__
-- Update `elliptic` to the latest version 6.5.3
-- Update `ethers` to the latest version 5.0.8
-- Fix `loadAbi()`
-
-__3.0.0__
-- Support sidechain for SunNetwork
-- Set feeLimit default value as 20 TRX
-
-__2.10.2__
-- Support toHex function with a space and empty character as parameter
-- The sign function supports visible as true.
-- Fix delete the private key in test files
-- Fix start method returned from watch is undefined #45
-
-__2.10.1__
-* Fix `trx.listExchangesPaginated`
-
-__2.10.0__
-* Fix `trx.getTokenListByName`
-
-__2.9.0__
-* Support smart contracts with function that requires an array of addresses as a parameter, included the constructor during the deployment
-
-__2.8.1__
-* Add options `keepTxID` to show also the txID when triggering a contract with `shouldPollResponse`
-
-__2.8.0__
-* Improve in the plugin architecture allows someone to implement a full lib at the same level of Trx and TransactionBuilder
-
-__2.7.4__
-* Fix bugs of trx.getBrokerage and trx.getReward function
-
-__2.7.3__
-* Support new apis related to Java-Tron 3.6.5
-* Original withdrawBlockRewards method support to withdraw user's reward
-
-__2.6.8__
-* Support extension of transaction expiration
-* Allow to add data to the transaction
-* Many minor changes and fixes
-
-__2.6.3__
-* Support get unconfirmed transaction function
-
-__2.6.0__
-* Support trigger constant contract, clear abi and add account by id
-* Add permission id option in functions related to creating transaction
-* Support multi-sign without permission id
-
-__2.5.6__
-* Reverse PR #6
-
-__2.5.5__
-* Ignore `receiverAddress` during `freezeBalance` and `unfreezeBalance` if it is equal to the owner address
-
-__2.5.4__
-* Adds cache in Trx to cache Contracts locally and make the process more efficient
-
-__2.5.2__
-* Adds static methods `Trx.signString` and `Trx.verifySignature`
-
-__2.5.0__
-* Allows freeBandwidth, freeBandwidthLimit, frozenAmount and frozenDuration to be zero
-
-__2.3.7__
-* Get rid of jssha to reduce the size of the package a little bit.
-
-__2.3.6__
-* Supports `/wallet/getapprovedlist` and `/wallet/getsignweight` JavaTron API.
-* Adds test for multi-sign workflow.
-
-__2.3.5__
-* Fixes a typo in `#event.getEventsByContractAddress` naming.
-
-__2.3.4__
-* Adds options to `#plugin.register` to pass parameters to `pluginInterface`.
-
-__2.3.3__
-* Adds filters during event watching.
-
-__2.3.2__
-* Removes mixed approach instantiating tronWeb. Before you could pass the servers as an object, and the privateKey as a separate parameter. Now, you pass them either in the options object or in the params.
-
-__2.3.1__
-* Adds support for not-tld domain, like http://localhost
-* Improve the new format, allow passing the privateKey as a property in the option object
-
-__2.3.0__
-* Introduces new format to instantiate tronWeb, passing an options object instead that `fullNode`, `solidityNode` and `eventServer` as separate params
-* Fixes bug in `_watch` which causes a continuous update of the `since` parameter
## Licence
diff --git a/package-lock.json b/package-lock.json
index 70f209b6..ddf22f96 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -1,22 +1,22 @@
{
"name": "tronweb",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0-beta.2",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "tronweb",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0-beta.2",
"license": "MIT",
"dependencies": {
"@babel/runtime": "^7.0.0",
"@ethersproject/abi": "^5.7.0",
"@tronweb3/google-protobuf": "^3.21.2",
- "axios": "^1.6.2",
+ "axios": "^1.6.8",
"bignumber.js": "^9.0.1",
"eslint-config-prettier": "^8.8.0",
- "ethereum-cryptography": "^2.1.2",
- "ethers": "^6.8.0",
+ "ethereum-cryptography": "^2.1.3",
+ "ethers": "^6.11.1",
"eventemitter3": "^3.1.0",
"events": "^3.3.0",
"injectpromise": "^1.0.0",
@@ -88,9 +88,9 @@
}
},
"node_modules/@adraffy/ens-normalize": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz",
- "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q=="
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
+ "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="
},
"node_modules/@ampproject/remapping": {
"version": "2.2.1",
@@ -2487,20 +2487,20 @@
}
},
"node_modules/@noble/curves": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
- "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz",
+ "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==",
"dependencies": {
- "@noble/hashes": "1.3.1"
+ "@noble/hashes": "1.3.3"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@noble/hashes": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz",
- "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==",
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz",
+ "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==",
"engines": {
"node": ">= 16"
},
@@ -2541,33 +2541,33 @@
}
},
"node_modules/@scure/base": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz",
- "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==",
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz",
+ "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==",
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@scure/bip32": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz",
- "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==",
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz",
+ "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==",
"dependencies": {
- "@noble/curves": "~1.1.0",
- "@noble/hashes": "~1.3.1",
- "@scure/base": "~1.1.0"
+ "@noble/curves": "~1.3.0",
+ "@noble/hashes": "~1.3.2",
+ "@scure/base": "~1.1.4"
},
"funding": {
"url": "https://paulmillr.com/funding/"
}
},
"node_modules/@scure/bip39": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz",
- "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz",
+ "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==",
"dependencies": {
- "@noble/hashes": "~1.3.0",
- "@scure/base": "~1.1.0"
+ "@noble/hashes": "~1.3.2",
+ "@scure/base": "~1.1.4"
},
"funding": {
"url": "https://paulmillr.com/funding/"
@@ -3573,11 +3573,11 @@
}
},
"node_modules/axios": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
- "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
+ "version": "1.6.8",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
+ "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
"dependencies": {
- "follow-redirects": "^1.15.0",
+ "follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -5459,20 +5459,20 @@
}
},
"node_modules/ethereum-cryptography": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz",
- "integrity": "sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==",
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz",
+ "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==",
"dependencies": {
- "@noble/curves": "1.1.0",
- "@noble/hashes": "1.3.1",
- "@scure/bip32": "1.3.1",
- "@scure/bip39": "1.2.1"
+ "@noble/curves": "1.3.0",
+ "@noble/hashes": "1.3.3",
+ "@scure/bip32": "1.3.3",
+ "@scure/bip39": "1.2.2"
}
},
"node_modules/ethers": {
- "version": "6.8.1",
- "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.8.1.tgz",
- "integrity": "sha512-iEKm6zox5h1lDn6scuRWdIdFJUCGg3+/aQWu0F4K0GVyEZiktFkqrJbRjTn1FlYEPz7RKA707D6g5Kdk6j7Ljg==",
+ "version": "6.11.1",
+ "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz",
+ "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==",
"funding": [
{
"type": "individual",
@@ -5484,7 +5484,7 @@
}
],
"dependencies": {
- "@adraffy/ens-normalize": "1.10.0",
+ "@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",
"@noble/hashes": "1.3.2",
"@types/node": "18.15.13",
@@ -6070,9 +6070,9 @@
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ=="
},
"node_modules/follow-redirects": {
- "version": "1.15.4",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
- "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==",
+ "version": "1.15.6",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+ "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA==",
"funding": [
{
"type": "individual",
@@ -11825,9 +11825,9 @@
"integrity": "sha512-1Yjs2SvM8TflER/OD3cOjhWWOZb58A2t7wpE2S9XfBYTiIl+XFhQG2bjy4Pu1I+EAlCNUzRDYDdFwFYUKvXcIA=="
},
"@adraffy/ens-normalize": {
- "version": "1.10.0",
- "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz",
- "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q=="
+ "version": "1.10.1",
+ "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz",
+ "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw=="
},
"@ampproject/remapping": {
"version": "2.2.1",
@@ -13433,17 +13433,17 @@
}
},
"@noble/curves": {
- "version": "1.1.0",
- "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.1.0.tgz",
- "integrity": "sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==",
+ "version": "1.3.0",
+ "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.3.0.tgz",
+ "integrity": "sha512-t01iSXPuN+Eqzb4eBX0S5oubSqXbK/xXa1Ne18Hj8f9pStxztHCE2gfboSp/dZRLSqfuLpRK2nDXDK+W9puocA==",
"requires": {
- "@noble/hashes": "1.3.1"
+ "@noble/hashes": "1.3.3"
}
},
"@noble/hashes": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz",
- "integrity": "sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA=="
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz",
+ "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA=="
},
"@nodelib/fs.scandir": {
"version": "2.1.5",
@@ -13469,27 +13469,27 @@
}
},
"@scure/base": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.3.tgz",
- "integrity": "sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q=="
+ "version": "1.1.5",
+ "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz",
+ "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ=="
},
"@scure/bip32": {
- "version": "1.3.1",
- "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.1.tgz",
- "integrity": "sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==",
+ "version": "1.3.3",
+ "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.3.tgz",
+ "integrity": "sha512-LJaN3HwRbfQK0X1xFSi0Q9amqOgzQnnDngIt+ZlsBC3Bm7/nE7K0kwshZHyaru79yIVRv/e1mQAjZyuZG6jOFQ==",
"requires": {
- "@noble/curves": "~1.1.0",
- "@noble/hashes": "~1.3.1",
- "@scure/base": "~1.1.0"
+ "@noble/curves": "~1.3.0",
+ "@noble/hashes": "~1.3.2",
+ "@scure/base": "~1.1.4"
}
},
"@scure/bip39": {
- "version": "1.2.1",
- "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz",
- "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==",
+ "version": "1.2.2",
+ "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.2.tgz",
+ "integrity": "sha512-HYf9TUXG80beW+hGAt3TRM8wU6pQoYur9iNypTROm42dorCGmLnFe3eWjz3gOq6G62H2WRh0FCzAR1PI+29zIA==",
"requires": {
- "@noble/hashes": "~1.3.0",
- "@scure/base": "~1.1.0"
+ "@noble/hashes": "~1.3.2",
+ "@scure/base": "~1.1.4"
}
},
"@socket.io/component-emitter": {
@@ -14247,11 +14247,11 @@
"peer": true
},
"axios": {
- "version": "1.6.2",
- "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz",
- "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==",
+ "version": "1.6.8",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz",
+ "integrity": "sha512-v/ZHtJDU39mDpyBoFVkETcd/uNdxrWRrg3bKpOKzXFA6Bvqopts6ALSMU3y6ijYxbw2B+wPrIv46egTzJXCLGQ==",
"requires": {
- "follow-redirects": "^1.15.0",
+ "follow-redirects": "^1.15.6",
"form-data": "^4.0.0",
"proxy-from-env": "^1.1.0"
}
@@ -15662,22 +15662,22 @@
"integrity": "sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g=="
},
"ethereum-cryptography": {
- "version": "2.1.2",
- "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.2.tgz",
- "integrity": "sha512-Z5Ba0T0ImZ8fqXrJbpHcbpAvIswRte2wGNR/KePnu8GbbvgJ47lMxT/ZZPG6i9Jaht4azPDop4HaM00J0J59ug==",
+ "version": "2.1.3",
+ "resolved": "https://registry.npmjs.org/ethereum-cryptography/-/ethereum-cryptography-2.1.3.tgz",
+ "integrity": "sha512-BlwbIL7/P45W8FGW2r7LGuvoEZ+7PWsniMvQ4p5s2xCyw9tmaDlpfsN9HjAucbF+t/qpVHwZUisgfK24TCW8aA==",
"requires": {
- "@noble/curves": "1.1.0",
- "@noble/hashes": "1.3.1",
- "@scure/bip32": "1.3.1",
- "@scure/bip39": "1.2.1"
+ "@noble/curves": "1.3.0",
+ "@noble/hashes": "1.3.3",
+ "@scure/bip32": "1.3.3",
+ "@scure/bip39": "1.2.2"
}
},
"ethers": {
- "version": "6.8.1",
- "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.8.1.tgz",
- "integrity": "sha512-iEKm6zox5h1lDn6scuRWdIdFJUCGg3+/aQWu0F4K0GVyEZiktFkqrJbRjTn1FlYEPz7RKA707D6g5Kdk6j7Ljg==",
+ "version": "6.11.1",
+ "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz",
+ "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==",
"requires": {
- "@adraffy/ens-normalize": "1.10.0",
+ "@adraffy/ens-normalize": "1.10.1",
"@noble/curves": "1.2.0",
"@noble/hashes": "1.3.2",
"@types/node": "18.15.13",
@@ -16156,9 +16156,9 @@
"integrity": "sha512-36yxDn5H7OFZQla0/jFJmbIKTdZAQHngCedGxiMmpNfEZM0sdEeT+WczLQrjK6D7o2aiyLYDnkw0R3JK0Qv1RQ=="
},
"follow-redirects": {
- "version": "1.15.4",
- "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz",
- "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw=="
+ "version": "1.15.6",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.6.tgz",
+ "integrity": "sha512-wWN62YITEaOpSK584EZXJafH1AGpO8RVgElfkuXbTOrPX4fIfOyEpW/CsiNd8JdYrAoOvafRTOEnvsO++qCqFA=="
},
"for-each": {
"version": "0.3.3",
diff --git a/package.json b/package.json
index a4536d66..f30cabce 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "tronweb",
- "version": "6.0.0-beta.1",
+ "version": "6.0.0-beta.2",
"description": "JavaScript SDK that encapsulates the TRON HTTP API",
"main": "./lib/commonjs/index.js",
"module": "./lib/esm/index.js",
@@ -59,11 +59,11 @@
"@babel/runtime": "^7.0.0",
"@ethersproject/abi": "^5.7.0",
"@tronweb3/google-protobuf": "^3.21.2",
- "axios": "^1.6.2",
+ "axios": "^1.6.8",
"bignumber.js": "^9.0.1",
"eslint-config-prettier": "^8.8.0",
- "ethereum-cryptography": "^2.1.2",
- "ethers": "^6.8.0",
+ "ethereum-cryptography": "^2.1.3",
+ "ethers": "^6.11.1",
"eventemitter3": "^3.1.0",
"events": "^3.3.0",
"injectpromise": "^1.0.0",
diff --git a/src/lib/trx.ts b/src/lib/trx.ts
index 24e54d50..f6abbd8b 100644
--- a/src/lib/trx.ts
+++ b/src/lib/trx.ts
@@ -1,6 +1,6 @@
import { TronWeb } from '../tronweb.js';
import utils from '../utils/index.js';
-import { keccak256, toUtf8Bytes, recoverAddress, SigningKey } from '../utils/ethersUtils.js';
+import { keccak256, toUtf8Bytes, recoverAddress, SigningKey, Signature } from '../utils/ethersUtils.js';
import { ADDRESS_PREFIX } from '../utils/address.js';
import { Validator } from '../paramValidator/index.js';
import { txCheck } from '../utils/transaction.js';
@@ -522,18 +522,13 @@ export class Trx {
static verifySignature(message: string, address: string, signature: string, useTronHeader = true) {
message = message.replace(/^0x/, '');
- signature = signature.replace(/^0x/, '');
const messageBytes = [
...toUtf8Bytes(useTronHeader ? TRX_MESSAGE_HEADER : ETH_MESSAGE_HEADER),
...utils.code.hexStr2byteArray(message),
];
const messageDigest = keccak256(new Uint8Array(messageBytes));
- const recovered = recoverAddress(messageDigest, {
- yParity: signature.substring(128, 130) == '1c' ? 1 : 0,
- r: '0x' + signature.substring(0, 64),
- s: '0x' + signature.substring(64, 128),
- });
+ const recovered = recoverAddress(messageDigest, Signature.from(`0x${signature.replace(/^0x/, '')}`));
const tronAddress = ADDRESS_PREFIX + recovered.substr(2);
const base58Address = TronWeb.address.fromHex(tronAddress);
@@ -568,14 +563,8 @@ export class Trx {
signature: string,
address: string
) {
- signature = signature.replace(/^0x/, '');
-
const messageDigest = utils._TypedDataEncoder.hash(domain, types, value);
- const recovered = recoverAddress(messageDigest, {
- yParity: signature.substring(128, 130) == '1c' ? 1 : 0,
- r: '0x' + signature.substring(0, 64),
- s: '0x' + signature.substring(64, 128),
- });
+ const recovered = recoverAddress(messageDigest, Signature.from(`0x${signature.replace(/^0x/, '')}`));
const tronAddress = ADDRESS_PREFIX + recovered.substr(2);
const base58Address = TronWeb.address.fromHex(tronAddress);
diff --git a/src/tronweb.ts b/src/tronweb.ts
index fdacc8b4..3d471052 100644
--- a/src/tronweb.ts
+++ b/src/tronweb.ts
@@ -22,7 +22,7 @@ const DEFAULT_VERSION = '4.7.1';
const FEE_LIMIT = 150000000;
-const version = '6.0.0-beta.1';
+const version = '6.0.0-beta.2';
function isValidOptions(options: unknown): options is TronWebOptions {
return (
diff --git a/src/types/Transaction.ts b/src/types/Transaction.ts
index a6b8f55f..4a094f33 100644
--- a/src/types/Transaction.ts
+++ b/src/types/Transaction.ts
@@ -50,6 +50,10 @@ export interface TransactionWrapper {
* This is returned in `transactionBuilder.estimateEnergy()` and `transactionBuilder.deployConstantContract()`
*/
energy_required?: number;
+ /**
+ * The penalty energy consumption.
+ */
+ energy_penalty?: number;
/**
* Energy used by triggering contract.
*/
diff --git a/src/utils/ethersUtils.ts b/src/utils/ethersUtils.ts
index 8b4f34f9..5021ef9e 100644
--- a/src/utils/ethersUtils.ts
+++ b/src/utils/ethersUtils.ts
@@ -42,6 +42,7 @@ export {
toUtf8Bytes,
toUtf8String,
recoverAddress,
+ Signature,
SigningKey,
AbiCoder,
Interface,