New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

tronweb

Package Overview
Dependencies
Maintainers
4
Versions
135
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

tronweb - npm Package Compare versions

Comparing version 2.1.25 to 2.1.26

2

package.json
{
"name": "tronweb",
"version": "2.1.25",
"version": "2.1.26",
"description": "JavaScript SDK that encapsulates the TRON Node HTTP API",

@@ -5,0 +5,0 @@ "main": "dist/TronWeb.node.js",

@@ -36,2 +36,3 @@ import utils from 'utils';

callValue: 0,
userFeePercentage: 100,
from: this.tronWeb.defaultAddress.hex, // Only used for send()

@@ -100,4 +101,3 @@ shouldPollResponse: false // Only used for sign()

this.functionSelector,
options.feeLimit,
options.callValue,
options,
parameters,

@@ -185,4 +185,3 @@ this.tronWeb.address.toHex(options.from),

this.functionSelector,
options.feeLimit,
options.callValue,
options,
parameters,

@@ -189,0 +188,0 @@ this.tronWeb.address.toHex(address)

@@ -310,7 +310,7 @@ import TronWeb from 'index';

const feeLimit = options.feeLimit || options.fee_limit || 1_000_000_000;
const userFeePercentage = options.userFeePercentage || options.consume_user_resource_percent || 0;
const originEnergyLimit = options.originEnergyLimit || options.origin_energy_limit || 10_000_000;
const callValue = options.callValue || options.call_value || 0;
const tokenValue = options.tokenValue || options.token_value;
const feeLimit = options.feeLimit || 1_000_000_000;
const userFeePercentage = options.userFeePercentage || 100;
const originEnergyLimit = options.originEnergyLimit || 10_000_000;
const callValue = options.callValue || 0;
const tokenValue = options.tokenValue;
const tokenId = options.tokenId || options.token_id;

@@ -375,6 +375,6 @@

if(tokenValue && !utils.isInteger(tokenValue) || tokenValue < 0)
if(utils.isNotNullOrUndefined(tokenValue) && (!utils.isInteger(tokenValue) || tokenValue < 0))
return callback('Invalid options.tokenValue provided');
if(tokenId && !utils.isInteger(tokenId) || tokenValue < 0)
if(utils.isNotNullOrUndefined(tokenId) && (!utils.isInteger(tokenId) || tokenId < 0))
return callback('Invalid options.tokenValue provided');

@@ -425,6 +425,6 @@

// tokenValue and tokenId can cause errors if provided when the trx10 proposal has not been approved yet. So we set them only if they are passed to the method.
if(tokenValue)
args.token_value = tokenValue
if(tokenId)
args.token_id = tokenId
if(utils.isNotNullOrUndefined(tokenValue))
args.call_token_value = parseInt(tokenValue)
if(utils.isNotNullOrUndefined(tokenId))
args.token_id = parseInt(tokenId)

@@ -434,7 +434,17 @@ this.tronWeb.fullNode.request('wallet/deploycontract', args, 'post').then(transaction => transactionResultManager(transaction, callback)).catch(err => callback(err));

triggerSmartContract(
triggerSmartContract(...params) {
if (typeof params[2] !== 'object') {
params[2] = {
feeLimit: params[2],
callValue: params[3]
}
params.splice(3,1)
}
return this._triggerSmartContract(...params);
}
_triggerSmartContract(
contractAddress,
functionSelector,
feeLimit = 1_000_000_000,
callValue = 0,
options = {},
parameters = [],

@@ -444,2 +454,3 @@ issuerAddress = this.tronWeb.defaultAddress.hex,

) {
if(utils.isFunction(issuerAddress)) {

@@ -455,19 +466,8 @@ callback = issuerAddress;

if(utils.isFunction(callValue)) {
callback = callValue;
callValue = 0;
}
if(utils.isFunction(feeLimit)) {
callback = feeLimit;
feeLimit = 1_000_000_000;
}
if(!callback) {
return this.injectPromise(
this.triggerSmartContract,
this._triggerSmartContract,
contractAddress,
functionSelector,
feeLimit,
callValue,
options,
parameters,

@@ -478,2 +478,13 @@ issuerAddress

let tokenValue = options.tokenValue;
let tokenId = options.tokenId;
let callValue = options.callValue || 0;
let feeLimit = options.feeLimit || 1_000_000_000;
if(utils.isNotNullOrUndefined(tokenValue) && (!utils.isInteger(tokenValue) || tokenValue < 0))
return callback('Invalid options.tokenValue provided');
if(utils.isNotNullOrUndefined(tokenId) && (!utils.isInteger(tokenId) || tokenId < 0))
return callback('Invalid options.tokenValue provided');
if(!this.tronWeb.isAddress(contractAddress))

@@ -524,3 +535,3 @@ return callback('Invalid contract address provided');

this.tronWeb.fullNode.request('wallet/triggersmartcontract', {
const args = {
contract_address: this.tronWeb.address.toHex(contractAddress),

@@ -532,5 +543,13 @@ owner_address: this.tronWeb.address.toHex(issuerAddress),

parameter: parameters
}, 'post').then(transaction => transactionResultManager(transaction, callback)).catch(err => callback(err));
};
if(utils.isNotNullOrUndefined(tokenValue))
args.call_token_value = parseInt(tokenValue)
if(utils.isNotNullOrUndefined(tokenId))
args.token_id = parseInt(tokenId)
this.tronWeb.fullNode.request('wallet/triggersmartcontract', args, 'post').then(transaction => transactionResultManager(transaction, callback)).catch(err => callback(err));
}
createToken(options = {}, issuerAddress = this.tronWeb.defaultAddress.hex, callback = false) {

@@ -537,0 +556,0 @@ if(utils.isFunction(issuerAddress)) {

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc