Updated dist files.

This commit is contained in:
Richard Moore 2020-01-11 04:18:28 -05:00
parent bb9aa808a0
commit 10943fc3ef
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
49 changed files with 517 additions and 375 deletions

@ -3,6 +3,16 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.167 (2020-01-11 04:16)
-----------------------------------------
- Fixed testcases for provider changes. ([90ed07c](https://github.com/ethers-io/ethers.js/commit/90ed07c74e7230ea0f02288b140d497d8b9779e0))
- Add support for legacy flat signatures with recid instead of normalized v. ([245cd0e](https://github.com/ethers-io/ethers.js/commit/245cd0e48e07eef35f5bf45ee7fe5ed5ef31338a))
- Fix TransactionResponse to have chainId instead of legacy networkId. ([#700](https://github.com/ethers-io/ethers.js/issues/700); [72b3bc9](https://github.com/ethers-io/ethers.js/commit/72b3bc9909074893038c768f3da1564ed96a6a20))
- Fixed splitSignature computing wrong v for BytesLike. ([#700](https://github.com/ethers-io/ethers.js/issues/700); [4151c0e](https://github.com/ethers-io/ethers.js/commit/4151c0eacd22287e2369a8656ffa00359db6f84b))
- Added dist files for hardware-wallets. ([c846649](https://github.com/ethers-io/ethers.js/commit/c84664953d2f50ee0d704a8aa18fe6c08668dabb))
- Browser support (with dist files) for Ledger. ([6f7fbf3](https://github.com/ethers-io/ethers.js/commit/6f7fbf3858c82417933a5e5595a919c0ec0487c7))
ethers/v5.0.0-beta.166 (2020-01-10 03:09)
-----------------------------------------

@ -1 +1 @@
export declare const version = "bytes/5.0.0-beta.135";
export declare const version = "bytes/5.0.0-beta.136";

@ -1 +1 @@
export const version = "bytes/5.0.0-beta.135";
export const version = "bytes/5.0.0-beta.136";

@ -266,16 +266,21 @@ export function splitSignature(signature) {
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r and s
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
// Reduce v to the canonical 27 or 28
result.v = bytes[64];
if (result.v !== 27 && result.v !== 28) {
result.v = 27 + (result.v % 2);
}
// Compute recoveryParam from v
result.recoveryParam = (result.v - 27);
result.recoveryParam = 1 - (result.v % 2);
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
@ -288,75 +293,58 @@ export function splitSignature(signature) {
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// Normalize v into a canonical 27 or 28
if (result.v != null && !(result.v == 27 || result.v == 28)) {
result.v = 27 + (result.v % 2);
}
// Populate a missing v or recoveryParam if possible
if (result.recoveryParam == null && result.v != null) {
result.recoveryParam = 1 - (result.v % 2);
}
else if (result.recoveryParam != null && result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam != null && result.v != null) {
if (result.v !== 27 + result.recoveryParam) {
logger.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
}
}
// Make sure r and s are padded properly
if (result.r != null) {
result.r = hexZeroPad(result.r, 32);
}
if (result.s != null) {
result.s = hexZeroPad(result.s, 32);
}
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
result._vs = hexZeroPad(result._vs, 32);
if (result._vs.length > 66) {
logger.throwArgumentError("signature _vs overflow", "signature", signature);
}
const vs = arrayify(result._vs);
const vs = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs);
// Set or check the recid
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
const v = 27 + result.recoveryParam;
// Use _vs to compute s
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs[0] &= 0x7f;
const s = hexlify(vs);
// Check _vs aggress with other parameters
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
result.v = v;
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else if (result.v !== v) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
if (recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
// After all populating, both v and recoveryParam are still missing...
if (result.v == null && result.recoveryParam == null) {
logger.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
// Check for canonical v
if (result.v !== 27 && result.v !== 28) {
logger.throwArgumentError("signature v not canonical", "signature", signature);
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
// Check that r and s are in range
if (result.r.length > 66 || result.s.length > 66) {
logger.throwArgumentError("signature overflow r or s", "signature", signature);
}
if (result._vs == null) {
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
const vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
@ -364,7 +352,19 @@ export function splitSignature(signature) {
if (result.recoveryParam) {
vs[0] |= 0x80;
}
result._vs = hexlify(vs);
const _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;

@ -1 +1 @@
export declare const version = "bytes/5.0.0-beta.135";
export declare const version = "bytes/5.0.0-beta.136";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bytes/5.0.0-beta.135";
exports.version = "bytes/5.0.0-beta.136";

@ -281,16 +281,21 @@ function splitSignature(signature) {
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r and s
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
// Reduce v to the canonical 27 or 28
result.v = bytes[64];
if (result.v !== 27 && result.v !== 28) {
result.v = 27 + (result.v % 2);
}
// Compute recoveryParam from v
result.recoveryParam = (result.v - 27);
result.recoveryParam = 1 - (result.v % 2);
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
@ -303,75 +308,58 @@ function splitSignature(signature) {
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// Normalize v into a canonical 27 or 28
if (result.v != null && !(result.v == 27 || result.v == 28)) {
result.v = 27 + (result.v % 2);
}
// Populate a missing v or recoveryParam if possible
if (result.recoveryParam == null && result.v != null) {
result.recoveryParam = 1 - (result.v % 2);
}
else if (result.recoveryParam != null && result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam != null && result.v != null) {
if (result.v !== 27 + result.recoveryParam) {
logger.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
}
}
// Make sure r and s are padded properly
if (result.r != null) {
result.r = hexZeroPad(result.r, 32);
}
if (result.s != null) {
result.s = hexZeroPad(result.s, 32);
}
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
result._vs = hexZeroPad(result._vs, 32);
if (result._vs.length > 66) {
logger.throwArgumentError("signature _vs overflow", "signature", signature);
var vs_1 = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs_1);
// Set or check the recid
var recoveryParam = ((vs_1[0] >= 128) ? 1 : 0);
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
var vs = arrayify(result._vs);
var recoveryParam = ((vs[0] >= 128) ? 1 : 0);
var v = 27 + result.recoveryParam;
// Use _vs to compute s
vs[0] &= 0x7f;
var s = hexlify(vs);
// Check _vs aggress with other parameters
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs_1[0] &= 0x7f;
var s = hexlify(vs_1);
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
result.v = v;
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else if (result.v !== v) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
if (recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
// After all populating, both v and recoveryParam are still missing...
if (result.v == null && result.recoveryParam == null) {
logger.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
// Check for canonical v
if (result.v !== 27 && result.v !== 28) {
logger.throwArgumentError("signature v not canonical", "signature", signature);
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
// Check that r and s are in range
if (result.r.length > 66 || result.s.length > 66) {
logger.throwArgumentError("signature overflow r or s", "signature", signature);
}
if (result._vs == null) {
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
var vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
@ -379,7 +367,19 @@ function splitSignature(signature) {
if (result.recoveryParam) {
vs[0] |= 0x80;
}
result._vs = hexlify(vs);
var _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;

@ -25,7 +25,7 @@
"build": "tsc -p ./tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x921a087d89b180890fffb807f9dccfba9d7b9f166af98dd665e16533fc0e54ef",
"tarballHash": "0xb6ffce56dff4aca505d1e9c305fa32b0c480a7bce7699836efd237c205862f05",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.135"
"version": "5.0.0-beta.136"
}

@ -1 +1 @@
export const version = "bytes/5.0.0-beta.135";
export const version = "bytes/5.0.0-beta.136";

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -3725,7 +3725,7 @@ var lib_esm = /*#__PURE__*/Object.freeze({
Logger: Logger
});
const version$1 = "bytes/5.0.0-beta.135";
const version$1 = "bytes/5.0.0-beta.136";
"use strict";
const logger = new Logger(version$1);
@ -3993,16 +3993,21 @@ function splitSignature(signature) {
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r and s
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
// Reduce v to the canonical 27 or 28
result.v = bytes[64];
if (result.v !== 27 && result.v !== 28) {
result.v = 27 + (result.v % 2);
}
// Compute recoveryParam from v
result.recoveryParam = (result.v - 27);
result.recoveryParam = 1 - (result.v % 2);
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
@ -4015,75 +4020,58 @@ function splitSignature(signature) {
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// Normalize v into a canonical 27 or 28
if (result.v != null && !(result.v == 27 || result.v == 28)) {
result.v = 27 + (result.v % 2);
}
// Populate a missing v or recoveryParam if possible
if (result.recoveryParam == null && result.v != null) {
result.recoveryParam = 1 - (result.v % 2);
}
else if (result.recoveryParam != null && result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam != null && result.v != null) {
if (result.v !== 27 + result.recoveryParam) {
logger.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
}
}
// Make sure r and s are padded properly
if (result.r != null) {
result.r = hexZeroPad(result.r, 32);
}
if (result.s != null) {
result.s = hexZeroPad(result.s, 32);
}
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
result._vs = hexZeroPad(result._vs, 32);
if (result._vs.length > 66) {
logger.throwArgumentError("signature _vs overflow", "signature", signature);
}
const vs = arrayify(result._vs);
const vs = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs);
// Set or check the recid
const recoveryParam = ((vs[0] >= 128) ? 1 : 0);
const v = 27 + result.recoveryParam;
// Use _vs to compute s
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs[0] &= 0x7f;
const s = hexlify(vs);
// Check _vs aggress with other parameters
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
result.v = v;
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else if (result.v !== v) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
if (recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
// After all populating, both v and recoveryParam are still missing...
if (result.v == null && result.recoveryParam == null) {
logger.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
// Check for canonical v
if (result.v !== 27 && result.v !== 28) {
logger.throwArgumentError("signature v not canonical", "signature", signature);
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
// Check that r and s are in range
if (result.r.length > 66 || result.s.length > 66) {
logger.throwArgumentError("signature overflow r or s", "signature", signature);
}
if (result._vs == null) {
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
const vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
@ -4091,7 +4079,19 @@ function splitSignature(signature) {
if (result.recoveryParam) {
vs[0] |= 0x80;
}
result._vs = hexlify(vs);
const _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;
@ -16092,7 +16092,7 @@ function poll(func, options) {
});
}
const version$j = "providers/5.0.0-beta.147";
const version$j = "providers/5.0.0-beta.148";
"use strict";
const logger$m = new Logger(version$j);
@ -16355,25 +16355,34 @@ class Formatter {
}
*/
let result = Formatter.check(this.formats.transaction, transaction);
let networkId = transaction.networkId;
if (transaction.chainId != null) {
let chainId = transaction.chainId;
if (isHexString(chainId)) {
chainId = BigNumber.from(chainId).toNumber();
}
result.chainId = chainId;
}
else {
let chainId = transaction.networkId;
// geth-etc returns chainId
if (transaction.chainId != null && networkId == null && result.v == null) {
networkId = transaction.chainId;
if (chainId == null && result.v == null) {
chainId = transaction.chainId;
}
if (isHexString(networkId)) {
networkId = BigNumber.from(networkId).toNumber();
if (isHexString(chainId)) {
chainId = BigNumber.from(chainId).toNumber();
}
if (typeof (networkId) !== "number" && result.v != null) {
networkId = (result.v - 35) / 2;
if (networkId < 0) {
networkId = 0;
if (typeof (chainId) !== "number" && result.v != null) {
chainId = (result.v - 35) / 2;
if (chainId < 0) {
chainId = 0;
}
networkId = parseInt(networkId);
chainId = parseInt(chainId);
}
if (typeof (networkId) !== "number") {
networkId = 0;
if (typeof (chainId) !== "number") {
chainId = 0;
}
result.chainId = chainId;
}
result.networkId = networkId;
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") {
result.blockHash = null;
@ -18993,7 +19002,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Indexed: Indexed
});
const version$l = "ethers/5.0.0-beta.166";
const version$l = "ethers/5.0.0-beta.167";
"use strict";
const errors = Logger.errors;

File diff suppressed because one or more lines are too long

@ -3758,7 +3758,7 @@
var _version$2 = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bytes/5.0.0-beta.135";
exports.version = "bytes/5.0.0-beta.136";
});
var _version$3 = unwrapExports(_version$2);
@ -4048,16 +4048,21 @@
if (bytes.length !== 65) {
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
}
// Get the r and s
// Get the r, s and v
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
// Reduce v to the canonical 27 or 28
result.v = bytes[64];
if (result.v !== 27 && result.v !== 28) {
result.v = 27 + (result.v % 2);
}
// Compute recoveryParam from v
result.recoveryParam = (result.v - 27);
result.recoveryParam = 1 - (result.v % 2);
// Allow a recid to be used as the v
if (result.v < 27) {
if (result.v === 0 || result.v === 1) {
result.v += 27;
}
else {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
@ -4070,75 +4075,58 @@
result.v = signature.v;
result.recoveryParam = signature.recoveryParam;
result._vs = signature._vs;
// Normalize v into a canonical 27 or 28
if (result.v != null && !(result.v == 27 || result.v == 28)) {
result.v = 27 + (result.v % 2);
}
// Populate a missing v or recoveryParam if possible
if (result.recoveryParam == null && result.v != null) {
result.recoveryParam = 1 - (result.v % 2);
}
else if (result.recoveryParam != null && result.v == null) {
result.v = 27 + result.recoveryParam;
}
else if (result.recoveryParam != null && result.v != null) {
if (result.v !== 27 + result.recoveryParam) {
logger.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
}
}
// Make sure r and s are padded properly
if (result.r != null) {
result.r = hexZeroPad(result.r, 32);
}
if (result.s != null) {
result.s = hexZeroPad(result.s, 32);
}
// If the _vs is available, use it to populate missing s, v and recoveryParam
// and verify non-missing s, v and recoveryParam
if (result._vs != null) {
result._vs = hexZeroPad(result._vs, 32);
if (result._vs.length > 66) {
logger.throwArgumentError("signature _vs overflow", "signature", signature);
var vs_1 = zeroPad(arrayify(result._vs), 32);
result._vs = hexlify(vs_1);
// Set or check the recid
var recoveryParam = ((vs_1[0] >= 128) ? 1 : 0);
if (result.recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
var vs = arrayify(result._vs);
var recoveryParam = ((vs[0] >= 128) ? 1 : 0);
var v = 27 + result.recoveryParam;
// Use _vs to compute s
vs[0] &= 0x7f;
var s = hexlify(vs);
// Check _vs aggress with other parameters
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
}
// Set or check the s
vs_1[0] &= 0x7f;
var s = hexlify(vs_1);
if (result.s == null) {
result.s = s;
}
else if (result.s !== s) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
}
// Use recid and v to populate each other
if (result.recoveryParam == null) {
if (result.v == null) {
result.v = v;
logger.throwArgumentError("signature missing v and recoveryParam", "signature", signature);
}
else if (result.v !== v) {
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
}
if (recoveryParam == null) {
result.recoveryParam = recoveryParam;
}
else if (result.recoveryParam !== recoveryParam) {
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
else {
result.recoveryParam = 1 - (result.v % 2);
}
}
// After all populating, both v and recoveryParam are still missing...
if (result.v == null && result.recoveryParam == null) {
logger.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
else {
if (result.v == null) {
result.v = 27 + result.recoveryParam;
}
// Check for canonical v
if (result.v !== 27 && result.v !== 28) {
logger.throwArgumentError("signature v not canonical", "signature", signature);
else if (result.recoveryParam !== (1 - (result.v % 2))) {
logger.throwArgumentError("signature recoveryParam mismatch v", "signature", signature);
}
// Check that r and s are in range
if (result.r.length > 66 || result.s.length > 66) {
logger.throwArgumentError("signature overflow r or s", "signature", signature);
}
if (result._vs == null) {
if (result.r == null || !isHexString(result.r)) {
logger.throwArgumentError("signature missing or invalid r", "signature", signature);
}
else {
result.r = hexZeroPad(result.r, 32);
}
if (result.s == null || !isHexString(result.s)) {
logger.throwArgumentError("signature missing or invalid s", "signature", signature);
}
else {
result.s = hexZeroPad(result.s, 32);
}
var vs = arrayify(result.s);
if (vs[0] >= 128) {
logger.throwArgumentError("signature s out of range", "signature", signature);
@ -4146,7 +4134,19 @@
if (result.recoveryParam) {
vs[0] |= 0x80;
}
result._vs = hexlify(vs);
var _vs = hexlify(vs);
if (result._vs) {
if (!isHexString(result._vs)) {
logger.throwArgumentError("signature invalid _vs", "signature", signature);
}
result._vs = hexZeroPad(result._vs, 32);
}
// Set or check the _vs
if (result._vs == null) {
result._vs = _vs;
}
else if (result._vs !== _vs) {
logger.throwArgumentError("signature _vs mismatch v and s", "signature", signature);
}
}
return result;
@ -17529,7 +17529,7 @@
var _version$G = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.147";
exports.version = "providers/5.0.0-beta.148";
});
var _version$H = unwrapExports(_version$G);
@ -17808,25 +17808,34 @@
}
*/
var result = Formatter.check(this.formats.transaction, transaction);
var networkId = transaction.networkId;
if (transaction.chainId != null) {
var chainId = transaction.chainId;
if (lib$1.isHexString(chainId)) {
chainId = lib$2.BigNumber.from(chainId).toNumber();
}
result.chainId = chainId;
}
else {
var chainId = transaction.networkId;
// geth-etc returns chainId
if (transaction.chainId != null && networkId == null && result.v == null) {
networkId = transaction.chainId;
if (chainId == null && result.v == null) {
chainId = transaction.chainId;
}
if (lib$1.isHexString(networkId)) {
networkId = lib$2.BigNumber.from(networkId).toNumber();
if (lib$1.isHexString(chainId)) {
chainId = lib$2.BigNumber.from(chainId).toNumber();
}
if (typeof (networkId) !== "number" && result.v != null) {
networkId = (result.v - 35) / 2;
if (networkId < 0) {
networkId = 0;
if (typeof (chainId) !== "number" && result.v != null) {
chainId = (result.v - 35) / 2;
if (chainId < 0) {
chainId = 0;
}
networkId = parseInt(networkId);
chainId = parseInt(chainId);
}
if (typeof (networkId) !== "number") {
networkId = 0;
if (typeof (chainId) !== "number") {
chainId = 0;
}
result.chainId = chainId;
}
result.networkId = networkId;
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") {
result.blockHash = null;
@ -21436,7 +21445,7 @@
var _version$K = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.166";
exports.version = "ethers/5.0.0-beta.167";
});
var _version$L = unwrapExports(_version$K);

File diff suppressed because one or more lines are too long

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.166";
export declare const version = "ethers/5.0.0-beta.167";

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.166";
export const version = "ethers/5.0.0-beta.167";

@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.166";
export declare const version = "ethers/5.0.0-beta.167";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.0-beta.166";
exports.version = "ethers/5.0.0-beta.167";

@ -52,7 +52,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xb7dbc30578bf8ebfd3a12a7a3a53ffc78171554bd4f49cf485d810f6a9e7ae91",
"tarballHash": "0x5b499981d1a9635745d062f0e034c508fd9609cb46b6a3e479641c8018761de2",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.166"
"version": "5.0.0-beta.167"
}

@ -1 +1 @@
export const version = "ethers/5.0.0-beta.166";
export const version = "ethers/5.0.0-beta.167";

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.147";
export declare const version = "providers/5.0.0-beta.148";

@ -1 +1 @@
export const version = "providers/5.0.0-beta.147";
export const version = "providers/5.0.0-beta.148";

@ -267,25 +267,34 @@ export class Formatter {
}
*/
let result = Formatter.check(this.formats.transaction, transaction);
let networkId = transaction.networkId;
if (transaction.chainId != null) {
let chainId = transaction.chainId;
if (isHexString(chainId)) {
chainId = BigNumber.from(chainId).toNumber();
}
result.chainId = chainId;
}
else {
let chainId = transaction.networkId;
// geth-etc returns chainId
if (transaction.chainId != null && networkId == null && result.v == null) {
networkId = transaction.chainId;
if (chainId == null && result.v == null) {
chainId = transaction.chainId;
}
if (isHexString(networkId)) {
networkId = BigNumber.from(networkId).toNumber();
if (isHexString(chainId)) {
chainId = BigNumber.from(chainId).toNumber();
}
if (typeof (networkId) !== "number" && result.v != null) {
networkId = (result.v - 35) / 2;
if (networkId < 0) {
networkId = 0;
if (typeof (chainId) !== "number" && result.v != null) {
chainId = (result.v - 35) / 2;
if (chainId < 0) {
chainId = 0;
}
networkId = parseInt(networkId);
chainId = parseInt(chainId);
}
if (typeof (networkId) !== "number") {
networkId = 0;
if (typeof (chainId) !== "number") {
chainId = 0;
}
result.chainId = chainId;
}
result.networkId = networkId;
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") {
result.blockHash = null;

@ -1 +1 @@
export declare const version = "providers/5.0.0-beta.147";
export declare const version = "providers/5.0.0-beta.148";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "providers/5.0.0-beta.147";
exports.version = "providers/5.0.0-beta.148";

@ -270,25 +270,34 @@ var Formatter = /** @class */ (function () {
}
*/
var result = Formatter.check(this.formats.transaction, transaction);
var networkId = transaction.networkId;
if (transaction.chainId != null) {
var chainId = transaction.chainId;
if (bytes_1.isHexString(chainId)) {
chainId = bignumber_1.BigNumber.from(chainId).toNumber();
}
result.chainId = chainId;
}
else {
var chainId = transaction.networkId;
// geth-etc returns chainId
if (transaction.chainId != null && networkId == null && result.v == null) {
networkId = transaction.chainId;
if (chainId == null && result.v == null) {
chainId = transaction.chainId;
}
if (bytes_1.isHexString(networkId)) {
networkId = bignumber_1.BigNumber.from(networkId).toNumber();
if (bytes_1.isHexString(chainId)) {
chainId = bignumber_1.BigNumber.from(chainId).toNumber();
}
if (typeof (networkId) !== "number" && result.v != null) {
networkId = (result.v - 35) / 2;
if (networkId < 0) {
networkId = 0;
if (typeof (chainId) !== "number" && result.v != null) {
chainId = (result.v - 35) / 2;
if (chainId < 0) {
chainId = 0;
}
networkId = parseInt(networkId);
chainId = parseInt(chainId);
}
if (typeof (networkId) !== "number") {
networkId = 0;
if (typeof (chainId) !== "number") {
chainId = 0;
}
result.chainId = chainId;
}
result.networkId = networkId;
// 0x0000... should actually be null
if (result.blockHash && result.blockHash.replace(/0/g, "") === "x") {
result.blockHash = null;

@ -44,7 +44,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x9b46000808071da2e4e6c5028459d397beff243d2f8a69b76e3a2275f91402b0",
"tarballHash": "0xc0f145d754fd5b9accf6a3f90d6834f0be2eb03fcc995e7f31aeb8976ad88869",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.147"
"version": "5.0.0-beta.148"
}

@ -1 +1 @@
export const version = "providers/5.0.0-beta.147";
export const version = "providers/5.0.0-beta.148";

@ -1 +1 @@
export declare const version = "testcases/5.0.0-beta.136";
export declare const version = "testcases/5.0.0-beta.137";

@ -1 +1 @@
export const version = "testcases/5.0.0-beta.136";
export const version = "testcases/5.0.0-beta.137";

@ -55,6 +55,21 @@ export declare module TestCase {
finney_format?: string;
satoshi_format?: string;
};
type SignedTransaction = {
name: string;
accountAddress: string;
privateKey: string;
signedTransaction: string;
unsignedTransaction: string;
signedTransactionChainId5: string;
unsignedTransactionChainId5: string;
nonce: number;
gasLimit: string;
gasPrice: string;
to: string;
value: string;
data: string;
};
}
export declare function saveTests(tag: string, data: any): void;
export declare function loadTests(tag: string): any;

@ -1 +1 @@
export declare const version = "testcases/5.0.0-beta.136";
export declare const version = "testcases/5.0.0-beta.137";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "testcases/5.0.0-beta.136";
exports.version = "testcases/5.0.0-beta.137";

@ -55,6 +55,21 @@ export declare module TestCase {
finney_format?: string;
satoshi_format?: string;
};
type SignedTransaction = {
name: string;
accountAddress: string;
privateKey: string;
signedTransaction: string;
unsignedTransaction: string;
signedTransactionChainId5: string;
unsignedTransactionChainId5: string;
nonce: number;
gasLimit: string;
gasPrice: string;
to: string;
value: string;
data: string;
};
}
export declare function saveTests(tag: string, data: any): void;
export declare function loadTests(tag: string): any;

@ -38,7 +38,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x94352bec3380a7007a97eb4c344dbd5758036941cc0e594d83132b14f32b7f56",
"tarballHash": "0x9a075980616044072f4e966cda0801c49577b991cb14c3d24960090b1b6e970a",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.136"
"version": "5.0.0-beta.137"
}

@ -1 +1 @@
export const version = "testcases/5.0.0-beta.136";
export const version = "testcases/5.0.0-beta.137";

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.145";
export declare const version = "tests/5.0.0-beta.146";

@ -1 +1 @@
export const version = "tests/5.0.0-beta.145";
export const version = "tests/5.0.0-beta.146";

@ -39,7 +39,7 @@ const blockchainData = {
v: 38,
creates: null,
raw: "0xf8d2808504a817c8008303d090946fc21092da55b392b045ed78f4732bff3c580e2c880186cc6acd4b0000b864f2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f000000000000000000000000000000000000000000000000000026a01e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265a0269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54",
networkId: 1
chainId: 1
},
transactionReceipt: {
blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566",
@ -405,6 +405,9 @@ function testProvider(providerName, networkName) {
}
["default", "homestead", "ropsten", "rinkeby", "kovan", "goerli"].forEach(function (networkName) {
["getDefaultProvider", "AlchemyProvider", "CloudflareProvider", "InfuraProvider", "EtherscanProvider", "NodesmithProvider", "Web3Provider"].forEach(function (providerName) {
if (providerName === "NodesmithProvider") {
return;
}
if (networkName === "goerli" && providerName === "AlchemyProvider") {
return;
}

@ -387,3 +387,33 @@ describe("Test nameprep", function () {
});
});
});
describe("Test Signature Manipulation", function () {
const tests = loadTests("transactions");
tests.forEach((test) => {
it("autofills partial signatures - " + test.name, function () {
const address = ethers.utils.getAddress(test.accountAddress);
const hash = ethers.utils.keccak256(test.unsignedTransaction);
const data = ethers.utils.RLP.decode(test.signedTransaction);
const s = data.pop(), r = data.pop(), v = parseInt(data.pop().substring(2), 16);
const sig = ethers.utils.splitSignature({ r: r, s: s, v: v });
{
const addr = ethers.utils.recoverAddress(hash, {
r: r, s: s, v: v
});
assert.equal(addr, address, "Using r, s and v");
}
{
const addr = ethers.utils.recoverAddress(hash, {
r: sig.r, _vs: sig._vs
});
assert.equal(addr, address, "Using r, _vs");
}
{
const addr = ethers.utils.recoverAddress(hash, {
r: sig.r, s: sig.s, recoveryParam: sig.recoveryParam
});
assert.equal(addr, address, "Using r, s and recoveryParam");
}
});
});
});

@ -182,11 +182,11 @@ describe('Test Signing Messages', function () {
});
describe("Serialize Transactions", function () {
it("allows odd-length numeric values", function () {
const result = ethers.utils.serializeTransaction({
ethers.utils.serializeTransaction({
gasLimit: "0x1",
gasPrice: "0x1",
value: "0x1"
});
console.log(result);
//console.log(result);
});
});

@ -1 +1 @@
export declare const version = "tests/5.0.0-beta.145";
export declare const version = "tests/5.0.0-beta.146";

@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "tests/5.0.0-beta.145";
exports.version = "tests/5.0.0-beta.146";

@ -43,7 +43,7 @@ var blockchainData = {
v: 38,
creates: null,
raw: "0xf8d2808504a817c8008303d090946fc21092da55b392b045ed78f4732bff3c580e2c880186cc6acd4b0000b864f2c298be000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000067269636d6f6f000000000000000000000000000000000000000000000000000026a01e5605197a03e3f0a168f14749168dfeefc44c9228312dacbffdcbbb13263265a0269c3e5b3558267ad91b0a887d51f9f10098771c67b82ea6cb74f29638754f54",
networkId: 1
chainId: 1
},
transactionReceipt: {
blockHash: "0x36b4af7f0538559e581c8588f16477df0f676439ea67fe8d7a2ae4abb20e2566",
@ -409,6 +409,9 @@ function testProvider(providerName, networkName) {
}
["default", "homestead", "ropsten", "rinkeby", "kovan", "goerli"].forEach(function (networkName) {
["getDefaultProvider", "AlchemyProvider", "CloudflareProvider", "InfuraProvider", "EtherscanProvider", "NodesmithProvider", "Web3Provider"].forEach(function (providerName) {
if (providerName === "NodesmithProvider") {
return;
}
if (networkName === "goerli" && providerName === "AlchemyProvider") {
return;
}

@ -398,3 +398,33 @@ describe("Test nameprep", function () {
});
});
});
describe("Test Signature Manipulation", function () {
var tests = testcases_1.loadTests("transactions");
tests.forEach(function (test) {
it("autofills partial signatures - " + test.name, function () {
var address = ethers_1.ethers.utils.getAddress(test.accountAddress);
var hash = ethers_1.ethers.utils.keccak256(test.unsignedTransaction);
var data = ethers_1.ethers.utils.RLP.decode(test.signedTransaction);
var s = data.pop(), r = data.pop(), v = parseInt(data.pop().substring(2), 16);
var sig = ethers_1.ethers.utils.splitSignature({ r: r, s: s, v: v });
{
var addr = ethers_1.ethers.utils.recoverAddress(hash, {
r: r, s: s, v: v
});
assert_1.default.equal(addr, address, "Using r, s and v");
}
{
var addr = ethers_1.ethers.utils.recoverAddress(hash, {
r: sig.r, _vs: sig._vs
});
assert_1.default.equal(addr, address, "Using r, _vs");
}
{
var addr = ethers_1.ethers.utils.recoverAddress(hash, {
r: sig.r, s: sig.s, recoveryParam: sig.recoveryParam
});
assert_1.default.equal(addr, address, "Using r, s and recoveryParam");
}
});
});
});

@ -193,11 +193,11 @@ describe('Test Signing Messages', function () {
});
describe("Serialize Transactions", function () {
it("allows odd-length numeric values", function () {
var result = ethers_1.ethers.utils.serializeTransaction({
ethers_1.ethers.utils.serializeTransaction({
gasLimit: "0x1",
gasPrice: "0x1",
value: "0x1"
});
console.log(result);
//console.log(result);
});
});

@ -35,7 +35,7 @@
"scripts": {
"test": "exit 1"
},
"tarballHash": "0xb952be2aa3827db142206825efd73b9b1d3071631d1ae6cf7c848659aa4fdccc",
"tarballHash": "0xbe52ac12e08169ec53b82dd2a065d01614df7c2600d5a502ce9ab93e99750597",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.145"
"version": "5.0.0-beta.146"
}

@ -1 +1 @@
export const version = "tests/5.0.0-beta.145";
export const version = "tests/5.0.0-beta.146";