Removed references to legacy errors pacakge and updated umbrella pacakge.

This commit is contained in:
Richard Moore 2019-08-02 02:32:32 -04:00
parent 226c100c72
commit c09de16347
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
26 changed files with 99 additions and 46 deletions

@ -51,6 +51,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers");
var cli_1 = require("../cli");
var _version_1 = require("../_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var ensAbi = [
"function setOwner(bytes32 node, address owner) external @500000",
"function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external @500000",
@ -226,7 +228,7 @@ var AccountPlugin = /** @class */ (function (_super) {
return _super !== null && _super.apply(this, arguments) || this;
}
AccountPlugin.getHelp = function () {
return ethers_1.ethers.errors.throwError("subclasses must implemetn this", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
return logger.throwError("subclasses must implemetn this", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "getHelp"
});
};

@ -57,6 +57,7 @@ var ethers_1 = require("ethers");
var scrypt_js_1 = __importDefault(require("scrypt-js"));
var prompt_1 = require("./prompt");
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var UsageError = /** @class */ (function (_super) {
__extends(UsageError, _super);
function UsageError() {
@ -818,12 +819,12 @@ var CLI = /** @class */ (function () {
// @TODO: Better way to specify default; i.e. may not have args
CLI.prototype.addPlugin = function (command, plugin) {
if (this.standAlone) {
ethers_1.ethers.errors.throwError("only setPlugin or addPlugin may be used at once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("only setPlugin or addPlugin may be used at once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "addPlugin"
});
}
else if (this.plugins[command]) {
ethers_1.ethers.errors.throwError("command already exists", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("command already exists", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "addPlugin",
command: command
});
@ -832,12 +833,12 @@ var CLI = /** @class */ (function () {
};
CLI.prototype.setPlugin = function (plugin) {
if (Object.keys(this.plugins).length !== 0) {
ethers_1.ethers.errors.throwError("only setPlugin or addPlugin may be used at once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("only setPlugin or addPlugin may be used at once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "setPlugin"
});
}
if (this.standAlone) {
ethers_1.ethers.errors.throwError("cannot setPlugin more than once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("cannot setPlugin more than once", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "setPlugin"
});
}

@ -29,5 +29,5 @@
"publishConfig": {
"access": "public"
},
"tarballHash": "0x46224f464ccc9cc68cb0f1fca15dce7b9b8fa6fa55109b467497e44094643833"
"tarballHash": "0x03ea112e9284e7053a8bb0aea51bdc2c7de129abf2fb3633509c0fd5099df222"
}

@ -2,11 +2,14 @@
'use strict';
import { ethers } from 'ethers';
import { ArgParser, CLI, Help, Plugin } from '../cli';
import { version } from "../_version";
const logger = new ethers.utils.Logger(version);
const ensAbi = [
"function setOwner(bytes32 node, address owner) external @500000",
"function setSubnodeOwner(bytes32 node, bytes32 label, address owner) external @500000",
@ -168,7 +171,7 @@ abstract class AccountPlugin extends Plugin {
_wait: boolean;
static getHelp(): Help {
return ethers.errors.throwError("subclasses must implemetn this", ethers.errors.UNSUPPORTED_OPERATION, {
return logger.throwError("subclasses must implemetn this", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "getHelp"
});
}

@ -10,6 +10,8 @@ import { getChoice, getPassword, getProgressBar } from "./prompt";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
class UsageError extends Error { }
@ -730,11 +732,11 @@ export class CLI {
addPlugin(command: string, plugin: PluginType) {
if (this.standAlone) {
ethers.errors.throwError("only setPlugin or addPlugin may be used at once", ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("only setPlugin or addPlugin may be used at once", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "addPlugin"
});
} else if (this.plugins[command]) {
ethers.errors.throwError("command already exists", ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("command already exists", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "addPlugin",
command: command
});
@ -744,12 +746,12 @@ export class CLI {
setPlugin(plugin: PluginType) {
if (Object.keys(this.plugins).length !== 0) {
ethers.errors.throwError("only setPlugin or addPlugin may be used at once", ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("only setPlugin or addPlugin may be used at once", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "setPlugin"
});
}
if (this.standAlone) {
ethers.errors.throwError("cannot setPlugin more than once", ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("cannot setPlugin more than once", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "setPlugin"
});
}

@ -13991,8 +13991,6 @@ var wallet_1 = require("@ethersproject/wallet");
exports.Wallet = wallet_1.Wallet;
var constants = __importStar(require("@ethersproject/constants"));
exports.constants = constants;
var errors = __importStar(require("@ethersproject/errors"));
exports.errors = errors;
var providers = __importStar(require("@ethersproject/providers"));
exports.providers = providers;
var wordlists_1 = require("@ethersproject/wordlists");
@ -14000,6 +13998,9 @@ exports.Wordlist = wordlists_1.Wordlist;
exports.wordlists = wordlists_1.wordlists;
var utils = __importStar(require("./utils"));
exports.utils = utils;
var logger_1 = require("@ethersproject/logger");
var errors = logger_1.Logger.errors;
exports.errors = errors;
////////////////////////
// Compile-Time Constants
// This is empty in node, and used by browserify to inject extra goodies
@ -14008,6 +14009,8 @@ exports.platform = platform_1.platform;
// This is generated by "npm run dist"
var _version_1 = require("./_version");
exports.version = _version_1.version;
var logger = new logger_1.Logger(_version_1.version);
exports.logger = logger;
////////////////////////
// Helper Functions
function getDefaultProvider(network, options) {
@ -14016,7 +14019,7 @@ function getDefaultProvider(network, options) {
}
var n = providers.getNetwork(network);
if (!n || !n._defaultProvider) {
errors.throwError("unsupported getDefaultProvider network", errors.NETWORK_ERROR, {
logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, {
operation: "getDefaultProvider",
network: network
});
@ -14025,7 +14028,7 @@ function getDefaultProvider(network, options) {
}
exports.getDefaultProvider = getDefaultProvider;
},{"./_version":75,"./platform":78,"./utils":79,"@ethersproject/abstract-signer":60,"@ethersproject/bignumber":68,"@ethersproject/constants":71,"@ethersproject/contracts":73,"@ethersproject/errors":74,"@ethersproject/providers":105,"@ethersproject/wallet":130,"@ethersproject/wordlists":134}],77:[function(require,module,exports){
},{"./_version":75,"./platform":78,"./utils":79,"@ethersproject/abstract-signer":60,"@ethersproject/bignumber":68,"@ethersproject/constants":71,"@ethersproject/contracts":73,"@ethersproject/logger":92,"@ethersproject/providers":105,"@ethersproject/wallet":130,"@ethersproject/wordlists":134}],77:[function(require,module,exports){
"use strict";
function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
@ -14103,6 +14106,8 @@ var json_wallets_1 = require("@ethersproject/json-wallets");
exports.getJsonWalletAddress = json_wallets_1.getJsonWalletAddress;
var keccak256_1 = require("@ethersproject/keccak256");
exports.keccak256 = keccak256_1.keccak256;
var logger_1 = require("@ethersproject/logger");
exports.Logger = logger_1.Logger;
var sha2_1 = require("@ethersproject/sha2");
exports.sha256 = sha2_1.sha256;
var solidity_1 = require("@ethersproject/solidity");
@ -14155,7 +14160,7 @@ exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm;
},{"@ethersproject/abi":55,"@ethersproject/address":62,"@ethersproject/base64":63,"@ethersproject/bytes":70,"@ethersproject/hash":81,"@ethersproject/hdnode":83,"@ethersproject/json-wallets":86,"@ethersproject/keccak256":90,"@ethersproject/properties":97,"@ethersproject/random":112,"@ethersproject/rlp":114,"@ethersproject/sha2":116,"@ethersproject/signing-key":118,"@ethersproject/solidity":119,"@ethersproject/strings":123,"@ethersproject/transactions":126,"@ethersproject/units":128,"@ethersproject/wallet":130,"@ethersproject/web":132}],80:[function(require,module,exports){
},{"@ethersproject/abi":55,"@ethersproject/address":62,"@ethersproject/base64":63,"@ethersproject/bytes":70,"@ethersproject/hash":81,"@ethersproject/hdnode":83,"@ethersproject/json-wallets":86,"@ethersproject/keccak256":90,"@ethersproject/logger":92,"@ethersproject/properties":97,"@ethersproject/random":112,"@ethersproject/rlp":114,"@ethersproject/sha2":116,"@ethersproject/signing-key":118,"@ethersproject/solidity":119,"@ethersproject/strings":123,"@ethersproject/transactions":126,"@ethersproject/units":128,"@ethersproject/wallet":130,"@ethersproject/web":132}],80:[function(require,module,exports){
arguments[4][61][0].apply(exports,arguments)
},{"dup":61}],81:[function(require,module,exports){
"use strict";

File diff suppressed because one or more lines are too long

@ -3,15 +3,18 @@ import { BigNumber, FixedNumber } from "@ethersproject/bignumber";
import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
import { Wallet } from "@ethersproject/wallet";
import * as constants from "@ethersproject/constants";
import * as errors from "@ethersproject/errors";
import * as providers from "@ethersproject/providers";
import { Wordlist, wordlists } from "@ethersproject/wordlists";
import * as utils from "./utils";
declare const errors: {
[name: string]: string;
};
import { BigNumberish } from "@ethersproject/bignumber";
import { Bytes, BytesLike, Signature } from "@ethersproject/bytes";
import { Transaction, UnsignedTransaction } from "@ethersproject/transactions";
import { platform } from "./platform";
import { version } from "./_version";
declare const logger: utils.Logger;
import { ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface } from "@ethersproject/contracts";
declare function getDefaultProvider(network?: providers.Network | string, options?: any): providers.BaseProvider;
export { version, Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, utils, wordlists, platform, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };
export { version, Signer, Wallet, VoidSigner, getDefaultProvider, providers, Contract, ContractFactory, BigNumber, FixedNumber, constants, errors, logger, utils, wordlists, platform, ContractFunction, ContractReceipt, ContractTransaction, Event, EventFilter, Overrides, PayableOverrides, CallOverrides, ContractInterface, BigNumberish, Bytes, BytesLike, Signature, Transaction, UnsignedTransaction, Wordlist };

@ -20,8 +20,6 @@ var wallet_1 = require("@ethersproject/wallet");
exports.Wallet = wallet_1.Wallet;
var constants = __importStar(require("@ethersproject/constants"));
exports.constants = constants;
var errors = __importStar(require("@ethersproject/errors"));
exports.errors = errors;
var providers = __importStar(require("@ethersproject/providers"));
exports.providers = providers;
var wordlists_1 = require("@ethersproject/wordlists");
@ -29,6 +27,9 @@ exports.Wordlist = wordlists_1.Wordlist;
exports.wordlists = wordlists_1.wordlists;
var utils = __importStar(require("./utils"));
exports.utils = utils;
var logger_1 = require("@ethersproject/logger");
var errors = logger_1.Logger.errors;
exports.errors = errors;
////////////////////////
// Compile-Time Constants
// This is empty in node, and used by browserify to inject extra goodies
@ -37,6 +38,8 @@ exports.platform = platform_1.platform;
// This is generated by "npm run dist"
var _version_1 = require("./_version");
exports.version = _version_1.version;
var logger = new logger_1.Logger(_version_1.version);
exports.logger = logger;
////////////////////////
// Helper Functions
function getDefaultProvider(network, options) {
@ -45,7 +48,7 @@ function getDefaultProvider(network, options) {
}
var n = providers.getNetwork(network);
if (!n || !n._defaultProvider) {
errors.throwError("unsupported getDefaultProvider network", errors.NETWORK_ERROR, {
logger.throwError("unsupported getDefaultProvider network", logger_1.Logger.errors.NETWORK_ERROR, {
operation: "getDefaultProvider",
network: network
});

@ -1,7 +1,7 @@
{
"name": "ethers",
"version": "5.0.0-beta.149",
"description": "Error utility functions for ethers.",
"description": "Umbrella package for most common Ethers libraries.",
"main": "index.js",
"scripts": {
"dist": "npm run dist-browser && npm run dist-minified",
@ -19,11 +19,11 @@
"@ethersproject/bytes": ">5.0.0-beta.0",
"@ethersproject/constants": ">5.0.0-beta.0",
"@ethersproject/contracts": ">5.0.0-beta.0",
"@ethersproject/errors": ">5.0.0-beta.0",
"@ethersproject/hash": ">5.0.0-beta.0",
"@ethersproject/hdnode": ">5.0.0-beta.0",
"@ethersproject/json-wallets": ">5.0.0-beta.0",
"@ethersproject/keccak256": ">5.0.0-beta.0",
"@ethersproject/logger": ">5.0.0-beta.0",
"@ethersproject/networks": ">5.0.0-beta.0",
"@ethersproject/pbkdf2": ">5.0.0-beta.0",
"@ethersproject/properties": ">5.0.0-beta.0",
@ -56,5 +56,5 @@
"publishConfig": {
"tag": "next"
},
"tarballHash": "0x331cb7370079df867415803325653d5fff45477f39e50abc0daabd4f4c920c07"
"tarballHash": "0xabcf56fe40ab0d8e6fb183e947773be07ddc4b52d6cdfcc0e7fd06e880de4b80"
}

@ -8,13 +8,16 @@ import { Signer, VoidSigner } from "@ethersproject/abstract-signer";
import { Wallet } from "@ethersproject/wallet";
import * as constants from "@ethersproject/constants";
import * as errors from "@ethersproject/errors";
import * as providers from "@ethersproject/providers";
import { Wordlist, wordlists} from "@ethersproject/wordlists";
import * as utils from "./utils";
import { Logger } from "@ethersproject/logger";
const errors: { [ name: string ]: string } = Logger.errors;
////////////////////////
// Types
@ -32,6 +35,7 @@ import { platform } from "./platform";
// This is generated by "npm run dist"
import { version } from "./_version";
const logger = new Logger(version);
////////////////////////
// Types
@ -59,7 +63,7 @@ function getDefaultProvider(network?: providers.Network | string, options?: any)
if (network == null) { network = "homestead"; }
let n = providers.getNetwork(network);
if (!n || !n._defaultProvider) {
errors.throwError("unsupported getDefaultProvider network", errors.NETWORK_ERROR, {
logger.throwError("unsupported getDefaultProvider network", Logger.errors.NETWORK_ERROR, {
operation: "getDefaultProvider",
network: network
});
@ -90,6 +94,8 @@ export {
constants,
errors,
logger,
utils,
wordlists,

@ -8,6 +8,7 @@ import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
import { getJsonWalletAddress } from "@ethersproject/json-wallets";
import { keccak256 } from "@ethersproject/keccak256";
import { Logger } from "@ethersproject/logger";
import { sha256 } from "@ethersproject/sha2";
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity";
import { randomBytes } from "@ethersproject/random";
@ -48,6 +49,8 @@ export {
ParamType,
FormatTypes,
Logger,
RLP,
fetchJson,

@ -6,6 +6,7 @@ import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, entropyToMnemonic, HDNode, isValidMnemonic, mnemonicToEntropy, mnemonicToSeed } from "@ethersproject/hdnode";
import { getJsonWalletAddress } from "@ethersproject/json-wallets";
import { keccak256 } from "@ethersproject/keccak256";
import { Logger } from "@ethersproject/logger";
import { sha256 } from "@ethersproject/sha2";
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity";
import { randomBytes } from "@ethersproject/random";
@ -23,4 +24,4 @@ import { CoerceFunc } from "@ethersproject/abi";
import { Bytes, BytesLike, Hexable } from "@ethersproject/bytes";
import { ConnectionInfo, OnceBlockable, PollOptions } from "@ethersproject/web";
import { EncryptOptions, ProgressCallback } from "@ethersproject/json-wallets";
export { AbiCoder, defaultAbiCoder, Fragment, EventFragment, FunctionFragment, ParamType, FormatTypes, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, 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, FormatTypes, Logger, RLP, fetchJson, poll, checkProperties, deepCopy, defineReadOnly, getStatic, resolveProperties, shallowCopy, arrayify, concat, stripZeros, zeroPad, defaultPath, HDNode, SigningKey, Interface, base64, hexlify, isHexString, hexStripZeros, hexValue, hexZeroPad, hexDataLength, hexDataSlice, nameprep, _toEscapedUtf8String, toUtf8Bytes, toUtf8CodePoints, toUtf8String, formatBytes32String, parseBytes32String, hashMessage, namehash, isValidName, 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 };

@ -54,6 +54,8 @@ var json_wallets_1 = require("@ethersproject/json-wallets");
exports.getJsonWalletAddress = json_wallets_1.getJsonWalletAddress;
var keccak256_1 = require("@ethersproject/keccak256");
exports.keccak256 = keccak256_1.keccak256;
var logger_1 = require("@ethersproject/logger");
exports.Logger = logger_1.Logger;
var sha2_1 = require("@ethersproject/sha2");
exports.sha256 = sha2_1.sha256;
var solidity_1 = require("@ethersproject/solidity");

@ -1 +1 @@
export declare const version = "5.0.0-beta.126";
export declare const version = "5.0.0-beta.127";

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

@ -18,6 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers");
var scrypt_js_1 = __importDefault(require("scrypt-js"));
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var warned = false;
var BrainWallet = /** @class */ (function (_super) {
__extends(BrainWallet, _super);
@ -26,20 +28,20 @@ var BrainWallet = /** @class */ (function (_super) {
}
BrainWallet._generate = function (username, password, legacy, progressCallback) {
if (!warned) {
ethers_1.ethers.errors.warn("Warning: using Brain Wallets should be considered insecure (this warning will not be repeated)");
logger.warn("Warning: using Brain Wallets should be considered insecure (this warning will not be repeated)");
warned = true;
}
var usernameBytes = null;
var passwordBytes = null;
if (typeof (username) === 'string') {
ethers_1.ethers.errors.checkNormalize();
logger.checkNormalize();
usernameBytes = ethers_1.ethers.utils.toUtf8Bytes(username.normalize('NFKC'));
}
else {
usernameBytes = ethers_1.ethers.utils.arrayify(username);
}
if (typeof (password) === 'string') {
ethers_1.ethers.errors.checkNormalize();
logger.checkNormalize();
passwordBytes = ethers_1.ethers.utils.toUtf8Bytes(password.normalize('NFKC'));
}
else {

@ -14,6 +14,8 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers");
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var MetamaskProvider = /** @class */ (function (_super) {
__extends(MetamaskProvider, _super);
function MetamaskProvider(ethereum) {
@ -21,7 +23,7 @@ var MetamaskProvider = /** @class */ (function (_super) {
if (!ethereum) {
ethereum = global.ethereum;
if (!ethereum) {
ethers_1.ethers.errors.throwError("could not auto-detect global.ethereum", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("could not auto-detect global.ethereum", ethers_1.ethers.errors.UNSUPPORTED_OPERATION, {
operation: "window.ethereum"
});
}

@ -14,12 +14,14 @@ var __extends = (this && this.__extends) || (function () {
})();
Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers");
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var NonceManager = /** @class */ (function (_super) {
__extends(NonceManager, _super);
function NonceManager(signer) {
var _newTarget = this.constructor;
var _this = this;
ethers_1.ethers.errors.checkNew(_newTarget, NonceManager);
logger.checkNew(_newTarget, NonceManager);
_this = _super.call(this) || this;
ethers_1.ethers.utils.defineReadOnly(_this, "signer", signer);
return _this;

@ -1,6 +1,6 @@
{
"name": "@ethersproject/experimental",
"version": "5.0.0-beta.126",
"version": "5.0.0-beta.127",
"description": "Experimental libraries for ethers. These should not be considered stable.",
"main": "index.js",
"scripts": {
@ -20,5 +20,5 @@
"publishConfig": {
"access": "public"
},
"tarballHash": "0x03208a62350c0f5fb087f77c922c55eecb3dba2d86e2a445bf30d5993b19fa09"
"tarballHash": "0x2b48abe96aa08a179308a471fb55cba045314e16b4b002a7339a0d3891821c52"
}

@ -20,12 +20,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
// See: https://github.com/ethers-io/ethers.js/issues/427
var ethers_1 = require("ethers");
var web_1 = require("@ethersproject/web");
var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var RetryProvider = /** @class */ (function (_super) {
__extends(RetryProvider, _super);
function RetryProvider(provider, options) {
var _newTarget = this.constructor;
var _this = this;
ethers_1.ethers.errors.checkNew(_newTarget, RetryProvider);
logger.checkNew(_newTarget, RetryProvider);
_this = _super.call(this, provider.getNetwork()) || this;
ethers_1.ethers.utils.defineReadOnly(_this, "provider", provider);
ethers_1.ethers.utils.defineReadOnly(_this, "options", options || {});

@ -1 +1 @@
export const version = "5.0.0-beta.126";
export const version = "5.0.0-beta.127";

@ -4,27 +4,31 @@ import { ethers } from "ethers";
import scrypt from "scrypt-js";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
let warned = false;
export class BrainWallet extends ethers.Wallet {
static _generate(username: ethers.Bytes | string, password: ethers.Bytes | string, legacy: boolean, progressCallback?: ethers.utils.ProgressCallback): Promise<BrainWallet> {
if (!warned) {
ethers.errors.warn("Warning: using Brain Wallets should be considered insecure (this warning will not be repeated)");
logger.warn("Warning: using Brain Wallets should be considered insecure (this warning will not be repeated)");
warned = true;
}
let usernameBytes: Uint8Array = null;
let passwordBytes: Uint8Array = null;
if (typeof(username) === 'string') {
ethers.errors.checkNormalize();
logger.checkNormalize();
usernameBytes = ethers.utils.toUtf8Bytes(username.normalize('NFKC'));
} else {
usernameBytes = ethers.utils.arrayify(username);
}
if (typeof(password) === 'string') {
ethers.errors.checkNormalize();
logger.checkNormalize();
passwordBytes = ethers.utils.toUtf8Bytes(password.normalize('NFKC'));
} else {
passwordBytes = ethers.utils.arrayify(password);

@ -2,6 +2,9 @@
import { ethers } from "ethers";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
export class MetamaskProvider extends ethers.providers.Web3Provider {
@ -12,7 +15,7 @@ export class MetamaskProvider extends ethers.providers.Web3Provider {
if (!ethereum) {
ethereum = (<any>global).ethereum;
if (!ethereum) {
ethers.errors.throwError("could not auto-detect global.ethereum", ethers.errors.UNSUPPORTED_OPERATION, {
logger.throwError("could not auto-detect global.ethereum", ethers.errors.UNSUPPORTED_OPERATION, {
operation: "window.ethereum"
});
}

@ -2,6 +2,10 @@
import { ethers } from "ethers";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
export class NonceManager extends ethers.Signer {
readonly signer: ethers.Signer;
readonly provider: ethers.providers.Provider;
@ -9,7 +13,7 @@ export class NonceManager extends ethers.Signer {
_transactionCount: Promise<number>;
constructor(signer: ethers.Signer) {
ethers.errors.checkNew(new.target, NonceManager);
logger.checkNew(new.target, NonceManager);
super();
ethers.utils.defineReadOnly(this, "signer", signer);
}

@ -10,6 +10,9 @@
import { ethers } from "ethers";
import { poll } from "@ethersproject/web";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
export type RetryOptions = {
// Maximum time in total to retry
@ -33,7 +36,7 @@ export class RetryProvider extends ethers.providers.BaseProvider {
readonly options: RetryOptions;
constructor(provider: ethers.providers.BaseProvider, options?: RetryOptions) {
ethers.errors.checkNew(new.target, RetryProvider);
logger.checkNew(new.target, RetryProvider);
super(provider.getNetwork());
ethers.utils.defineReadOnly(this, "provider", provider);
ethers.utils.defineReadOnly(this, "options", options || { });