Updated dist files.

This commit is contained in:
Richard Moore 2018-08-27 14:51:44 +02:00
parent 5efd0c1f8a
commit ae4cd90441
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
9 changed files with 76 additions and 26 deletions

@ -4,6 +4,7 @@
var Interface = require('./interface.js'); var Interface = require('./interface.js');
var utils = (function() { var utils = (function() {
var convert = require('../utils/convert.js');
return { return {
defineProperty: require('../utils/properties.js').defineProperty, defineProperty: require('../utils/properties.js').defineProperty,
@ -11,7 +12,8 @@ var utils = (function() {
bigNumberify: require('../utils/bignumber.js').bigNumberify, bigNumberify: require('../utils/bignumber.js').bigNumberify,
hexlify: require('../utils/convert.js').hexlify, arrayify: convert.arrayify,
hexlify: convert.hexlify,
}; };
})(); })();
@ -125,9 +127,12 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
}).then(function(value) { }).then(function(value) {
try { try {
if ((utils.arrayify(value).length % 32) !== 0) {
throw new Error('call exception');
}
var result = call.parse(value); var result = call.parse(value);
} catch (error) { } catch (error) {
if (value === '0x' && method.outputs.types.length > 0) { if ((value === '0x' && method.outputs.types.length > 0) || error.message === 'call exception') {
errors.throwError('call exception', errors.CALL_EXCEPTION, { errors.throwError('call exception', errors.CALL_EXCEPTION, {
address: addressOrName, address: addressOrName,
method: call.signature, method: call.signature,
@ -5191,10 +5196,11 @@ var coderNumber = function(coerceFunc, size, signed, localName) {
}); });
} }
value = value.toTwos(size * 8).maskn(size * 8); value = value.toTwos(size * 8).maskn(size * 8);
//value = value.toTwos(size * 8).maskn(size * 8);
if (signed) { if (signed) {
value = value.fromTwos(size * 8).toTwos(256); value = value.fromTwos(size * 8).toTwos(256);
} }
return utils.padZeros(utils.arrayify(value), 32); return utils.padZeros(utils.arrayify(value), 32);
}, },
decode: function(data, offset) { decode: function(data, offset) {
@ -5262,6 +5268,14 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
encode: function(value) { encode: function(value) {
try { try {
value = utils.arrayify(value); value = utils.arrayify(value);
// @TODO: In next major change, the value.length MUST equal the
// length, but that is a backward-incompatible change, so here
// we just check for things that can cause problems.
if (value.length > 32) {
throw new Error('too many bytes for field');
}
} catch (error) { } catch (error) {
errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, {
arg: localName, arg: localName,
@ -5269,7 +5283,8 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
value: error.value value: error.value
}); });
} }
if (length === 32) { return value; }
if (value.length === 32) { return value; }
var result = new Uint8Array(32); var result = new Uint8Array(32);
result.set(value); result.set(value);

File diff suppressed because one or more lines are too long

14
dist/ethers-utils.js vendored

@ -5398,10 +5398,11 @@ var coderNumber = function(coerceFunc, size, signed, localName) {
}); });
} }
value = value.toTwos(size * 8).maskn(size * 8); value = value.toTwos(size * 8).maskn(size * 8);
//value = value.toTwos(size * 8).maskn(size * 8);
if (signed) { if (signed) {
value = value.fromTwos(size * 8).toTwos(256); value = value.fromTwos(size * 8).toTwos(256);
} }
return utils.padZeros(utils.arrayify(value), 32); return utils.padZeros(utils.arrayify(value), 32);
}, },
decode: function(data, offset) { decode: function(data, offset) {
@ -5469,6 +5470,14 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
encode: function(value) { encode: function(value) {
try { try {
value = utils.arrayify(value); value = utils.arrayify(value);
// @TODO: In next major change, the value.length MUST equal the
// length, but that is a backward-incompatible change, so here
// we just check for things that can cause problems.
if (value.length > 32) {
throw new Error('too many bytes for field');
}
} catch (error) { } catch (error) {
errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, {
arg: localName, arg: localName,
@ -5476,7 +5485,8 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
value: error.value value: error.value
}); });
} }
if (length === 32) { return value; }
if (value.length === 32) { return value; }
var result = new Uint8Array(32); var result = new Uint8Array(32);
result.set(value); result.set(value);

File diff suppressed because one or more lines are too long

14
dist/ethers-wallet.js vendored

@ -9483,10 +9483,11 @@ var coderNumber = function(coerceFunc, size, signed, localName) {
}); });
} }
value = value.toTwos(size * 8).maskn(size * 8); value = value.toTwos(size * 8).maskn(size * 8);
//value = value.toTwos(size * 8).maskn(size * 8);
if (signed) { if (signed) {
value = value.fromTwos(size * 8).toTwos(256); value = value.fromTwos(size * 8).toTwos(256);
} }
return utils.padZeros(utils.arrayify(value), 32); return utils.padZeros(utils.arrayify(value), 32);
}, },
decode: function(data, offset) { decode: function(data, offset) {
@ -9554,6 +9555,14 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
encode: function(value) { encode: function(value) {
try { try {
value = utils.arrayify(value); value = utils.arrayify(value);
// @TODO: In next major change, the value.length MUST equal the
// length, but that is a backward-incompatible change, so here
// we just check for things that can cause problems.
if (value.length > 32) {
throw new Error('too many bytes for field');
}
} catch (error) { } catch (error) {
errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, {
arg: localName, arg: localName,
@ -9561,7 +9570,8 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
value: error.value value: error.value
}); });
} }
if (length === 32) { return value; }
if (value.length === 32) { return value; }
var result = new Uint8Array(32); var result = new Uint8Array(32);
result.set(value); result.set(value);

File diff suppressed because one or more lines are too long

25
dist/ethers.js vendored

@ -4,6 +4,7 @@
var Interface = require('./interface.js'); var Interface = require('./interface.js');
var utils = (function() { var utils = (function() {
var convert = require('../utils/convert.js');
return { return {
defineProperty: require('../utils/properties.js').defineProperty, defineProperty: require('../utils/properties.js').defineProperty,
@ -11,7 +12,8 @@ var utils = (function() {
bigNumberify: require('../utils/bignumber.js').bigNumberify, bigNumberify: require('../utils/bignumber.js').bigNumberify,
hexlify: require('../utils/convert.js').hexlify, arrayify: convert.arrayify,
hexlify: convert.hexlify,
}; };
})(); })();
@ -125,9 +127,12 @@ function Contract(addressOrName, contractInterface, signerOrProvider) {
}).then(function(value) { }).then(function(value) {
try { try {
if ((utils.arrayify(value).length % 32) !== 0) {
throw new Error('call exception');
}
var result = call.parse(value); var result = call.parse(value);
} catch (error) { } catch (error) {
if (value === '0x' && method.outputs.types.length > 0) { if ((value === '0x' && method.outputs.types.length > 0) || error.message === 'call exception') {
errors.throwError('call exception', errors.CALL_EXCEPTION, { errors.throwError('call exception', errors.CALL_EXCEPTION, {
address: addressOrName, address: addressOrName,
method: call.signature, method: call.signature,
@ -9922,7 +9927,7 @@ uuid.unparse = unparse;
module.exports = uuid; module.exports = uuid;
},{"./rng":44}],46:[function(require,module,exports){ },{"./rng":44}],46:[function(require,module,exports){
module.exports={"version":"3.0.25"} module.exports={"version":"3.0.27"}
},{}],47:[function(require,module,exports){ },{}],47:[function(require,module,exports){
'use strict'; 'use strict';
@ -12365,10 +12370,11 @@ var coderNumber = function(coerceFunc, size, signed, localName) {
}); });
} }
value = value.toTwos(size * 8).maskn(size * 8); value = value.toTwos(size * 8).maskn(size * 8);
//value = value.toTwos(size * 8).maskn(size * 8);
if (signed) { if (signed) {
value = value.fromTwos(size * 8).toTwos(256); value = value.fromTwos(size * 8).toTwos(256);
} }
return utils.padZeros(utils.arrayify(value), 32); return utils.padZeros(utils.arrayify(value), 32);
}, },
decode: function(data, offset) { decode: function(data, offset) {
@ -12436,6 +12442,14 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
encode: function(value) { encode: function(value) {
try { try {
value = utils.arrayify(value); value = utils.arrayify(value);
// @TODO: In next major change, the value.length MUST equal the
// length, but that is a backward-incompatible change, so here
// we just check for things that can cause problems.
if (value.length > 32) {
throw new Error('too many bytes for field');
}
} catch (error) { } catch (error) {
errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, {
arg: localName, arg: localName,
@ -12443,7 +12457,8 @@ var coderFixedBytes = function(coerceFunc, length, localName) {
value: error.value value: error.value
}); });
} }
if (length === 32) { return value; }
if (value.length === 32) { return value; }
var result = new Uint8Array(32); var result = new Uint8Array(32);
result.set(value); result.set(value);

10
dist/ethers.min.js vendored

File diff suppressed because one or more lines are too long

@ -1,6 +1,6 @@
{ {
"name": "ethers", "name": "ethers",
"version": "3.0.26", "version": "3.0.27",
"description": "Ethereum wallet library.", "description": "Ethereum wallet library.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {