Skip to content

Commit 15b8f1d

Browse files
authored
Merge pull request #677 from tronprotocol/release/v6.1.1
Release/v6.1.1
2 parents 15a649d + 855cbf1 commit 15b8f1d

File tree

7 files changed

+72
-185
lines changed

7 files changed

+72
-185
lines changed

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
Change Log
22
=========
33

4+
__6.1.1__
5+
6+
## Changes
7+
8+
- Remove dependency `jsonwebtoken`.
9+
- Bump `validator` from v13.15.20 to v13.15.23.
10+
- Address other audit issues.
11+
412
__6.1.0__
513

614
## New Features

package-lock.json

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

package.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tronweb",
3-
"version": "6.1.0",
3+
"version": "6.1.1",
44
"description": "JavaScript SDK that encapsulates the TRON HTTP API",
55
"main": "./lib/commonjs/index.js",
66
"module": "./lib/esm/index.js",
@@ -65,7 +65,7 @@
6565
"eventemitter3": "5.0.1",
6666
"google-protobuf": "3.21.4",
6767
"semver": "7.7.1",
68-
"validator": "13.15.20"
68+
"validator": "13.15.23"
6969
},
7070
"devDependencies": {
7171
"@babel/core": "7.26.10",
@@ -103,7 +103,6 @@
103103
"globby": "14.1.0",
104104
"husky": "9.1.7",
105105
"json-schema": "0.4.0",
106-
"jsonwebtoken": "9.0.2",
107106
"karma": "6.4.4",
108107
"karma-chrome-launcher": "3.2.0",
109108
"karma-coverage": "2.2.1",

src/tronweb.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const DEFAULT_VERSION = '4.7.1';
2222

2323
const FEE_LIMIT = 150000000;
2424

25-
const version = '6.1.0';
25+
const version = '6.1.1';
2626

2727
function isValidOptions(options: unknown): options is TronWebOptions {
2828
return (

test/lib/contract/index.test.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,16 @@ describe('#contract.index', function () {
4242

4343
it('should revert with custom error', async () => {
4444
const txid = await customError.test(111).send();
45-
await wait(10);
46-
const data = await tronWeb.trx.getTransactionInfo(txid);
45+
let data;
46+
while (true) {
47+
data = await tronWeb.trx.getTransactionInfo(txid);
48+
if (Object.keys(data).length === 0) {
49+
await wait(3);
50+
continue;
51+
} else {
52+
break;
53+
}
54+
}
4755
const errorData = data.contractResult;
4856
const expectedErrorData =
4957
TronWeb.sha3('CustomError(uint256,uint256)', false).slice(0, 8) +

test/lib/transactionBuilder.test.ts

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -176,25 +176,18 @@ describe('TronWeb.transactionBuilder', function () {
176176
);
177177
});
178178

179-
it('should send 10 sun from default address to accounts[1] for more than 2 times in one block', async function () {
180-
let firstBlockNum = '';
181-
let loopTimes = 0;
182-
for (let i = 0; i < 100; i++) {
183-
loopTimes++;
184-
const txHeader = await tronWeb.trx.getCurrentRefBlockParams();
185-
txHeader.timestamp += new Date().getMilliseconds(); // to avoid txID duplication
179+
it('should send 10 sun from default address to accounts[1] for 10 times in one block', async function () {
180+
const curTime = Date.now();
181+
const txHeader = await tronWeb.trx.getCurrentRefBlockParams();
182+
const originTimestamp = txHeader.timestamp;
183+
for (let i = 0; i < 10; i++) {
184+
// to avoid txID duplication
185+
txHeader.timestamp = originTimestamp + Date.now() - curTime;
186186
const res = await broadcaster(
187187
tronWeb.transactionBuilder.sendTrx(accounts.b58[1], 10, undefined, { blockHeader: txHeader })
188188
);
189-
if (firstBlockNum === '') {
190-
firstBlockNum = res.transaction.raw_data.ref_block_bytes;
191-
} else {
192-
if (firstBlockNum !== res.transaction.raw_data.ref_block_bytes) break;
193-
}
194-
195189
assert.isTrue(res.receipt.result);
196190
}
197-
assert.isAtLeast(loopTimes, 2, 'loopTimes is less than 2 times, should rerun');
198191
});
199192
});
200193

@@ -2355,8 +2348,8 @@ describe('TronWeb.transactionBuilder', function () {
23552348

23562349
const params = [
23572350
[transactions[0], accounts.hex[7], { permissionId: 2 }],
2358-
[transactions[1], accounts.hex[7]],
23592351
[transactions[2], accounts.hex[7], { blockHeader: await tronWeb.trx.getCurrentRefBlockParams() }],
2352+
[transactions[1], accounts.hex[7]],
23602353
];
23612354
for (const param of params) {
23622355
const contractAddress = param[0].contract_address;
@@ -2518,12 +2511,11 @@ describe('TronWeb.transactionBuilder', function () {
25182511
const functionSelector = 'store(uint256)';
25192512
const parameter = [{ type: 'uint256', value: 1 }];
25202513
const options: TriggerConstantContractOptions = {};
2521-
let firstBlockNum = '';
2522-
let loopTimes = 0;
2523-
for (let i = 0; i < 100; i++) {
2524-
loopTimes++;
2525-
const txHeader = await tronWeb.trx.getCurrentRefBlockParams();
2526-
txHeader.timestamp += new Date().getMilliseconds();
2514+
const curTime = Date.now();
2515+
const txHeader = await tronWeb.trx.getCurrentRefBlockParams();
2516+
const originTimestamp = txHeader.timestamp;
2517+
for (let i = 0; i < 10; i++) {
2518+
txHeader.timestamp = originTimestamp + Date.now() - curTime; // ensure unique timestamp
25272519
options.blockHeader = txHeader;
25282520
const tx = await tronWeb.transactionBuilder.triggerSmartContract(
25292521
contractAddress,
@@ -2532,15 +2524,9 @@ describe('TronWeb.transactionBuilder', function () {
25322524
parameter,
25332525
issuerAddress
25342526
);
2535-
if (firstBlockNum === '') {
2536-
firstBlockNum = tx.transaction.raw_data.ref_block_bytes;
2537-
} else {
2538-
if (firstBlockNum !== tx.transaction.raw_data.ref_block_bytes) break;
2539-
}
25402527
const { receipt } = await broadcaster(null, accounts.pks[6], tx.transaction);
25412528
assert.isTrue(receipt.result);
25422529
}
2543-
assert.isAtLeast(loopTimes, 2, 'loopTimes is less than 2 times, should rerun');
25442530
});
25452531
});
25462532

0 commit comments

Comments
 (0)