bumped version
This commit is contained in:
parent
1c7dde9696
commit
81ab762ff1
|
@ -1884,7 +1884,7 @@ var sha3 = require('./sha3.js');
|
|||
var utf8 = require('utf8');
|
||||
|
||||
var unitMap = {
|
||||
'noether': '0',
|
||||
'noether': '0',
|
||||
'wei': '1',
|
||||
'kwei': '1000',
|
||||
'Kwei': '1000',
|
||||
|
@ -2104,7 +2104,7 @@ var toHex = function (val) {
|
|||
if (isBigNumber(val))
|
||||
return fromDecimal(val);
|
||||
|
||||
if (isObject(val))
|
||||
if (typeof val === 'object')
|
||||
return fromUtf8(JSON.stringify(val));
|
||||
|
||||
// if its a negative number, pass it through fromDecimal
|
||||
|
@ -2265,18 +2265,18 @@ var isAddress = function (address) {
|
|||
* @param {String} address the given HEX adress
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var isChecksumAddress = function (address) {
|
||||
var isChecksumAddress = function (address) {
|
||||
// Check each case
|
||||
address = address.replace('0x','');
|
||||
var addressHash = sha3(address.toLowerCase());
|
||||
|
||||
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
|
||||
if ((parseInt(addressHash[i], 16) > 7 && address[i].toUpperCase() !== address[i]) || (parseInt(addressHash[i], 16) <= 7 && address[i].toLowerCase() !== address[i])) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
|
@ -2288,15 +2288,15 @@ var isChecksumAddress = function (address) {
|
|||
* @param {String} address the given HEX adress
|
||||
* @return {String}
|
||||
*/
|
||||
var toChecksumAddress = function (address) {
|
||||
var toChecksumAddress = function (address) {
|
||||
if (typeof address === 'undefined') return '';
|
||||
|
||||
address = address.toLowerCase().replace('0x','');
|
||||
var addressHash = sha3(address);
|
||||
var checksumAddress = '0x';
|
||||
|
||||
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) {
|
||||
checksumAddress += address[i].toUpperCase();
|
||||
} else {
|
||||
|
@ -2368,7 +2368,7 @@ var isFunction = function (object) {
|
|||
* @return {Boolean}
|
||||
*/
|
||||
var isObject = function (object) {
|
||||
return typeof object === 'object';
|
||||
return object !== null && !(object instanceof Array) && typeof object === 'object';
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -2420,7 +2420,7 @@ var isBloom = function (bloom) {
|
|||
return false;
|
||||
} else if (/^(0x)?[0-9a-f]{512}$/.test(bloom) || /^(0x)?[0-9A-F]{512}$/.test(bloom)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -2436,7 +2436,7 @@ var isTopic = function (topic) {
|
|||
return false;
|
||||
} else if (/^(0x)?[0-9a-f]{64}$/.test(topic) || /^(0x)?[0-9A-F]{64}$/.test(topic)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
|
@ -2475,7 +2475,7 @@ module.exports = {
|
|||
|
||||
},{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":85}],21:[function(require,module,exports){
|
||||
module.exports={
|
||||
"version": "0.18.4"
|
||||
"version": "0.19.0"
|
||||
}
|
||||
|
||||
},{}],22:[function(require,module,exports){
|
||||
|
@ -2581,6 +2581,8 @@ Web3.prototype.isAddress = utils.isAddress;
|
|||
Web3.prototype.isChecksumAddress = utils.isChecksumAddress;
|
||||
Web3.prototype.toChecksumAddress = utils.toChecksumAddress;
|
||||
Web3.prototype.isIBAN = utils.isIBAN;
|
||||
Web3.prototype.padLeft = utils.padLeft;
|
||||
Web3.prototype.padRight = utils.padRight;
|
||||
|
||||
|
||||
Web3.prototype.sha3 = function(string, options) {
|
||||
|
@ -3124,8 +3126,11 @@ module.exports = ContractFactory;
|
|||
*/
|
||||
|
||||
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){
|
||||
return new Error('CONNECTION ERROR: Couldn\'t connect to node '+ host +'.');
|
||||
|
@ -3555,7 +3560,9 @@ var Filter = function (requestManager, options, methods, formatter, callback, fi
|
|||
self.callbacks.forEach(function(cb){
|
||||
cb(error);
|
||||
});
|
||||
filterCreationErrorCallback(error);
|
||||
if (typeof filterCreationErrorCallback === 'function') {
|
||||
filterCreationErrorCallback(error);
|
||||
}
|
||||
} else {
|
||||
self.filterId = id;
|
||||
|
||||
|
@ -3969,6 +3976,7 @@ module.exports = {
|
|||
|
||||
var coder = require('../solidity/coder');
|
||||
var utils = require('../utils/utils');
|
||||
var errors = require('./errors');
|
||||
var formatters = require('./formatters');
|
||||
var sha3 = require('../utils/sha3');
|
||||
|
||||
|
@ -4001,6 +4009,23 @@ SolidityFunction.prototype.extractDefaultBlock = function (args) {
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
|
@ -4013,6 +4038,7 @@ SolidityFunction.prototype.toPayload = function (args) {
|
|||
if (args.length > this._inputTypes.length && utils.isObject(args[args.length -1])) {
|
||||
options = args[args.length - 1];
|
||||
}
|
||||
this.validateArgs(args);
|
||||
options.to = this._address;
|
||||
options.data = '0x' + this.signature() + coder.encodeParams(this._inputTypes, args);
|
||||
return options;
|
||||
|
@ -4207,8 +4233,7 @@ SolidityFunction.prototype.attachToContract = function (contract) {
|
|||
|
||||
module.exports = SolidityFunction;
|
||||
|
||||
|
||||
},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./formatters":30}],32:[function(require,module,exports){
|
||||
},{"../solidity/coder":7,"../utils/sha3":19,"../utils/utils":20,"./errors":26,"./formatters":30}],32:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of web3.js.
|
||||
|
||||
|
@ -4960,7 +4985,7 @@ Method.prototype.extractCallback = function (args) {
|
|||
*/
|
||||
Method.prototype.validateArgs = function (args) {
|
||||
if (args.length !== this.params) {
|
||||
throw errors.InvalidNumberOfParams();
|
||||
throw errors.InvalidNumberOfRPCParams();
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -5054,7 +5079,6 @@ Method.prototype.request = function () {
|
|||
|
||||
module.exports = Method;
|
||||
|
||||
|
||||
},{"../utils/utils":20,"./errors":26}],37:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of web3.js.
|
||||
|
@ -5461,8 +5485,8 @@ Eth.prototype.contract = function (abi) {
|
|||
return factory;
|
||||
};
|
||||
|
||||
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);
|
||||
};
|
||||
|
||||
Eth.prototype.namereg = function () {
|
||||
|
@ -5587,6 +5611,25 @@ var methods = function () {
|
|||
inputFormatter: [null]
|
||||
});
|
||||
|
||||
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({
|
||||
name: 'unlockAccount',
|
||||
call: 'personal_unlockAccount',
|
||||
|
@ -5610,7 +5653,10 @@ var methods = function () {
|
|||
|
||||
return [
|
||||
newAccount,
|
||||
importRawKey,
|
||||
unlockAccount,
|
||||
ecRecover,
|
||||
sign,
|
||||
sendTransaction,
|
||||
lockAccount
|
||||
];
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1,3 +1,3 @@
|
|||
{
|
||||
"version": "0.18.4"
|
||||
"version": "0.19.0"
|
||||
}
|
||||
|
|
|
@ -93,7 +93,7 @@ var methods = function () {
|
|||
|
||||
return [
|
||||
newAccount,
|
||||
importRawKey
|
||||
importRawKey,
|
||||
unlockAccount,
|
||||
ecRecover,
|
||||
sign,
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* 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',
|
||||
git: 'https://github.com/ethereum/ethereum.js',
|
||||
// By default, Meteor will default to using README.md for documentation.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"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",
|
||||
"main": "./index.js",
|
||||
"directories": {
|
||||
|
|
Loading…
Reference in New Issue