Skip to content

Commit

Permalink
Updated dist files.
Browse files Browse the repository at this point in the history
  • Loading branch information
ricmoo committed Aug 22, 2019
1 parent c031a13 commit 6f4ca61
Show file tree
Hide file tree
Showing 32 changed files with 421 additions and 56 deletions.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ Changelog

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

ethers/v5.0.0-beta.155 (2019-08-22 17:11)
-----------------------------------------

- Added Wrapped Ether and Token transfers to CLI. ([c031a13](https://github.com/ethers-io/ethers.js/commit/c031a1336815923bae85d9982dba0985a79cfaed))
- Fixed sendTransaction and use median gas price in FallbackProvider. ([07e1599](https://github.com/ethers-io/ethers.js/commit/07e15993ba181cfbff987778d158dbde6bb84de2))
- Port optional Secret Storage wallet address to v5. ([#582](https://github.com/ethers-io/ethers.js/issues/582); [a12d60d](https://github.com/ethers-io/ethers.js/commit/a12d60d722dfcf998a2e06eba5e46390d7d442e5))
- Updated flatworm docs output. ([8745a81](https://github.com/ethers-io/ethers.js/commit/8745a81b11b710036ddb546308c13958be1affb9))
- Added initial flatworm documentation stubs. ([0333a76](https://github.com/ethers-io/ethers.js/commit/0333a76f4ff382b5b59b24c672b702721e7a386a))

ethers/v5.0.0-beta.154 (2019-08-21 01:51)
-----------------------------------------

Expand Down
2 changes: 1 addition & 1 deletion packages/cli/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "cli/5.0.0-beta.140";
export declare const version = "cli/5.0.0-beta.141";
2 changes: 1 addition & 1 deletion packages/cli/_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 = "cli/5.0.0-beta.140";
exports.version = "cli/5.0.0-beta.141";
236 changes: 236 additions & 0 deletions packages/cli/bin/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -814,6 +814,242 @@ var WaitPlugin = /** @class */ (function (_super) {
return WaitPlugin;
}(cli_1.Plugin));
cli.addPlugin("wait", WaitPlugin);
var WethAddress = "0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2";
var WethAbi = [
"function deposit() payable",
"function withdraw(uint wad)"
];
var WrapEtherPlugin = /** @class */ (function (_super) {
__extends(WrapEtherPlugin, _super);
function WrapEtherPlugin() {
return _super !== null && _super.apply(this, arguments) || this;
}
WrapEtherPlugin.getHelp = function () {
return {
name: "wrap-ether VALUE",
help: "Deposit VALUE into Wrapped Ether (WETH)"
};
};
WrapEtherPlugin.prototype.prepareArgs = function (args) {
return __awaiter(this, void 0, void 0, function () {
var address, balance;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _super.prototype.prepareArgs.call(this, args)];
case 1:
_a.sent();
if (this.accounts.length !== 1) {
this.throwError("wrap-ether requires exactly one account");
}
if (args.length !== 1) {
this.throwError("wrap-ether requires exactly VALUE");
}
this.value = ethers_1.ethers.utils.parseEther(args[0]);
return [4 /*yield*/, this.accounts[0].getAddress()];
case 2:
address = _a.sent();
return [4 /*yield*/, this.provider.getBalance(address)];
case 3:
balance = _a.sent();
if (balance.lt(this.value)) {
this.throwError("insufficient ether to wrap");
}
return [2 /*return*/];
}
});
});
};
WrapEtherPlugin.prototype.run = function () {
return __awaiter(this, void 0, void 0, function () {
var address, contract;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.accounts[0].getAddress()];
case 1:
address = _a.sent();
this.dump("Wrapping ether", {
"From": address,
"Value": ethers_1.ethers.utils.formatEther(this.value)
});
contract = new ethers_1.ethers.Contract(WethAddress, WethAbi, this.accounts[0]);
return [4 /*yield*/, contract.deposit({ value: this.value })];
case 2:
_a.sent();
return [2 /*return*/];
}
});
});
};
return WrapEtherPlugin;
}(cli_1.Plugin));
cli.addPlugin("wrap-ether", WrapEtherPlugin);
var UnwrapEtherPlugin = /** @class */ (function (_super) {
__extends(UnwrapEtherPlugin, _super);
function UnwrapEtherPlugin() {
return _super !== null && _super.apply(this, arguments) || this;
}
UnwrapEtherPlugin.getHelp = function () {
return {
name: "unwrap-ether VALUE",
help: "Withdraw VALUE from Wrapped Ether (WETH)"
};
};
UnwrapEtherPlugin.prototype.prepareArgs = function (args) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _super.prototype.prepareArgs.call(this, args)];
case 1:
_a.sent();
if (this.accounts.length !== 1) {
this.throwError("unwrap-ether requires exactly one account");
}
if (args.length !== 1) {
this.throwError("unwrap-ether requires exactly VALUE");
}
this.value = ethers_1.ethers.utils.parseEther(args[0]);
return [2 /*return*/];
}
});
});
};
UnwrapEtherPlugin.prototype.run = function () {
return __awaiter(this, void 0, void 0, function () {
var address, contract;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, _super.prototype.run.call(this)];
case 1:
_a.sent();
return [4 /*yield*/, this.accounts[0].getAddress()];
case 2:
address = _a.sent();
this.dump("Withdrawing Wrapped Ether", {
"To": address,
"Valiue": ethers_1.ethers.utils.formatEther(this.value)
});
contract = new ethers_1.ethers.Contract(WethAddress, WethAbi, this.accounts[0]);
return [4 /*yield*/, contract.withdraw(this.value)];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
return UnwrapEtherPlugin;
}(cli_1.Plugin));
cli.addPlugin("unwrap-ether", UnwrapEtherPlugin);
var Erc20Abi = [
"function decimals() view returns (uint8)",
"function symbol() view returns (string)",
"function name() view returns (string)",
"function balanceOf(address) view returns (uint)",
"function transfer(address to, uint256 value)"
];
var Erc20AltAbi = [
"function symbol() view returns (bytes32)",
"function name() view returns (bytes32)",
];
var SendTokenPlugin = /** @class */ (function (_super) {
__extends(SendTokenPlugin, _super);
function SendTokenPlugin() {
return _super !== null && _super.apply(this, arguments) || this;
}
SendTokenPlugin.getHelp = function () {
return {
name: "send-token TOKEN ADDRESS VALUE",
help: "Send VALUE tokens (at TOKEN) to ADDRESS"
};
};
SendTokenPlugin.prototype.prepareArgs = function (args) {
return __awaiter(this, void 0, void 0, function () {
var tokenAddress, _a, _b;
return __generator(this, function (_c) {
switch (_c.label) {
case 0: return [4 /*yield*/, _super.prototype.prepareArgs.call(this, args)];
case 1:
_c.sent();
if (args.length !== 3) {
this.throwError("send-token requires exactly TOKEN, ADDRESS and VALUE");
}
if (this.accounts.length !== 1) {
this.throwError("send-token requires exactly one account");
}
return [4 /*yield*/, this.getAddress(args[0])];
case 2:
tokenAddress = _c.sent();
this.contract = new ethers_1.ethers.Contract(tokenAddress, Erc20Abi, this.accounts[0]);
_a = this;
return [4 /*yield*/, this.contract.decimals()];
case 3:
_a.decimals = _c.sent();
_b = this;
return [4 /*yield*/, this.getAddress(args[1])];
case 4:
_b.toAddress = _c.sent();
this.value = ethers_1.ethers.utils.parseUnits(args[2], this.decimals);
return [2 /*return*/];
}
});
});
};
SendTokenPlugin.prototype.run = function () {
return __awaiter(this, void 0, void 0, function () {
var info, namePromise, symbolPromise;
var _this = this;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
info = {
"To": this.toAddress,
"Token Contract": this.contract.address,
"Value": ethers_1.ethers.utils.formatUnits(this.value, this.decimals)
};
namePromise = this.contract.name().then(function (name) {
if (name === "") {
throw new Error("returned zero");
}
info["Token Name"] = name;
}, function (error) {
var contract = new ethers_1.ethers.Contract(_this.contract.address, Erc20AltAbi, _this.contract.signer);
contract.name().then(function (name) {
info["Token Name"] = ethers_1.ethers.utils.parseBytes32String(name);
}, function (error) {
throw error;
});
});
symbolPromise = this.contract.symbol().then(function (symbol) {
if (symbol === "") {
throw new Error("returned zero");
}
info["Token Symbol"] = symbol;
}, function (error) {
var contract = new ethers_1.ethers.Contract(_this.contract.address, Erc20AltAbi, _this.contract.signer);
contract.symbol().then(function (symbol) {
info["Token Symbol"] = ethers_1.ethers.utils.parseBytes32String(symbol);
}, function (error) {
throw error;
});
});
return [4 /*yield*/, namePromise];
case 1:
_a.sent();
return [4 /*yield*/, symbolPromise];
case 2:
_a.sent();
this.dump("Sending Tokens:", info);
return [4 /*yield*/, this.contract.transfer(this.toAddress, this.value)];
case 3:
_a.sent();
return [2 /*return*/];
}
});
});
};
return SendTokenPlugin;
}(cli_1.Plugin));
cli.addPlugin("send-token", SendTokenPlugin);
var CompilePlugin = /** @class */ (function (_super) {
__extends(CompilePlugin, _super);
function CompilePlugin() {
Expand Down
4 changes: 2 additions & 2 deletions packages/cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ethersproject/cli",
"version": "5.0.0-beta.140",
"version": "5.0.0-beta.141",
"description": "Command-Line Interface scripts and releated utilities.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -34,5 +34,5 @@
"type": "git",
"url": "git://github.com/ethers-io/ethers.js.git"
},
"tarballHash": "0xd2c6b2e212b12b199af45b10c5b6e9132c88b4cd9ab69ec9501b2b5dd48f86c7"
"tarballHash": "0x9ca201d156724880ae19a0e253cc5521d32928d7629fd6d6e78c25064bdbca7b"
}
2 changes: 1 addition & 1 deletion packages/cli/src.ts/_version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const version = "cli/5.0.0-beta.140";
export const version = "cli/5.0.0-beta.141";
2 changes: 1 addition & 1 deletion packages/ethers/_version.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export declare const version = "ethers/5.0.0-beta.154";
export declare const version = "ethers/5.0.0-beta.155";
2 changes: 1 addition & 1 deletion packages/ethers/_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.0-beta.154";
exports.version = "ethers/5.0.0-beta.155";
Loading

0 comments on commit 6f4ca61

Please sign in to comment.