Skip to content

Commit d2a300a

Browse files
authored
Merge pull request #399 from tronprotocol/release/v5.3.0
Release/v5.3.0
2 parents 4b131bb + d6ea4cf commit d2a300a

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+20451
-14836
lines changed

.npmignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ scripts
88
src
99
demo
1010
.vscode
11+
test-git-hash
12+
test-report
13+
pre-commit-result
14+
.editorconfig

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2019 TRON Foundation
3+
Copyright (c) 2023 TRON Foundation
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,16 @@ Contact the team at https://cn.developers.tron.network/docs/online-technical-sup
183183

184184
## Recent History
185185

186+
__5.3.0__
187+
- Replace `elliptic` with `ethereum-cryptography/secp256k1`
188+
- Bump ethers to ^6.6.0
189+
- Optimize argument validation for `createToken`, `updateToken` and `applyForSR`
190+
- callValue can be 0 when the contract constructor is payable
191+
- Support shouldPollResponse to customize poll times ([#368](https://github.com/tronprotocol/tronweb/issues/368))
192+
- Support [Tip541](https://github.com/tronprotocol/tips/issues/541) by `transactionBuilder.cancelUnfreezeBalanceV2`
193+
- Support [Tip542](https://github.com/tronprotocol/tips/issues/542) by adding a parameter in `transactionBuilder.delegateResource`
194+
- Support estimate the energy used in contract deployment by `transactionBuilder.deployConstantContract`
195+
186196
__5.2.0__
187197
- Support build transactions locally with protobuf
188198
- Support multi-sign for `setAccountId`, `updateBrokerage`, `clearABI`, `updateAccountPermissions` function in `transactionBuilder` lib

karma.conf.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ module.exports = function (config) {
8282
},
8383
plugins: [
8484
require("karma-webpack"),
85-
require("istanbul-instrumenter-loader"),
8685
require("karma-mocha"),
8786
require("karma-coverage"),
8887
require("karma-chrome-launcher"),

package-lock.json

Lines changed: 13853 additions & 5158 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tronweb",
3-
"version": "5.2.0",
3+
"version": "5.3.0",
44
"description": "JavaScript SDK that encapsulates the TRON HTTP API",
55
"main": "dist/TronWeb.node.js",
66
"keywords": [
@@ -28,51 +28,52 @@
2828
},
2929
"dependencies": {
3030
"@babel/runtime": "^7.0.0",
31+
"@ethersproject/abi": "^5.7.0",
3132
"@tronweb3/google-protobuf": "^3.21.2",
3233
"axios": "^0.26.1",
3334
"bignumber.js": "^9.0.1",
34-
"elliptic": "^6.5.4",
35-
"ethers": "^5.7.2",
35+
"ethereum-cryptography": "^2.0.0",
36+
"ethers": "^6.6.0",
3637
"eventemitter3": "^3.1.0",
3738
"injectpromise": "^1.0.0",
3839
"lodash": "^4.17.21",
40+
"querystring-es3": "^0.2.1",
3941
"semver": "^5.6.0",
4042
"validator": "^13.7.0"
4143
},
4244
"devDependencies": {
43-
"@babel/core": "^7.20.12",
45+
"@babel/core": "^7.21.0",
4446
"@babel/plugin-proposal-class-properties": "^7.0.0",
4547
"@babel/plugin-proposal-numeric-separator": "^7.0.0",
4648
"@babel/plugin-proposal-object-rest-spread": "^7.0.0",
4749
"@babel/plugin-transform-runtime": "^7.0.0",
48-
"@babel/preset-env": "^7.0.0",
50+
"@babel/preset-env": "^7.20.2",
4951
"babel-loader": "^8.0.2",
5052
"babel-plugin-istanbul": "^6.1.1",
5153
"babel-plugin-source-map-support": "^2.1.3",
5254
"chai": "^4.1.2",
5355
"chalk": "^2.4.1",
54-
"globby": "^8.0.1",
56+
"globby": "^13.1.3",
5557
"husky": "^7.0.0",
5658
"istanbul": "^0.4.5",
57-
"istanbul-instrumenter-loader": "^3.0.1",
5859
"jsonwebtoken": "^9.0.0",
5960
"karma": "^6.3.17",
6061
"karma-chrome-launcher": "^2.2.0",
6162
"karma-coverage": "^2.0.3",
6263
"karma-coverage-istanbul-reporter": "^3.0.3",
6364
"karma-edge-launcher": "^0.4.2",
6465
"karma-firefox-launcher": "^1.1.0",
65-
"karma-mocha": "^1.3.0",
66+
"karma-mocha": "^2.0.1",
6667
"karma-sourcemap-loader": "^0.3.7",
6768
"karma-spec-reporter": "^0.0.32",
68-
"karma-webpack": "4.0.0-rc.6",
69+
"karma-webpack": "^5.0.0",
6970
"matchdep": "^2.0.0",
70-
"mocha": "^5.2.0",
71+
"mocha": "^10.2.0",
7172
"puppeteer": "^13.5.1",
7273
"rimraf": "^3.0.2",
7374
"source-map-support": "^0.5.19",
74-
"webpack": "^4.46.0",
75-
"webpack-cli": "^3.3.12",
75+
"webpack": "^5.75.0",
76+
"webpack-cli": "^5.0.1",
7677
"webpack-node-externals": "^3.0.0"
7778
},
7879
"author": {

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -435,7 +435,7 @@ export default class TronWeb extends EventEmitter {
435435
return account
436436
}
437437

438-
static fromMnemonic(mnemonic, path = TRON_BIP39_PATH_INDEX_0, wordlist = 'en') {
438+
static fromMnemonic(mnemonic, path = TRON_BIP39_PATH_INDEX_0, wordlist = null) {
439439
const account = utils.accounts.generateAccountWithMnemonic(mnemonic, path, wordlist);
440440

441441
return account

src/lib/contract/method.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import utils from 'utils';
2-
import {ADDRESS_PREFIX_REGEX} from 'utils/address';
32
import {encodeParamsV2ByABI, decodeParamsV2ByABI} from 'utils/abi';
43
import injectpromise from 'injectpromise';
54

@@ -11,7 +10,7 @@ const getFunctionSelector = abi => {
1110
if(abi.type === 'event') {
1211
return iface.getEvent(abi.name).format(utils.ethersUtils.FormatTypes.sighash);
1312
}
14-
return iface.getFunction(abi.name).format(utils.ethersUtils.FormatTypes.sighash)
13+
return iface.getFunction(abi.name).format(utils.ethersUtils.FormatTypes.sighash);
1514
}
1615

1716
const decodeOutput = (abi, output) => {
@@ -37,7 +36,7 @@ export default class Method {
3736
feeLimit: this.tronWeb.feeLimit,
3837
callValue: 0,
3938
userFeePercentage: 100,
40-
shouldPollResponse: false // Only used for sign()
39+
shouldPollResponse: false, // Only used for sign()
4140
};
4241
}
4342

@@ -243,7 +242,7 @@ export default class Method {
243242
return callback(null, signedTransaction.txID);
244243

245244
const checkResult = async (index = 0) => {
246-
if (index === 20) {
245+
if (index === (options.pollTimes || 20)) {
247246
return callback({
248247
error: 'Cannot find result in solidity node',
249248
transaction: signedTransaction

src/lib/event.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import TronWeb from 'index';
22
import utils from 'utils';
33
import providers from "./providers";
4-
import querystring from "querystring";
4+
import querystring from "querystring-es3";
55
import injectpromise from 'injectpromise';
66

77
export default class Event {

src/lib/sidechain.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ export default class SideChain {
2121
this.sidechain.trx.multiSign = (...args) => {
2222
return self.multiSign(...args);
2323
};
24+
25+
console.warn("TronWeb: 'tronWeb.sidechain' is deprecated and may be removed in the future. Please use the 'sunweb' sdk instead. For more information, see: https://github.com/tronprotocol/sun-network/tree/develop/js-sdk");
2426
}
2527
setMainGatewayAddress(mainGatewayAddress) {
2628
if (!this.isAddress(mainGatewayAddress))

0 commit comments

Comments
 (0)