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.30 to 2.1.31

2

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

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

@@ -58,2 +58,15 @@ <h1 align="center">

### Browser
First, don't use the release section of this repo, it has not updated in a long time.
Then easiest way to use TronWeb in a browser is to install it as above and copy the dist file to your working folder. For example:
```
cp node_modules/tron-web/dist/TronWeb.js ./js/tronweb.js
```
so that you can call it in your HTML page as
```
<script src="./js/tronweb.js"><script>
```
## Example

@@ -60,0 +73,0 @@

@@ -14,10 +14,10 @@ const {execSync, spawn} = require('child_process')

const isSourceChanged = unpushed.some(logLine => logLine.includes('src/'));
const isDistTracked = isSourceChanged ? unpushed.some(logLine => logLine.includes('dist/TronWeb.js')) : true;
// const isSourceChanged = unpushed.some(logLine => logLine.includes('src/'));
// const isDistTracked = isSourceChanged ? unpushed.some(logLine => logLine.includes('dist/TronWeb.js')) : true;
//
// if(!isDistTracked) {
// console.log(chalk.red('Please run: yarn build'));
// process.exit(1);
// }
if(!isDistTracked) {
console.log(chalk.red('Please run: yarn build'));
process.exit(1);
}
let errors = false

@@ -24,0 +24,0 @@ const test = spawn('yarn', ['test:node'])

@@ -5,2 +5,3 @@ import providers from 'lib/providers';

import EventEmitter from 'eventemitter3';
import querystring from 'querystring';

@@ -163,16 +164,53 @@ import TransactionBuilder from 'lib/transactionBuilder';

getEventResult(contractAddress = false, sinceTimestamp = 0, eventName = false, blockNumber = false, size = 20, page = 1, callback = false) {
if(utils.isFunction(page)) {
callback = page;
page = 1;
}
getEventResult(...params) {
if(utils.isFunction(size)) {
callback = size;
size = 20;
if (typeof params[1] !== 'object') {
params[1] = {
sinceTimestamp: params[1] || 0,
eventName: params[2] || false,
blockNumber: params[3] || false,
size: params[4] || 20,
page: params[5] || 1
}
params.splice(2, 4)
// callback:
if (!utils.isFunction(params[2])) {
if (utils.isFunction(params[1].page)) {
params[2] = params[1].page;
params[1].page = 1;
} else if (utils.isFunction(params[1].size)) {
params[2] = params[1].size;
params[1].size = 20;
params[1].page = 1;
}
}
}
return this._getEventResult(...params);
}
_getEventResult(contractAddress = false, options = {}, callback = false) {
let {
sinceTimestamp,
eventName,
blockNumber,
size,
page,
onlyConfirmed,
onlyUnconfirmed,
previousLastEventFingerprint
} = Object.assign({
sinceTimestamp: 0,
eventName: false,
blockNumber: false,
size: 20,
page: 1
}, options)
if(!callback)
return this.injectPromise(this.getEventResult, contractAddress, sinceTimestamp, eventName, blockNumber, size, page);
return this.injectPromise(this.getEventResult, contractAddress, options);

@@ -216,3 +254,18 @@ if(!this.eventServer)

return this.eventServer.request(`event/contract/${routeParams.join('/')}?since=${sinceTimestamp}&size=${size}&page=${page}`).then((data = false) => {
const qs = {
since: sinceTimestamp,
size,
page
}
if(onlyConfirmed)
qs.onlyConfirmed = onlyConfirmed
if(onlyUnconfirmed && !onlyConfirmed)
qs.onlyUnconfirmed = onlyUnconfirmed
if (previousLastEventFingerprint)
qs.previousLastEventFingerprint = previousLastEventFingerprint
return this.eventServer.request(`event/contract/${routeParams.join('/')}?${querystring.stringify(qs)}`).then((data = false) => {
if(!data)

@@ -219,0 +272,0 @@ return callback('Unknown error occurred');

@@ -472,6 +472,11 @@ import TronWeb from 'index';

let tokenValue = options.tokenValue;
let tokenId = options.tokenId;
let callValue = options.callValue || 0;
let feeLimit = options.feeLimit || 1_000_000_000;
let {
tokenValue,
tokenId,
callValue,
feeLimit
} = Object.assign({
callValue: 0,
feeLimit: 1_000_000_000
}, options)

@@ -478,0 +483,0 @@ if(utils.isNotNullOrUndefined(tokenValue) && (!utils.isInteger(tokenValue) || tokenValue < 0))

@@ -245,9 +245,3 @@ import TronWeb from 'index';

].sort((a, b) => {
if (b.raw_data) {
// soliditynode format
return b.raw_data.timestamp - a.raw_data.timestamp
} else {
// tronscan format
return b.timestamp - a.timestamp
}
return b.raw_data.timestamp - a.raw_data.timestamp
}));

@@ -254,0 +248,0 @@ } catch (ex) {

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