Comparing version 3.0.25 to 3.0.26
{ | ||
"name": "ethers", | ||
"version": "3.0.25", | ||
"version": "3.0.26", | ||
"description": "Ethereum wallet library.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -344,6 +344,7 @@ 'use strict'; | ||
value = value.toTwos(size * 8).maskn(size * 8); | ||
//value = value.toTwos(size * 8).maskn(size * 8); | ||
if (signed) { | ||
value = value.fromTwos(size * 8).toTwos(256); | ||
} | ||
return utils.padZeros(utils.arrayify(value), 32); | ||
@@ -416,2 +417,10 @@ }, | ||
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) { | ||
@@ -424,4 +433,5 @@ errors.throwError('invalid ' + name + ' value', errors.INVALID_ARGUMENT, { | ||
} | ||
if (length === 32) { return value; } | ||
if (value.length === 32) { return value; } | ||
var result = new Uint8Array(32); | ||
@@ -428,0 +438,0 @@ result.set(value); |
Minified code
QualityThis package contains minified code. This may be harmless in some cases where minified code is included in packaged libraries, however packages on npm should not minify code.
Found 1 instance in 1 package
6
29
5
2496162
60
50005