Updated dist filels.

This commit is contained in:
Richard Moore 2019-07-02 16:13:03 -04:00
parent 9cc269ceb5
commit ab5f9e2f82
No known key found for this signature in database
GPG Key ID: 525F70A6FCABC295
22 changed files with 149 additions and 58 deletions

View File

@ -3,6 +3,13 @@ Changelog
This change log is managed by `scripts/cmds/update-versions` but may be manually updated. This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
ethers/v5.0.0-beta.143 (2019-07-02 16:12)
-----------------------------------------
- Adding more support for offline signing in the CLI. ([9cc269c](https://github.com/ethers-io/ethers.js/commit/9cc269ceb5d33b2d88542d4bc6771279f729e733))
- Allow providers to prepare their Network object. ([6484908](https://github.com/ethers-io/ethers.js/commit/6484908cb25dd35e5d98b2672dca72ed3f30cbe1))
- Export BIP-44 default path in ethers.utils. ([04bdf45](https://github.com/ethers-io/ethers.js/commit/04bdf456eb07aa72872265e0ee01e3231d2b6cf1))
ethers/v5.0.0-beta.142 (2019-06-28 16:13) ethers/v5.0.0-beta.142 (2019-06-28 16:13)
----------------------------------------- -----------------------------------------

View File

@ -1 +1 @@
export declare const version = "5.0.0-beta.131"; export declare const version = "5.0.0-beta.132";

View File

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

View File

@ -445,6 +445,10 @@ var SendPlugin = /** @class */ (function (_super) {
{ {
name: "[ --allow-zero ]", name: "[ --allow-zero ]",
help: "Allow sending to the address zero" help: "Allow sending to the address zero"
},
{
name: "[ --data DATA ]",
help: "Include data in the transaction"
} }
]; ];
}; };
@ -458,6 +462,7 @@ var SendPlugin = /** @class */ (function (_super) {
if (this.accounts.length !== 1) { if (this.accounts.length !== 1) {
this.throwUsageError("send requires exacly one account"); this.throwUsageError("send requires exacly one account");
} }
this.data = ethers_1.ethers.utils.hexlify(argParser.consumeOption("data") || "0x");
this.allowZero = argParser.consumeFlag("allow-zero"); this.allowZero = argParser.consumeFlag("allow-zero");
return [2 /*return*/]; return [2 /*return*/];
} }
@ -491,6 +496,7 @@ var SendPlugin = /** @class */ (function (_super) {
switch (_a.label) { switch (_a.label) {
case 0: return [4 /*yield*/, this.accounts[0].sendTransaction({ case 0: return [4 /*yield*/, this.accounts[0].sendTransaction({
to: this.toAddress, to: this.toAddress,
data: this.data,
value: this.value value: this.value
})]; })];
case 1: case 1:

View File

@ -8,6 +8,7 @@ declare class WrappedSigner extends ethers.Signer {
connect(provider?: ethers.providers.Provider): ethers.Signer; connect(provider?: ethers.providers.Provider): ethers.Signer;
getAddress(): Promise<string>; getAddress(): Promise<string>;
signMessage(message: string | ethers.utils.Bytes): Promise<string>; signMessage(message: string | ethers.utils.Bytes): Promise<string>;
populateTransaction(transactionRequest: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionRequest>;
signTransaction(transactionRequest: ethers.providers.TransactionRequest): Promise<string>; signTransaction(transactionRequest: ethers.providers.TransactionRequest): Promise<string>;
sendTransaction(transactionRequest: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>; sendTransaction(transactionRequest: ethers.providers.TransactionRequest): Promise<ethers.providers.TransactionResponse>;
unlock(): Promise<void>; unlock(): Promise<void>;
@ -39,11 +40,11 @@ export declare class Plugin {
network: ethers.providers.Network; network: ethers.providers.Network;
provider: ethers.providers.Provider; provider: ethers.providers.Provider;
accounts: Array<WrappedSigner>; accounts: Array<WrappedSigner>;
mnemonicPassword: boolean;
gasLimit: ethers.BigNumber; gasLimit: ethers.BigNumber;
gasPrice: ethers.BigNumber; gasPrice: ethers.BigNumber;
nonce: number; nonce: number;
data: string; data: string;
value: ethers.BigNumber;
yes: boolean; yes: boolean;
constructor(); constructor();
static getHelp(): Help; static getHelp(): Help;

View File

@ -63,6 +63,19 @@ var UsageError = /** @class */ (function (_super) {
}(Error)); }(Error));
///////////////////////////// /////////////////////////////
// Signer // Signer
/*
const signerStates = new WeakMap();
class SignerState {
signerFunc: () => Promise<ethers.Signer>;
signer: ethers.Signer;
alwaysAllow: boolean;
static get(wrapper: WrappedSigner): SignerState {
return signerStates.get(wrapper);
}
}
*/
var signerFuncs = new WeakMap(); var signerFuncs = new WeakMap();
var signers = new WeakMap(); var signers = new WeakMap();
var alwaysAllow = new WeakMap(); var alwaysAllow = new WeakMap();
@ -223,6 +236,30 @@ var WrappedSigner = /** @class */ (function (_super) {
}); });
}); });
}; };
WrappedSigner.prototype.populateTransaction = function (transactionRequest) {
return __awaiter(this, void 0, void 0, function () {
var signer;
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
transactionRequest = ethers_1.ethers.utils.shallowCopy(transactionRequest);
if (this.plugin.gasPrice != null) {
transactionRequest.gasPrice = this.plugin.gasPrice;
}
if (this.plugin.gasLimit != null) {
transactionRequest.gasLimit = this.plugin.gasLimit;
}
if (this.plugin.nonce != null) {
transactionRequest.nonce = this.plugin.nonce;
}
return [4 /*yield*/, getSigner(this)];
case 1:
signer = _a.sent();
return [2 /*return*/, signer.populateTransaction(transactionRequest)];
}
});
});
};
WrappedSigner.prototype.signTransaction = function (transactionRequest) { WrappedSigner.prototype.signTransaction = function (transactionRequest) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var signer, network, tx, info, result, signature; var signer, network, tx, info, result, signature;
@ -251,7 +288,6 @@ var WrappedSigner = /** @class */ (function (_super) {
info["Gas Limit"] = ethers_1.ethers.BigNumber.from(tx.gasLimit || 0).toString(); info["Gas Limit"] = ethers_1.ethers.BigNumber.from(tx.gasLimit || 0).toString();
info["Gas Price"] = (ethers_1.ethers.utils.formatUnits(tx.gasPrice || 0, "gwei") + " gwei"), info["Gas Price"] = (ethers_1.ethers.utils.formatUnits(tx.gasPrice || 0, "gwei") + " gwei"),
info["Chain ID"] = (tx.chainId || 0); info["Chain ID"] = (tx.chainId || 0);
info["Data"] = ethers_1.ethers.utils.hexlify(tx.data || "0x");
info["Network"] = network.name; info["Network"] = network.name;
dump("Transaction:", info); dump("Transaction:", info);
return [4 /*yield*/, isAllowed(this, "Sign Transaction?")]; return [4 /*yield*/, isAllowed(this, "Sign Transaction?")];
@ -285,7 +321,7 @@ var WrappedSigner = /** @class */ (function (_super) {
return [4 /*yield*/, this.provider.getNetwork()]; return [4 /*yield*/, this.provider.getNetwork()];
case 2: case 2:
network = _a.sent(); network = _a.sent();
return [4 /*yield*/, signer.populateTransaction(transactionRequest)]; return [4 /*yield*/, this.populateTransaction(transactionRequest)];
case 3: case 3:
tx = _a.sent(); tx = _a.sent();
return [4 /*yield*/, ethers_1.ethers.utils.resolveProperties(tx)]; return [4 /*yield*/, ethers_1.ethers.utils.resolveProperties(tx)];
@ -305,7 +341,6 @@ var WrappedSigner = /** @class */ (function (_super) {
info["Gas Limit"] = ethers_1.ethers.BigNumber.from(tx.gasLimit || 0).toString(); info["Gas Limit"] = ethers_1.ethers.BigNumber.from(tx.gasLimit || 0).toString();
info["Gas Price"] = (ethers_1.ethers.utils.formatUnits(tx.gasPrice || 0, "gwei") + " gwei"), info["Gas Price"] = (ethers_1.ethers.utils.formatUnits(tx.gasPrice || 0, "gwei") + " gwei"),
info["Chain ID"] = (tx.chainId || 0); info["Chain ID"] = (tx.chainId || 0);
info["Data"] = ethers_1.ethers.utils.hexlify(tx.data || "0x");
info["Network"] = network.name; info["Network"] = network.name;
dump("Transaction:", info); dump("Transaction:", info);
return [4 /*yield*/, isAllowed(this, "Send Transaction?")]; return [4 /*yield*/, isAllowed(this, "Send Transaction?")];
@ -336,6 +371,21 @@ var WrappedSigner = /** @class */ (function (_super) {
}; };
return WrappedSigner; return WrappedSigner;
}(ethers_1.ethers.Signer)); }(ethers_1.ethers.Signer));
var OfflineProvider = /** @class */ (function (_super) {
__extends(OfflineProvider, _super);
function OfflineProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
OfflineProvider.prototype.perform = function (method, params) {
if (method === "sendTransaction") {
console.log("Signed Transaction:");
console.log(params.signedTransaction);
return Promise.resolve(ethers_1.ethers.utils.keccak256(params.signedTransaction));
}
return _super.prototype.perform.call(this, method, params);
};
return OfflineProvider;
}(ethers_1.ethers.providers.BaseProvider));
///////////////////////////// /////////////////////////////
// Argument Parser // Argument Parser
var ArgParser = /** @class */ (function () { var ArgParser = /** @class */ (function () {
@ -434,9 +484,9 @@ exports.ArgParser = ArgParser;
// - JSON Wallet filename (which will require a password to unlock) // - JSON Wallet filename (which will require a password to unlock)
// - raw private key // - raw private key
// - mnemonic // - mnemonic
function loadAccount(arg, plugin) { function loadAccount(arg, plugin, preventFile) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var content, signer_1, signer_2, content_1, address; var content, signer_1, signerPromise_1, content_1, address;
var _this = this; var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
@ -445,7 +495,7 @@ function loadAccount(arg, plugin) {
return [4 /*yield*/, prompt_1.getPassword("Private Key / Mnemonic:")]; return [4 /*yield*/, prompt_1.getPassword("Private Key / Mnemonic:")];
case 1: case 1:
content = _a.sent(); content = _a.sent();
return [2 /*return*/, loadAccount(content, plugin)]; return [2 /*return*/, loadAccount(content, plugin, true)];
case 2: case 2:
// Raw private key // Raw private key
if (ethers_1.ethers.utils.isHexString(arg, 32)) { if (ethers_1.ethers.utils.isHexString(arg, 32)) {
@ -454,8 +504,17 @@ function loadAccount(arg, plugin) {
} }
// Mnemonic // Mnemonic
if (ethers_1.ethers.utils.isValidMnemonic(arg)) { if (ethers_1.ethers.utils.isValidMnemonic(arg)) {
signer_2 = ethers_1.ethers.Wallet.fromMnemonic(arg).connect(plugin.provider); signerPromise_1 = null;
return [2 /*return*/, Promise.resolve(new WrappedSigner(signer_2.getAddress(), function () { return Promise.resolve(signer_2); }, plugin))]; if (plugin.mnemonicPassword) {
signerPromise_1 = prompt_1.getPassword("Password (mnemonic): ").then(function (password) {
var node = ethers_1.ethers.utils.HDNode.fromMnemonic(arg, password).derivePath(ethers_1.ethers.utils.defaultPath);
return new ethers_1.ethers.Wallet(node.privateKey, plugin.provider);
});
}
else {
signerPromise_1 = Promise.resolve(ethers_1.ethers.Wallet.fromMnemonic(arg).connect(plugin.provider));
}
return [2 /*return*/, Promise.resolve(new WrappedSigner(signerPromise_1.then(function (wallet) { return wallet.getAddress(); }), function () { return signerPromise_1; }, plugin))];
} }
// Check for a JSON wallet // Check for a JSON wallet
try { try {
@ -477,6 +536,9 @@ function loadAccount(arg, plugin) {
}); });
}); }, plugin))]; }); }, plugin))];
} }
else {
return [2 /*return*/, loadAccount(content_1.trim(), plugin, true)];
}
} }
catch (error) { catch (error) {
if (error.message === "cancelled") { if (error.message === "cancelled") {
@ -502,7 +564,7 @@ var Plugin = /** @class */ (function () {
}; };
Plugin.prototype.prepareOptions = function (argParser) { Plugin.prototype.prepareOptions = function (argParser) {
return __awaiter(this, void 0, void 0, function () { return __awaiter(this, void 0, void 0, function () {
var runners, network, providers, rpc, accounts, accountOptions, _loop_1, this_1, i, gasPrice, gasLimit, nonce, value, data, error_2; var runners, network, providers, rpc, accounts, accountOptions, _loop_1, this_1, i, gasPrice, gasLimit, nonce, error_2;
var _this = this; var _this = this;
return __generator(this, function (_a) { return __generator(this, function (_a) {
switch (_a.label) { switch (_a.label) {
@ -529,19 +591,25 @@ var Plugin = /** @class */ (function () {
if (argParser.consumeFlag("nodesmith")) { if (argParser.consumeFlag("nodesmith")) {
providers.push(new ethers_1.ethers.providers.NodesmithProvider(network)); providers.push(new ethers_1.ethers.providers.NodesmithProvider(network));
} }
if (argParser.consumeFlag("offline")) {
providers.push(new OfflineProvider(network));
}
if (providers.length === 1) { if (providers.length === 1) {
this.provider = providers[0]; ethers_1.ethers.utils.defineReadOnly(this, "provider", providers[0]);
} }
else if (providers.length) { else if (providers.length) {
this.provider = new ethers_1.ethers.providers.FallbackProvider(providers); ethers_1.ethers.utils.defineReadOnly(this, "provider", new ethers_1.ethers.providers.FallbackProvider(providers));
} }
else { else {
this.provider = ethers_1.ethers.getDefaultProvider(network); ethers_1.ethers.utils.defineReadOnly(this, "provider", ethers_1.ethers.getDefaultProvider(network));
} }
/////////////////////
// Accounts
ethers_1.ethers.utils.defineReadOnly(this, "mnemonicPassword", argParser.consumeFlag("mnemonic-password"));
accounts = []; accounts = [];
accountOptions = argParser.consumeMultiOptions(["account", "account-rpc", "account-void"]); accountOptions = argParser.consumeMultiOptions(["account", "account-rpc", "account-void"]);
_loop_1 = function (i) { _loop_1 = function (i) {
var account, _a, wrappedSigner, signer_3, addressPromise, signerPromise_1; var account, _a, wrappedSigner, signer_2, addressPromise, signerPromise_2;
return __generator(this, function (_b) { return __generator(this, function (_b) {
switch (_b.label) { switch (_b.label) {
case 0: case 0:
@ -563,14 +631,14 @@ var Plugin = /** @class */ (function () {
this_1.throwUsageError("--account-rpc requires exactly one JSON-RPC provider"); this_1.throwUsageError("--account-rpc requires exactly one JSON-RPC provider");
} }
try { try {
signer_3 = null; signer_2 = null;
if (account.value.match(/^[0-9]+$/)) { if (account.value.match(/^[0-9]+$/)) {
signer_3 = rpc[0].getSigner(parseInt(account.value)); signer_2 = rpc[0].getSigner(parseInt(account.value));
} }
else { else {
signer_3 = rpc[0].getSigner(ethers_1.ethers.utils.getAddress(account.value)); signer_2 = rpc[0].getSigner(ethers_1.ethers.utils.getAddress(account.value));
} }
accounts.push(new WrappedSigner(signer_3.getAddress(), function () { return Promise.resolve(signer_3); }, this_1)); accounts.push(new WrappedSigner(signer_2.getAddress(), function () { return Promise.resolve(signer_2); }, this_1));
} }
catch (error) { catch (error) {
this_1.throwUsageError("invalid --account-rpc - " + account.value); this_1.throwUsageError("invalid --account-rpc - " + account.value);
@ -579,10 +647,10 @@ var Plugin = /** @class */ (function () {
case 4: case 4:
{ {
addressPromise = this_1.provider.resolveName(account.value); addressPromise = this_1.provider.resolveName(account.value);
signerPromise_1 = addressPromise.then(function (addr) { signerPromise_2 = addressPromise.then(function (addr) {
return new ethers_1.ethers.VoidSigner(addr, _this.provider); return new ethers_1.ethers.VoidSigner(addr, _this.provider);
}); });
accounts.push(new WrappedSigner(addressPromise, function () { return signerPromise_1; }, this_1)); accounts.push(new WrappedSigner(addressPromise, function () { return signerPromise_2; }, this_1));
return [3 /*break*/, 5]; return [3 /*break*/, 5];
} }
_b.label = 5; _b.label = 5;
@ -603,35 +671,33 @@ var Plugin = /** @class */ (function () {
i++; i++;
return [3 /*break*/, 1]; return [3 /*break*/, 1];
case 4: case 4:
this.accounts = accounts; ethers_1.ethers.utils.defineReadOnly(this, "accounts", Object.freeze(accounts));
gasPrice = argParser.consumeOption("gas-price"); gasPrice = argParser.consumeOption("gas-price");
if (gasPrice) { if (gasPrice) {
this.gasPrice = ethers_1.ethers.utils.parseUnits(gasPrice, "gwei"); ethers_1.ethers.utils.defineReadOnly(this, "gasPrice", ethers_1.ethers.utils.parseUnits(gasPrice, "gwei"));
}
else {
ethers_1.ethers.utils.defineReadOnly(this, "gasPrice", null);
} }
gasLimit = argParser.consumeOption("gas-limit"); gasLimit = argParser.consumeOption("gas-limit");
if (gasLimit) { if (gasLimit) {
this.gasLimit = ethers_1.ethers.BigNumber.from(gasLimit); ethers_1.ethers.utils.defineReadOnly(this, "gasLimit", ethers_1.ethers.BigNumber.from(gasLimit));
}
else {
ethers_1.ethers.utils.defineReadOnly(this, "gasLimit", null);
} }
nonce = argParser.consumeOption("nonce"); nonce = argParser.consumeOption("nonce");
if (nonce) { if (nonce) {
this.nonce = ethers_1.ethers.BigNumber.from(nonce).toNumber(); this.nonce = ethers_1.ethers.BigNumber.from(nonce).toNumber();
} }
value = argParser.consumeOption("value");
if (value) {
this.value = ethers_1.ethers.utils.parseEther(value);
}
data = argParser.consumeOption("data");
if (data) {
this.data = ethers_1.ethers.utils.hexlify(data);
}
// Now wait for all asynchronous options to load // Now wait for all asynchronous options to load
runners.push(this.provider.getNetwork().then(function (network) { runners.push(this.provider.getNetwork().then(function (network) {
_this.network = network; ethers_1.ethers.utils.defineReadOnly(_this, "network", Object.freeze(network));
}, function (error) { }, function (error) {
_this.network = { ethers_1.ethers.utils.defineReadOnly(_this, "network", Object.freeze({
chainId: 0, chainId: 0,
name: "no-network" name: "no-network"
}; }));
})); }));
_a.label = 5; _a.label = 5;
case 5: case 5:
@ -731,7 +797,7 @@ var CLI = /** @class */ (function () {
console.log(""); console.log("");
} }
console.log("ACCOUNT OPTIONS"); console.log("ACCOUNT OPTIONS");
console.log(" --account FILENAME Load a JSON Wallet (crowdsale or keystore)"); console.log(" --account FILENAME Load from a file (JSON, RAW or mnemonic)");
console.log(" --account RAW_KEY Use a private key (insecure *)"); console.log(" --account RAW_KEY Use a private key (insecure *)");
console.log(" --account 'MNEMONIC' Use a mnemonic (insecure *)"); console.log(" --account 'MNEMONIC' Use a mnemonic (insecure *)");
console.log(" --account - Use secure entry for a raw key or mnemonic"); console.log(" --account - Use secure entry for a raw key or mnemonic");
@ -739,6 +805,7 @@ var CLI = /** @class */ (function () {
console.log(" --account-void ENS_NAME Add the resolved address as a void signer"); console.log(" --account-void ENS_NAME Add the resolved address as a void signer");
console.log(" --account-rpc ADDRESS Add the address from a JSON-RPC provider"); console.log(" --account-rpc ADDRESS Add the address from a JSON-RPC provider");
console.log(" --account-rpc INDEX Add the index from a JSON-RPC provider"); console.log(" --account-rpc INDEX Add the index from a JSON-RPC provider");
console.log(" --mnemonic-password Prompt for a password for mnemonics");
console.log(""); console.log("");
console.log("PROVIDER OPTIONS (default: getDefaultProvider)"); console.log("PROVIDER OPTIONS (default: getDefaultProvider)");
console.log(" --alchemy Include Alchemy"); console.log(" --alchemy Include Alchemy");
@ -746,6 +813,7 @@ var CLI = /** @class */ (function () {
console.log(" --infura Include INFURA"); console.log(" --infura Include INFURA");
console.log(" --nodesmith Include nodesmith"); console.log(" --nodesmith Include nodesmith");
console.log(" --rpc URL Include a custom JSON-RPC"); console.log(" --rpc URL Include a custom JSON-RPC");
console.log(" --offline Dump signed transactions (no send)");
console.log(" --network NETWORK Network to connect to (default: homestead)"); console.log(" --network NETWORK Network to connect to (default: homestead)");
console.log(""); console.log("");
console.log("TRANSACTION OPTIONS (default: query the network)"); console.log("TRANSACTION OPTIONS (default: query the network)");
@ -780,13 +848,13 @@ var CLI = /** @class */ (function () {
// We run a temporary argument parser to check for a command by processing standard options // We run a temporary argument parser to check for a command by processing standard options
{ {
argParser_1 = new ArgParser(args); argParser_1 = new ArgParser(args);
["debug", "help", "yes"].forEach(function (key) { ["debug", "help", "mnemonic-password", "offline", "yes"].forEach(function (key) {
argParser_1.consumeFlag(key); argParser_1.consumeFlag(key);
}); });
["alchemy", "etherscan", "infura", "nodesmith"].forEach(function (flag) { ["alchemy", "etherscan", "infura", "nodesmith"].forEach(function (flag) {
argParser_1.consumeFlag(flag); argParser_1.consumeFlag(flag);
}); });
["network", "rpc", "account", "account-rpc", "account-void", "gas-price", "gas-limit", "nonce", "data"].forEach(function (option) { ["network", "rpc", "account", "account-rpc", "account-void", "gas-price", "gas-limit", "nonce"].forEach(function (option) {
argParser_1.consumeOption(option); argParser_1.consumeOption(option);
}); });
commandIndex = argParser_1._checkCommandIndex(); commandIndex = argParser_1._checkCommandIndex();

View File

@ -1,6 +1,6 @@
{ {
"name": "@ethersproject/cli", "name": "@ethersproject/cli",
"version": "5.0.0-beta.131", "version": "5.0.0-beta.132",
"description": "Command-Line Interface scripts and releated utilities.", "description": "Command-Line Interface scripts and releated utilities.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -27,5 +27,5 @@
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"tarballHash": "0x58e887badc9c63a07c3eb726f6667958dcebf84e67eead73c4e129f580a177c4" "tarballHash": "0x6476e8eca60537e2b153d93b71d6589f740869312bf85d489cc24d898e0a720e"
} }

View File

@ -1 +1 @@
export const version = "5.0.0-beta.131"; export const version = "5.0.0-beta.132";

View File

@ -1 +1 @@
export declare const version = "5.0.0-beta.142"; export declare const version = "5.0.0-beta.143";

View File

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

View File

@ -13850,7 +13850,7 @@ exports.info = info;
},{}],68:[function(require,module,exports){ },{}],68:[function(require,module,exports){
"use strict"; "use strict";
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "5.0.0-beta.142"; exports.version = "5.0.0-beta.143";
},{}],69:[function(require,module,exports){ },{}],69:[function(require,module,exports){
"use strict"; "use strict";
@ -13975,6 +13975,7 @@ exports.hashMessage = hash_1.hashMessage;
exports.id = hash_1.id; exports.id = hash_1.id;
exports.namehash = hash_1.namehash; exports.namehash = hash_1.namehash;
var hdnode_1 = require("@ethersproject/hdnode"); var hdnode_1 = require("@ethersproject/hdnode");
exports.defaultPath = hdnode_1.defaultPath;
exports.entropyToMnemonic = hdnode_1.entropyToMnemonic; exports.entropyToMnemonic = hdnode_1.entropyToMnemonic;
exports.HDNode = hdnode_1.HDNode; exports.HDNode = hdnode_1.HDNode;
exports.isValidMnemonic = hdnode_1.isValidMnemonic; exports.isValidMnemonic = hdnode_1.isValidMnemonic;
@ -15560,7 +15561,7 @@ var BaseProvider = /** @class */ (function (_super) {
_this.ready.catch(function (error) { }); _this.ready.catch(function (error) { });
} }
else { else {
var knownNetwork = networks_1.getNetwork((network == null) ? "homestead" : network); var knownNetwork = properties_1.getStatic((_newTarget), "getNetwork")(network);
if (knownNetwork) { if (knownNetwork) {
properties_1.defineReadOnly(_this, "_network", knownNetwork); properties_1.defineReadOnly(_this, "_network", knownNetwork);
properties_1.defineReadOnly(_this, "ready", Promise.resolve(_this._network)); properties_1.defineReadOnly(_this, "ready", Promise.resolve(_this._network));
@ -15583,6 +15584,9 @@ var BaseProvider = /** @class */ (function (_super) {
} }
return defaultFormatter; return defaultFormatter;
}; };
BaseProvider.getNetwork = function (network) {
return networks_1.getNetwork((network == null) ? "homestead" : network);
};
BaseProvider.prototype.poll = function () { BaseProvider.prototype.poll = function () {
var _this = this; var _this = this;
var pollId = nextPollId++; var pollId = nextPollId++;

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{ {
"name": "ethers", "name": "ethers",
"version": "5.0.0-beta.142", "version": "5.0.0-beta.143",
"description": "Error utility functions for ethers.", "description": "Error utility functions for ethers.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -56,5 +56,5 @@
"publishConfig": { "publishConfig": {
"tag": "next" "tag": "next"
}, },
"tarballHash": "0xca0904f3be00ad4c50b892b5838c64f97038e09fb6d4ff19494b71951d79549d" "tarballHash": "0x725465f585001c4ff9c6793ed904b421e3fd81538fb426e901991c9ee225b1fa"
} }

View File

@ -1 +1 @@
export const version = "5.0.0-beta.142"; export const version = "5.0.0-beta.143";

View File

@ -3,7 +3,7 @@ import { getAddress, getContractAddress, getIcapAddress, isAddress } from "@ethe
import * as base64 from "@ethersproject/base64"; import * as base64 from "@ethersproject/base64";
import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes"; import { arrayify, concat, hexDataSlice, hexDataLength, hexlify, hexStripZeros, hexValue, hexZeroPad, isHexString, joinSignature, zeroPad, splitSignature, stripZeros } from "@ethersproject/bytes";
import { hashMessage, id, namehash } from "@ethersproject/hash"; import { hashMessage, id, namehash } from "@ethersproject/hash";
import { entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode"; import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
import { getJsonWalletAddress } from "@ethersproject/json-wallets"; import { getJsonWalletAddress } from "@ethersproject/json-wallets";
import { keccak256 } from "@ethersproject/keccak256"; import { keccak256 } from "@ethersproject/keccak256";
import { sha256 } from "@ethersproject/sha2"; import { sha256 } from "@ethersproject/sha2";
@ -23,4 +23,4 @@ import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes"; import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { ConnectionInfo, OnceBlockable, PollOptions } from "@ethersproject/web"; import { ConnectionInfo, OnceBlockable, PollOptions } from "@ethersproject/web";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets"; import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback }; export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, toUtf8Bytes, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, id, getAddress, getIcapAddress, getContractAddress, isAddress, formatEther, parseEther, formatUnits, parseUnits, commify, keccak256, sha256, randomBytes, solidityPack, solidityKeccak256, soliditySha256, splitSignature, joinSignature, parseTransaction, serializeTransaction, getJsonWalletAddress, computeAddress, recoverAddress, computePublicKey, recoverPublicKey, verifyMessage, mnemonicToEntropy, entropyToMnemonic, isValidMnemonic, mnemonicToSeed, SupportedAlgorithms, UnicodeNormalizationForm, Bytes, BytesLike, Hexable, CoerceFunc, Indexed, ConnectionInfo, OnceBlockable, PollOptions, EncryptOptions, ProgressCallback };

View File

@ -42,6 +42,7 @@ exports.hashMessage = hash_1.hashMessage;
exports.id = hash_1.id; exports.id = hash_1.id;
exports.namehash = hash_1.namehash; exports.namehash = hash_1.namehash;
var hdnode_1 = require("@ethersproject/hdnode"); var hdnode_1 = require("@ethersproject/hdnode");
exports.defaultPath = hdnode_1.defaultPath;
exports.entropyToMnemonic = hdnode_1.entropyToMnemonic; exports.entropyToMnemonic = hdnode_1.entropyToMnemonic;
exports.HDNode = hdnode_1.HDNode; exports.HDNode = hdnode_1.HDNode;
exports.isValidMnemonic = hdnode_1.isValidMnemonic; exports.isValidMnemonic = hdnode_1.isValidMnemonic;

View File

@ -1 +1 @@
export declare const version = "5.0.0-beta.134"; export declare const version = "5.0.0-beta.135";

View File

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

View File

@ -44,6 +44,7 @@ export declare class BaseProvider extends Provider {
ready: Promise<Network>; ready: Promise<Network>;
constructor(network: Networkish | Promise<Network>); constructor(network: Networkish | Promise<Network>);
static getFormatter(): Formatter; static getFormatter(): Formatter;
static getNetwork(network: Networkish): Network;
poll(): void; poll(): void;
resetEventsBlock(blockNumber: number): void; resetEventsBlock(blockNumber: number): void;
readonly network: Network; readonly network: Network;

View File

@ -139,7 +139,7 @@ var BaseProvider = /** @class */ (function (_super) {
_this.ready.catch(function (error) { }); _this.ready.catch(function (error) { });
} }
else { else {
var knownNetwork = networks_1.getNetwork((network == null) ? "homestead" : network); var knownNetwork = properties_1.getStatic((_newTarget), "getNetwork")(network);
if (knownNetwork) { if (knownNetwork) {
properties_1.defineReadOnly(_this, "_network", knownNetwork); properties_1.defineReadOnly(_this, "_network", knownNetwork);
properties_1.defineReadOnly(_this, "ready", Promise.resolve(_this._network)); properties_1.defineReadOnly(_this, "ready", Promise.resolve(_this._network));
@ -162,6 +162,9 @@ var BaseProvider = /** @class */ (function (_super) {
} }
return defaultFormatter; return defaultFormatter;
}; };
BaseProvider.getNetwork = function (network) {
return networks_1.getNetwork((network == null) ? "homestead" : network);
};
BaseProvider.prototype.poll = function () { BaseProvider.prototype.poll = function () {
var _this = this; var _this = this;
var pollId = nextPollId++; var pollId = nextPollId++;

View File

@ -1,6 +1,6 @@
{ {
"name": "@ethersproject/providers", "name": "@ethersproject/providers",
"version": "5.0.0-beta.134", "version": "5.0.0-beta.135",
"description": "Error utility functions for ethers.", "description": "Error utility functions for ethers.",
"main": "index.js", "main": "index.js",
"browser": { "browser": {
@ -39,5 +39,5 @@
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"tarballHash": "0x2c6f5aa6d90887b48a28a828a5102ae32f65864b405e4e1ff5bc7f876c3237f4" "tarballHash": "0xbad9062a78cf40c1236c46a09c90148282685a87864186f7a7646a8633f838ad"
} }

View File

@ -1 +1 @@
export const version = "5.0.0-beta.134"; export const version = "5.0.0-beta.135";