mirror of
https://github.com/status-im/web3.js.git
synced 2025-02-23 11:38:12 +00:00
Merge develop and bump version (#870)
* bumped version (#865) * validate number of args to solidity functions (#866) * Fix for "filterCreationErrorCallback is not a function" Error #552 (#861) * Missing some checks in order to verify if given value is an object (#568) * make sure the old behaviour is valued in toHex * Porting personal.importRawKey, personal.sign, personal.ecRecover from go-ethereum to web3.js (#565) * Porting personal.importRawKey * Porting personal.sign * Porting personal.ecRecover * Export padLeft and padRight as functions of web3 (#848) I'm working with `bytes12` and it's useful to have these two functions in the web3 object for formatting. * bumped version * fixed lint * new versions file
This commit is contained in:
parent
a075680c85
commit
89b9cb9e04
@ -5,7 +5,7 @@
|
||||
"eqeqeq": true,
|
||||
"freeze": true,
|
||||
"funcscope": false,
|
||||
"maxcomplexity": 4, /* our target is 3! */
|
||||
"maxcomplexity": 5, /* our target is 3! */
|
||||
"maxdepth": 3,
|
||||
"maxerr": 50,
|
||||
/*"maxlen": 80*/ /*this should be our goal*/
|
||||
|
@ -1,3 +1,3 @@
|
||||
ethereum:web3@0.18.4
|
||||
ethereum:web3@0.19.0
|
||||
meteor@1.6.1
|
||||
underscore@1.0.10
|
||||
|
68
dist/web3-light.js
vendored
68
dist/web3-light.js
vendored
@ -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
|
||||
@ -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';
|
||||
};
|
||||
|
||||
/**
|
||||
@ -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);
|
||||
});
|
||||
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
|
||||
];
|
||||
|
8
dist/web3-light.min.js
vendored
8
dist/web3-light.min.js
vendored
File diff suppressed because one or more lines are too long
341
dist/web3.js
vendored
341
dist/web3.js
vendored
@ -1842,7 +1842,7 @@ module.exports = function (value, options) {
|
||||
};
|
||||
|
||||
|
||||
},{"crypto-js":59,"crypto-js/sha3":80}],20:[function(require,module,exports){
|
||||
},{"crypto-js":58,"crypto-js/sha3":79}],20:[function(require,module,exports){
|
||||
/*
|
||||
This file is part of web3.js.
|
||||
|
||||
@ -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
|
||||
@ -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';
|
||||
};
|
||||
|
||||
/**
|
||||
@ -2473,9 +2473,9 @@ module.exports = {
|
||||
isTopic: isTopic,
|
||||
};
|
||||
|
||||
},{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":85}],21:[function(require,module,exports){
|
||||
},{"./sha3.js":19,"bignumber.js":"bignumber.js","utf8":84}],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);
|
||||
});
|
||||
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.
|
||||
|
||||
@ -4363,7 +4388,7 @@ HttpProvider.prototype.isConnected = function() {
|
||||
|
||||
module.exports = HttpProvider;
|
||||
|
||||
},{"./errors":26,"xhr2":86,"xmlhttprequest":17}],33:[function(require,module,exports){
|
||||
},{"./errors":26,"xhr2":85,"xmlhttprequest":17}],33:[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
|
||||
];
|
||||
@ -6634,8 +6680,6 @@ module.exports = transfer;
|
||||
|
||||
|
||||
},{"../contracts/SmartExchange.json":3,"./iban":33}],50:[function(require,module,exports){
|
||||
|
||||
},{}],51:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -6868,7 +6912,7 @@ module.exports = transfer;
|
||||
return CryptoJS.AES;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],52:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],51:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -7744,7 +7788,7 @@ module.exports = transfer;
|
||||
|
||||
|
||||
}));
|
||||
},{"./core":53}],53:[function(require,module,exports){
|
||||
},{"./core":52}],52:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -8505,7 +8549,7 @@ module.exports = transfer;
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
},{}],54:[function(require,module,exports){
|
||||
},{}],53:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -8641,7 +8685,7 @@ module.exports = transfer;
|
||||
return CryptoJS.enc.Base64;
|
||||
|
||||
}));
|
||||
},{"./core":53}],55:[function(require,module,exports){
|
||||
},{"./core":52}],54:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -8791,7 +8835,7 @@ module.exports = transfer;
|
||||
return CryptoJS.enc.Utf16;
|
||||
|
||||
}));
|
||||
},{"./core":53}],56:[function(require,module,exports){
|
||||
},{"./core":52}],55:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -8924,7 +8968,7 @@ module.exports = transfer;
|
||||
return CryptoJS.EvpKDF;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./hmac":58,"./sha1":77}],57:[function(require,module,exports){
|
||||
},{"./core":52,"./hmac":57,"./sha1":76}],56:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -8991,7 +9035,7 @@ module.exports = transfer;
|
||||
return CryptoJS.format.Hex;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],58:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],57:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9135,7 +9179,7 @@ module.exports = transfer;
|
||||
|
||||
|
||||
}));
|
||||
},{"./core":53}],59:[function(require,module,exports){
|
||||
},{"./core":52}],58:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9154,7 +9198,7 @@ module.exports = transfer;
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
},{"./aes":51,"./cipher-core":52,"./core":53,"./enc-base64":54,"./enc-utf16":55,"./evpkdf":56,"./format-hex":57,"./hmac":58,"./lib-typedarrays":60,"./md5":61,"./mode-cfb":62,"./mode-ctr":64,"./mode-ctr-gladman":63,"./mode-ecb":65,"./mode-ofb":66,"./pad-ansix923":67,"./pad-iso10126":68,"./pad-iso97971":69,"./pad-nopadding":70,"./pad-zeropadding":71,"./pbkdf2":72,"./rabbit":74,"./rabbit-legacy":73,"./rc4":75,"./ripemd160":76,"./sha1":77,"./sha224":78,"./sha256":79,"./sha3":80,"./sha384":81,"./sha512":82,"./tripledes":83,"./x64-core":84}],60:[function(require,module,exports){
|
||||
},{"./aes":50,"./cipher-core":51,"./core":52,"./enc-base64":53,"./enc-utf16":54,"./evpkdf":55,"./format-hex":56,"./hmac":57,"./lib-typedarrays":59,"./md5":60,"./mode-cfb":61,"./mode-ctr":63,"./mode-ctr-gladman":62,"./mode-ecb":64,"./mode-ofb":65,"./pad-ansix923":66,"./pad-iso10126":67,"./pad-iso97971":68,"./pad-nopadding":69,"./pad-zeropadding":70,"./pbkdf2":71,"./rabbit":73,"./rabbit-legacy":72,"./rc4":74,"./ripemd160":75,"./sha1":76,"./sha224":77,"./sha256":78,"./sha3":79,"./sha384":80,"./sha512":81,"./tripledes":82,"./x64-core":83}],59:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9231,7 +9275,7 @@ module.exports = transfer;
|
||||
return CryptoJS.lib.WordArray;
|
||||
|
||||
}));
|
||||
},{"./core":53}],61:[function(require,module,exports){
|
||||
},{"./core":52}],60:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9500,7 +9544,7 @@ module.exports = transfer;
|
||||
return CryptoJS.MD5;
|
||||
|
||||
}));
|
||||
},{"./core":53}],62:[function(require,module,exports){
|
||||
},{"./core":52}],61:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9579,7 +9623,7 @@ module.exports = transfer;
|
||||
return CryptoJS.mode.CFB;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],63:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],62:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9696,7 +9740,7 @@ module.exports = transfer;
|
||||
return CryptoJS.mode.CTRGladman;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],64:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],63:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9755,7 +9799,7 @@ module.exports = transfer;
|
||||
return CryptoJS.mode.CTR;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],65:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],64:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9796,7 +9840,7 @@ module.exports = transfer;
|
||||
return CryptoJS.mode.ECB;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],66:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],65:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9851,7 +9895,7 @@ module.exports = transfer;
|
||||
return CryptoJS.mode.OFB;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],67:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],66:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9901,7 +9945,7 @@ module.exports = transfer;
|
||||
return CryptoJS.pad.Ansix923;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],68:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],67:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9946,7 +9990,7 @@ module.exports = transfer;
|
||||
return CryptoJS.pad.Iso10126;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],69:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],68:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -9987,7 +10031,7 @@ module.exports = transfer;
|
||||
return CryptoJS.pad.Iso97971;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],70:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],69:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10018,7 +10062,7 @@ module.exports = transfer;
|
||||
return CryptoJS.pad.NoPadding;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],71:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],70:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10064,7 +10108,7 @@ module.exports = transfer;
|
||||
return CryptoJS.pad.ZeroPadding;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53}],72:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52}],71:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10210,7 +10254,7 @@ module.exports = transfer;
|
||||
return CryptoJS.PBKDF2;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./hmac":58,"./sha1":77}],73:[function(require,module,exports){
|
||||
},{"./core":52,"./hmac":57,"./sha1":76}],72:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10401,7 +10445,7 @@ module.exports = transfer;
|
||||
return CryptoJS.RabbitLegacy;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],74:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],73:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10594,7 +10638,7 @@ module.exports = transfer;
|
||||
return CryptoJS.Rabbit;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],75:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],74:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -10734,7 +10778,7 @@ module.exports = transfer;
|
||||
return CryptoJS.RC4;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],76:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],75:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11002,7 +11046,7 @@ module.exports = transfer;
|
||||
return CryptoJS.RIPEMD160;
|
||||
|
||||
}));
|
||||
},{"./core":53}],77:[function(require,module,exports){
|
||||
},{"./core":52}],76:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11153,7 +11197,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA1;
|
||||
|
||||
}));
|
||||
},{"./core":53}],78:[function(require,module,exports){
|
||||
},{"./core":52}],77:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11234,7 +11278,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA224;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./sha256":79}],79:[function(require,module,exports){
|
||||
},{"./core":52,"./sha256":78}],78:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11434,7 +11478,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA256;
|
||||
|
||||
}));
|
||||
},{"./core":53}],80:[function(require,module,exports){
|
||||
},{"./core":52}],79:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11758,7 +11802,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA3;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./x64-core":84}],81:[function(require,module,exports){
|
||||
},{"./core":52,"./x64-core":83}],80:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -11842,7 +11886,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA384;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./sha512":82,"./x64-core":84}],82:[function(require,module,exports){
|
||||
},{"./core":52,"./sha512":81,"./x64-core":83}],81:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -12166,7 +12210,7 @@ module.exports = transfer;
|
||||
return CryptoJS.SHA512;
|
||||
|
||||
}));
|
||||
},{"./core":53,"./x64-core":84}],83:[function(require,module,exports){
|
||||
},{"./core":52,"./x64-core":83}],82:[function(require,module,exports){
|
||||
;(function (root, factory, undef) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -12937,7 +12981,7 @@ module.exports = transfer;
|
||||
return CryptoJS.TripleDES;
|
||||
|
||||
}));
|
||||
},{"./cipher-core":52,"./core":53,"./enc-base64":54,"./evpkdf":56,"./md5":61}],84:[function(require,module,exports){
|
||||
},{"./cipher-core":51,"./core":52,"./enc-base64":53,"./evpkdf":55,"./md5":60}],83:[function(require,module,exports){
|
||||
;(function (root, factory) {
|
||||
if (typeof exports === "object") {
|
||||
// CommonJS
|
||||
@ -13242,7 +13286,7 @@ module.exports = transfer;
|
||||
return CryptoJS;
|
||||
|
||||
}));
|
||||
},{"./core":53}],85:[function(require,module,exports){
|
||||
},{"./core":52}],84:[function(require,module,exports){
|
||||
/*! https://mths.be/utf8js v2.1.2 by @mathias */
|
||||
;(function(root) {
|
||||
|
||||
@ -13488,25 +13532,25 @@ module.exports = transfer;
|
||||
|
||||
}(this));
|
||||
|
||||
},{}],86:[function(require,module,exports){
|
||||
},{}],85:[function(require,module,exports){
|
||||
module.exports = XMLHttpRequest;
|
||||
|
||||
},{}],"bignumber.js":[function(require,module,exports){
|
||||
/*! bignumber.js v2.0.7 https://github.com/MikeMcl/bignumber.js/LICENCE */
|
||||
/*! bignumber.js v4.0.2 https://github.com/MikeMcl/bignumber.js/LICENCE */
|
||||
|
||||
;(function (global) {
|
||||
;(function (globalObj) {
|
||||
'use strict';
|
||||
|
||||
/*
|
||||
bignumber.js v2.0.7
|
||||
bignumber.js v4.0.2
|
||||
A JavaScript library for arbitrary-precision arithmetic.
|
||||
https://github.com/MikeMcl/bignumber.js
|
||||
Copyright (c) 2015 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
Copyright (c) 2017 Michael Mclaughlin <M8ch88l@gmail.com>
|
||||
MIT Expat Licence
|
||||
*/
|
||||
|
||||
|
||||
var BigNumber, crypto, parseNumeric,
|
||||
var BigNumber,
|
||||
isNumeric = /^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i,
|
||||
mathceil = Math.ceil,
|
||||
mathfloor = Math.floor,
|
||||
@ -13532,8 +13576,8 @@ module.exports = XMLHttpRequest;
|
||||
/*
|
||||
* Create and return a BigNumber constructor.
|
||||
*/
|
||||
function another(configObj) {
|
||||
var div,
|
||||
function constructorFactory(config) {
|
||||
var div, parseNumeric,
|
||||
|
||||
// id tracks the caller function, so its name can be included in error messages.
|
||||
id = 0,
|
||||
@ -13619,7 +13663,7 @@ module.exports = XMLHttpRequest;
|
||||
|
||||
// The maximum number of significant digits of the result of the toPower operation.
|
||||
// If POW_PRECISION is 0, there will be unlimited significant digits.
|
||||
POW_PRECISION = 100, // 0 to MAX
|
||||
POW_PRECISION = 0, // 0 to MAX
|
||||
|
||||
// The format specification used by the BigNumber.prototype.toFormat method.
|
||||
FORMAT = {
|
||||
@ -13752,7 +13796,9 @@ module.exports = XMLHttpRequest;
|
||||
|
||||
// Disallow numbers with over 15 significant digits if number type.
|
||||
// 'new BigNumber() number type has more than 15 significant digits: {n}'
|
||||
if ( num && ERRORS && len > 15 ) raise( id, tooManyDigits, x.s * n );
|
||||
if ( num && ERRORS && len > 15 && ( n > MAX_SAFE_INTEGER || n !== mathfloor(n) ) ) {
|
||||
raise( id, tooManyDigits, x.s * n );
|
||||
}
|
||||
|
||||
e = e - i - 1;
|
||||
|
||||
@ -13807,7 +13853,7 @@ module.exports = XMLHttpRequest;
|
||||
// CONSTRUCTOR PROPERTIES
|
||||
|
||||
|
||||
BigNumber.another = another;
|
||||
BigNumber.another = constructorFactory;
|
||||
|
||||
BigNumber.ROUND_UP = 0;
|
||||
BigNumber.ROUND_DOWN = 1;
|
||||
@ -13854,7 +13900,7 @@ module.exports = XMLHttpRequest;
|
||||
* Ignore properties/parameters set to null or undefined.
|
||||
* Return an object with the properties current values.
|
||||
*/
|
||||
BigNumber.config = function () {
|
||||
BigNumber.config = BigNumber.set = function () {
|
||||
var v, p,
|
||||
i = 0,
|
||||
r = {},
|
||||
@ -13934,9 +13980,19 @@ module.exports = XMLHttpRequest;
|
||||
// 'config() crypto unavailable: {crypto}'
|
||||
if ( has( p = 'CRYPTO' ) ) {
|
||||
|
||||
if ( v === !!v || v === 1 || v === 0 ) {
|
||||
CRYPTO = !!( v && crypto && typeof crypto == 'object' );
|
||||
if ( v && !CRYPTO && ERRORS ) raise( 2, 'crypto unavailable', crypto );
|
||||
if ( v === true || v === false || v === 1 || v === 0 ) {
|
||||
if (v) {
|
||||
v = typeof crypto == 'undefined';
|
||||
if ( !v && crypto && (crypto.getRandomValues || crypto.randomBytes)) {
|
||||
CRYPTO = true;
|
||||
} else if (ERRORS) {
|
||||
raise( 2, 'crypto unavailable', v ? void 0 : crypto );
|
||||
} else {
|
||||
CRYPTO = false;
|
||||
}
|
||||
} else {
|
||||
CRYPTO = false;
|
||||
}
|
||||
} else if (ERRORS) {
|
||||
raise( 2, p + notBool, v );
|
||||
}
|
||||
@ -14026,7 +14082,7 @@ module.exports = XMLHttpRequest;
|
||||
if (CRYPTO) {
|
||||
|
||||
// Browsers supporting crypto.getRandomValues.
|
||||
if ( crypto && crypto.getRandomValues ) {
|
||||
if (crypto.getRandomValues) {
|
||||
|
||||
a = crypto.getRandomValues( new Uint32Array( k *= 2 ) );
|
||||
|
||||
@ -14059,7 +14115,7 @@ module.exports = XMLHttpRequest;
|
||||
i = k / 2;
|
||||
|
||||
// Node.js supporting crypto.randomBytes.
|
||||
} else if ( crypto && crypto.randomBytes ) {
|
||||
} else if (crypto.randomBytes) {
|
||||
|
||||
// buffer
|
||||
a = crypto.randomBytes( k *= 7 );
|
||||
@ -14084,13 +14140,14 @@ module.exports = XMLHttpRequest;
|
||||
}
|
||||
}
|
||||
i = k / 7;
|
||||
} else if (ERRORS) {
|
||||
raise( 14, 'crypto unavailable', crypto );
|
||||
} else {
|
||||
CRYPTO = false;
|
||||
if (ERRORS) raise( 14, 'crypto unavailable', crypto );
|
||||
}
|
||||
}
|
||||
|
||||
// Use Math.random: CRYPTO is false or crypto is unavailable and ERRORS is false.
|
||||
if (!i) {
|
||||
// Use Math.random.
|
||||
if (!CRYPTO) {
|
||||
|
||||
for ( ; i < k; ) {
|
||||
v = random53bitInt();
|
||||
@ -14116,7 +14173,7 @@ module.exports = XMLHttpRequest;
|
||||
} else {
|
||||
|
||||
// Remove leading elements which are zero and adjust exponent accordingly.
|
||||
for ( e = -1 ; c[0] === 0; c.shift(), e -= LOG_BASE);
|
||||
for ( e = -1 ; c[0] === 0; c.splice(0, 1), e -= LOG_BASE);
|
||||
|
||||
// Count the digits of the first element of c to determine leading zeros, and...
|
||||
for ( i = 1, v = c[0]; v >= 10; v /= 10, i++);
|
||||
@ -14209,7 +14266,7 @@ module.exports = XMLHttpRequest;
|
||||
|
||||
if ( !d ) {
|
||||
++e;
|
||||
xc.unshift(1);
|
||||
xc = [1].concat(xc);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -14247,7 +14304,7 @@ module.exports = XMLHttpRequest;
|
||||
x[i] = temp % base;
|
||||
}
|
||||
|
||||
if (carry) x.unshift(carry);
|
||||
if (carry) x = [carry].concat(x);
|
||||
|
||||
return x;
|
||||
}
|
||||
@ -14281,7 +14338,7 @@ module.exports = XMLHttpRequest;
|
||||
}
|
||||
|
||||
// Remove leading zeros.
|
||||
for ( ; !a[0] && a.length > 1; a.shift() );
|
||||
for ( ; !a[0] && a.length > 1; a.splice(0, 1) );
|
||||
}
|
||||
|
||||
// x: dividend, y: divisor.
|
||||
@ -14350,7 +14407,7 @@ module.exports = XMLHttpRequest;
|
||||
// Add zeros to make remainder as long as divisor.
|
||||
for ( ; remL < yL; rem[remL++] = 0 );
|
||||
yz = yc.slice();
|
||||
yz.unshift(0);
|
||||
yz = [0].concat(yz);
|
||||
yc0 = yc[0];
|
||||
if ( yc[1] >= base / 2 ) yc0++;
|
||||
// Not necessary, but to prevent trial digit n > base, when using base 3.
|
||||
@ -14421,7 +14478,7 @@ module.exports = XMLHttpRequest;
|
||||
prodL = prod.length;
|
||||
}
|
||||
|
||||
if ( prodL < remL ) prod.unshift(0);
|
||||
if ( prodL < remL ) prod = [0].concat(prod);
|
||||
|
||||
// Subtract product from remainder.
|
||||
subtract( rem, prod, remL, base );
|
||||
@ -14462,7 +14519,7 @@ module.exports = XMLHttpRequest;
|
||||
more = rem[0] != null;
|
||||
|
||||
// Leading zero?
|
||||
if ( !qc[0] ) qc.shift();
|
||||
if ( !qc[0] ) qc.splice(0, 1);
|
||||
}
|
||||
|
||||
if ( base == BASE ) {
|
||||
@ -14622,11 +14679,11 @@ module.exports = XMLHttpRequest;
|
||||
|
||||
// Handle values that fail the validity test in BigNumber.
|
||||
parseNumeric = (function () {
|
||||
var basePrefix = /^(-?)0([xbo])/i,
|
||||
var basePrefix = /^(-?)0([xbo])(?=\w[\w.]*$)/i,
|
||||
dotAfter = /^([^.]+)\.$/,
|
||||
dotBefore = /^\.([^.]+)$/,
|
||||
isInfinityOrNaN = /^-?(Infinity|NaN)$/,
|
||||
whitespaceOrPlus = /^\s*\+|^\s+|\s+$/g;
|
||||
whitespaceOrPlus = /^\s*\+(?=[\w.])|^\s+|\s+$/g;
|
||||
|
||||
return function ( x, str, num, b ) {
|
||||
var base,
|
||||
@ -14794,7 +14851,7 @@ module.exports = XMLHttpRequest;
|
||||
sd -= x.e + 1;
|
||||
|
||||
// 1, 0.1, 0.01, 0.001, 0.0001 etc.
|
||||
xc[0] = pows10[ sd % LOG_BASE ];
|
||||
xc[0] = pows10[ ( LOG_BASE - sd % LOG_BASE ) % LOG_BASE ];
|
||||
x.e = -sd || 0;
|
||||
} else {
|
||||
|
||||
@ -15172,7 +15229,7 @@ module.exports = XMLHttpRequest;
|
||||
}
|
||||
|
||||
// Remove leading zeros and adjust exponent accordingly.
|
||||
for ( ; xc[0] == 0; xc.shift(), --ye );
|
||||
for ( ; xc[0] == 0; xc.splice(0, 1), --ye );
|
||||
|
||||
// Zero?
|
||||
if ( !xc[0] ) {
|
||||
@ -15336,11 +15393,11 @@ module.exports = XMLHttpRequest;
|
||||
// Only start adding at yc.length - 1 as the further digits of xc can be ignored.
|
||||
for ( a = 0; b; ) {
|
||||
a = ( xc[--b] = xc[b] + yc[b] + a ) / BASE | 0;
|
||||
xc[b] %= BASE;
|
||||
xc[b] = BASE === xc[b] ? 0 : xc[b] % BASE;
|
||||
}
|
||||
|
||||
if (a) {
|
||||
xc.unshift(a);
|
||||
xc = [a].concat(xc);
|
||||
++ye;
|
||||
}
|
||||
|
||||
@ -15629,7 +15686,7 @@ module.exports = XMLHttpRequest;
|
||||
if (c) {
|
||||
++e;
|
||||
} else {
|
||||
zc.shift();
|
||||
zc.splice(0, 1);
|
||||
}
|
||||
|
||||
return normalise( y, zc, e );
|
||||
@ -15847,59 +15904,91 @@ module.exports = XMLHttpRequest;
|
||||
* Return the value of this BigNumber converted to a number primitive.
|
||||
*/
|
||||
P.toNumber = function () {
|
||||
var x = this;
|
||||
|
||||
// Ensure zero has correct sign.
|
||||
return +x || ( x.s ? x.s * 0 : NaN );
|
||||
return +this;
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* Return a BigNumber whose value is the value of this BigNumber raised to the power n.
|
||||
* If m is present, return the result modulo m.
|
||||
* If n is negative round according to DECIMAL_PLACES and ROUNDING_MODE.
|
||||
* If POW_PRECISION is not 0, round to POW_PRECISION using ROUNDING_MODE.
|
||||
* If POW_PRECISION is non-zero and m is not present, round to POW_PRECISION using
|
||||
* ROUNDING_MODE.
|
||||
*
|
||||
* n {number} Integer, -9007199254740992 to 9007199254740992 inclusive.
|
||||
* (Performs 54 loop iterations for n of 9007199254740992.)
|
||||
* The modular power operation works efficiently when x, n, and m are positive integers,
|
||||
* otherwise it is equivalent to calculating x.toPower(n).modulo(m) (with POW_PRECISION 0).
|
||||
*
|
||||
* n {number} Integer, -MAX_SAFE_INTEGER to MAX_SAFE_INTEGER inclusive.
|
||||
* [m] {number|string|BigNumber} The modulus.
|
||||
*
|
||||
* 'pow() exponent not an integer: {n}'
|
||||
* 'pow() exponent out of range: {n}'
|
||||
*
|
||||
* Performs 54 loop iterations for n of 9007199254740991.
|
||||
*/
|
||||
P.toPower = P.pow = function (n) {
|
||||
var k, y,
|
||||
P.toPower = P.pow = function ( n, m ) {
|
||||
var k, y, z,
|
||||
i = mathfloor( n < 0 ? -n : +n ),
|
||||
x = this;
|
||||
|
||||
if ( m != null ) {
|
||||
id = 23;
|
||||
m = new BigNumber(m);
|
||||
}
|
||||
|
||||
// Pass ±Infinity to Math.pow if exponent is out of range.
|
||||
if ( !isValidInt( n, -MAX_SAFE_INTEGER, MAX_SAFE_INTEGER, 23, 'exponent' ) &&
|
||||
( !isFinite(n) || i > MAX_SAFE_INTEGER && ( n /= 0 ) ||
|
||||
parseFloat(n) != n && !( n = NaN ) ) ) {
|
||||
return new BigNumber( Math.pow( +x, n ) );
|
||||
parseFloat(n) != n && !( n = NaN ) ) || n == 0 ) {
|
||||
k = Math.pow( +x, n );
|
||||
return new BigNumber( m ? k % m : k );
|
||||
}
|
||||
|
||||
if (m) {
|
||||
if ( n > 1 && x.gt(ONE) && x.isInt() && m.gt(ONE) && m.isInt() ) {
|
||||
x = x.mod(m);
|
||||
} else {
|
||||
z = m;
|
||||
|
||||
// Nullify m so only a single mod operation is performed at the end.
|
||||
m = null;
|
||||
}
|
||||
} else if (POW_PRECISION) {
|
||||
|
||||
// Truncating each coefficient array to a length of k after each multiplication
|
||||
// equates to truncating significant digits to POW_PRECISION + [28, 41],
|
||||
// i.e. there will be a minimum of 28 guard digits retained.
|
||||
// (Using + 1.5 would give [9, 21] guard digits.)
|
||||
k = mathceil( POW_PRECISION / LOG_BASE + 2 );
|
||||
}
|
||||
|
||||
// Truncating each coefficient array to a length of k after each multiplication equates
|
||||
// to truncating significant digits to POW_PRECISION + [28, 41], i.e. there will be a
|
||||
// minimum of 28 guard digits retained. (Using + 1.5 would give [9, 21] guard digits.)
|
||||
k = POW_PRECISION ? mathceil( POW_PRECISION / LOG_BASE + 2 ) : 0;
|
||||
y = new BigNumber(ONE);
|
||||
|
||||
for ( ; ; ) {
|
||||
|
||||
if ( i % 2 ) {
|
||||
y = y.times(x);
|
||||
if ( !y.c ) break;
|
||||
if ( k && y.c.length > k ) y.c.length = k;
|
||||
if (k) {
|
||||
if ( y.c.length > k ) y.c.length = k;
|
||||
} else if (m) {
|
||||
y = y.mod(m);
|
||||
}
|
||||
}
|
||||
|
||||
i = mathfloor( i / 2 );
|
||||
if ( !i ) break;
|
||||
|
||||
x = x.times(x);
|
||||
if ( k && x.c && x.c.length > k ) x.c.length = k;
|
||||
if (k) {
|
||||
if ( x.c && x.c.length > k ) x.c.length = k;
|
||||
} else if (m) {
|
||||
x = x.mod(m);
|
||||
}
|
||||
}
|
||||
|
||||
if (m) return y;
|
||||
if ( n < 0 ) y = ONE.div(y);
|
||||
return k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;
|
||||
|
||||
return z ? y.mod(z) : k ? round( y, POW_PRECISION, ROUNDING_MODE ) : y;
|
||||
};
|
||||
|
||||
|
||||
@ -15977,26 +16066,30 @@ module.exports = XMLHttpRequest;
|
||||
};
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Return as toString, but do not accept a base argument.
|
||||
* Return as toString, but do not accept a base argument, and include the minus sign for
|
||||
* negative zero.
|
||||
*/
|
||||
P.valueOf = P.toJSON = function () {
|
||||
return this.toString();
|
||||
var str,
|
||||
n = this,
|
||||
e = n.e;
|
||||
|
||||
if ( e === null ) return n.toString();
|
||||
|
||||
str = coeffToString( n.c );
|
||||
|
||||
str = e <= TO_EXP_NEG || e >= TO_EXP_POS
|
||||
? toExponential( str, e )
|
||||
: toFixedPoint( str, e );
|
||||
|
||||
return n.s < 0 ? '-' + str : str;
|
||||
};
|
||||
|
||||
|
||||
// Aliases for BigDecimal methods.
|
||||
//P.add = P.plus; // P.add included above
|
||||
//P.subtract = P.minus; // P.sub included above
|
||||
//P.multiply = P.times; // P.mul included above
|
||||
//P.divide = P.div;
|
||||
//P.remainder = P.mod;
|
||||
//P.compareTo = P.cmp;
|
||||
//P.negate = P.neg;
|
||||
P.isBigNumber = true;
|
||||
|
||||
|
||||
if ( configObj != null ) BigNumber.config(configObj);
|
||||
if ( config != null ) BigNumber.config(config);
|
||||
|
||||
return BigNumber;
|
||||
}
|
||||
@ -16159,24 +16252,26 @@ module.exports = XMLHttpRequest;
|
||||
// EXPORT
|
||||
|
||||
|
||||
BigNumber = another();
|
||||
BigNumber = constructorFactory();
|
||||
BigNumber['default'] = BigNumber.BigNumber = BigNumber;
|
||||
|
||||
|
||||
// AMD.
|
||||
if ( typeof define == 'function' && define.amd ) {
|
||||
define( function () { return BigNumber; } );
|
||||
|
||||
// Node and other environments that support module.exports.
|
||||
// Node.js and other environments that support module.exports.
|
||||
} else if ( typeof module != 'undefined' && module.exports ) {
|
||||
module.exports = BigNumber;
|
||||
if ( !crypto ) try { crypto = require('crypto'); } catch (e) {}
|
||||
|
||||
// Browser.
|
||||
} else {
|
||||
global.BigNumber = BigNumber;
|
||||
if ( !globalObj ) globalObj = typeof self != 'undefined' ? self : Function('return this')();
|
||||
globalObj.BigNumber = BigNumber;
|
||||
}
|
||||
})(this);
|
||||
|
||||
},{"crypto":50}],"web3":[function(require,module,exports){
|
||||
},{}],"web3":[function(require,module,exports){
|
||||
var Web3 = require('./lib/web3');
|
||||
|
||||
// dont override global variable
|
||||
|
24
dist/web3.js.map
vendored
24
dist/web3.js.map
vendored
File diff suppressed because one or more lines are too long
10
dist/web3.min.js
vendored
10
dist/web3.min.js
vendored
File diff suppressed because one or more lines are too long
@ -259,7 +259,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
|
||||
@ -523,7 +523,7 @@ var isFunction = function (object) {
|
||||
* @return {Boolean}
|
||||
*/
|
||||
var isObject = function (object) {
|
||||
return typeof object === 'object';
|
||||
return object !== null && !(object instanceof Array) && typeof object === 'object';
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -1,3 +1,3 @@
|
||||
{
|
||||
"version": "0.18.4"
|
||||
"version": "0.19.0"
|
||||
}
|
||||
|
@ -100,6 +100,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) {
|
||||
|
@ -21,8 +21,11 @@
|
||||
*/
|
||||
|
||||
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 +'.');
|
||||
|
@ -150,7 +150,9 @@ var Filter = function (requestManager, options, methods, formatter, callback, fi
|
||||
self.callbacks.forEach(function(cb){
|
||||
cb(error);
|
||||
});
|
||||
if (typeof filterCreationErrorCallback === 'function') {
|
||||
filterCreationErrorCallback(error);
|
||||
}
|
||||
} else {
|
||||
self.filterId = id;
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
var coder = require('../solidity/coder');
|
||||
var utils = require('../utils/utils');
|
||||
var errors = require('./errors');
|
||||
var formatters = require('./formatters');
|
||||
var sha3 = require('../utils/sha3');
|
||||
|
||||
@ -54,6 +55,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
|
||||
*
|
||||
@ -66,6 +84,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;
|
||||
@ -259,4 +278,3 @@ SolidityFunction.prototype.attachToContract = function (contract) {
|
||||
};
|
||||
|
||||
module.exports = SolidityFunction;
|
||||
|
||||
|
@ -69,7 +69,7 @@ Method.prototype.extractCallback = function (args) {
|
||||
*/
|
||||
Method.prototype.validateArgs = function (args) {
|
||||
if (args.length !== this.params) {
|
||||
throw errors.InvalidNumberOfParams();
|
||||
throw errors.InvalidNumberOfRPCParams();
|
||||
}
|
||||
};
|
||||
|
||||
@ -162,4 +162,3 @@ Method.prototype.request = function () {
|
||||
};
|
||||
|
||||
module.exports = Method;
|
||||
|
||||
|
@ -335,8 +335,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 () {
|
||||
|
@ -51,6 +51,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',
|
||||
@ -74,7 +93,10 @@ var methods = function () {
|
||||
|
||||
return [
|
||||
newAccount,
|
||||
importRawKey,
|
||||
unlockAccount,
|
||||
ecRecover,
|
||||
sign,
|
||||
sendTransaction,
|
||||
lockAccount
|
||||
];
|
||||
|
@ -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": {
|
||||
|
@ -4,6 +4,7 @@ var Web3 = require('../index');
|
||||
var FakeHttpProvider = require('./helpers/FakeHttpProvider');
|
||||
var FakeHttpProvider2 = require('./helpers/FakeHttpProvider2');
|
||||
var utils = require('../lib/utils/utils');
|
||||
var errors = require('../lib/web3/errors');
|
||||
var BigNumber = require('bignumber.js');
|
||||
var sha3 = require('../lib/utils/sha3');
|
||||
|
||||
@ -353,6 +354,31 @@ describe('contract', function () {
|
||||
|
||||
});
|
||||
|
||||
it('should throw if called with optional params without all args', function () {
|
||||
var provider = new FakeHttpProvider();
|
||||
var web3 = new Web3(provider);
|
||||
provider.injectResult('0x0000000000000000000000000000000000000000000000000000000000000032');
|
||||
var signature = 'balance(address)';
|
||||
var address = '0x1234567890123456789012345678901234567891';
|
||||
provider.injectValidation(function (payload) {
|
||||
assert.equal(payload.method, 'eth_call');
|
||||
assert.deepEqual(payload.params, [{
|
||||
data: '0x' + sha3(signature).slice(0, 8) + '0000000000000000000000001234567890123456789012345678901234567891',
|
||||
to: address,
|
||||
from: address,
|
||||
gas: '0xc350'
|
||||
}, 'latest']);
|
||||
});
|
||||
|
||||
var contract = web3.eth.contract(desc).at(address);
|
||||
|
||||
var test = function() {
|
||||
var r = contract.balance({from: address, gas: 50000});
|
||||
}
|
||||
assert.throws(test, errors.InvalidNumberOfSolidityArgs().message);
|
||||
|
||||
});
|
||||
|
||||
it('should explicitly make a call with optional params', function () {
|
||||
var provider = new FakeHttpProvider();
|
||||
var web3 = new Web3(provider);
|
||||
@ -399,6 +425,35 @@ describe('contract', function () {
|
||||
|
||||
});
|
||||
|
||||
it('it should throw if sendTransaction with optional params without all args', function () {
|
||||
var provider = new FakeHttpProvider();
|
||||
var web3 = new Web3(provider);
|
||||
var signature = 'send(address,uint256)';
|
||||
var address = '0x1234567890123456789012345678901234567891';
|
||||
provider.injectValidation(function (payload) {
|
||||
assert.equal(payload.method, 'eth_sendTransaction');
|
||||
assert.deepEqual(payload.params, [{
|
||||
data: '0x' + sha3(signature).slice(0, 8) +
|
||||
'0000000000000000000000001234567890123456789012345678901234567891' +
|
||||
'0000000000000000000000000000000000000000000000000000000000000011' ,
|
||||
to: address,
|
||||
from: address,
|
||||
gas: '0xc350',
|
||||
gasPrice: '0xbb8',
|
||||
value: '0x2710'
|
||||
}]);
|
||||
});
|
||||
|
||||
var contract = web3.eth.contract(desc).at(address);
|
||||
|
||||
var test = function() {
|
||||
contract.send(address, {from: address, gas: 50000, gasPrice: 3000, value: 10000});
|
||||
}
|
||||
|
||||
assert.throws(test, errors.InvalidNumberOfSolidityArgs().message);
|
||||
|
||||
});
|
||||
|
||||
it('should sendTransaction with optional params', function () {
|
||||
var provider = new FakeHttpProvider();
|
||||
var web3 = new Web3(provider);
|
||||
@ -557,4 +612,3 @@ describe('contract', function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -39,9 +39,8 @@ describe('lib/web3/method', function () {
|
||||
var test2 = function () { method.validateArgs(args2); };
|
||||
|
||||
// then
|
||||
assert.throws(test, errors.InvalidNumberOfParams().message);
|
||||
assert.throws(test2, errors.InvalidNumberOfParams().message);
|
||||
assert.throws(test, errors.InvalidNumberOfRPCParams().message);
|
||||
assert.throws(test2, errors.InvalidNumberOfRPCParams().message);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user