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

View File

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

View File

@ -57,6 +57,7 @@ var ethers_1 = require("ethers");
var scrypt_js_1 = __importDefault(require("scrypt-js")); var scrypt_js_1 = __importDefault(require("scrypt-js"));
var prompt_1 = require("./prompt"); var prompt_1 = require("./prompt");
var _version_1 = require("./_version"); var _version_1 = require("./_version");
var logger = new ethers_1.ethers.utils.Logger(_version_1.version);
var UsageError = /** @class */ (function (_super) { var UsageError = /** @class */ (function (_super) {
__extends(UsageError, _super); __extends(UsageError, _super);
function UsageError() { function UsageError() {
@ -818,12 +819,12 @@ var CLI = /** @class */ (function () {
// @TODO: Better way to specify default; i.e. may not have args // @TODO: Better way to specify default; i.e. may not have args
CLI.prototype.addPlugin = function (command, plugin) { CLI.prototype.addPlugin = function (command, plugin) {
if (this.standAlone) { 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" operation: "addPlugin"
}); });
} }
else if (this.plugins[command]) { 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", operation: "addPlugin",
command: command command: command
}); });
@ -832,12 +833,12 @@ var CLI = /** @class */ (function () {
}; };
CLI.prototype.setPlugin = function (plugin) { CLI.prototype.setPlugin = function (plugin) {
if (Object.keys(this.plugins).length !== 0) { 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" operation: "setPlugin"
}); });
} }
if (this.standAlone) { 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" operation: "setPlugin"
}); });
} }

View File

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

View File

@ -2,11 +2,14 @@
'use strict'; 'use strict';
import { ethers } from 'ethers'; import { ethers } from 'ethers';
import { ArgParser, CLI, Help, Plugin } from '../cli'; import { ArgParser, CLI, Help, Plugin } from '../cli';
import { version } from "../_version";
const logger = new ethers.utils.Logger(version);
const ensAbi = [ const ensAbi = [
"function setOwner(bytes32 node, address owner) external @500000", "function setOwner(bytes32 node, address owner) external @500000",
"function setSubnodeOwner(bytes32 node, bytes32 label, 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; _wait: boolean;
static getHelp(): Help { 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" operation: "getHelp"
}); });
} }

View File

@ -10,6 +10,8 @@ import { getChoice, getPassword, getProgressBar } from "./prompt";
import { version } from "./_version"; import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
class UsageError extends Error { } class UsageError extends Error { }
@ -730,11 +732,11 @@ export class CLI {
addPlugin(command: string, plugin: PluginType) { addPlugin(command: string, plugin: PluginType) {
if (this.standAlone) { 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" operation: "addPlugin"
}); });
} else if (this.plugins[command]) { } 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", operation: "addPlugin",
command: command command: command
}); });
@ -744,12 +746,12 @@ export class CLI {
setPlugin(plugin: PluginType) { setPlugin(plugin: PluginType) {
if (Object.keys(this.plugins).length !== 0) { 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" operation: "setPlugin"
}); });
} }
if (this.standAlone) { 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" operation: "setPlugin"
}); });
} }

View File

@ -13991,8 +13991,6 @@ var wallet_1 = require("@ethersproject/wallet");
exports.Wallet = wallet_1.Wallet; exports.Wallet = wallet_1.Wallet;
var constants = __importStar(require("@ethersproject/constants")); var constants = __importStar(require("@ethersproject/constants"));
exports.constants = constants; exports.constants = constants;
var errors = __importStar(require("@ethersproject/errors"));
exports.errors = errors;
var providers = __importStar(require("@ethersproject/providers")); var providers = __importStar(require("@ethersproject/providers"));
exports.providers = providers; exports.providers = providers;
var wordlists_1 = require("@ethersproject/wordlists"); var wordlists_1 = require("@ethersproject/wordlists");
@ -14000,6 +13998,9 @@ exports.Wordlist = wordlists_1.Wordlist;
exports.wordlists = wordlists_1.wordlists; exports.wordlists = wordlists_1.wordlists;
var utils = __importStar(require("./utils")); var utils = __importStar(require("./utils"));
exports.utils = utils; exports.utils = utils;
var logger_1 = require("@ethersproject/logger");
var errors = logger_1.Logger.errors;
exports.errors = errors;
//////////////////////// ////////////////////////
// Compile-Time Constants // Compile-Time Constants
// This is empty in node, and used by browserify to inject extra goodies // 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" // This is generated by "npm run dist"
var _version_1 = require("./_version"); var _version_1 = require("./_version");
exports.version = _version_1.version; exports.version = _version_1.version;
var logger = new logger_1.Logger(_version_1.version);
exports.logger = logger;
//////////////////////// ////////////////////////
// Helper Functions // Helper Functions
function getDefaultProvider(network, options) { function getDefaultProvider(network, options) {
@ -14016,7 +14019,7 @@ function getDefaultProvider(network, options) {
} }
var n = providers.getNetwork(network); var n = providers.getNetwork(network);
if (!n || !n._defaultProvider) { 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", operation: "getDefaultProvider",
network: network network: network
}); });
@ -14025,7 +14028,7 @@ function getDefaultProvider(network, options) {
} }
exports.getDefaultProvider = getDefaultProvider; 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"; "use strict";
function __export(m) { function __export(m) {
for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p]; 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; exports.getJsonWalletAddress = json_wallets_1.getJsonWalletAddress;
var keccak256_1 = require("@ethersproject/keccak256"); var keccak256_1 = require("@ethersproject/keccak256");
exports.keccak256 = keccak256_1.keccak256; exports.keccak256 = keccak256_1.keccak256;
var logger_1 = require("@ethersproject/logger");
exports.Logger = logger_1.Logger;
var sha2_1 = require("@ethersproject/sha2"); var sha2_1 = require("@ethersproject/sha2");
exports.sha256 = sha2_1.sha256; exports.sha256 = sha2_1.sha256;
var solidity_1 = require("@ethersproject/solidity"); var solidity_1 = require("@ethersproject/solidity");
@ -14155,7 +14160,7 @@ exports.SupportedAlgorithms = sha2_2.SupportedAlgorithms;
var strings_2 = require("@ethersproject/strings"); var strings_2 = require("@ethersproject/strings");
exports.UnicodeNormalizationForm = strings_2.UnicodeNormalizationForm; 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) arguments[4][61][0].apply(exports,arguments)
},{"dup":61}],81:[function(require,module,exports){ },{"dup":61}],81:[function(require,module,exports){
"use strict"; "use strict";

File diff suppressed because one or more lines are too long

View File

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

View File

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

View File

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

View File

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

View File

@ -8,6 +8,7 @@ import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, 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 { Logger } from "@ethersproject/logger";
import { sha256 } from "@ethersproject/sha2"; import { sha256 } from "@ethersproject/sha2";
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity"; import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity";
import { randomBytes } from "@ethersproject/random"; import { randomBytes } from "@ethersproject/random";
@ -48,6 +49,8 @@ export {
ParamType, ParamType,
FormatTypes, FormatTypes,
Logger,
RLP, RLP,
fetchJson, fetchJson,

View File

@ -6,6 +6,7 @@ import { hashMessage, id, isValidName, namehash } from "@ethersproject/hash";
import { defaultPath, 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 { Logger } from "@ethersproject/logger";
import { sha256 } from "@ethersproject/sha2"; import { sha256 } from "@ethersproject/sha2";
import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity"; import { keccak256 as solidityKeccak256, pack as solidityPack, sha256 as soliditySha256 } from "@ethersproject/solidity";
import { randomBytes } from "@ethersproject/random"; import { randomBytes } from "@ethersproject/random";
@ -23,4 +24,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, 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 };

View File

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

View File

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

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.126"; exports.version = "5.0.0-beta.127";

View File

@ -18,6 +18,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers"); var ethers_1 = require("ethers");
var scrypt_js_1 = __importDefault(require("scrypt-js")); 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 warned = false;
var BrainWallet = /** @class */ (function (_super) { var BrainWallet = /** @class */ (function (_super) {
__extends(BrainWallet, _super); __extends(BrainWallet, _super);
@ -26,20 +28,20 @@ var BrainWallet = /** @class */ (function (_super) {
} }
BrainWallet._generate = function (username, password, legacy, progressCallback) { BrainWallet._generate = function (username, password, legacy, progressCallback) {
if (!warned) { 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; warned = true;
} }
var usernameBytes = null; var usernameBytes = null;
var passwordBytes = null; var passwordBytes = null;
if (typeof (username) === 'string') { if (typeof (username) === 'string') {
ethers_1.ethers.errors.checkNormalize(); logger.checkNormalize();
usernameBytes = ethers_1.ethers.utils.toUtf8Bytes(username.normalize('NFKC')); usernameBytes = ethers_1.ethers.utils.toUtf8Bytes(username.normalize('NFKC'));
} }
else { else {
usernameBytes = ethers_1.ethers.utils.arrayify(username); usernameBytes = ethers_1.ethers.utils.arrayify(username);
} }
if (typeof (password) === 'string') { if (typeof (password) === 'string') {
ethers_1.ethers.errors.checkNormalize(); logger.checkNormalize();
passwordBytes = ethers_1.ethers.utils.toUtf8Bytes(password.normalize('NFKC')); passwordBytes = ethers_1.ethers.utils.toUtf8Bytes(password.normalize('NFKC'));
} }
else { else {

View File

@ -14,6 +14,8 @@ var __extends = (this && this.__extends) || (function () {
})(); })();
Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "__esModule", { value: true });
var ethers_1 = require("ethers"); 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) { var MetamaskProvider = /** @class */ (function (_super) {
__extends(MetamaskProvider, _super); __extends(MetamaskProvider, _super);
function MetamaskProvider(ethereum) { function MetamaskProvider(ethereum) {
@ -21,7 +23,7 @@ var MetamaskProvider = /** @class */ (function (_super) {
if (!ethereum) { if (!ethereum) {
ethereum = global.ethereum; ethereum = global.ethereum;
if (!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" operation: "window.ethereum"
}); });
} }

View File

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

View File

@ -1,6 +1,6 @@
{ {
"name": "@ethersproject/experimental", "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.", "description": "Experimental libraries for ethers. These should not be considered stable.",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
@ -20,5 +20,5 @@
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"
}, },
"tarballHash": "0x03208a62350c0f5fb087f77c922c55eecb3dba2d86e2a445bf30d5993b19fa09" "tarballHash": "0x2b48abe96aa08a179308a471fb55cba045314e16b4b002a7339a0d3891821c52"
} }

View File

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

View File

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

View File

@ -4,27 +4,31 @@ import { ethers } from "ethers";
import scrypt from "scrypt-js"; import scrypt from "scrypt-js";
import { version } from "./_version";
const logger = new ethers.utils.Logger(version);
let warned = false; let warned = false;
export class BrainWallet extends ethers.Wallet { export class BrainWallet extends ethers.Wallet {
static _generate(username: ethers.Bytes | string, password: ethers.Bytes | string, legacy: boolean, progressCallback?: ethers.utils.ProgressCallback): Promise<BrainWallet> { static _generate(username: ethers.Bytes | string, password: ethers.Bytes | string, legacy: boolean, progressCallback?: ethers.utils.ProgressCallback): Promise<BrainWallet> {
if (!warned) { 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; warned = true;
} }
let usernameBytes: Uint8Array = null; let usernameBytes: Uint8Array = null;
let passwordBytes: Uint8Array = null; let passwordBytes: Uint8Array = null;
if (typeof(username) === 'string') { if (typeof(username) === 'string') {
ethers.errors.checkNormalize(); logger.checkNormalize();
usernameBytes = ethers.utils.toUtf8Bytes(username.normalize('NFKC')); usernameBytes = ethers.utils.toUtf8Bytes(username.normalize('NFKC'));
} else { } else {
usernameBytes = ethers.utils.arrayify(username); usernameBytes = ethers.utils.arrayify(username);
} }
if (typeof(password) === 'string') { if (typeof(password) === 'string') {
ethers.errors.checkNormalize(); logger.checkNormalize();
passwordBytes = ethers.utils.toUtf8Bytes(password.normalize('NFKC')); passwordBytes = ethers.utils.toUtf8Bytes(password.normalize('NFKC'));
} else { } else {
passwordBytes = ethers.utils.arrayify(password); passwordBytes = ethers.utils.arrayify(password);

View File

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

View File

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

View File

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