Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Jul 8, 2020
1 parent bf65ddb commit 59239d2
Show file tree
Hide file tree
Showing 45 changed files with 157 additions and 99 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ Changelog

This change log is managed by `scripts/cmds/update-versions` but may be manually updated.

ethers/v5.0.5 (2020-07-07 23:18)
--------------------------------

- Fixed splitSignature when recoveryParam is encoded directly. ([#893](https://github.com/ethers-io/ethers.js/issues/893), [#933](https://github.com/ethers-io/ethers.js/issues/933); [bf65ddb](https://github.com/ethers-io/ethers.js/commit/bf65ddbff0036f6eb8e99c145f30edff157687f5))
- Fixed BigNumber string validation. ([#935](https://github.com/ethers-io/ethers.js/issues/935); [7e56f3d](https://github.com/ethers-io/ethers.js/commit/7e56f3d392e52815c5c859772b99660e0fc38ef5))

ethers/v5.0.4 (2020-07-04 23:46)
--------------------------------

Expand Down
2 changes: 1 addition & 1 deletion packages/bignumber/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "bignumber/5.0.3";
export declare const version = "bignumber/5.0.4";
2 changes: 1 addition & 1 deletion packages/bignumber/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "bignumber/5.0.3";
export const version = "bignumber/5.0.4";
2 changes: 1 addition & 1 deletion packages/bignumber/lib.esm/bignumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export class BigNumber {
return value;
}
if (typeof (value) === "string") {
if (value.match(/-?0x[0-9a-f]+/i)) {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
Expand Down
2 changes: 1 addition & 1 deletion packages/bignumber/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "bignumber/5.0.3";
export declare const version = "bignumber/5.0.4";
2 changes: 1 addition & 1 deletion packages/bignumber/lib/_version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bignumber/5.0.3";
exports.version = "bignumber/5.0.4";
2 changes: 1 addition & 1 deletion packages/bignumber/lib/bignumber.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ var BigNumber = /** @class */ (function () {
return value;
}
if (typeof (value) === "string") {
if (value.match(/-?0x[0-9a-f]+/i)) {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
Expand Down
4 changes: 2 additions & 2 deletions packages/bignumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xba26126d4ff05eeaf442acc8c4c25b239da90bf636183d81b9a4ae077aadd4e5",
"tarballHash": "0x1b6d657234180fff450e1df6b5923057043ab9e0453e4300ffa22b5e18b04ceb",
"types": "./lib/index.d.ts",
"version": "5.0.3"
"version": "5.0.4"
}
2 changes: 1 addition & 1 deletion packages/bignumber/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "bignumber/5.0.3";
export const version = "bignumber/5.0.4";
2 changes: 1 addition & 1 deletion packages/bytes/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "bytes/5.0.1";
export declare const version = "bytes/5.0.2";
2 changes: 1 addition & 1 deletion packages/bytes/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "bytes/5.0.1";
export const version = "bytes/5.0.2";
4 changes: 2 additions & 2 deletions packages/bytes/lib.esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,6 @@ export function splitSignature(signature) {
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Compute recoveryParam from v
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) {
Expand All @@ -281,6 +279,8 @@ export function splitSignature(signature) {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
Expand Down
2 changes: 1 addition & 1 deletion packages/bytes/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "bytes/5.0.1";
export declare const version = "bytes/5.0.2";
2 changes: 1 addition & 1 deletion packages/bytes/lib/_version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bytes/5.0.1";
exports.version = "bytes/5.0.2";
4 changes: 2 additions & 2 deletions packages/bytes/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,6 @@ function splitSignature(signature) {
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Compute recoveryParam from v
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) {
Expand All @@ -296,6 +294,8 @@ function splitSignature(signature) {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
Expand Down
4 changes: 2 additions & 2 deletions packages/bytes/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"build": "tsc -p ./tsconfig.json",
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x38d537642ec1492da9037a0bace04ff260534dbc92f13c98e0c92d44a84611c8",
"tarballHash": "0x1f1b5b80f2744d771fc150c14e25f62180f57396ca7728d60348e0a7ee980cc0",
"types": "./lib/index.d.ts",
"version": "5.0.1"
"version": "5.0.2"
}
2 changes: 1 addition & 1 deletion packages/bytes/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "bytes/5.0.1";
export const version = "bytes/5.0.2";
4 changes: 2 additions & 2 deletions packages/ethers/dist/ethers-all.esm.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions packages/ethers/dist/ethers-all.umd.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/ethers/dist/ethers.esm.js
Original file line number Diff line number Diff line change
Expand Up @@ -3750,7 +3750,7 @@ var lib_esm = /*#__PURE__*/Object.freeze({
Logger: Logger
});

const version$1 = "bytes/5.0.1";
const version$1 = "bytes/5.0.2";

"use strict";
const logger = new Logger(version$1);
Expand Down Expand Up @@ -4022,8 +4022,6 @@ function splitSignature(signature) {
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Compute recoveryParam from v
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) {
Expand All @@ -4033,6 +4031,8 @@ function splitSignature(signature) {
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
Expand Down Expand Up @@ -4149,7 +4149,7 @@ var lib_esm$1 = /*#__PURE__*/Object.freeze({
joinSignature: joinSignature
});

const version$2 = "bignumber/5.0.3";
const version$2 = "bignumber/5.0.4";

"use strict";
const logger$1 = new Logger(version$2);
Expand Down Expand Up @@ -4301,7 +4301,7 @@ class BigNumber {
return value;
}
if (typeof (value) === "string") {
if (value.match(/-?0x[0-9a-f]+/i)) {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
Expand Down Expand Up @@ -20002,7 +20002,7 @@ var utils$1 = /*#__PURE__*/Object.freeze({
Indexed: Indexed
});

const version$o = "ethers/5.0.4";
const version$o = "ethers/5.0.5";

"use strict";
const logger$E = new Logger(version$o);
Expand Down
4 changes: 2 additions & 2 deletions packages/ethers/dist/ethers.esm.min.js

Large diffs are not rendered by default.

12 changes: 6 additions & 6 deletions packages/ethers/dist/ethers.umd.js
Original file line number Diff line number Diff line change
Expand Up @@ -3783,7 +3783,7 @@
var _version$2 = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bytes/5.0.1";
exports.version = "bytes/5.0.2";
});

var _version$3 = unwrapExports(_version$2);
Expand Down Expand Up @@ -4077,8 +4077,6 @@
result.r = hexlify(bytes.slice(0, 32));
result.s = hexlify(bytes.slice(32, 64));
result.v = bytes[64];
// Compute recoveryParam from v
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) {
Expand All @@ -4088,6 +4086,8 @@
logger.throwArgumentError("signature invalid v byte", "signature", signature);
}
}
// Compute recoveryParam from v
result.recoveryParam = 1 - (result.v % 2);
// Compute _vs from recoveryParam and s
if (result.recoveryParam) {
bytes[32] |= 0x80;
Expand Down Expand Up @@ -4209,7 +4209,7 @@
var _version$4 = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "bignumber/5.0.3";
exports.version = "bignumber/5.0.4";
});

var _version$5 = unwrapExports(_version$4);
Expand Down Expand Up @@ -4380,7 +4380,7 @@
return value;
}
if (typeof (value) === "string") {
if (value.match(/-?0x[0-9a-f]+/i)) {
if (value.match(/^-?0x[0-9a-f]+$/i)) {
return new BigNumber(_constructorGuard, toHex(value));
}
if (value.match(/^-?[0-9]+$/)) {
Expand Down Expand Up @@ -23088,7 +23088,7 @@
var _version$M = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.4";
exports.version = "ethers/5.0.5";
});

var _version$N = unwrapExports(_version$M);
Expand Down
4 changes: 2 additions & 2 deletions packages/ethers/dist/ethers.umd.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/ethers/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "ethers/5.0.4";
export declare const version = "ethers/5.0.5";
2 changes: 1 addition & 1 deletion packages/ethers/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "ethers/5.0.4";
export const version = "ethers/5.0.5";
2 changes: 1 addition & 1 deletion packages/ethers/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "ethers/5.0.4";
export declare const version = "ethers/5.0.5";
2 changes: 1 addition & 1 deletion packages/ethers/lib/_version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "ethers/5.0.4";
exports.version = "ethers/5.0.5";
4 changes: 2 additions & 2 deletions packages/ethers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x10a2b8ad182c2dfe399304c33c3d854577c21c260731ccb508f5d1b6ee32c482",
"tarballHash": "0xb849e03913cd1aff995db87ada534902b50cf9bc5ec3135b46f548aa541d4ecf",
"types": "./lib/index.d.ts",
"version": "5.0.4"
"version": "5.0.5"
}
2 changes: 1 addition & 1 deletion packages/ethers/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "ethers/5.0.4";
export const version = "ethers/5.0.5";
2 changes: 1 addition & 1 deletion packages/testcases/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "testcases/5.0.1";
export declare const version = "testcases/5.0.2";
2 changes: 1 addition & 1 deletion packages/testcases/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "testcases/5.0.1";
export const version = "testcases/5.0.2";
5 changes: 5 additions & 0 deletions packages/testcases/lib.esm/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import { randomBytes, randomHexString, randomNumber } from "./random";
export { randomBytes, randomHexString, randomNumber };
export declare module TestCase {
type BigNumber = {
testcase: string;
value: string | number;
expectedValue: string;
};
type HDWalletNode = {
path: string;
address: string;
Expand Down
2 changes: 1 addition & 1 deletion packages/testcases/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "testcases/5.0.1";
export declare const version = "testcases/5.0.2";
2 changes: 1 addition & 1 deletion packages/testcases/lib/_version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "testcases/5.0.1";
exports.version = "testcases/5.0.2";
5 changes: 5 additions & 0 deletions packages/testcases/lib/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
import { randomBytes, randomHexString, randomNumber } from "./random";
export { randomBytes, randomHexString, randomNumber };
export declare module TestCase {
type BigNumber = {
testcase: string;
value: string | number;
expectedValue: string;
};
type HDWalletNode = {
path: string;
address: string;
Expand Down
4 changes: 2 additions & 2 deletions packages/testcases/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x98f5cd9439df63d54f6cf0aa287932c20cb27a1bf09850ba6179fc510feb570b",
"tarballHash": "0x364dd4d1d0e366c5572b42da417f2dbc4d65612d42a25e71c603b76cb5486465",
"types": "./lib/index.d.ts",
"version": "5.0.1"
"version": "5.0.2"
}
2 changes: 1 addition & 1 deletion packages/testcases/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "testcases/5.0.1";
export const version = "testcases/5.0.2";
2 changes: 1 addition & 1 deletion packages/tests/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "tests/5.0.1";
export declare const version = "tests/5.0.2";
2 changes: 1 addition & 1 deletion packages/tests/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "tests/5.0.1";
export const version = "tests/5.0.2";
59 changes: 40 additions & 19 deletions packages/tests/lib.esm/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -340,25 +340,6 @@ describe('Test Bytes32String coder', function () {
assert.equal(str2, str, "parsed correctly");
});
});
describe('Test BigNumber', function () {
it("computes absolute values", function () {
function testAbs(test) {
let value = ethers.BigNumber.from(test.value);
let expected = ethers.BigNumber.from(test.expected);
assert.ok(value.abs().eq(expected), 'BigNumber.abs - ' + test.value);
}
[
{ value: "0x0", expected: "0x0" },
{ value: "-0x0", expected: "0x0" },
{ value: "0x5", expected: "0x5" },
{ value: "-0x5", expected: "0x5" },
{ value: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "-0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "-0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
].forEach(testAbs);
});
});
function getHex(value) {
return "0x" + Buffer.from(value).toString("hex");
}
Expand Down Expand Up @@ -430,3 +411,43 @@ describe("Test Signature Manipulation", function () {
});
});
});
describe("BigNumber", function () {
const tests = loadTests("bignumber");
tests.forEach((test) => {
if (test.expectedValue == null) {
it(test.testcase, function () {
assert.throws(() => {
const value = ethers.BigNumber.from(test.value);
console.log("ERROR", value);
}, (error) => {
return true;
});
});
}
else {
it(test.testcase, function () {
const value = ethers.BigNumber.from(test.value);
assert.equal(value.toHexString(), test.expectedValue);
const value2 = ethers.BigNumber.from(value);
assert.equal(value2.toHexString(), test.expectedValue);
});
}
});
[
{ value: "0x0", expected: "0x0" },
{ value: "-0x0", expected: "0x0" },
{ value: "0x5", expected: "0x5" },
{ value: "-0x5", expected: "0x5" },
{ value: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "-0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
{ value: "-0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", expected: "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff" },
].forEach((test) => {
it(`absolute value (${test.value})`, function () {
const value = ethers.BigNumber.from(test.value);
const expected = ethers.BigNumber.from(test.expected);
assert.ok(value.abs().eq(expected));
});
});
// @TODO: Add more tests here
});
2 changes: 1 addition & 1 deletion packages/tests/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "tests/5.0.1";
export declare const version = "tests/5.0.2";
2 changes: 1 addition & 1 deletion packages/tests/lib/_version.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "tests/5.0.1";
exports.version = "tests/5.0.2";
Loading

0 comments on commit 59239d2

Please sign in to comment.