Socket
Socket
Sign inDemoInstall

web3-core-helpers

Package Overview
Dependencies
Maintainers
1
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-core-helpers - npm Package Compare versions

Comparing version 1.0.0-beta.29 to 1.0.0-beta.30

6

package.json
{
"name": "web3-core-helpers",
"namespace": "ethereum",
"version": "1.0.0-beta.29",
"version": "1.0.0-beta.30",
"description": "Web3 core tools helper for sub packages. This is an internal package.",

@@ -11,5 +11,5 @@ "repository": "https://github.com/ethereum/web3.js/tree/master/packages/web3-core-helpers",

"underscore": "1.8.3",
"web3-eth-iban": "1.0.0-beta.29",
"web3-utils": "1.0.0-beta.29"
"web3-eth-iban": "1.0.0-beta.30",
"web3-utils": "1.0.0-beta.30"
}
}

@@ -68,18 +68,25 @@ /*

*
* @method inputCallFormatter
* @method _txInputFormatter
* @param {Object} transaction options
* @returns object
*/
var inputCallFormatter = function (options){
*/
var _txInputFormatter = function (options){
var from = options.from || (this ? this.defaultAccount : null);
if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
}
if (from) {
options.from = inputAddressFormatter(from);
if (options.data && options.input) {
throw new Error('You can\'t have "data" and "input" as properties of transactions at the same time, please use either "data" or "input" instead.');
}
if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
if (!options.data && options.input) {
options.data = options.input;
delete options.input;
}
if(options.data && !utils.isHex(options.data)) {
throw new Error('The data field must be HEX encoded data.');
}
// allow both

@@ -102,2 +109,23 @@ if (options.gas || options.gasLimit) {

*
* @method inputCallFormatter
* @param {Object} transaction options
* @returns object
*/
var inputCallFormatter = function (options){
options = _txInputFormatter(options);
var from = options.from || (this ? this.defaultAccount : null);
if (from) {
options.from = inputAddressFormatter(from);
}
return options;
};
/**
* Formats the input of a transaction and converts all values to HEX
*
* @method inputTransactionFormatter

@@ -109,2 +137,4 @@ * @param {Object} options

options = _txInputFormatter(options);
// check from, only if not number, or object

@@ -121,17 +151,2 @@ if (!_.isNumber(options.from) && !_.isObject(options.from)) {

if (options.to) { // it might be contract creation
options.to = inputAddressFormatter(options.to);
}
// allow both
if (options.gas || options.gasLimit) {
options.gas = options.gas || options.gasLimit;
}
['gasPrice', 'gas', 'value', 'nonce'].filter(function (key) {
return options[key] !== undefined;
}).forEach(function(key){
options[key] = utils.numberToHex(options[key]);
});
return options;

@@ -138,0 +153,0 @@ };

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