Skip to content

Commit

Permalink
Removed references to legacy errors pacakge and updated umbrella paca…
Browse files Browse the repository at this point in the history
…kge.
  • Loading branch information
ricmoo committed Aug 2, 2019
1 parent 226c100 commit c09de16
Show file tree
Hide file tree
Showing 26 changed files with 99 additions and 46 deletions.
4 changes: 3 additions & 1 deletion packages/cli/bin/ethers-ens.js
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
});
};
Expand Down
9 changes: 5 additions & 4 deletions packages/cli/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down Expand Up @@ -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
});
Expand All @@ -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"
});
}
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
"publishConfig": {
"access": "public"
},
"tarballHash": "0x46224f464ccc9cc68cb0f1fca15dce7b9b8fa6fa55109b467497e44094643833"
"tarballHash": "0x03ea112e9284e7053a8bb0aea51bdc2c7de129abf2fb3633509c0fd5099df222"
}
7 changes: 5 additions & 2 deletions packages/cli/src.ts/bin/ethers-ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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"
});
}
Expand Down
10 changes: 6 additions & 4 deletions packages/cli/src.ts/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 { }


Expand Down Expand Up @@ -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
});
Expand All @@ -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"
});
}
Expand Down
15 changes: 10 additions & 5 deletions packages/ethers/dist/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13991,15 +13991,16 @@ 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");
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
Expand All @@ -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) {
Expand All @@ -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
});
Expand All @@ -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];
Expand Down Expand Up @@ -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");
Expand Down Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion packages/ethers/dist/ethers.min.js

Large diffs are not rendered by default.

7 changes: 5 additions & 2 deletions packages/ethers/ethers.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 };
9 changes: 6 additions & 3 deletions packages/ethers/ethers.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,16 @@ 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");
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
Expand All @@ -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) {
Expand All @@ -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
});
Expand Down
6 changes: 3 additions & 3 deletions packages/ethers/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -56,5 +56,5 @@
"publishConfig": {
"tag": "next"
},
"tarballHash": "0x331cb7370079df867415803325653d5fff45477f39e50abc0daabd4f4c920c07"
"tarballHash": "0xabcf56fe40ab0d8e6fb183e947773be07ddc4b52d6cdfcc0e7fd06e880de4b80"
}
10 changes: 8 additions & 2 deletions packages/ethers/src.ts/ethers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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
Expand Down Expand Up @@ -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
});
Expand Down Expand Up @@ -90,6 +94,8 @@ export {
constants,
errors,

logger,

utils,

wordlists,
Expand Down
3 changes: 3 additions & 0 deletions packages/ethers/src.ts/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -48,6 +49,8 @@ export {
ParamType,
FormatTypes,

Logger,

RLP,

fetchJson,
Expand Down
Loading

0 comments on commit c09de16

Please sign in to comment.