Skip to content

Commit

Permalink
Merge pull request #128 from tronprotocol/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
unicornonea authored Jan 7, 2021
2 parents 32d1b1a + ecc18b8 commit 5e5cb5a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 5 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,10 @@ In order to contribute you can

## Recent History

__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
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tronweb",
"version": "3.1.0",
"version": "3.2.2",
"description": "JavaScript SDK that encapsulates the TRON HTTP API",
"main": "dist/TronWeb.node.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { ADDRESS_PREFIX } from 'utils/address';

const DEFAULT_VERSION = '3.5.0';

const FEE_LIMIT = 20000000;
const FEE_LIMIT = 40000000;

export default class TronWeb extends EventEmitter {
static providers = providers;
Expand Down
4 changes: 2 additions & 2 deletions src/lib/transactionBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -1035,8 +1035,8 @@ export default class TransactionBuilder {
if (utils.isNotNullOrUndefined(voteScore) && (!utils.isInteger(voteScore) || voteScore <= 0))
return callback('voteScore must be a positive integer greater than 0');

if (utils.isNotNullOrUndefined(precision) && (!utils.isInteger(precision) || precision <= 0 || precision > 6))
return callback('precision must be a positive integer > 0 and <= 6');
if (utils.isNotNullOrUndefined(precision) && (!utils.isInteger(precision) || precision < 0 || precision > 6))
return callback('precision must be a positive integer >= 0 and <= 6');

const data = {
owner_address: toHex(issuerAddress),
Expand Down
14 changes: 13 additions & 1 deletion test/lib/transactionBuilder.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,18 @@ describe('TronWeb.transactionBuilder', function () {
}
});

it(`should create a TestToken passing with precision is zero`, async function () {
const options = getTokenOptions();
options.precision = 0
for (let i = 0; i < 2; i++) {
if (i === 1) options.permissionId = 2;
const transaction = await tronWeb.transactionBuilder.createToken(options);
const parameter = txPars(transaction);
await assertEqualHex(parameter.value.abbr, options.abbreviation);
assert.equal(transaction.raw_data.contract[0].Permission_id || 0, options.permissionId || 0);
}
});

it(`should create a TestToken without freezing anything in 3.6.0`, async function () {
if (tronWeb.fullnodeSatisfies('^3.6.0')) {
const options = getTokenOptions();
Expand Down Expand Up @@ -1159,7 +1171,7 @@ describe('TronWeb.transactionBuilder', function () {
const tx = await tronWeb.transactionBuilder.createSmartContract(options)
assert.equal(tx.raw_data.contract[0].parameter.value.new_contract.consume_user_resource_percent, 100);
assert.equal(tx.raw_data.contract[0].parameter.value.new_contract.origin_energy_limit, 1e7);
assert.equal(tx.raw_data.fee_limit, 2e7);
assert.equal(tx.raw_data.fee_limit, 4e7);
assert.equal(tx.raw_data.contract[0].Permission_id || 0, options.permissionId || 0);
}
});
Expand Down

0 comments on commit 5e5cb5a

Please sign in to comment.