Updated dist files.
This commit is contained in:
parent
bf65ddbff0
commit
59239d2f61
@ -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)
|
||||
--------------------------------
|
||||
|
||||
|
2
packages/bignumber/lib.esm/_version.d.ts
vendored
2
packages/bignumber/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bignumber/5.0.3";
|
||||
export declare const version = "bignumber/5.0.4";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bignumber/5.0.3";
|
||||
export const version = "bignumber/5.0.4";
|
||||
|
@ -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]+$/)) {
|
||||
|
2
packages/bignumber/lib/_version.d.ts
vendored
2
packages/bignumber/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bignumber/5.0.3";
|
||||
export declare const version = "bignumber/5.0.4";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "bignumber/5.0.3";
|
||||
exports.version = "bignumber/5.0.4";
|
||||
|
@ -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]+$/)) {
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bignumber/5.0.3";
|
||||
export const version = "bignumber/5.0.4";
|
||||
|
2
packages/bytes/lib.esm/_version.d.ts
vendored
2
packages/bytes/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bytes/5.0.1";
|
||||
export declare const version = "bytes/5.0.2";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bytes/5.0.1";
|
||||
export const version = "bytes/5.0.2";
|
||||
|
@ -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) {
|
||||
@ -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;
|
||||
|
2
packages/bytes/lib/_version.d.ts
vendored
2
packages/bytes/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "bytes/5.0.1";
|
||||
export declare const version = "bytes/5.0.2";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "bytes/5.0.1";
|
||||
exports.version = "bytes/5.0.2";
|
||||
|
@ -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) {
|
||||
@ -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;
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "bytes/5.0.1";
|
||||
export const version = "bytes/5.0.2";
|
||||
|
4
packages/ethers/dist/ethers-all.esm.min.js
vendored
4
packages/ethers/dist/ethers-all.esm.min.js
vendored
File diff suppressed because one or more lines are too long
4
packages/ethers/dist/ethers-all.umd.min.js
vendored
4
packages/ethers/dist/ethers-all.umd.min.js
vendored
File diff suppressed because one or more lines are too long
12
packages/ethers/dist/ethers.esm.js
vendored
12
packages/ethers/dist/ethers.esm.js
vendored
@ -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);
|
||||
@ -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) {
|
||||
@ -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;
|
||||
@ -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);
|
||||
@ -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]+$/)) {
|
||||
@ -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);
|
||||
|
4
packages/ethers/dist/ethers.esm.min.js
vendored
4
packages/ethers/dist/ethers.esm.min.js
vendored
File diff suppressed because one or more lines are too long
12
packages/ethers/dist/ethers.umd.js
vendored
12
packages/ethers/dist/ethers.umd.js
vendored
@ -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);
|
||||
@ -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) {
|
||||
@ -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;
|
||||
@ -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);
|
||||
@ -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]+$/)) {
|
||||
@ -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);
|
||||
|
4
packages/ethers/dist/ethers.umd.min.js
vendored
4
packages/ethers/dist/ethers.umd.min.js
vendored
File diff suppressed because one or more lines are too long
2
packages/ethers/lib.esm/_version.d.ts
vendored
2
packages/ethers/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.4";
|
||||
export declare const version = "ethers/5.0.5";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.4";
|
||||
export const version = "ethers/5.0.5";
|
||||
|
2
packages/ethers/lib/_version.d.ts
vendored
2
packages/ethers/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "ethers/5.0.4";
|
||||
export declare const version = "ethers/5.0.5";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "ethers/5.0.4";
|
||||
exports.version = "ethers/5.0.5";
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "ethers/5.0.4";
|
||||
export const version = "ethers/5.0.5";
|
||||
|
2
packages/testcases/lib.esm/_version.d.ts
vendored
2
packages/testcases/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "testcases/5.0.1";
|
||||
export declare const version = "testcases/5.0.2";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "testcases/5.0.1";
|
||||
export const version = "testcases/5.0.2";
|
||||
|
5
packages/testcases/lib.esm/index.d.ts
vendored
5
packages/testcases/lib.esm/index.d.ts
vendored
@ -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;
|
||||
|
2
packages/testcases/lib/_version.d.ts
vendored
2
packages/testcases/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "testcases/5.0.1";
|
||||
export declare const version = "testcases/5.0.2";
|
||||
|
@ -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
packages/testcases/lib/index.d.ts
vendored
5
packages/testcases/lib/index.d.ts
vendored
@ -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;
|
||||
|
@ -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"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "testcases/5.0.1";
|
||||
export const version = "testcases/5.0.2";
|
||||
|
2
packages/tests/lib.esm/_version.d.ts
vendored
2
packages/tests/lib.esm/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "tests/5.0.1";
|
||||
export declare const version = "tests/5.0.2";
|
||||
|
@ -1 +1 @@
|
||||
export const version = "tests/5.0.1";
|
||||
export const version = "tests/5.0.2";
|
||||
|
@ -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");
|
||||
}
|
||||
@ -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
packages/tests/lib/_version.d.ts
vendored
2
packages/tests/lib/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "tests/5.0.1";
|
||||
export declare const version = "tests/5.0.2";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "tests/5.0.1";
|
||||
exports.version = "tests/5.0.2";
|
||||
|
@ -351,25 +351,6 @@ describe('Test Bytes32String coder', function () {
|
||||
assert_1.default.equal(str2, str, "parsed correctly");
|
||||
});
|
||||
});
|
||||
describe('Test BigNumber', function () {
|
||||
it("computes absolute values", function () {
|
||||
function testAbs(test) {
|
||||
var value = ethers_1.ethers.BigNumber.from(test.value);
|
||||
var expected = ethers_1.ethers.BigNumber.from(test.expected);
|
||||
assert_1.default.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");
|
||||
}
|
||||
@ -441,3 +422,43 @@ describe("Test Signature Manipulation", function () {
|
||||
});
|
||||
});
|
||||
});
|
||||
describe("BigNumber", function () {
|
||||
var tests = testcases_1.loadTests("bignumber");
|
||||
tests.forEach(function (test) {
|
||||
if (test.expectedValue == null) {
|
||||
it(test.testcase, function () {
|
||||
assert_1.default.throws(function () {
|
||||
var value = ethers_1.ethers.BigNumber.from(test.value);
|
||||
console.log("ERROR", value);
|
||||
}, function (error) {
|
||||
return true;
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
it(test.testcase, function () {
|
||||
var value = ethers_1.ethers.BigNumber.from(test.value);
|
||||
assert_1.default.equal(value.toHexString(), test.expectedValue);
|
||||
var value2 = ethers_1.ethers.BigNumber.from(value);
|
||||
assert_1.default.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(function (test) {
|
||||
it("absolute value (" + test.value + ")", function () {
|
||||
var value = ethers_1.ethers.BigNumber.from(test.value);
|
||||
var expected = ethers_1.ethers.BigNumber.from(test.expected);
|
||||
assert_1.default.ok(value.abs().eq(expected));
|
||||
});
|
||||
});
|
||||
// @TODO: Add more tests here
|
||||
});
|
||||
|
@ -39,7 +39,7 @@
|
||||
"scripts": {
|
||||
"test": "exit 1"
|
||||
},
|
||||
"tarballHash": "0x0db400f7ae13cdb04c2f598edb5f6a19a214dc23b233103f0b020a867f0d4851",
|
||||
"tarballHash": "0x133b68ae3619cc437879eb5f473d7511a8e4a67e1473eed13ce622b2080b9ecc",
|
||||
"types": "./lib/index.d.ts",
|
||||
"version": "5.0.1"
|
||||
"version": "5.0.2"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "tests/5.0.1";
|
||||
export const version = "tests/5.0.2";
|
||||
|
Loading…
Reference in New Issue
Block a user