Updated dist files.
This commit is contained in:
parent
9745a6ecbc
commit
7e91091cc3
123
dist/ethers-contracts.js
vendored
123
dist/ethers-contracts.js
vendored
@ -317,7 +317,7 @@ utils.defineProperty(Contract, 'getDeployTransaction', function(bytecode, contra
|
||||
|
||||
module.exports = Contract;
|
||||
|
||||
},{"../utils/address.js":9,"../utils/bignumber.js":10,"../utils/convert.js":11,"../utils/properties.js":13,"./interface.js":3}],2:[function(require,module,exports){
|
||||
},{"../utils/address.js":9,"../utils/bignumber.js":10,"../utils/convert.js":11,"../utils/properties.js":14,"./interface.js":3}],2:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Contract = require('./contract.js');
|
||||
@ -672,7 +672,7 @@ function Interface(abi) {
|
||||
|
||||
module.exports = Interface;
|
||||
|
||||
},{"../utils/abi-coder":8,"../utils/convert":11,"../utils/keccak256":12,"../utils/properties":13,"../utils/throw-error":14,"../utils/utf8":15}],4:[function(require,module,exports){
|
||||
},{"../utils/abi-coder":8,"../utils/convert":11,"../utils/keccak256":13,"../utils/properties":14,"../utils/throw-error":15,"../utils/utf8":16}],4:[function(require,module,exports){
|
||||
(function (module, exports) {
|
||||
'use strict';
|
||||
|
||||
@ -5126,7 +5126,7 @@ utils.defineProperty(Coder, 'defaultCoder', new Coder());
|
||||
|
||||
module.exports = Coder
|
||||
|
||||
},{"../utils/address":9,"../utils/bignumber.js":10,"../utils/convert.js":11,"../utils/properties.js":13,"../utils/throw-error":14,"../utils/utf8.js":15}],9:[function(require,module,exports){
|
||||
},{"../utils/address":9,"../utils/bignumber.js":10,"../utils/convert.js":11,"../utils/properties.js":14,"../utils/throw-error":15,"../utils/utf8.js":16}],9:[function(require,module,exports){
|
||||
|
||||
var BN = require('bn.js');
|
||||
|
||||
@ -5252,7 +5252,7 @@ module.exports = {
|
||||
getAddress: getAddress,
|
||||
}
|
||||
|
||||
},{"./convert":11,"./keccak256":12,"./throw-error":14,"bn.js":4}],10:[function(require,module,exports){
|
||||
},{"./convert":11,"./keccak256":13,"./throw-error":15,"bn.js":4}],10:[function(require,module,exports){
|
||||
/**
|
||||
* BigNumber
|
||||
*
|
||||
@ -5403,14 +5403,15 @@ module.exports = {
|
||||
BigNumber: BigNumber
|
||||
};
|
||||
|
||||
},{"./convert":11,"./properties":13,"./throw-error":14,"bn.js":4}],11:[function(require,module,exports){
|
||||
},{"./convert":11,"./properties":14,"./throw-error":15,"bn.js":4}],11:[function(require,module,exports){
|
||||
/**
|
||||
* Conversion Utilities
|
||||
*
|
||||
*/
|
||||
|
||||
var defineProperty = require('./properties.js').defineProperty;
|
||||
var throwError = require('./throw-error');
|
||||
|
||||
var errors = require('./errors');
|
||||
|
||||
function addSlice(array) {
|
||||
if (array.slice) { return array; }
|
||||
@ -5438,7 +5439,10 @@ function isArrayish(value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function arrayify(value, name) {
|
||||
function arrayify(value) {
|
||||
if (value == null) {
|
||||
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (value && value.toHexString) {
|
||||
value = value.toHexString();
|
||||
@ -5454,13 +5458,19 @@ function arrayify(value, name) {
|
||||
}
|
||||
|
||||
return addSlice(new Uint8Array(result));
|
||||
|
||||
} else if (typeof(value) === 'string') {
|
||||
if (value.match(/^[0-9a-fA-F]*$/)) {
|
||||
errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (isArrayish(value)) {
|
||||
return addSlice(new Uint8Array(value));
|
||||
}
|
||||
|
||||
throwError('invalid arrayify value', { name: name, input: value });
|
||||
errors.throwError('invalid arrayify value', { arg: 'value', value: value, type: typeof(value) });
|
||||
}
|
||||
|
||||
function concat(objects) {
|
||||
@ -5519,7 +5529,7 @@ function isHexString(value, length) {
|
||||
|
||||
var HexCharacters = '0123456789abcdef';
|
||||
|
||||
function hexlify(value, name) {
|
||||
function hexlify(value) {
|
||||
|
||||
if (value && value.toHexString) {
|
||||
return value.toHexString();
|
||||
@ -5527,7 +5537,7 @@ function hexlify(value, name) {
|
||||
|
||||
if (typeof(value) === 'number') {
|
||||
if (value < 0) {
|
||||
throwError('cannot hexlify negative value', { name: name, input: value });
|
||||
errors.throwError('cannot hexlify negative value', errors.INVALID_ARG, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
var hex = '';
|
||||
@ -5560,7 +5570,7 @@ function hexlify(value, name) {
|
||||
return '0x' + result.join('');
|
||||
}
|
||||
|
||||
throwError('invalid hexlify value', { name: name, input: value });
|
||||
errors.throwError('invalid hexlify value', { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
function hexStripZeros(value) {
|
||||
@ -5577,6 +5587,31 @@ function hexZeroPad(value, length) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* @TODO: Add something like this to make slicing code easier to understand
|
||||
function hexSlice(hex, start, end) {
|
||||
hex = hexlify(hex);
|
||||
return '0x' + hex.substring(2 + start * 2, 2 + end * 2);
|
||||
}
|
||||
*/
|
||||
|
||||
function splitSignature(signature) {
|
||||
signature = arrayify(signature);
|
||||
if (signature.length !== 65) {
|
||||
throw new Error('invalid signature');
|
||||
}
|
||||
|
||||
var v = signature[64];
|
||||
if (v !== 27 && v !== 28) {
|
||||
v = 27 + (v % 2);
|
||||
}
|
||||
|
||||
return {
|
||||
r: hexlify(signature.slice(0, 32)),
|
||||
s: hexlify(signature.slice(32, 64)),
|
||||
v: v
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayify: arrayify,
|
||||
isArrayish: isArrayish,
|
||||
@ -5586,13 +5621,71 @@ module.exports = {
|
||||
padZeros: padZeros,
|
||||
stripZeros: stripZeros,
|
||||
|
||||
splitSignature: splitSignature,
|
||||
|
||||
hexlify: hexlify,
|
||||
isHexString: isHexString,
|
||||
hexStripZeros: hexStripZeros,
|
||||
hexZeroPad: hexZeroPad,
|
||||
};
|
||||
|
||||
},{"./properties.js":13,"./throw-error":14}],12:[function(require,module,exports){
|
||||
},{"./errors":12,"./properties.js":14}],12:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var defineProperty = require('./properties').defineProperty;
|
||||
|
||||
var codes = { };
|
||||
|
||||
[
|
||||
// Unknown Error
|
||||
'UNKNOWN_ERROR',
|
||||
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
'MISSING_NEW',
|
||||
|
||||
// Invalid argument to a function:
|
||||
// - arg: The argument name that was invalid
|
||||
'INVALID_ARGUMENT'
|
||||
|
||||
].forEach(function(code) {
|
||||
defineProperty(codes, code, code);
|
||||
});
|
||||
|
||||
|
||||
defineProperty(codes, 'throwError', function(message, code, params) {
|
||||
if (!code) { code = codes.UNKNOWN_ERROR; }
|
||||
if (!params) { params = {}; }
|
||||
|
||||
var messageDetails = [];
|
||||
Object.keys(params).forEach(function(key) {
|
||||
messageDetails.push(key + '=' + JSON.stringify(params[key]));
|
||||
});
|
||||
var reason = message;
|
||||
if (messageDetails.length) {
|
||||
message += ' (' + messageDetails.join(', ') + ')';
|
||||
}
|
||||
|
||||
var error = new Error(message);
|
||||
error.reason = reason;
|
||||
error.code = code
|
||||
|
||||
Object.keys(params).forEach(function(key) {
|
||||
error[key] = params[key];
|
||||
});
|
||||
|
||||
throw error;
|
||||
});
|
||||
|
||||
defineProperty(codes, 'checkNew', function(self, kind) {
|
||||
if (!(self instanceof kind)) {
|
||||
codes.throwError('missing new', codes.MISSING_NEW, { name: kind.name });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = codes;
|
||||
|
||||
},{"./properties":14}],13:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var sha3 = require('js-sha3');
|
||||
@ -5606,7 +5699,7 @@ function keccak256(data) {
|
||||
|
||||
module.exports = keccak256;
|
||||
|
||||
},{"./convert.js":11,"js-sha3":6}],13:[function(require,module,exports){
|
||||
},{"./convert.js":11,"js-sha3":6}],14:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function defineProperty(object, name, value) {
|
||||
@ -5630,7 +5723,7 @@ module.exports = {
|
||||
defineProperty: defineProperty,
|
||||
};
|
||||
|
||||
},{}],14:[function(require,module,exports){
|
||||
},{}],15:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function throwError(message, params) {
|
||||
@ -5643,7 +5736,7 @@ function throwError(message, params) {
|
||||
|
||||
module.exports = throwError;
|
||||
|
||||
},{}],15:[function(require,module,exports){
|
||||
},{}],16:[function(require,module,exports){
|
||||
|
||||
var convert = require('./convert.js');
|
||||
|
||||
|
4
dist/ethers-contracts.min.js
vendored
4
dist/ethers-contracts.min.js
vendored
File diff suppressed because one or more lines are too long
135
dist/ethers-providers.js
vendored
135
dist/ethers-providers.js
vendored
@ -4231,7 +4231,7 @@ utils.defineProperty(EtherscanProvider.prototype, 'getHistory', function(address
|
||||
|
||||
module.exports = EtherscanProvider;;
|
||||
|
||||
},{"../utils/convert.js":18,"../utils/properties.js":21,"./provider.js":13}],8:[function(require,module,exports){
|
||||
},{"../utils/convert.js":18,"../utils/properties.js":22,"./provider.js":13}],8:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var inherits = require('inherits');
|
||||
@ -4295,7 +4295,7 @@ utils.defineProperty(FallbackProvider.prototype, 'perform', function(method, par
|
||||
|
||||
module.exports = FallbackProvider;
|
||||
|
||||
},{"../utils/properties.js":21,"./provider.js":13,"inherits":3}],9:[function(require,module,exports){
|
||||
},{"../utils/properties.js":22,"./provider.js":13,"inherits":3}],9:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Provider = require('./provider.js');
|
||||
@ -4381,7 +4381,7 @@ utils.defineProperty(InfuraProvider.prototype, '_stopPending', function() {
|
||||
|
||||
module.exports = InfuraProvider;
|
||||
|
||||
},{"../utils/properties.js":21,"./json-rpc-provider":11,"./provider":13}],11:[function(require,module,exports){
|
||||
},{"../utils/properties.js":22,"./json-rpc-provider":11,"./provider":13}],11:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
// See: https://github.com/ethereum/wiki/wiki/JSON-RPC
|
||||
@ -4574,7 +4574,7 @@ utils.defineProperty(JsonRpcProvider, '_hexlifyTransaction', function(transactio
|
||||
|
||||
module.exports = JsonRpcProvider;
|
||||
|
||||
},{"../utils/convert":18,"../utils/properties":21,"./provider.js":13}],12:[function(require,module,exports){
|
||||
},{"../utils/convert":18,"../utils/properties":22,"./provider.js":13}],12:[function(require,module,exports){
|
||||
module.exports={
|
||||
"unspecified": {
|
||||
"chainId": 0,
|
||||
@ -5781,7 +5781,7 @@ utils.defineProperty(Provider, '_formatters', {
|
||||
|
||||
module.exports = Provider;
|
||||
|
||||
},{"../utils/address":15,"../utils/bignumber":16,"../utils/contract-address":17,"../utils/convert":18,"../utils/namehash":20,"../utils/properties":21,"../utils/rlp":22,"../utils/utf8":24,"./networks.json":12,"inherits":3,"xmlhttprequest":6}],14:[function(require,module,exports){
|
||||
},{"../utils/address":15,"../utils/bignumber":16,"../utils/contract-address":17,"../utils/convert":18,"../utils/namehash":21,"../utils/properties":22,"../utils/rlp":23,"../utils/utf8":25,"./networks.json":12,"inherits":3,"xmlhttprequest":6}],14:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var Provider = require('./provider');
|
||||
@ -5954,7 +5954,7 @@ utils.defineProperty(Web3Provider.prototype, 'send', function(method, params) {
|
||||
|
||||
module.exports = Web3Provider;
|
||||
|
||||
},{"../utils/address":15,"../utils/convert":18,"../utils/properties":21,"../utils/utf8":24,"./json-rpc-provider":11,"./provider":13}],15:[function(require,module,exports){
|
||||
},{"../utils/address":15,"../utils/convert":18,"../utils/properties":22,"../utils/utf8":25,"./json-rpc-provider":11,"./provider":13}],15:[function(require,module,exports){
|
||||
|
||||
var BN = require('bn.js');
|
||||
|
||||
@ -6080,7 +6080,7 @@ module.exports = {
|
||||
getAddress: getAddress,
|
||||
}
|
||||
|
||||
},{"./convert":18,"./keccak256":19,"./throw-error":23,"bn.js":1}],16:[function(require,module,exports){
|
||||
},{"./convert":18,"./keccak256":20,"./throw-error":24,"bn.js":1}],16:[function(require,module,exports){
|
||||
/**
|
||||
* BigNumber
|
||||
*
|
||||
@ -6231,7 +6231,7 @@ module.exports = {
|
||||
BigNumber: BigNumber
|
||||
};
|
||||
|
||||
},{"./convert":18,"./properties":21,"./throw-error":23,"bn.js":1}],17:[function(require,module,exports){
|
||||
},{"./convert":18,"./properties":22,"./throw-error":24,"bn.js":1}],17:[function(require,module,exports){
|
||||
|
||||
var getAddress = require('./address').getAddress;
|
||||
var convert = require('./convert');
|
||||
@ -6253,14 +6253,15 @@ module.exports = {
|
||||
getContractAddress: getContractAddress,
|
||||
}
|
||||
|
||||
},{"./address":15,"./convert":18,"./keccak256":19,"./rlp":22}],18:[function(require,module,exports){
|
||||
},{"./address":15,"./convert":18,"./keccak256":20,"./rlp":23}],18:[function(require,module,exports){
|
||||
/**
|
||||
* Conversion Utilities
|
||||
*
|
||||
*/
|
||||
|
||||
var defineProperty = require('./properties.js').defineProperty;
|
||||
var throwError = require('./throw-error');
|
||||
|
||||
var errors = require('./errors');
|
||||
|
||||
function addSlice(array) {
|
||||
if (array.slice) { return array; }
|
||||
@ -6288,7 +6289,10 @@ function isArrayish(value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function arrayify(value, name) {
|
||||
function arrayify(value) {
|
||||
if (value == null) {
|
||||
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (value && value.toHexString) {
|
||||
value = value.toHexString();
|
||||
@ -6304,13 +6308,19 @@ function arrayify(value, name) {
|
||||
}
|
||||
|
||||
return addSlice(new Uint8Array(result));
|
||||
|
||||
} else if (typeof(value) === 'string') {
|
||||
if (value.match(/^[0-9a-fA-F]*$/)) {
|
||||
errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (isArrayish(value)) {
|
||||
return addSlice(new Uint8Array(value));
|
||||
}
|
||||
|
||||
throwError('invalid arrayify value', { name: name, input: value });
|
||||
errors.throwError('invalid arrayify value', { arg: 'value', value: value, type: typeof(value) });
|
||||
}
|
||||
|
||||
function concat(objects) {
|
||||
@ -6369,7 +6379,7 @@ function isHexString(value, length) {
|
||||
|
||||
var HexCharacters = '0123456789abcdef';
|
||||
|
||||
function hexlify(value, name) {
|
||||
function hexlify(value) {
|
||||
|
||||
if (value && value.toHexString) {
|
||||
return value.toHexString();
|
||||
@ -6377,7 +6387,7 @@ function hexlify(value, name) {
|
||||
|
||||
if (typeof(value) === 'number') {
|
||||
if (value < 0) {
|
||||
throwError('cannot hexlify negative value', { name: name, input: value });
|
||||
errors.throwError('cannot hexlify negative value', errors.INVALID_ARG, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
var hex = '';
|
||||
@ -6410,7 +6420,7 @@ function hexlify(value, name) {
|
||||
return '0x' + result.join('');
|
||||
}
|
||||
|
||||
throwError('invalid hexlify value', { name: name, input: value });
|
||||
errors.throwError('invalid hexlify value', { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
function hexStripZeros(value) {
|
||||
@ -6427,6 +6437,31 @@ function hexZeroPad(value, length) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* @TODO: Add something like this to make slicing code easier to understand
|
||||
function hexSlice(hex, start, end) {
|
||||
hex = hexlify(hex);
|
||||
return '0x' + hex.substring(2 + start * 2, 2 + end * 2);
|
||||
}
|
||||
*/
|
||||
|
||||
function splitSignature(signature) {
|
||||
signature = arrayify(signature);
|
||||
if (signature.length !== 65) {
|
||||
throw new Error('invalid signature');
|
||||
}
|
||||
|
||||
var v = signature[64];
|
||||
if (v !== 27 && v !== 28) {
|
||||
v = 27 + (v % 2);
|
||||
}
|
||||
|
||||
return {
|
||||
r: hexlify(signature.slice(0, 32)),
|
||||
s: hexlify(signature.slice(32, 64)),
|
||||
v: v
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayify: arrayify,
|
||||
isArrayish: isArrayish,
|
||||
@ -6436,13 +6471,71 @@ module.exports = {
|
||||
padZeros: padZeros,
|
||||
stripZeros: stripZeros,
|
||||
|
||||
splitSignature: splitSignature,
|
||||
|
||||
hexlify: hexlify,
|
||||
isHexString: isHexString,
|
||||
hexStripZeros: hexStripZeros,
|
||||
hexZeroPad: hexZeroPad,
|
||||
};
|
||||
|
||||
},{"./properties.js":21,"./throw-error":23}],19:[function(require,module,exports){
|
||||
},{"./errors":19,"./properties.js":22}],19:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var defineProperty = require('./properties').defineProperty;
|
||||
|
||||
var codes = { };
|
||||
|
||||
[
|
||||
// Unknown Error
|
||||
'UNKNOWN_ERROR',
|
||||
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
'MISSING_NEW',
|
||||
|
||||
// Invalid argument to a function:
|
||||
// - arg: The argument name that was invalid
|
||||
'INVALID_ARGUMENT'
|
||||
|
||||
].forEach(function(code) {
|
||||
defineProperty(codes, code, code);
|
||||
});
|
||||
|
||||
|
||||
defineProperty(codes, 'throwError', function(message, code, params) {
|
||||
if (!code) { code = codes.UNKNOWN_ERROR; }
|
||||
if (!params) { params = {}; }
|
||||
|
||||
var messageDetails = [];
|
||||
Object.keys(params).forEach(function(key) {
|
||||
messageDetails.push(key + '=' + JSON.stringify(params[key]));
|
||||
});
|
||||
var reason = message;
|
||||
if (messageDetails.length) {
|
||||
message += ' (' + messageDetails.join(', ') + ')';
|
||||
}
|
||||
|
||||
var error = new Error(message);
|
||||
error.reason = reason;
|
||||
error.code = code
|
||||
|
||||
Object.keys(params).forEach(function(key) {
|
||||
error[key] = params[key];
|
||||
});
|
||||
|
||||
throw error;
|
||||
});
|
||||
|
||||
defineProperty(codes, 'checkNew', function(self, kind) {
|
||||
if (!(self instanceof kind)) {
|
||||
codes.throwError('missing new', codes.MISSING_NEW, { name: kind.name });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = codes;
|
||||
|
||||
},{"./properties":22}],20:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var sha3 = require('js-sha3');
|
||||
@ -6456,7 +6549,7 @@ function keccak256(data) {
|
||||
|
||||
module.exports = keccak256;
|
||||
|
||||
},{"./convert.js":18,"js-sha3":4}],20:[function(require,module,exports){
|
||||
},{"./convert.js":18,"js-sha3":4}],21:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var convert = require('./convert');
|
||||
@ -6496,7 +6589,7 @@ function namehash(name, depth) {
|
||||
module.exports = namehash;
|
||||
|
||||
|
||||
},{"./convert":18,"./keccak256":19,"./utf8":24}],21:[function(require,module,exports){
|
||||
},{"./convert":18,"./keccak256":20,"./utf8":25}],22:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function defineProperty(object, name, value) {
|
||||
@ -6520,7 +6613,7 @@ module.exports = {
|
||||
defineProperty: defineProperty,
|
||||
};
|
||||
|
||||
},{}],22:[function(require,module,exports){
|
||||
},{}],23:[function(require,module,exports){
|
||||
//See: https://github.com/ethereum/wiki/wiki/RLP
|
||||
|
||||
var convert = require('./convert.js');
|
||||
@ -6664,7 +6757,7 @@ module.exports = {
|
||||
decode: decode,
|
||||
}
|
||||
|
||||
},{"./convert.js":18}],23:[function(require,module,exports){
|
||||
},{"./convert.js":18}],24:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function throwError(message, params) {
|
||||
@ -6677,7 +6770,7 @@ function throwError(message, params) {
|
||||
|
||||
module.exports = throwError;
|
||||
|
||||
},{}],24:[function(require,module,exports){
|
||||
},{}],25:[function(require,module,exports){
|
||||
|
||||
var convert = require('./convert.js');
|
||||
|
||||
|
4
dist/ethers-providers.min.js
vendored
4
dist/ethers-providers.min.js
vendored
File diff suppressed because one or more lines are too long
141
dist/ethers-utils.js
vendored
141
dist/ethers-utils.js
vendored
@ -5412,7 +5412,7 @@ utils.defineProperty(Coder, 'defaultCoder', new Coder());
|
||||
|
||||
module.exports = Coder
|
||||
|
||||
},{"../utils/address":20,"../utils/bignumber.js":21,"../utils/convert.js":24,"../utils/properties.js":29,"../utils/throw-error":33,"../utils/utf8.js":35}],20:[function(require,module,exports){
|
||||
},{"../utils/address":20,"../utils/bignumber.js":21,"../utils/convert.js":24,"../utils/properties.js":30,"../utils/throw-error":34,"../utils/utf8.js":36}],20:[function(require,module,exports){
|
||||
|
||||
var BN = require('bn.js');
|
||||
|
||||
@ -5538,7 +5538,7 @@ module.exports = {
|
||||
getAddress: getAddress,
|
||||
}
|
||||
|
||||
},{"./convert":24,"./keccak256":27,"./throw-error":33,"bn.js":1}],21:[function(require,module,exports){
|
||||
},{"./convert":24,"./keccak256":28,"./throw-error":34,"bn.js":1}],21:[function(require,module,exports){
|
||||
/**
|
||||
* BigNumber
|
||||
*
|
||||
@ -5689,7 +5689,7 @@ module.exports = {
|
||||
BigNumber: BigNumber
|
||||
};
|
||||
|
||||
},{"./convert":24,"./properties":29,"./throw-error":33,"bn.js":1}],22:[function(require,module,exports){
|
||||
},{"./convert":24,"./properties":30,"./throw-error":34,"bn.js":1}],22:[function(require,module,exports){
|
||||
(function (global){
|
||||
'use strict';
|
||||
|
||||
@ -5736,7 +5736,7 @@ if (crypto._weakCrypto === true) {
|
||||
module.exports = randomBytes;
|
||||
|
||||
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
|
||||
},{"./convert":24,"./properties":29}],23:[function(require,module,exports){
|
||||
},{"./convert":24,"./properties":30}],23:[function(require,module,exports){
|
||||
|
||||
var getAddress = require('./address').getAddress;
|
||||
var convert = require('./convert');
|
||||
@ -5758,14 +5758,15 @@ module.exports = {
|
||||
getContractAddress: getContractAddress,
|
||||
}
|
||||
|
||||
},{"./address":20,"./convert":24,"./keccak256":27,"./rlp":30}],24:[function(require,module,exports){
|
||||
},{"./address":20,"./convert":24,"./keccak256":28,"./rlp":31}],24:[function(require,module,exports){
|
||||
/**
|
||||
* Conversion Utilities
|
||||
*
|
||||
*/
|
||||
|
||||
var defineProperty = require('./properties.js').defineProperty;
|
||||
var throwError = require('./throw-error');
|
||||
|
||||
var errors = require('./errors');
|
||||
|
||||
function addSlice(array) {
|
||||
if (array.slice) { return array; }
|
||||
@ -5793,7 +5794,10 @@ function isArrayish(value) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function arrayify(value, name) {
|
||||
function arrayify(value) {
|
||||
if (value == null) {
|
||||
errors.throwError('cannot convert null value to array', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (value && value.toHexString) {
|
||||
value = value.toHexString();
|
||||
@ -5809,13 +5813,19 @@ function arrayify(value, name) {
|
||||
}
|
||||
|
||||
return addSlice(new Uint8Array(result));
|
||||
|
||||
} else if (typeof(value) === 'string') {
|
||||
if (value.match(/^[0-9a-fA-F]*$/)) {
|
||||
errors.throwError('hex string must have 0x prefix', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
errors.throwError('invalid hexidecimal string', errors.INVALID_ARGUMENT, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
if (isArrayish(value)) {
|
||||
return addSlice(new Uint8Array(value));
|
||||
}
|
||||
|
||||
throwError('invalid arrayify value', { name: name, input: value });
|
||||
errors.throwError('invalid arrayify value', { arg: 'value', value: value, type: typeof(value) });
|
||||
}
|
||||
|
||||
function concat(objects) {
|
||||
@ -5874,7 +5884,7 @@ function isHexString(value, length) {
|
||||
|
||||
var HexCharacters = '0123456789abcdef';
|
||||
|
||||
function hexlify(value, name) {
|
||||
function hexlify(value) {
|
||||
|
||||
if (value && value.toHexString) {
|
||||
return value.toHexString();
|
||||
@ -5882,7 +5892,7 @@ function hexlify(value, name) {
|
||||
|
||||
if (typeof(value) === 'number') {
|
||||
if (value < 0) {
|
||||
throwError('cannot hexlify negative value', { name: name, input: value });
|
||||
errors.throwError('cannot hexlify negative value', errors.INVALID_ARG, { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
var hex = '';
|
||||
@ -5915,7 +5925,7 @@ function hexlify(value, name) {
|
||||
return '0x' + result.join('');
|
||||
}
|
||||
|
||||
throwError('invalid hexlify value', { name: name, input: value });
|
||||
errors.throwError('invalid hexlify value', { arg: 'value', value: value });
|
||||
}
|
||||
|
||||
function hexStripZeros(value) {
|
||||
@ -5932,6 +5942,31 @@ function hexZeroPad(value, length) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/* @TODO: Add something like this to make slicing code easier to understand
|
||||
function hexSlice(hex, start, end) {
|
||||
hex = hexlify(hex);
|
||||
return '0x' + hex.substring(2 + start * 2, 2 + end * 2);
|
||||
}
|
||||
*/
|
||||
|
||||
function splitSignature(signature) {
|
||||
signature = arrayify(signature);
|
||||
if (signature.length !== 65) {
|
||||
throw new Error('invalid signature');
|
||||
}
|
||||
|
||||
var v = signature[64];
|
||||
if (v !== 27 && v !== 28) {
|
||||
v = 27 + (v % 2);
|
||||
}
|
||||
|
||||
return {
|
||||
r: hexlify(signature.slice(0, 32)),
|
||||
s: hexlify(signature.slice(32, 64)),
|
||||
v: v
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
arrayify: arrayify,
|
||||
isArrayish: isArrayish,
|
||||
@ -5941,13 +5976,71 @@ module.exports = {
|
||||
padZeros: padZeros,
|
||||
stripZeros: stripZeros,
|
||||
|
||||
splitSignature: splitSignature,
|
||||
|
||||
hexlify: hexlify,
|
||||
isHexString: isHexString,
|
||||
hexStripZeros: hexStripZeros,
|
||||
hexZeroPad: hexZeroPad,
|
||||
};
|
||||
|
||||
},{"./properties.js":29,"./throw-error":33}],25:[function(require,module,exports){
|
||||
},{"./errors":25,"./properties.js":30}],25:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var defineProperty = require('./properties').defineProperty;
|
||||
|
||||
var codes = { };
|
||||
|
||||
[
|
||||
// Unknown Error
|
||||
'UNKNOWN_ERROR',
|
||||
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
'MISSING_NEW',
|
||||
|
||||
// Invalid argument to a function:
|
||||
// - arg: The argument name that was invalid
|
||||
'INVALID_ARGUMENT'
|
||||
|
||||
].forEach(function(code) {
|
||||
defineProperty(codes, code, code);
|
||||
});
|
||||
|
||||
|
||||
defineProperty(codes, 'throwError', function(message, code, params) {
|
||||
if (!code) { code = codes.UNKNOWN_ERROR; }
|
||||
if (!params) { params = {}; }
|
||||
|
||||
var messageDetails = [];
|
||||
Object.keys(params).forEach(function(key) {
|
||||
messageDetails.push(key + '=' + JSON.stringify(params[key]));
|
||||
});
|
||||
var reason = message;
|
||||
if (messageDetails.length) {
|
||||
message += ' (' + messageDetails.join(', ') + ')';
|
||||
}
|
||||
|
||||
var error = new Error(message);
|
||||
error.reason = reason;
|
||||
error.code = code
|
||||
|
||||
Object.keys(params).forEach(function(key) {
|
||||
error[key] = params[key];
|
||||
});
|
||||
|
||||
throw error;
|
||||
});
|
||||
|
||||
defineProperty(codes, 'checkNew', function(self, kind) {
|
||||
if (!(self instanceof kind)) {
|
||||
codes.throwError('missing new', codes.MISSING_NEW, { name: kind.name });
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = codes;
|
||||
|
||||
},{"./properties":30}],26:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var keccak256 = require('./keccak256');
|
||||
@ -5959,7 +6052,7 @@ function id(text) {
|
||||
|
||||
module.exports = id;
|
||||
|
||||
},{"./keccak256":27,"./utf8":35}],26:[function(require,module,exports){
|
||||
},{"./keccak256":28,"./utf8":36}],27:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
// This is SUPER useful, but adds 140kb (even zipped, adds 40kb)
|
||||
@ -6029,9 +6122,11 @@ module.exports = {
|
||||
solidityPack: solidity.pack,
|
||||
solidityKeccak256: solidity.keccak256,
|
||||
soliditySha256: solidity.sha256,
|
||||
|
||||
splitSignature: convert.splitSignature,
|
||||
}
|
||||
|
||||
},{"./abi-coder":19,"./address":20,"./bignumber":21,"./contract-address":23,"./convert":24,"./id":25,"./keccak256":27,"./namehash":28,"./properties":29,"./random-bytes":22,"./rlp":30,"./sha2":31,"./solidity":32,"./units":34,"./utf8":35}],27:[function(require,module,exports){
|
||||
},{"./abi-coder":19,"./address":20,"./bignumber":21,"./contract-address":23,"./convert":24,"./id":26,"./keccak256":28,"./namehash":29,"./properties":30,"./random-bytes":22,"./rlp":31,"./sha2":32,"./solidity":33,"./units":35,"./utf8":36}],28:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var sha3 = require('js-sha3');
|
||||
@ -6045,7 +6140,7 @@ function keccak256(data) {
|
||||
|
||||
module.exports = keccak256;
|
||||
|
||||
},{"./convert.js":24,"js-sha3":16}],28:[function(require,module,exports){
|
||||
},{"./convert.js":24,"js-sha3":16}],29:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var convert = require('./convert');
|
||||
@ -6085,7 +6180,7 @@ function namehash(name, depth) {
|
||||
module.exports = namehash;
|
||||
|
||||
|
||||
},{"./convert":24,"./keccak256":27,"./utf8":35}],29:[function(require,module,exports){
|
||||
},{"./convert":24,"./keccak256":28,"./utf8":36}],30:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function defineProperty(object, name, value) {
|
||||
@ -6109,7 +6204,7 @@ module.exports = {
|
||||
defineProperty: defineProperty,
|
||||
};
|
||||
|
||||
},{}],30:[function(require,module,exports){
|
||||
},{}],31:[function(require,module,exports){
|
||||
//See: https://github.com/ethereum/wiki/wiki/RLP
|
||||
|
||||
var convert = require('./convert.js');
|
||||
@ -6253,7 +6348,7 @@ module.exports = {
|
||||
decode: decode,
|
||||
}
|
||||
|
||||
},{"./convert.js":24}],31:[function(require,module,exports){
|
||||
},{"./convert.js":24}],32:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var hash = require('hash.js');
|
||||
@ -6278,7 +6373,7 @@ module.exports = {
|
||||
createSha512: hash.sha512,
|
||||
}
|
||||
|
||||
},{"./convert.js":24,"hash.js":3}],32:[function(require,module,exports){
|
||||
},{"./convert.js":24,"hash.js":3}],33:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
var bigNumberify = require('./bignumber').bigNumberify;
|
||||
@ -6377,7 +6472,7 @@ module.exports = {
|
||||
sha256: sha256,
|
||||
}
|
||||
|
||||
},{"./address":20,"./bignumber":21,"./convert":24,"./keccak256":27,"./sha2":31,"./utf8":35}],33:[function(require,module,exports){
|
||||
},{"./address":20,"./bignumber":21,"./convert":24,"./keccak256":28,"./sha2":32,"./utf8":36}],34:[function(require,module,exports){
|
||||
'use strict';
|
||||
|
||||
function throwError(message, params) {
|
||||
@ -6390,7 +6485,7 @@ function throwError(message, params) {
|
||||
|
||||
module.exports = throwError;
|
||||
|
||||
},{}],34:[function(require,module,exports){
|
||||
},{}],35:[function(require,module,exports){
|
||||
var bigNumberify = require('./bignumber.js').bigNumberify;
|
||||
var throwError = require('./throw-error');
|
||||
|
||||
@ -6540,7 +6635,7 @@ module.exports = {
|
||||
parseUnits: parseUnits,
|
||||
}
|
||||
|
||||
},{"./bignumber.js":21,"./throw-error":33}],35:[function(require,module,exports){
|
||||
},{"./bignumber.js":21,"./throw-error":34}],36:[function(require,module,exports){
|
||||
|
||||
var convert = require('./convert.js');
|
||||
|
||||
@ -6655,5 +6750,5 @@ module.exports = {
|
||||
toUtf8String: bytesToUtf8,
|
||||
};
|
||||
|
||||
},{"./convert.js":24}]},{},[26])(26)
|
||||
},{"./convert.js":24}]},{},[27])(27)
|
||||
});
|
2
dist/ethers-utils.min.js
vendored
2
dist/ethers-utils.min.js
vendored
File diff suppressed because one or more lines are too long
188
dist/ethers-wallet.js
vendored
188
dist/ethers-wallet.js
vendored
File diff suppressed because one or more lines are too long
8
dist/ethers-wallet.min.js
vendored
8
dist/ethers-wallet.min.js
vendored
File diff suppressed because one or more lines are too long
206
dist/ethers.js
vendored
206
dist/ethers.js
vendored
File diff suppressed because one or more lines are too long
10
dist/ethers.min.js
vendored
10
dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user