Skip to content

Commit

Permalink
Merge pull request #208 from tronprotocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
llwslc authored Nov 15, 2021
2 parents 247a1ea + 58e00e8 commit 11d508a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 33 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,11 @@ In order to contribute you can

## Recent History

__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
Expand Down
Empty file modified package-lock.json
100644 → 100755
Empty file.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tronweb",
"version": "4.0.0",
"version": "4.0.1",
"description": "JavaScript SDK that encapsulates the TRON HTTP API",
"main": "dist/TronWeb.node.js",
"scripts": {
Expand Down Expand Up @@ -81,7 +81,7 @@
"url": "https://github.com/tron-us"
}
],
"homepage": "https://github.com/tron-us/tronweb",
"homepage": "https://github.com/tronprotocol/tronweb",
"license": "MIT",
"repository": "https://github.com/tron-us/tronweb.git"
"repository": "https://github.com/tronprotocol/tronweb.git"
}
1 change: 1 addition & 0 deletions src/lib/contract/method.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ export default class Method {
...this.defaultOptions,
from: this.tronWeb.defaultAddress.hex,
...options,
_isConstant: true
};

const parameters = args.map((value, index) => ({
Expand Down
26 changes: 8 additions & 18 deletions src/lib/sidechain.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import injectpromise from 'injectpromise';
import Validator from 'paramValidator';

const MAX_FEE_LIMIT = 5_000_000_000;
export default class SideChain {
constructor(sideOptions, TronWeb = false, mainchain = false, privateKey = false) {
this.mainchain = mainchain;
Expand Down Expand Up @@ -212,8 +210,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: MAX_FEE_LIMIT
gte: 0
}
], callback)) {
return;
Expand Down Expand Up @@ -268,8 +265,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: MAX_FEE_LIMIT
gte: 0
},
{
name: 'tokenId',
Expand Down Expand Up @@ -339,8 +335,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: MAX_FEE_LIMIT
gte: 0
},
{
name: 'contractAddress',
Expand Down Expand Up @@ -512,8 +507,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: MAX_FEE_LIMIT
gte: 0
}
], callback)) {
return;
Expand Down Expand Up @@ -617,8 +611,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: 1_000_000_000
gte: 0
}
], callback)) {
return;
Expand Down Expand Up @@ -680,8 +673,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: 1_000_000_000
gte: 0
}
], callback)) {
return;
Expand Down Expand Up @@ -745,8 +737,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: 1_000_000_000
gte: 0
},
{
name: 'contractAddress',
Expand Down Expand Up @@ -926,8 +917,7 @@ export default class SideChain {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gte: 0,
lte: 1_000_000_000
gte: 0
}
], callback)) {
return;
Expand Down
6 changes: 2 additions & 4 deletions src/lib/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -588,8 +588,7 @@ export default class TransactionBuilder {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gt: 0,
lte: 5_000_000_000
gt: 0
},
{
name: 'callValue',
Expand Down Expand Up @@ -780,8 +779,7 @@ export default class TransactionBuilder {
name: 'feeLimit',
type: 'integer',
value: feeLimit,
gt: 0,
lte: 5_000_000_000
gt: 0
},
{
name: 'callValue',
Expand Down
20 changes: 12 additions & 8 deletions test/lib/sidechain.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ describe("TronWeb.sidechain", function () {
});

it('should throw if an invalid fee limit is passed', async function () {
const feeLimit = 10000000000
const feeLimit = -1
await assertThrow(
tronWeb.sidechain.depositTrc10(TOKEN_ID, 100, DEPOSIT_FEE, feeLimit),
'Invalid feeLimit provided'
Expand Down Expand Up @@ -187,7 +187,7 @@ describe("TronWeb.sidechain", function () {

it('should throw if an invalid fee limit is passed', async function () {
const num = 100;
const feeLimit = 100000000000;
const feeLimit = -1;
await assertThrow(
tronWeb.sidechain.depositTrc20(num, DEPOSIT_FEE, feeLimit, CONTRACT_ADDRESS20),
'Invalid feeLimit provided'
Expand Down Expand Up @@ -292,7 +292,7 @@ describe("TronWeb.sidechain", function () {
});

it('should throw if an invalid fee limit is passed', async function () {
const feeLimit = 100000000000;
const feeLimit = -1;
await assertThrow(
tronWeb.sidechain.mappingTrc20(HASH20, MAPPING_FEE, feeLimit),
'Invalid feeLimit provided'
Expand Down Expand Up @@ -438,7 +438,7 @@ describe("TronWeb.sidechain", function () {
});

it('should throw if an invalid fee limit is passed', async function () {
const feeLimit = 100000000000;
const feeLimit = -1;
await assertThrow(
tronWeb.sidechain.withdrawTrc10(TOKEN_ID, 100, WITHDRAW_FEE, feeLimit),
'Invalid feeLimit provided'
Expand Down Expand Up @@ -498,10 +498,14 @@ describe("TronWeb.sidechain", function () {

it('should throw if an invalid fee limit is passed', async function () {
const feeLimit = 100000000000;
await assertThrow(
tronWeb.sidechain.withdrawTrc20(100, WITHDRAW_FEE, feeLimit, ADDRESS20_MAPPING),
'Invalid feeLimit provided'
);
const num = 10;
const options = { permissionId: 0 };
const txID = await tronWeb.sidechain.withdrawTrc20(num, WITHDRAW_FEE, FEE_LIMIT, ADDRESS20_MAPPING, options, PRIVATE_KEY);
assert.equal(txID.length, 64);
// await assertThrow(
// tronWeb.sidechain.withdrawTrc20(100, WITHDRAW_FEE, feeLimit, ADDRESS20_MAPPING),
// 'Invalid feeLimit provided'
// );
});

it('should throw if an invalid contract address is passed', async function () {
Expand Down
Empty file modified yarn.lock
100644 → 100755
Empty file.

0 comments on commit 11d508a

Please sign in to comment.