Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed May 1, 2020
1 parent 1e21eb0 commit 0d71cfb
Show file tree
Hide file tree
Showing 65 changed files with 944 additions and 296 deletions.
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@ Changelog
=========

This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
During the v5-BETA, although attempts are made to minimize it, some of the APIs
may change. It is generally recommended that you remove your `node_modules/`,
`package-lock.json` (and similar files for yarn, etc.) and doing an `npm install`
after upgrading to a newer version of the v5-BETA.

ethers/v5.0.0-beta.185 (2020-05-01 16:45)
-----------------------------------------

- Allow modifiers on Human-Readable ABI for tuples and arrays. ([83fba3d](https://github.com/ethers-io/ethers.js/commit/83fba3de25b524cc48975b1952f4319d63874205))
- Added initial renew support to ENS CLI. ([54dfb75](https://github.com/ethers-io/ethers.js/commit/54dfb757c4c88e4bcada1890c4016fadfb25581a))
- Allow contract filters to include OR-ed values. ([#437](https://github.com/ethers-io/ethers.js/issues/437); [28800d7](https://github.com/ethers-io/ethers.js/commit/28800d7681f3bab08f6d30a22f0813e04feee18a))

ethers/v5.0.0-beta.184 (2020-04-28 04:58)
-----------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion packages/abi/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "abi/5.0.0-beta.152";
export declare const version = "abi/5.0.0-beta.153";
2 changes: 1 addition & 1 deletion packages/abi/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "abi/5.0.0-beta.152";
export const version = "abi/5.0.0-beta.153";
6 changes: 6 additions & 0 deletions packages/abi/lib.esm/fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const logger = new Logger(version);
;
const _constructorGuard = {};
let ModifiersBytes = { calldata: true, memory: true, storage: true };
let ModifiersNest = { calldata: true, memory: true };
function checkModifier(type, name) {
if (type === "bytes" || type === "string") {
if (ModifiersBytes[name]) {
Expand All @@ -18,6 +19,11 @@ function checkModifier(type, name) {
return true;
}
}
else if (type.indexOf("[") >= 0 || type === "tuple") {
if (ModifiersNest[name]) {
return true;
}
}
if (ModifiersBytes[name] || name === "payable") {
logger.throwArgumentError("invalid modifier", "name", name);
}
Expand Down
30 changes: 18 additions & 12 deletions packages/abi/lib.esm/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,19 @@ export class Interface {
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
const encodeTopic = (param, value) => {
if (param.type === "string") {
return id(value);
}
else if (param.type === "bytes") {
return keccak256(hexlify(value));
}
// Check addresses are valid
if (param.type === "address") {
this._abiCoder.encode(["address"], [value]);
}
return hexZeroPad(hexlify(value), 32);
};
values.forEach((value, index) => {
let param = eventFragment.inputs[index];
if (!param.indexed) {
Expand All @@ -287,21 +300,14 @@ export class Interface {
if (value == null) {
topics.push(null);
}
else if (param.type === "string") {
topics.push(id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256(hexlify(value)));
}
else if (param.type.indexOf("[") !== -1 || param.type.substring(0, 5) === "tuple") {
else if (param.baseType === "array" || param.baseType === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else if (Array.isArray(value)) {
topics.push(value.map((value) => encodeTopic(param, value)));
}
else {
// Check addresses are valid
if (param.type === "address") {
this._abiCoder.encode(["address"], [value]);
}
topics.push(hexZeroPad(hexlify(value), 32));
topics.push(encodeTopic(param, value));
}
});
// Trim off trailing nulls
Expand Down
2 changes: 1 addition & 1 deletion packages/abi/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "abi/5.0.0-beta.152";
export declare const version = "abi/5.0.0-beta.153";
2 changes: 1 addition & 1 deletion packages/abi/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 = "abi/5.0.0-beta.152";
exports.version = "abi/5.0.0-beta.153";
6 changes: 6 additions & 0 deletions packages/abi/lib/fragments.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var logger = new logger_1.Logger(_version_1.version);
;
var _constructorGuard = {};
var ModifiersBytes = { calldata: true, memory: true, storage: true };
var ModifiersNest = { calldata: true, memory: true };
function checkModifier(type, name) {
if (type === "bytes" || type === "string") {
if (ModifiersBytes[name]) {
Expand All @@ -32,6 +33,11 @@ function checkModifier(type, name) {
return true;
}
}
else if (type.indexOf("[") >= 0 || type === "tuple") {
if (ModifiersNest[name]) {
return true;
}
}
if (ModifiersBytes[name] || name === "payable") {
logger.throwArgumentError("invalid modifier", "name", name);
}
Expand Down
30 changes: 18 additions & 12 deletions packages/abi/lib/interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,19 @@ var Interface = /** @class */ (function () {
if (!eventFragment.anonymous) {
topics.push(this.getEventTopic(eventFragment));
}
var encodeTopic = function (param, value) {
if (param.type === "string") {
return hash_1.id(value);
}
else if (param.type === "bytes") {
return keccak256_1.keccak256(bytes_1.hexlify(value));
}
// Check addresses are valid
if (param.type === "address") {
_this._abiCoder.encode(["address"], [value]);
}
return bytes_1.hexZeroPad(bytes_1.hexlify(value), 32);
};
values.forEach(function (value, index) {
var param = eventFragment.inputs[index];
if (!param.indexed) {
Expand All @@ -322,21 +335,14 @@ var Interface = /** @class */ (function () {
if (value == null) {
topics.push(null);
}
else if (param.type === "string") {
topics.push(hash_1.id(value));
}
else if (param.type === "bytes") {
topics.push(keccak256_1.keccak256(bytes_1.hexlify(value)));
}
else if (param.type.indexOf("[") !== -1 || param.type.substring(0, 5) === "tuple") {
else if (param.baseType === "array" || param.baseType === "tuple") {
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
}
else if (Array.isArray(value)) {
topics.push(value.map(function (value) { return encodeTopic(param, value); }));
}
else {
// Check addresses are valid
if (param.type === "address") {
_this._abiCoder.encode(["address"], [value]);
}
topics.push(bytes_1.hexZeroPad(bytes_1.hexlify(value), 32));
topics.push(encodeTopic(param, value));
}
});
// Trim off trailing nulls
Expand Down
4 changes: 2 additions & 2 deletions packages/abi/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x109653533bca166a77b4d0b473f2113fb87d8a40f5559cb935697fa04a73afb1",
"tarballHash": "0x7fd77ad0e6f0df98c7f7b5f91552b5c5ce359a2fbd05a9ab852bec00530a7712",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.152"
"version": "5.0.0-beta.153"
}
2 changes: 1 addition & 1 deletion packages/abi/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "abi/5.0.0-beta.152";
export const version = "abi/5.0.0-beta.153";
2 changes: 1 addition & 1 deletion packages/abstract-signer/lib.esm/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "abstract-signer/5.0.0-beta.141";
export declare const version = "abstract-signer/5.0.0-beta.142";
2 changes: 1 addition & 1 deletion packages/abstract-signer/lib.esm/_version.js
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "abstract-signer/5.0.0-beta.141";
export const version = "abstract-signer/5.0.0-beta.142";
45 changes: 29 additions & 16 deletions packages/abstract-signer/lib.esm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,25 +31,31 @@ export class Signer {
///////////////////
// Sub-classes MAY override these
getBalance(blockTag) {
this._checkProvider("getBalance");
return this.provider.getBalance(this.getAddress(), blockTag);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getBalance");
return yield this.provider.getBalance(this.getAddress(), blockTag);
});
}
getTransactionCount(blockTag) {
this._checkProvider("getTransactionCount");
return this.provider.getTransactionCount(this.getAddress(), blockTag);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getTransactionCount");
return yield this.provider.getTransactionCount(this.getAddress(), blockTag);
});
}
// Populates "from" if unspecified, and estimates the gas for the transation
estimateGas(transaction) {
this._checkProvider("estimateGas");
return resolveProperties(this.checkTransaction(transaction)).then((tx) => {
return this.provider.estimateGas(tx);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("estimateGas");
const tx = yield resolveProperties(this.checkTransaction(transaction));
return yield this.provider.estimateGas(tx);
});
}
// Populates "from" if unspecified, and calls with the transation
call(transaction, blockTag) {
this._checkProvider("call");
return resolveProperties(this.checkTransaction(transaction)).then((tx) => {
return this.provider.call(tx, blockTag);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("call");
const tx = yield resolveProperties(this.checkTransaction(transaction));
return yield this.provider.call(tx, blockTag);
});
}
// Populates all fields in a transaction, signs it and sends it to the network
Expand All @@ -62,16 +68,23 @@ export class Signer {
});
}
getChainId() {
this._checkProvider("getChainId");
return this.provider.getNetwork().then((network) => network.chainId);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getChainId");
const network = yield this.provider.getNetwork();
return network.chainId;
});
}
getGasPrice() {
this._checkProvider("getGasPrice");
return this.provider.getGasPrice();
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("getGasPrice");
return yield this.provider.getGasPrice();
});
}
resolveName(name) {
this._checkProvider("resolveName");
return this.provider.resolveName(name);
return __awaiter(this, void 0, void 0, function* () {
this._checkProvider("resolveName");
return yield this.provider.resolveName(name);
});
}
// Checks a transaction does not contain invalid keys and if
// no "from" is provided, populates it.
Expand Down
2 changes: 1 addition & 1 deletion packages/abstract-signer/lib/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "abstract-signer/5.0.0-beta.141";
export declare const version = "abstract-signer/5.0.0-beta.142";
2 changes: 1 addition & 1 deletion packages/abstract-signer/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 = "abstract-signer/5.0.0-beta.141";
exports.version = "abstract-signer/5.0.0-beta.142";
97 changes: 79 additions & 18 deletions packages/abstract-signer/lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,27 +73,61 @@ var Signer = /** @class */ (function () {
///////////////////
// Sub-classes MAY override these
Signer.prototype.getBalance = function (blockTag) {
this._checkProvider("getBalance");
return this.provider.getBalance(this.getAddress(), blockTag);
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getBalance");
return [4 /*yield*/, this.provider.getBalance(this.getAddress(), blockTag)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
Signer.prototype.getTransactionCount = function (blockTag) {
this._checkProvider("getTransactionCount");
return this.provider.getTransactionCount(this.getAddress(), blockTag);
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getTransactionCount");
return [4 /*yield*/, this.provider.getTransactionCount(this.getAddress(), blockTag)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates "from" if unspecified, and estimates the gas for the transation
Signer.prototype.estimateGas = function (transaction) {
var _this = this;
this._checkProvider("estimateGas");
return properties_1.resolveProperties(this.checkTransaction(transaction)).then(function (tx) {
return _this.provider.estimateGas(tx);
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("estimateGas");
return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
case 1:
tx = _a.sent();
return [4 /*yield*/, this.provider.estimateGas(tx)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates "from" if unspecified, and calls with the transation
Signer.prototype.call = function (transaction, blockTag) {
var _this = this;
this._checkProvider("call");
return properties_1.resolveProperties(this.checkTransaction(transaction)).then(function (tx) {
return _this.provider.call(tx, blockTag);
return __awaiter(this, void 0, void 0, function () {
var tx;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("call");
return [4 /*yield*/, properties_1.resolveProperties(this.checkTransaction(transaction))];
case 1:
tx = _a.sent();
return [4 /*yield*/, this.provider.call(tx, blockTag)];
case 2: return [2 /*return*/, _a.sent()];
}
});
});
};
// Populates all fields in a transaction, signs it and sends it to the network
Expand All @@ -107,16 +141,43 @@ var Signer = /** @class */ (function () {
});
};
Signer.prototype.getChainId = function () {
this._checkProvider("getChainId");
return this.provider.getNetwork().then(function (network) { return network.chainId; });
return __awaiter(this, void 0, void 0, function () {
var network;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getChainId");
return [4 /*yield*/, this.provider.getNetwork()];
case 1:
network = _a.sent();
return [2 /*return*/, network.chainId];
}
});
});
};
Signer.prototype.getGasPrice = function () {
this._checkProvider("getGasPrice");
return this.provider.getGasPrice();
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("getGasPrice");
return [4 /*yield*/, this.provider.getGasPrice()];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
Signer.prototype.resolveName = function (name) {
this._checkProvider("resolveName");
return this.provider.resolveName(name);
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
this._checkProvider("resolveName");
return [4 /*yield*/, this.provider.resolveName(name)];
case 1: return [2 /*return*/, _a.sent()];
}
});
});
};
// Checks a transaction does not contain invalid keys and if
// no "from" is provided, populates it.
Expand Down
4 changes: 2 additions & 2 deletions packages/abstract-signer/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": "0x81934b72f07020a63a2f9b53d0df6bb79e1d99ef4522750dbcea34ffecfe8f02",
"tarballHash": "0xa925460f603ca591a3d22f158741982670c91e1473d22c80c949889911b48164",
"types": "./lib/index.d.ts",
"version": "5.0.0-beta.141"
"version": "5.0.0-beta.142"
}
Loading

0 comments on commit 0d71cfb

Please sign in to comment.