Comparing version 0.18.4 to 0.19.0
@@ -42,3 +42,3 @@ /* | ||
var unitMap = { | ||
'noether': '0', | ||
'noether': '0', | ||
'wei': '1', | ||
@@ -263,3 +263,3 @@ 'kwei': '1000', | ||
if (isObject(val)) | ||
if (typeof val === 'object') | ||
return fromUtf8(JSON.stringify(val)); | ||
@@ -425,3 +425,3 @@ | ||
*/ | ||
var isChecksumAddress = function (address) { | ||
var isChecksumAddress = function (address) { | ||
// Check each case | ||
@@ -431,3 +431,3 @@ address = address.replace('0x',''); | ||
for (var i = 0; i < 40; i++ ) { | ||
for (var i = 0; i < 40; i++ ) { | ||
// the nth letter should be uppercase if the nth digit of casemap is 1 | ||
@@ -438,3 +438,3 @@ if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) { | ||
} | ||
return true; | ||
return true; | ||
}; | ||
@@ -451,3 +451,3 @@ | ||
*/ | ||
var toChecksumAddress = function (address) { | ||
var toChecksumAddress = function (address) { | ||
if (typeof address === 'undefined') return ''; | ||
@@ -459,4 +459,4 @@ | ||
for (var i = 0; i < address.length; i++ ) { | ||
// If ith character is 9 to f then make it uppercase | ||
for (var i = 0; i < address.length; i++ ) { | ||
// If ith character is 9 to f then make it uppercase | ||
if (parseInt(addressHash[i], 16) > 7) { | ||
@@ -533,3 +533,3 @@ checksumAddress += address[i].toUpperCase(); | ||
var isObject = function (object) { | ||
return typeof object === 'object'; | ||
return object !== null && !(object instanceof Array) && typeof object === 'object'; | ||
}; | ||
@@ -586,3 +586,3 @@ | ||
return true; | ||
} | ||
} | ||
return false; | ||
@@ -603,3 +603,3 @@ }; | ||
return true; | ||
} | ||
} | ||
return false; | ||
@@ -606,0 +606,0 @@ }; |
{ | ||
"version": "0.18.4" | ||
"version": "0.19.0" | ||
} |
@@ -103,2 +103,4 @@ /* | ||
Web3.prototype.isIBAN = utils.isIBAN; | ||
Web3.prototype.padLeft = utils.padLeft; | ||
Web3.prototype.padRight = utils.padRight; | ||
@@ -105,0 +107,0 @@ |
@@ -24,5 +24,8 @@ /* | ||
module.exports = { | ||
InvalidNumberOfParams: function () { | ||
return new Error('Invalid number of input parameters'); | ||
InvalidNumberOfSolidityArgs: function () { | ||
return new Error('Invalid number of arguments to Solidity function'); | ||
}, | ||
InvalidNumberOfRPCParams: function () { | ||
return new Error('Invalid number of input parameters to RPC method'); | ||
}, | ||
InvalidConnection: function (host){ | ||
@@ -29,0 +32,0 @@ return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.'); |
@@ -153,3 +153,5 @@ /* | ||
}); | ||
filterCreationErrorCallback(error); | ||
if (typeof filterCreationErrorCallback === 'function') { | ||
filterCreationErrorCallback(error); | ||
} | ||
} else { | ||
@@ -156,0 +158,0 @@ self.filterId = id; |
@@ -25,2 +25,3 @@ /* | ||
var utils = require('../utils/utils'); | ||
var errors = require('./errors'); | ||
var formatters = require('./formatters'); | ||
@@ -59,2 +60,19 @@ var sha3 = require('../utils/sha3'); | ||
/** | ||
* Should be called to check if the number of arguments is correct | ||
* | ||
* @method validateArgs | ||
* @param {Array} arguments | ||
* @throws {Error} if it is not | ||
*/ | ||
SolidityFunction.prototype.validateArgs = function (args) { | ||
var inputArgs = args.filter(function (a) { | ||
// filter the options object but not arguments that are arrays | ||
return !(utils.isObject(a) === true && utils.isArray(a) === false); | ||
}); | ||
if (inputArgs.length !== this._inputTypes.length) { | ||
throw errors.InvalidNumberOfSolidityArgs(); | ||
} | ||
}; | ||
/** | ||
* Should be used to create payload from arguments | ||
@@ -71,2 +89,3 @@ * | ||
} | ||
this.validateArgs(args); | ||
options.to = this._address; | ||
@@ -265,2 +284,1 @@ options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args); | ||
module.exports = SolidityFunction; | ||
@@ -72,3 +72,3 @@ /* | ||
if (args.length !== this.params) { | ||
throw errors.InvalidNumberOfParams(); | ||
throw errors.InvalidNumberOfRPCParams(); | ||
} | ||
@@ -166,2 +166,1 @@ }; | ||
module.exports = Method; | ||
@@ -338,4 +338,4 @@ /* | ||
Eth.prototype.filter = function (fil, callback) { | ||
return new Filter(this._requestManager, fil, watches.eth(), formatters.outputLogFormatter, callback); | ||
Eth.prototype.filter = function (fil, callback, filterCreationErrorCallback) { | ||
return new Filter(this._requestManager, fil, watches.eth(), formatters.outputLogFormatter, callback, filterCreationErrorCallback); | ||
}; | ||
@@ -342,0 +342,0 @@ |
@@ -54,2 +54,21 @@ /* | ||
var importRawKey = new Method({ | ||
name: 'importRawKey', | ||
call: 'personal_importRawKey', | ||
params: 2 | ||
}); | ||
var sign = new Method({ | ||
name: 'sign', | ||
call: 'personal_sign', | ||
params: 3, | ||
inputFormatter: [null, formatters.inputAddressFormatter, null] | ||
}); | ||
var ecRecover = new Method({ | ||
name: 'ecRecover', | ||
call: 'personal_ecRecover', | ||
params: 2 | ||
}); | ||
var unlockAccount = new Method({ | ||
@@ -78,3 +97,6 @@ name: 'unlockAccount', | ||
newAccount, | ||
importRawKey, | ||
unlockAccount, | ||
ecRecover, | ||
sign, | ||
sendTransaction, | ||
@@ -81,0 +103,0 @@ lockAccount |
/* jshint ignore:start */ | ||
Package.describe({ | ||
name: 'ethereum:web3', | ||
version: '0.18.4', | ||
version: '0.19.0', | ||
summary: 'Ethereum JavaScript API, middleware to talk to a ethreum node over RPC', | ||
@@ -6,0 +6,0 @@ git: 'https://github.com/ethereum/ethereum.js', |
{ | ||
"name": "web3", | ||
"namespace": "ethereum", | ||
"version": "0.18.4", | ||
"version": "0.19.0", | ||
"description": "Ethereum JavaScript API, middleware to talk to a ethereum node over RPC", | ||
@@ -6,0 +6,0 @@ "main": "./index.js", |
Sorry, the diff of this file is not supported yet
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 too big to display
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Uses eval
Supply chain riskPackage uses dynamic code execution (e.g., eval()), which is a dangerous practice. This can prevent the code from running in certain environments and increases the risk that the code may contain exploits or malicious behavior.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2202508
32693
2