Updated dist files.
This commit is contained in:
parent
0af95f4a65
commit
8354c3f9fe
@ -3,6 +3,13 @@ Changelog
|
||||
|
||||
This change log is managed by `scripts/cmds/update-versions` but may be manually updated.
|
||||
|
||||
ethers/v5.0.0-beta.149 (2019-08-02 2:07)
|
||||
----------------------------------------
|
||||
|
||||
- Full case-folding for IDNA in namehash. ([0af95f4](https://github.com/ethers-io/ethers.js/commit/0af95f4a655106e67c2ba8f445af88c9e9e24339))
|
||||
- Deprecating errors for logger. ([0b224e8](https://github.com/ethers-io/ethers.js/commit/0b224e8fb5811cd06727063c909ca1e1e5cde57e))
|
||||
- More consistent debug events for Providers. ([e8f28b5](https://github.com/ethers-io/ethers.js/commit/e8f28b55d7dd62e29f03628232ffe7c75dc811b5))
|
||||
|
||||
ethers/v5.0.0-beta.148 (2019-07-27 18:56)
|
||||
-----------------------------------------
|
||||
|
||||
|
2
packages/abi/_version.d.ts
vendored
2
packages/abi/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.134";
|
||||
export declare const version = "5.0.0-beta.135";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.134";
|
||||
exports.version = "5.0.0-beta.135";
|
||||
|
@ -1,16 +1,11 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// See: https://github.com/ethereum/wiki/wiki/Ethereum-Contract-ABI
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var abstract_coder_1 = require("./coders/abstract-coder");
|
||||
var address_1 = require("./coders/address");
|
||||
var array_1 = require("./coders/array");
|
||||
@ -27,7 +22,7 @@ var paramTypeNumber = new RegExp(/^(u?int)([0-9]*)$/);
|
||||
var AbiCoder = /** @class */ (function () {
|
||||
function AbiCoder(coerceFunc) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, AbiCoder);
|
||||
logger.checkNew(_newTarget, AbiCoder);
|
||||
properties_1.defineReadOnly(this, "coerceFunc", coerceFunc || null);
|
||||
}
|
||||
AbiCoder.prototype._getCoder = function (param) {
|
||||
@ -55,10 +50,7 @@ var AbiCoder = /** @class */ (function () {
|
||||
if (match) {
|
||||
var size = parseInt(match[2] || "256");
|
||||
if (size === 0 || size > 256 || (size % 8) !== 0) {
|
||||
errors.throwError("invalid " + match[1] + " bit length", errors.INVALID_ARGUMENT, {
|
||||
arg: "param",
|
||||
value: param
|
||||
});
|
||||
logger.throwArgumentError("invalid " + match[1] + " bit length", "param", param);
|
||||
}
|
||||
return new number_1.NumberCoder(size / 8, (match[1] === "int"), param.name);
|
||||
}
|
||||
@ -67,17 +59,11 @@ var AbiCoder = /** @class */ (function () {
|
||||
if (match) {
|
||||
var size = parseInt(match[1]);
|
||||
if (size === 0 || size > 32) {
|
||||
errors.throwError("invalid bytes length", errors.INVALID_ARGUMENT, {
|
||||
arg: "param",
|
||||
value: param
|
||||
});
|
||||
logger.throwArgumentError("invalid bytes length", "param", param);
|
||||
}
|
||||
return new fixed_bytes_1.FixedBytesCoder(size, param.name);
|
||||
}
|
||||
return errors.throwError("invalid type", errors.INVALID_ARGUMENT, {
|
||||
arg: "type",
|
||||
value: param.type
|
||||
});
|
||||
return logger.throwError("invalid type", "type", param.type);
|
||||
};
|
||||
AbiCoder.prototype._getWordSize = function () { return 32; };
|
||||
AbiCoder.prototype._getReader = function (data) {
|
||||
@ -89,7 +75,7 @@ var AbiCoder = /** @class */ (function () {
|
||||
AbiCoder.prototype.encode = function (types, values) {
|
||||
var _this = this;
|
||||
if (types.length !== values.length) {
|
||||
errors.throwError("types/values length mismatch", errors.INVALID_ARGUMENT, {
|
||||
logger.throwError("types/values length mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, {
|
||||
count: { types: types.length, values: values.length },
|
||||
value: { types: types, values: values }
|
||||
});
|
||||
|
@ -1,17 +1,12 @@
|
||||
"use trict";
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("../_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var Coder = /** @class */ (function () {
|
||||
function Coder(name, type, localName, dynamic) {
|
||||
this.name = name;
|
||||
@ -20,11 +15,7 @@ var Coder = /** @class */ (function () {
|
||||
this.dynamic = dynamic;
|
||||
}
|
||||
Coder.prototype._throwError = function (message, value) {
|
||||
errors.throwError(message, errors.INVALID_ARGUMENT, {
|
||||
argument: this.localName,
|
||||
coder: this,
|
||||
value: value
|
||||
});
|
||||
logger.throwArgumentError(message, this.localName, value);
|
||||
};
|
||||
return Coder;
|
||||
}());
|
||||
@ -60,7 +51,7 @@ var Writer = /** @class */ (function () {
|
||||
Writer.prototype._getValue = function (value) {
|
||||
var bytes = bytes_1.arrayify(bignumber_1.BigNumber.from(value));
|
||||
if (bytes.length > this.wordSize) {
|
||||
errors.throwError("value out-of-bounds", errors.BUFFER_OVERRUN, {
|
||||
logger.throwError("value out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, {
|
||||
length: this.wordSize,
|
||||
offset: bytes.length
|
||||
});
|
||||
@ -119,7 +110,7 @@ var Reader = /** @class */ (function () {
|
||||
Reader.prototype._peekBytes = function (offset, length) {
|
||||
var alignedLength = Math.ceil(length / this.wordSize) * this.wordSize;
|
||||
if (this._offset + alignedLength > this._data.length) {
|
||||
errors.throwError("data out-of-bounds", errors.BUFFER_OVERRUN, {
|
||||
logger.throwError("data out-of-bounds", logger_1.Logger.errors.BUFFER_OVERRUN, {
|
||||
length: this._data.length,
|
||||
offset: this._offset + alignedLength
|
||||
});
|
||||
|
@ -12,15 +12,10 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("../_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var abstract_coder_1 = require("./abstract-coder");
|
||||
var anonymous_1 = require("./anonymous");
|
||||
function pack(writer, coders, values) {
|
||||
@ -35,16 +30,10 @@ function pack(writer, coders, values) {
|
||||
values = arrayValues_1;
|
||||
}
|
||||
else {
|
||||
errors.throwError("invalid tuple value", errors.INVALID_ARGUMENT, {
|
||||
coderType: "tuple",
|
||||
value: values
|
||||
});
|
||||
logger.throwArgumentError("invalid tuple value", "tuple", values);
|
||||
}
|
||||
if (coders.length !== values.length) {
|
||||
errors.throwError("types/value length mismatch", errors.INVALID_ARGUMENT, {
|
||||
coderType: "tuple",
|
||||
value: values
|
||||
});
|
||||
logger.throwArgumentError("types/value length mismatch", "tuple", values);
|
||||
}
|
||||
var staticWriter = new abstract_coder_1.Writer(writer.wordSize);
|
||||
var dynamicWriter = new abstract_coder_1.Writer(writer.wordSize);
|
||||
@ -135,7 +124,7 @@ var ArrayCoder = /** @class */ (function (_super) {
|
||||
count = value.length;
|
||||
writer.writeValue(value.length);
|
||||
}
|
||||
errors.checkArgumentCount(count, value.length, " in coder array" + (this.localName ? (" " + this.localName) : ""));
|
||||
logger.checkArgumentCount(count, value.length, "coder array" + (this.localName ? (" " + this.localName) : ""));
|
||||
var coders = [];
|
||||
for (var i = 0; i < value.length; i++) {
|
||||
coders.push(this.coder);
|
||||
|
@ -12,17 +12,12 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
;
|
||||
var _constructorGuard = {};
|
||||
var ModifiersBytes = { calldata: true, memory: true, storage: true };
|
||||
@ -38,7 +33,7 @@ function checkModifier(type, name) {
|
||||
}
|
||||
}
|
||||
if (ModifiersBytes[name] || name === "payable") {
|
||||
errors.throwArgumentError("invalid modifier", "name", name);
|
||||
logger.throwArgumentError("invalid modifier", "name", name);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -253,7 +248,7 @@ var ParamType = /** @class */ (function () {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
errors.throwArgumentError("invalid format type", "format", format);
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
var result_1 = {
|
||||
@ -368,7 +363,7 @@ var Fragment = /** @class */ (function () {
|
||||
// @TODO:
|
||||
return null;
|
||||
}
|
||||
return errors.throwArgumentError("invalid fragment object", "value", value);
|
||||
return logger.throwArgumentError("invalid fragment object", "value", value);
|
||||
};
|
||||
Fragment.fromString = function (value) {
|
||||
// Make sure the "returns" is surrounded by a space and all whitespace is exactly one space
|
||||
@ -402,7 +397,7 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
errors.throwArgumentError("invalid format type", "format", format);
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
@ -458,7 +453,7 @@ var EventFragment = /** @class */ (function (_super) {
|
||||
case "":
|
||||
break;
|
||||
default:
|
||||
errors.warn("unknown modifier: " + modifier);
|
||||
logger.warn("unknown modifier: " + modifier);
|
||||
}
|
||||
});
|
||||
return EventFragment.fromObject({
|
||||
@ -565,7 +560,7 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
errors.throwArgumentError("invalid format type", "format", format);
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
@ -577,7 +572,7 @@ var ConstructorFragment = /** @class */ (function (_super) {
|
||||
});
|
||||
}
|
||||
if (format === exports.FormatTypes.sighash) {
|
||||
errors.throwError("cannot format a constructor for sighash", errors.UNSUPPORTED_OPERATION, {
|
||||
logger.throwError("cannot format a constructor for sighash", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "format(sighash)"
|
||||
});
|
||||
}
|
||||
@ -641,7 +636,7 @@ var FunctionFragment = /** @class */ (function (_super) {
|
||||
format = exports.FormatTypes.sighash;
|
||||
}
|
||||
if (!exports.FormatTypes[format]) {
|
||||
errors.throwArgumentError("invalid format type", "format", format);
|
||||
logger.throwArgumentError("invalid format type", "format", format);
|
||||
}
|
||||
if (format === exports.FormatTypes.json) {
|
||||
return JSON.stringify({
|
||||
|
@ -12,23 +12,18 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("@ethersproject/address");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var hash_1 = require("@ethersproject/hash");
|
||||
var keccak256_1 = require("@ethersproject/keccak256");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var abi_coder_1 = require("./abi-coder");
|
||||
var fragments_1 = require("./fragments");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var LogDescription = /** @class */ (function (_super) {
|
||||
__extends(LogDescription, _super);
|
||||
function LogDescription() {
|
||||
@ -66,7 +61,7 @@ var Interface = /** @class */ (function () {
|
||||
function Interface(fragments) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, Interface);
|
||||
logger.checkNew(_newTarget, Interface);
|
||||
var abi = [];
|
||||
if (typeof (fragments) === "string") {
|
||||
abi = JSON.parse(fragments);
|
||||
@ -88,7 +83,7 @@ var Interface = /** @class */ (function () {
|
||||
switch (fragment.type) {
|
||||
case "constructor":
|
||||
if (_this.deploy) {
|
||||
errors.warn("duplicate definition - constructor");
|
||||
logger.warn("duplicate definition - constructor");
|
||||
return;
|
||||
}
|
||||
properties_1.defineReadOnly(_this, "deploy", fragment);
|
||||
@ -104,7 +99,7 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
var signature = fragment.format();
|
||||
if (bucket[signature]) {
|
||||
errors.warn("duplicate definition - " + signature);
|
||||
logger.warn("duplicate definition - " + signature);
|
||||
return;
|
||||
}
|
||||
bucket[signature] = fragment;
|
||||
@ -115,7 +110,7 @@ var Interface = /** @class */ (function () {
|
||||
Object.keys(bucket).forEach(function (signature) {
|
||||
var fragment = bucket[signature];
|
||||
if (count[fragment.name] !== 1) {
|
||||
errors.warn("duplicate definition - " + fragment.name);
|
||||
logger.warn("duplicate definition - " + fragment.name);
|
||||
return;
|
||||
}
|
||||
bucket[fragment.name] = fragment;
|
||||
@ -208,7 +203,7 @@ var Interface = /** @class */ (function () {
|
||||
}
|
||||
break;
|
||||
}
|
||||
return errors.throwError("call revert exception", errors.CALL_EXCEPTION, {
|
||||
return logger.throwError("call revert exception", logger_1.Logger.errors.CALL_EXCEPTION, {
|
||||
method: functionFragment.format(),
|
||||
errorSignature: errorSignature,
|
||||
errorArgs: [reason],
|
||||
@ -221,7 +216,7 @@ var Interface = /** @class */ (function () {
|
||||
eventFragment = this.getEvent(eventFragment);
|
||||
}
|
||||
if (values.length > eventFragment.inputs.length) {
|
||||
errors.throwError("too many arguments for " + eventFragment.format(), errors.UNEXPECTED_ARGUMENT, {
|
||||
logger.throwError("too many arguments for " + eventFragment.format(), logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {
|
||||
argument: "values",
|
||||
value: values
|
||||
});
|
||||
@ -234,7 +229,7 @@ var Interface = /** @class */ (function () {
|
||||
var param = eventFragment.inputs[index];
|
||||
if (!param.indexed) {
|
||||
if (value != null) {
|
||||
errors.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
|
||||
logger.throwArgumentError("cannot filter non-indexed parameters; must be null", ("contract." + param.name), value);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -248,7 +243,7 @@ var Interface = /** @class */ (function () {
|
||||
topics.push(keccak256_1.keccak256(bytes_1.hexlify(value)));
|
||||
}
|
||||
else if (param.type.indexOf("[") !== -1 || param.type.substring(0, 5) === "tuple") {
|
||||
errors.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
|
||||
logger.throwArgumentError("filtering with tuples or arrays not supported", ("contract." + param.name), value);
|
||||
}
|
||||
else {
|
||||
// Check addresses are valid
|
||||
@ -271,7 +266,7 @@ var Interface = /** @class */ (function () {
|
||||
if (topics != null && !eventFragment.anonymous) {
|
||||
var topicHash = this.getEventTopic(eventFragment);
|
||||
if (!bytes_1.isHexString(topics[0], 32) || topics[0].toLowerCase() !== topicHash) {
|
||||
errors.throwError("fragment/topic mismatch", errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
||||
logger.throwError("fragment/topic mismatch", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "topics[0]", expected: topicHash, value: topics[0] });
|
||||
}
|
||||
topics = topics.slice(1);
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abi",
|
||||
"version": "5.0.0-beta.134",
|
||||
"version": "5.0.0-beta.135",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -26,5 +26,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xa9aab251418094b09c848883131f48807425fee7ac824c20b1e8df9a22f71165"
|
||||
"tarballHash": "0xe2971001e2b8a5140871de1bcff0e78fc6bd526b6754522bf500c284ece17d9f"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.134";
|
||||
export const version = "5.0.0-beta.135";
|
||||
|
2
packages/abstract-provider/_version.d.ts
vendored
2
packages/abstract-provider/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
export declare const version = "5.0.0-beta.128";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.127";
|
||||
exports.version = "5.0.0-beta.128";
|
||||
|
@ -12,18 +12,13 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var errors_1 = require("@ethersproject/errors");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
;
|
||||
;
|
||||
//export type CallTransactionable = {
|
||||
@ -45,7 +40,7 @@ var BlockForkEvent = /** @class */ (function (_super) {
|
||||
function BlockForkEvent(blockhash, expiry) {
|
||||
var _this = this;
|
||||
if (!bytes_1.isHexString(blockhash, 32)) {
|
||||
errors.throwArgumentError("invalid blockhash", "blockhash", blockhash);
|
||||
logger.throwArgumentError("invalid blockhash", "blockhash", blockhash);
|
||||
}
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
@ -63,7 +58,7 @@ var TransactionForkEvent = /** @class */ (function (_super) {
|
||||
function TransactionForkEvent(hash, expiry) {
|
||||
var _this = this;
|
||||
if (!bytes_1.isHexString(hash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "hash", hash);
|
||||
logger.throwArgumentError("invalid transaction hash", "hash", hash);
|
||||
}
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
@ -81,10 +76,10 @@ var TransactionOrderForkEvent = /** @class */ (function (_super) {
|
||||
function TransactionOrderForkEvent(beforeHash, afterHash, expiry) {
|
||||
var _this = this;
|
||||
if (!bytes_1.isHexString(beforeHash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
|
||||
logger.throwArgumentError("invalid transaction hash", "beforeHash", beforeHash);
|
||||
}
|
||||
if (!bytes_1.isHexString(afterHash, 32)) {
|
||||
errors.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
||||
logger.throwArgumentError("invalid transaction hash", "afterHash", afterHash);
|
||||
}
|
||||
_this = _super.call(this, {
|
||||
_isForkEvent: true,
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abstract-provider",
|
||||
"version": "5.0.0-beta.127",
|
||||
"version": "5.0.0-beta.128",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"browser": {
|
||||
@ -28,5 +28,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x600f6a57977cc87491325f019f663b18a783108c35ac4285250445afbc63eace"
|
||||
"tarballHash": "0xcb0db0e650fdaa60aeeb0cbf1adeffdb73058ee2747c86da745ec90970042c4a"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.127";
|
||||
export const version = "5.0.0-beta.128";
|
||||
|
2
packages/abstract-signer/_version.d.ts
vendored
2
packages/abstract-signer/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
export declare const version = "5.0.0-beta.128";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.127";
|
||||
exports.version = "5.0.0-beta.128";
|
||||
|
@ -12,16 +12,11 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var allowedTransactionKeys = [
|
||||
"chainId", "data", "from", "gasLimit", "gasPrice", "nonce", "to", "value"
|
||||
];
|
||||
@ -36,7 +31,7 @@ var Signer = /** @class */ (function () {
|
||||
// Sub-classes MUST call super
|
||||
function Signer() {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkAbstract(_newTarget, Signer);
|
||||
logger.checkAbstract(_newTarget, Signer);
|
||||
properties_1.defineReadOnly(this, "_isSigner", true);
|
||||
}
|
||||
///////////////////
|
||||
@ -99,7 +94,7 @@ var Signer = /** @class */ (function () {
|
||||
Signer.prototype.checkTransaction = function (transaction) {
|
||||
for (var key in transaction) {
|
||||
if (allowedTransactionKeys.indexOf(key) === -1) {
|
||||
errors.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
|
||||
logger.throwArgumentError("invalid transaction key: " + key, "transaction", transaction);
|
||||
}
|
||||
}
|
||||
var tx = properties_1.shallowCopy(transaction);
|
||||
@ -134,7 +129,7 @@ var Signer = /** @class */ (function () {
|
||||
_this.provider.resolveName(tx.from)
|
||||
]).then(function (results) {
|
||||
if (results[0] !== results[1]) {
|
||||
errors.throwArgumentError("from address mismatch", "transaction", transaction);
|
||||
logger.throwArgumentError("from address mismatch", "transaction", transaction);
|
||||
}
|
||||
return results[0];
|
||||
});
|
||||
@ -152,7 +147,7 @@ var Signer = /** @class */ (function () {
|
||||
// Sub-classes SHOULD leave these alone
|
||||
Signer.prototype._checkProvider = function (operation) {
|
||||
if (!this.provider) {
|
||||
errors.throwError("missing provider", errors.UNSUPPORTED_OPERATION, {
|
||||
logger.throwError("missing provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: (operation || "_checkProvider")
|
||||
});
|
||||
}
|
||||
@ -168,7 +163,7 @@ var VoidSigner = /** @class */ (function (_super) {
|
||||
function VoidSigner(address, provider) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, VoidSigner);
|
||||
logger.checkNew(_newTarget, VoidSigner);
|
||||
_this = _super.call(this) || this;
|
||||
properties_1.defineReadOnly(_this, "address", address);
|
||||
properties_1.defineReadOnly(_this, "provider", provider || null);
|
||||
@ -179,7 +174,7 @@ var VoidSigner = /** @class */ (function (_super) {
|
||||
};
|
||||
VoidSigner.prototype._fail = function (message, operation) {
|
||||
return Promise.resolve().then(function () {
|
||||
errors.throwError(message, errors.UNSUPPORTED_OPERATION, { operation: operation });
|
||||
logger.throwError(message, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: operation });
|
||||
});
|
||||
};
|
||||
VoidSigner.prototype.signMessage = function (message) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/abstract-signer",
|
||||
"version": "5.0.0-beta.127",
|
||||
"version": "5.0.0-beta.128",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -22,5 +22,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xd9b7bb0ec627b00472f857c47fae281eff630aa11696650a6b311693e8d4e965"
|
||||
"tarballHash": "0x121a017b5f0ead6463583252996c1897074dac3f88d592c7a38271634aab5859"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.127";
|
||||
export const version = "5.0.0-beta.128";
|
||||
|
2
packages/address/_version.d.ts
vendored
2
packages/address/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
@ -9,13 +9,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
// We use this for base 36 maths
|
||||
var BN = __importStar(require("bn.js"));
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var keccak256_1 = require("@ethersproject/keccak256");
|
||||
var rlp_1 = require("@ethersproject/rlp");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
function getChecksumAddress(address) {
|
||||
if (!bytes_1.isHexString(address, 20)) {
|
||||
errors.throwError("invalid address", errors.INVALID_ARGUMENT, { arg: "address", value: address });
|
||||
logger.throwArgumentError("invalid address", "address", address);
|
||||
}
|
||||
address = address.toLowerCase();
|
||||
var chars = address.substring(2).split("");
|
||||
@ -75,7 +77,7 @@ function ibanChecksum(address) {
|
||||
function getAddress(address) {
|
||||
var result = null;
|
||||
if (typeof (address) !== "string") {
|
||||
errors.throwArgumentError("invalid address", "address", address);
|
||||
logger.throwArgumentError("invalid address", "address", address);
|
||||
}
|
||||
if (address.match(/^(0x)?[0-9a-fA-F]{40}$/)) {
|
||||
// Missing the 0x prefix
|
||||
@ -85,14 +87,14 @@ function getAddress(address) {
|
||||
result = getChecksumAddress(address);
|
||||
// It is a checksummed address with a bad checksum
|
||||
if (address.match(/([A-F].*[a-f])|([a-f].*[A-F])/) && result !== address) {
|
||||
errors.throwArgumentError("bad address checksum", "address", address);
|
||||
logger.throwArgumentError("bad address checksum", "address", address);
|
||||
}
|
||||
// Maybe ICAP? (we only support direct mode)
|
||||
}
|
||||
else if (address.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)) {
|
||||
// It is an ICAP address with a bad checksum
|
||||
if (address.substring(2, 4) !== ibanChecksum(address)) {
|
||||
errors.throwArgumentError("bad icap checksum", "address", address);
|
||||
logger.throwArgumentError("bad icap checksum", "address", address);
|
||||
}
|
||||
result = (new BN.BN(address.substring(4), 36)).toString(16);
|
||||
while (result.length < 40) {
|
||||
@ -101,7 +103,7 @@ function getAddress(address) {
|
||||
result = getChecksumAddress("0x" + result);
|
||||
}
|
||||
else {
|
||||
errors.throwArgumentError("invalid address", "address", address);
|
||||
logger.throwArgumentError("invalid address", "address", address);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ -130,7 +132,7 @@ function getContractAddress(transaction) {
|
||||
from = getAddress(transaction.from);
|
||||
}
|
||||
catch (error) {
|
||||
errors.throwArgumentError("missing from address", "transaction", transaction);
|
||||
logger.throwArgumentError("missing from address", "transaction", transaction);
|
||||
}
|
||||
var nonce = bytes_1.stripZeros(bytes_1.arrayify(transaction.nonce));
|
||||
return getAddress(bytes_1.hexDataSlice(keccak256_1.keccak256(rlp_1.encode([from, nonce])), 12));
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/address",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -23,5 +23,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x962ac58ce384cd1b220fd2d7fbd66e914f4c55f38440d75afd12ba560cffc7f1"
|
||||
"tarballHash": "0xfc843692a9c02ceebc8035163bdd3ab953cac93219b25be6e2a1525ebb7ffd3d"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
2
packages/bignumber/_version.d.ts
vendored
2
packages/bignumber/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
export declare const version = "5.0.0-beta.128";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.127";
|
||||
exports.version = "5.0.0-beta.128";
|
||||
|
@ -16,7 +16,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
||||
*/
|
||||
var BN = __importStar(require("bn.js"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var _constructorGuard = {};
|
||||
var MAX_SAFE = 0x1fffffffffffff;
|
||||
function isBigNumberish(value) {
|
||||
@ -31,9 +33,9 @@ exports.isBigNumberish = isBigNumberish;
|
||||
var BigNumber = /** @class */ (function () {
|
||||
function BigNumber(constructorGuard, hex) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, BigNumber);
|
||||
logger.checkNew(_newTarget, BigNumber);
|
||||
if (constructorGuard !== _constructorGuard) {
|
||||
errors.throwError("cannot call consturtor directly; use BigNumber.from", errors.UNSUPPORTED_OPERATION, {
|
||||
logger.throwError("cannot call consturtor directly; use BigNumber.from", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "new (BigNumber)"
|
||||
});
|
||||
}
|
||||
@ -108,7 +110,7 @@ var BigNumber = /** @class */ (function () {
|
||||
BigNumber.prototype.toString = function () {
|
||||
// Lots of people expect this, which we do not support, so check
|
||||
if (arguments.length !== 0) {
|
||||
errors.throwError("bigNumber.toString does not accept parameters", errors.UNEXPECTED_ARGUMENT, {});
|
||||
logger.throwError("bigNumber.toString does not accept parameters", logger_1.Logger.errors.UNEXPECTED_ARGUMENT, {});
|
||||
}
|
||||
return toBN(this).toString(10);
|
||||
};
|
||||
@ -126,7 +128,7 @@ var BigNumber = /** @class */ (function () {
|
||||
if (value.match(/^-?[0-9]+$/)) {
|
||||
return new BigNumber(_constructorGuard, toHex(new BN.BN(value)));
|
||||
}
|
||||
return errors.throwArgumentError("invalid BigNumber string", "value", value);
|
||||
return logger.throwArgumentError("invalid BigNumber string", "value", value);
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
if (value % 1) {
|
||||
@ -152,7 +154,7 @@ var BigNumber = /** @class */ (function () {
|
||||
return BigNumber.from(value);
|
||||
}
|
||||
}
|
||||
return errors.throwArgumentError("invalid BigNumber value", "value", value);
|
||||
return logger.throwArgumentError("invalid BigNumber value", "value", value);
|
||||
};
|
||||
BigNumber.isBigNumber = function (value) {
|
||||
return !!(value && value._isBigNumber);
|
||||
@ -172,7 +174,7 @@ function toHex(value) {
|
||||
value = value.substring(1);
|
||||
// Cannot have mulitple negative signs (e.g. "--0x04")
|
||||
if (value[0] === "-") {
|
||||
errors.throwArgumentError("invalid hex", "value", value);
|
||||
logger.throwArgumentError("invalid hex", "value", value);
|
||||
}
|
||||
// Call toHex on the positive component
|
||||
value = toHex(value);
|
||||
@ -216,5 +218,5 @@ function throwFault(fault, operation, value) {
|
||||
if (value != null) {
|
||||
params.value = value;
|
||||
}
|
||||
return errors.throwError(fault, errors.NUMERIC_FAULT, params);
|
||||
return logger.throwError(fault, logger_1.Logger.errors.NUMERIC_FAULT, params);
|
||||
}
|
||||
|
@ -1,14 +1,9 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var bignumber_1 = require("./bignumber");
|
||||
var _constructorGuard = {};
|
||||
var Zero = bignumber_1.BigNumber.from(0);
|
||||
@ -18,7 +13,7 @@ function throwFault(message, fault, operation, value) {
|
||||
if (value !== undefined) {
|
||||
params.value = value;
|
||||
}
|
||||
return errors.throwError(message, errors.NUMERIC_FAULT, params);
|
||||
return logger.throwError(message, logger_1.Logger.errors.NUMERIC_FAULT, params);
|
||||
}
|
||||
// Constant to pull zeros from for multipliers
|
||||
var zeros = "0";
|
||||
@ -36,7 +31,7 @@ function getMultiplier(decimals) {
|
||||
if (typeof (decimals) === "number" && decimals >= 0 && decimals <= 256 && !(decimals % 1)) {
|
||||
return ("1" + zeros.substring(0, decimals));
|
||||
}
|
||||
return errors.throwArgumentError("invalid decimal size", "decimals", decimals);
|
||||
return logger.throwArgumentError("invalid decimal size", "decimals", decimals);
|
||||
}
|
||||
function formatFixed(value, decimals) {
|
||||
if (decimals == null) {
|
||||
@ -69,7 +64,7 @@ function parseFixed(value, decimals) {
|
||||
}
|
||||
var multiplier = getMultiplier(decimals);
|
||||
if (typeof (value) !== "string" || !value.match(/^-?[0-9.,]+$/)) {
|
||||
errors.throwArgumentError("invalid decimal value", "value", value);
|
||||
logger.throwArgumentError("invalid decimal value", "value", value);
|
||||
}
|
||||
if (multiplier.length - 1 === 0) {
|
||||
return bignumber_1.BigNumber.from(value);
|
||||
@ -80,12 +75,12 @@ function parseFixed(value, decimals) {
|
||||
value = value.substring(1);
|
||||
}
|
||||
if (value === ".") {
|
||||
errors.throwArgumentError("missing value", "value", value);
|
||||
logger.throwArgumentError("missing value", "value", value);
|
||||
}
|
||||
// Split it into a whole and fractional part
|
||||
var comps = value.split(".");
|
||||
if (comps.length > 2) {
|
||||
errors.throwArgumentError("too many decimal points", "value", value);
|
||||
logger.throwArgumentError("too many decimal points", "value", value);
|
||||
}
|
||||
var whole = comps[0], fraction = comps[1];
|
||||
if (!whole) {
|
||||
@ -137,7 +132,7 @@ var FixedFormat = /** @class */ (function () {
|
||||
else if (value != null) {
|
||||
var match = value.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);
|
||||
if (!match) {
|
||||
errors.throwArgumentError("invalid fixed format", "format", value);
|
||||
logger.throwArgumentError("invalid fixed format", "format", value);
|
||||
}
|
||||
signed = (match[1] !== "u");
|
||||
width = parseInt(match[2]);
|
||||
@ -150,7 +145,7 @@ var FixedFormat = /** @class */ (function () {
|
||||
return defaultValue;
|
||||
}
|
||||
if (typeof (value[key]) !== type) {
|
||||
errors.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
||||
logger.throwArgumentError("invalid fixed format (" + key + " not " + type + ")", "format." + key, value[key]);
|
||||
}
|
||||
return value[key];
|
||||
};
|
||||
@ -159,10 +154,10 @@ var FixedFormat = /** @class */ (function () {
|
||||
decimals = check("decimals", "number", decimals);
|
||||
}
|
||||
if (width % 8) {
|
||||
errors.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
||||
logger.throwArgumentError("invalid fixed format width (not byte aligned)", "format.width", width);
|
||||
}
|
||||
if (decimals > 80) {
|
||||
errors.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
||||
logger.throwArgumentError("invalid fixed format (decimals too large)", "format.decimals", decimals);
|
||||
}
|
||||
return new FixedFormat(_constructorGuard, signed, width, decimals);
|
||||
};
|
||||
@ -172,7 +167,7 @@ exports.FixedFormat = FixedFormat;
|
||||
var FixedNumber = /** @class */ (function () {
|
||||
function FixedNumber(constructorGuard, hex, value, format) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, FixedNumber);
|
||||
logger.checkNew(_newTarget, FixedNumber);
|
||||
this.format = format;
|
||||
this._hex = hex;
|
||||
this._value = value;
|
||||
@ -181,7 +176,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
}
|
||||
FixedNumber.prototype._checkFormat = function (other) {
|
||||
if (this.format.name !== other.format.name) {
|
||||
errors.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
||||
logger.throwArgumentError("incompatible format; use fixedNumber.toFormat", "other", other);
|
||||
}
|
||||
};
|
||||
FixedNumber.prototype.addUnsafe = function (other) {
|
||||
@ -214,7 +209,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
decimals = 0;
|
||||
}
|
||||
if (decimals < 0 || decimals > 80 || (decimals % 1)) {
|
||||
errors.throwArgumentError("invalid decimal cound", "decimals", decimals);
|
||||
logger.throwArgumentError("invalid decimal cound", "decimals", decimals);
|
||||
}
|
||||
// If we are already in range, we're done
|
||||
var comps = this.toString().split(".");
|
||||
@ -233,7 +228,7 @@ var FixedNumber = /** @class */ (function () {
|
||||
return this._hex;
|
||||
}
|
||||
if (width % 8) {
|
||||
errors.throwArgumentError("invalid byte width", "width", width);
|
||||
logger.throwArgumentError("invalid byte width", "width", width);
|
||||
}
|
||||
var hex = bignumber_1.BigNumber.from(this._hex).fromTwos(this.format.width).toTwos(width).toHexString();
|
||||
return bytes_1.hexZeroPad(hex, width / 8);
|
||||
@ -304,11 +299,11 @@ var FixedNumber = /** @class */ (function () {
|
||||
}
|
||||
catch (error) {
|
||||
// Allow NUMERIC_FAULT to bubble up
|
||||
if (error.code !== errors.INVALID_ARGUMENT) {
|
||||
if (error.code !== logger_1.Logger.errors.INVALID_ARGUMENT) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
return errors.throwArgumentError("invalid FixedNumber value", "value", value);
|
||||
return logger.throwArgumentError("invalid FixedNumber value", "value", value);
|
||||
};
|
||||
FixedNumber.isFixedNumber = function (value) {
|
||||
return !!(value && value._isFixedNumber);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/bignumber",
|
||||
"version": "5.0.0-beta.127",
|
||||
"version": "5.0.0-beta.128",
|
||||
"description": "BigNumber library used in ethers.js.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -22,5 +22,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x14d337214e2bbf81c9fcb5ac33573db3e26649e457324e63ec016acae5b681e6"
|
||||
"tarballHash": "0x8f8980eb4b0d753d1dc88c557b7fa448628a7cc628991df19cdb97466fd0953e"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.127";
|
||||
export const version = "5.0.0-beta.128";
|
||||
|
2
packages/bytes/_version.d.ts
vendored
2
packages/bytes/_version.d.ts
vendored
@ -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";
|
||||
|
@ -1,13 +1,8 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
///////////////////////////////
|
||||
function isHexable(value) {
|
||||
return !!(value.toHexString);
|
||||
@ -53,7 +48,7 @@ function arrayify(value, options) {
|
||||
options = {};
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
errors.checkSafeUint53(value, "invalid arrayify value");
|
||||
logger.checkSafeUint53(value, "invalid arrayify value");
|
||||
var result = [];
|
||||
while (value) {
|
||||
result.unshift(value & 0xff);
|
||||
@ -73,7 +68,7 @@ function arrayify(value, options) {
|
||||
if (isHexString(value)) {
|
||||
var hex = value.substring(2);
|
||||
if (!options.allowOddLength && hex.length % 2) {
|
||||
errors.throwArgumentError("hex data is odd-length", "value", value);
|
||||
logger.throwArgumentError("hex data is odd-length", "value", value);
|
||||
}
|
||||
var result = [];
|
||||
for (var i = 0; i < hex.length; i += 2) {
|
||||
@ -84,7 +79,7 @@ function arrayify(value, options) {
|
||||
if (isBytes(value)) {
|
||||
return addSlice(new Uint8Array(value));
|
||||
}
|
||||
return errors.throwArgumentError("invalid arrayify value", "value", value);
|
||||
return logger.throwArgumentError("invalid arrayify value", "value", value);
|
||||
}
|
||||
exports.arrayify = arrayify;
|
||||
function concat(items) {
|
||||
@ -118,7 +113,7 @@ exports.stripZeros = stripZeros;
|
||||
function zeroPad(value, length) {
|
||||
value = arrayify(value);
|
||||
if (value.length > length) {
|
||||
errors.throwArgumentError("value out of range", "value", arguments[0]);
|
||||
logger.throwArgumentError("value out of range", "value", arguments[0]);
|
||||
}
|
||||
var result = new Uint8Array(length);
|
||||
result.set(value, length - value.length);
|
||||
@ -141,7 +136,7 @@ function hexlify(value, options) {
|
||||
options = {};
|
||||
}
|
||||
if (typeof (value) === "number") {
|
||||
errors.checkSafeUint53(value, "invalid hexlify value");
|
||||
logger.checkSafeUint53(value, "invalid hexlify value");
|
||||
var hex = "";
|
||||
while (value) {
|
||||
hex = HexCharacters[value & 0x0f] + hex;
|
||||
@ -163,7 +158,7 @@ function hexlify(value, options) {
|
||||
}
|
||||
if (isHexString(value)) {
|
||||
if (!options.allowOddLength && value.length % 2) {
|
||||
errors.throwArgumentError("hex data is odd-length", "value", value);
|
||||
logger.throwArgumentError("hex data is odd-length", "value", value);
|
||||
}
|
||||
return value.toLowerCase();
|
||||
}
|
||||
@ -175,7 +170,7 @@ function hexlify(value, options) {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return errors.throwArgumentError("invalid hexlify value", "value", value);
|
||||
return logger.throwArgumentError("invalid hexlify value", "value", value);
|
||||
}
|
||||
exports.hexlify = hexlify;
|
||||
/*
|
||||
@ -201,7 +196,7 @@ function hexDataSlice(data, offset, endOffset) {
|
||||
data = hexlify(data);
|
||||
}
|
||||
else if (!isHexString(data) || (data.length % 2)) {
|
||||
errors.throwArgumentError("invalid hexData", "value", data);
|
||||
logger.throwArgumentError("invalid hexData", "value", data);
|
||||
}
|
||||
offset = 2 + 2 * offset;
|
||||
if (endOffset != null) {
|
||||
@ -231,7 +226,7 @@ function hexStripZeros(value) {
|
||||
value = hexlify(value);
|
||||
}
|
||||
if (!isHexString(value)) {
|
||||
errors.throwArgumentError("invalid hex string", "value", value);
|
||||
logger.throwArgumentError("invalid hex string", "value", value);
|
||||
}
|
||||
value = value.substring(2);
|
||||
var offset = 0;
|
||||
@ -246,10 +241,10 @@ function hexZeroPad(value, length) {
|
||||
value = hexlify(value);
|
||||
}
|
||||
else if (!isHexString(value)) {
|
||||
errors.throwArgumentError("invalid hex string", "value", value);
|
||||
logger.throwArgumentError("invalid hex string", "value", value);
|
||||
}
|
||||
if (value.length > 2 * length + 2) {
|
||||
errors.throwArgumentError("value out of range", "value", arguments[1]);
|
||||
logger.throwArgumentError("value out of range", "value", arguments[1]);
|
||||
}
|
||||
while (value.length < 2 * length + 2) {
|
||||
value = "0x0" + value.substring(2);
|
||||
@ -268,7 +263,7 @@ function splitSignature(signature) {
|
||||
if (isBytesLike(signature)) {
|
||||
var bytes = arrayify(signature);
|
||||
if (bytes.length !== 65) {
|
||||
errors.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
||||
logger.throwArgumentError("invalid signature string; must be 65 bytes", "signature", signature);
|
||||
}
|
||||
// Get the r and s
|
||||
result.r = hexlify(bytes.slice(0, 32));
|
||||
@ -305,7 +300,7 @@ function splitSignature(signature) {
|
||||
}
|
||||
else if (result.recoveryParam != null && result.v != null) {
|
||||
if (result.v !== 27 + result.recoveryParam) {
|
||||
errors.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
|
||||
logger.throwArgumentError("signature v mismatch recoveryParam", "signature", signature);
|
||||
}
|
||||
}
|
||||
// Make sure r and s are padded properly
|
||||
@ -320,7 +315,7 @@ function splitSignature(signature) {
|
||||
if (result._vs != null) {
|
||||
result._vs = hexZeroPad(result._vs, 32);
|
||||
if (result._vs.length > 66) {
|
||||
errors.throwArgumentError("signature _vs overflow", "signature", signature);
|
||||
logger.throwArgumentError("signature _vs overflow", "signature", signature);
|
||||
}
|
||||
var vs = arrayify(result._vs);
|
||||
var recoveryParam = ((vs[0] >= 128) ? 1 : 0);
|
||||
@ -333,37 +328,37 @@ function splitSignature(signature) {
|
||||
result.s = s;
|
||||
}
|
||||
else if (result.s !== s) {
|
||||
errors.throwArgumentError("signature v mismatch _vs", "signature", signature);
|
||||
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
|
||||
}
|
||||
if (result.v == null) {
|
||||
result.v = v;
|
||||
}
|
||||
else if (result.v !== v) {
|
||||
errors.throwArgumentError("signature v mismatch _vs", "signature", signature);
|
||||
logger.throwArgumentError("signature v mismatch _vs", "signature", signature);
|
||||
}
|
||||
if (recoveryParam == null) {
|
||||
result.recoveryParam = recoveryParam;
|
||||
}
|
||||
else if (result.recoveryParam !== recoveryParam) {
|
||||
errors.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
|
||||
logger.throwArgumentError("signature recoveryParam mismatch _vs", "signature", signature);
|
||||
}
|
||||
}
|
||||
// After all populating, both v and recoveryParam are still missing...
|
||||
if (result.v == null && result.recoveryParam == null) {
|
||||
errors.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
|
||||
logger.throwArgumentError("signature requires at least one of recoveryParam, v or _vs", "signature", signature);
|
||||
}
|
||||
// Check for canonical v
|
||||
if (result.v !== 27 && result.v !== 28) {
|
||||
errors.throwArgumentError("signature v not canonical", "signature", signature);
|
||||
logger.throwArgumentError("signature v not canonical", "signature", signature);
|
||||
}
|
||||
// Check that r and s are in range
|
||||
if (result.r.length > 66 || result.s.length > 66) {
|
||||
errors.throwArgumentError("signature overflow r or s", "signature", signature);
|
||||
logger.throwArgumentError("signature overflow r or s", "signature", signature);
|
||||
}
|
||||
if (result._vs == null) {
|
||||
var vs = arrayify(result.s);
|
||||
if (vs[0] >= 128) {
|
||||
errors.throwArgumentError("signature s out of range", "signature", signature);
|
||||
logger.throwArgumentError("signature s out of range", "signature", signature);
|
||||
}
|
||||
if (result.recoveryParam) {
|
||||
vs[0] |= 0x80;
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/bytes",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "Bytes utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -20,5 +20,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xb1a6e6e8b38d5c28de285c858a6a7fe0a505a0de9cb2baa0d07a7c0e3af167d1"
|
||||
"tarballHash": "0x24aa796869c48face90486095d5d95c8d9da01c0b6f32ce1d4327c7d79b62e75"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
2
packages/cli/_version.d.ts
vendored
2
packages/cli/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.135";
|
||||
export declare const version = "5.0.0-beta.136";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.135";
|
||||
exports.version = "5.0.0-beta.136";
|
||||
|
0
packages/cli/bin/ethers-ens.js
Normal file → Executable file
0
packages/cli/bin/ethers-ens.js
Normal file → Executable file
0
packages/cli/bin/ethers-ts.js
Normal file → Executable file
0
packages/cli/bin/ethers-ts.js
Normal file → Executable file
0
packages/cli/bin/ethers.js
Normal file → Executable file
0
packages/cli/bin/ethers.js
Normal file → Executable file
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/cli",
|
||||
"version": "5.0.0-beta.135",
|
||||
"version": "5.0.0-beta.136",
|
||||
"description": "Command-Line Interface scripts and releated utilities.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -29,5 +29,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x273492dacdf9a87887fa1d84c132525199dce4922f81235004dbac8628213e5f"
|
||||
"tarballHash": "0x46224f464ccc9cc68cb0f1fca15dce7b9b8fa6fa55109b467497e44094643833"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.135";
|
||||
export const version = "5.0.0-beta.136";
|
||||
|
2
packages/contracts/_version.d.ts
vendored
2
packages/contracts/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.134";
|
||||
export declare const version = "5.0.0-beta.135";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.134";
|
||||
exports.version = "5.0.0-beta.135";
|
||||
|
@ -12,13 +12,6 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var abi_1 = require("@ethersproject/abi");
|
||||
var abstract_provider_1 = require("@ethersproject/abstract-provider");
|
||||
@ -27,8 +20,10 @@ var address_1 = require("@ethersproject/address");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var constants_1 = require("@ethersproject/constants");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
///////////////////////////////
|
||||
var allowedTransactionKeys = {
|
||||
chainId: true, data: true, from: true, gasLimit: true, gasPrice: true, nonce: true, to: true, value: true
|
||||
@ -74,15 +69,15 @@ function runMethod(contract, functionName, options) {
|
||||
// Check for unexpected keys (e.g. using "gas" instead of "gasLimit")
|
||||
for (var key in tx) {
|
||||
if (!allowedTransactionKeys[key]) {
|
||||
errors.throwError(("unknown transaxction override - " + key), "overrides", tx);
|
||||
logger.throwError(("unknown transaxction override - " + key), "overrides", tx);
|
||||
}
|
||||
}
|
||||
}
|
||||
errors.checkArgumentCount(params.length, method.inputs.length, "passed to contract");
|
||||
logger.checkArgumentCount(params.length, method.inputs.length, "passed to contract");
|
||||
// Check overrides make sense
|
||||
["data", "to"].forEach(function (key) {
|
||||
if (tx[key] != null) {
|
||||
errors.throwError("cannot override " + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
}
|
||||
});
|
||||
// If the contract was just deployed, wait until it is minded
|
||||
@ -102,7 +97,7 @@ function runMethod(contract, functionName, options) {
|
||||
return Promise.resolve(constants_1.Zero);
|
||||
}
|
||||
if (!contract.provider && !contract.signer) {
|
||||
errors.throwError("call (constant functions) require a provider or signer", errors.UNSUPPORTED_OPERATION, { operation: "call" });
|
||||
logger.throwError("call (constant functions) require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "call" });
|
||||
}
|
||||
// Check overrides make sense
|
||||
["gasLimit", "gasPrice", "value"].forEach(function (key) {
|
||||
@ -122,7 +117,7 @@ function runMethod(contract, functionName, options) {
|
||||
return result;
|
||||
}
|
||||
catch (error) {
|
||||
if (error.code === errors.CALL_EXCEPTION) {
|
||||
if (error.code === logger_1.Logger.errors.CALL_EXCEPTION) {
|
||||
error.address = contract.address;
|
||||
error.args = params;
|
||||
error.transaction = tx;
|
||||
@ -134,7 +129,7 @@ function runMethod(contract, functionName, options) {
|
||||
// Only computing the transaction estimate
|
||||
if (options.estimate) {
|
||||
if (!contract.provider && !contract.signer) {
|
||||
errors.throwError("estimate require a provider or signer", errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" });
|
||||
logger.throwError("estimate require a provider or signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "estimateGas" });
|
||||
}
|
||||
return (contract.signer || contract.provider).estimateGas(tx);
|
||||
}
|
||||
@ -142,17 +137,13 @@ function runMethod(contract, functionName, options) {
|
||||
tx.gasLimit = bignumber_1.BigNumber.from(method.gas).add(21000);
|
||||
}
|
||||
if (tx.value != null && !method.payable) {
|
||||
errors.throwError("contract method is not payable", errors.INVALID_ARGUMENT, {
|
||||
argument: "sendTransaction",
|
||||
value: tx,
|
||||
method: method.format()
|
||||
});
|
||||
logger.throwArgumentError("contract method is not payable", "sendTransaction:" + method.format(), tx);
|
||||
}
|
||||
if (options.transaction) {
|
||||
return properties_1.resolveProperties(tx);
|
||||
}
|
||||
if (!contract.signer) {
|
||||
errors.throwError("sending a transaction require a signer", errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" });
|
||||
logger.throwError("sending a transaction require a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction" });
|
||||
}
|
||||
return contract.signer.sendTransaction(tx).then(function (tx) {
|
||||
var wait = tx.wait.bind(tx);
|
||||
@ -258,7 +249,7 @@ var FragmentRunningEvent = /** @class */ (function (_super) {
|
||||
var topic = contractInterface.getEventTopic(fragment);
|
||||
if (topics) {
|
||||
if (topic !== topics[0]) {
|
||||
errors.throwArgumentError("topic mismatch", "topics", topics);
|
||||
logger.throwArgumentError("topic mismatch", "topics", topics);
|
||||
}
|
||||
filter.topics = topics.slice();
|
||||
}
|
||||
@ -310,7 +301,7 @@ var Contract = /** @class */ (function () {
|
||||
function Contract(addressOrName, contractInterface, signerOrProvider) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, Contract);
|
||||
logger.checkNew(_newTarget, Contract);
|
||||
// @TODO: Maybe still check the addressOrName looks like a valid address or name?
|
||||
//address = getAddress(address);
|
||||
properties_1.defineReadOnly(this, "interface", properties_1.getStatic((_newTarget), "getInterface")(contractInterface));
|
||||
@ -323,7 +314,7 @@ var Contract = /** @class */ (function () {
|
||||
properties_1.defineReadOnly(this, "signer", null);
|
||||
}
|
||||
else {
|
||||
errors.throwError("invalid signer or provider", errors.INVALID_ARGUMENT, { arg: "signerOrProvider", value: signerOrProvider });
|
||||
logger.throwArgumentError("invalid signer or provider", "signerOrProvider", signerOrProvider);
|
||||
}
|
||||
properties_1.defineReadOnly(this, "callStatic", {});
|
||||
properties_1.defineReadOnly(this, "estimate", {});
|
||||
@ -363,7 +354,7 @@ var Contract = /** @class */ (function () {
|
||||
}
|
||||
catch (error) {
|
||||
// Without a provider, we cannot use ENS names
|
||||
errors.throwError("provider is required to use non-address contract address", errors.INVALID_ARGUMENT, { argument: "addressOrName", value: addressOrName });
|
||||
logger.throwArgumentError("provider is required to use non-address contract address", "addressOrName", addressOrName);
|
||||
}
|
||||
}
|
||||
Object.keys(this.interface.functions).forEach(function (name) {
|
||||
@ -413,7 +404,7 @@ var Contract = /** @class */ (function () {
|
||||
// Otherwise, poll for our code to be deployed
|
||||
this._deployedPromise = this.provider.getCode(this.address, blockTag).then(function (code) {
|
||||
if (code === "0x") {
|
||||
errors.throwError("contract not deployed", errors.UNSUPPORTED_OPERATION, {
|
||||
logger.throwError("contract not deployed", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
contractAddress: _this.address,
|
||||
operation: "getDeployed"
|
||||
});
|
||||
@ -431,14 +422,14 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype.fallback = function (overrides) {
|
||||
var _this = this;
|
||||
if (!this.signer) {
|
||||
errors.throwError("sending a transaction require a signer", errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" });
|
||||
logger.throwError("sending a transaction require a signer", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "sendTransaction(fallback)" });
|
||||
}
|
||||
var tx = properties_1.shallowCopy(overrides || {});
|
||||
["from", "to"].forEach(function (key) {
|
||||
if (tx[key] == null) {
|
||||
return;
|
||||
}
|
||||
errors.throwError("cannot override " + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
});
|
||||
tx.to = this.addressPromise;
|
||||
return this.deployed().then(function () {
|
||||
@ -483,7 +474,7 @@ var Contract = /** @class */ (function () {
|
||||
}
|
||||
var fragment = this.interface.getEvent(eventName);
|
||||
if (!fragment) {
|
||||
errors.throwError("unknown event - " + eventName, errors.INVALID_ARGUMENT, { argumnet: "eventName", value: eventName });
|
||||
logger.throwArgumentError("unknown event - " + eventName, "eventName", eventName);
|
||||
}
|
||||
return this._normalizeRunningEvent(new FragmentRunningEvent(this.address, this.interface, fragment));
|
||||
}
|
||||
@ -539,7 +530,7 @@ var Contract = /** @class */ (function () {
|
||||
Contract.prototype._addEventListener = function (runningEvent, listener, once) {
|
||||
var _this = this;
|
||||
if (!this.provider) {
|
||||
errors.throwError("events require a provider or a signer with a provider", errors.UNSUPPORTED_OPERATION, { operation: "once" });
|
||||
logger.throwError("events require a provider or a signer with a provider", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "once" });
|
||||
}
|
||||
runningEvent.addListener(listener, once);
|
||||
// Track this running event and its listeners (may already be there; but no hard in updating)
|
||||
@ -565,7 +556,7 @@ var Contract = /** @class */ (function () {
|
||||
var filter = properties_1.shallowCopy(runningEvent.filter);
|
||||
if (typeof (fromBlockOrBlockhash) === "string" && bytes_1.isHexString(fromBlockOrBlockhash, 32)) {
|
||||
if (toBlock != null) {
|
||||
errors.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock);
|
||||
logger.throwArgumentError("cannot specify toBlock with blockhash", "toBlock", toBlock);
|
||||
}
|
||||
filter.blockhash = fromBlockOrBlockhash;
|
||||
}
|
||||
@ -677,11 +668,11 @@ var ContractFactory = /** @class */ (function () {
|
||||
}
|
||||
// Make sure the final result is valid bytecode
|
||||
if (!bytes_1.isHexString(bytecodeHex) || (bytecodeHex.length % 2)) {
|
||||
errors.throwArgumentError("invalid bytecode", "bytecode", bytecode);
|
||||
logger.throwArgumentError("invalid bytecode", "bytecode", bytecode);
|
||||
}
|
||||
// If we have a signer, make sure it is valid
|
||||
if (signer && !abstract_signer_1.Signer.isSigner(signer)) {
|
||||
errors.throwArgumentError("invalid signer", "signer", signer);
|
||||
logger.throwArgumentError("invalid signer", "signer", signer);
|
||||
}
|
||||
properties_1.defineReadOnly(this, "bytecode", bytecodeHex);
|
||||
properties_1.defineReadOnly(this, "interface", properties_1.getStatic((_newTarget), "getInterface")(contractInterface));
|
||||
@ -707,10 +698,10 @@ var ContractFactory = /** @class */ (function () {
|
||||
if (tx[key] == null) {
|
||||
return;
|
||||
}
|
||||
errors.throwError("cannot override " + key, errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
logger.throwError("cannot override " + key, logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: key });
|
||||
});
|
||||
// Make sure the call matches the constructor signature
|
||||
errors.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor");
|
||||
logger.checkArgumentCount(args.length, this.interface.deploy.inputs.length, " in Contract constructor");
|
||||
// Set the data to the bytecode + the encoded constructor arguments
|
||||
tx.data = bytes_1.hexlify(bytes_1.concat([
|
||||
this.bytecode,
|
||||
@ -744,7 +735,7 @@ var ContractFactory = /** @class */ (function () {
|
||||
};
|
||||
ContractFactory.fromSolidity = function (compilerOutput, signer) {
|
||||
if (compilerOutput == null) {
|
||||
errors.throwError("missing compiler output", errors.MISSING_ARGUMENT, { argument: "compilerOutput" });
|
||||
logger.throwError("missing compiler output", logger_1.Logger.errors.MISSING_ARGUMENT, { argument: "compilerOutput" });
|
||||
}
|
||||
if (typeof (compilerOutput) === "string") {
|
||||
compilerOutput = JSON.parse(compilerOutput);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/contracts",
|
||||
"version": "5.0.0-beta.134",
|
||||
"version": "5.0.0-beta.135",
|
||||
"description": "Contract abstraction meta-class for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -27,5 +27,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x6b25925f92f10c31dc8d9a61012e7f70ae09094896da0d252e59f42823981c27"
|
||||
"tarballHash": "0x1f5e01859660fd9090de4b597d7f71ff095f5bddcb894488c8e6848d142bc0c4"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.134";
|
||||
export const version = "5.0.0-beta.135";
|
||||
|
2
packages/errors/_version.d.ts
vendored
2
packages/errors/_version.d.ts
vendored
@ -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";
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/errors",
|
||||
"version": "5.0.0-beta.126",
|
||||
"version": "5.0.0-beta.127",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -15,5 +15,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xd285051d17a97638f3840564e5121f34ac194907818e337e0a1339784d8daeff"
|
||||
"tarballHash": "0xe8976154307d1c7b39246387063ce62549bb8a01364f9dd6ae53b7d79c187526"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.126";
|
||||
export const version = "5.0.0-beta.127";
|
||||
|
2
packages/ethers/_version.d.ts
vendored
2
packages/ethers/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.148";
|
||||
export declare const version = "5.0.0-beta.149";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.148";
|
||||
exports.version = "5.0.0-beta.149";
|
||||
|
1516
packages/ethers/dist/ethers.js
vendored
1516
packages/ethers/dist/ethers.js
vendored
File diff suppressed because it is too large
Load Diff
2
packages/ethers/dist/ethers.min.js
vendored
2
packages/ethers/dist/ethers.min.js
vendored
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ethers",
|
||||
"version": "5.0.0-beta.148",
|
||||
"version": "5.0.0-beta.149",
|
||||
"description": "Error utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -56,5 +56,5 @@
|
||||
"publishConfig": {
|
||||
"tag": "next"
|
||||
},
|
||||
"tarballHash": "0x2ec6db7c7158eaff31e9fa2bebe9d8d7c138298dd48b4f083c5a0d75c2d8e222"
|
||||
"tarballHash": "0x331cb7370079df867415803325653d5fff45477f39e50abc0daabd4f4c920c07"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.148";
|
||||
export const version = "5.0.0-beta.149";
|
||||
|
2
packages/hash/_version.d.ts
vendored
2
packages/hash/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
@ -1,16 +1,11 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var strings_1 = require("@ethersproject/strings");
|
||||
var keccak256_1 = require("@ethersproject/keccak256");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
///////////////////////////////
|
||||
var Zeros = new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
|
||||
var Partition = new RegExp("^((.*)\\.)?([^.]+)$");
|
||||
@ -30,10 +25,7 @@ function isValidName(name) {
|
||||
exports.isValidName = isValidName;
|
||||
function namehash(name) {
|
||||
if (typeof (name) !== "string") {
|
||||
errors.throwError("invalid address - " + String(name), errors.INVALID_ARGUMENT, {
|
||||
argument: "name",
|
||||
value: name
|
||||
});
|
||||
logger.throwArgumentError("invalid address - " + String(name), "name", name);
|
||||
}
|
||||
var result = Zeros;
|
||||
while (name.length) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/hash",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Hash utility functions for Ethereum.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -21,5 +21,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xaf57b1789e1e19a2daf619e73a170095b225512f8339916c4602a0545bed68f0"
|
||||
"tarballHash": "0x82e98c451886d28478d24f8e166976072e63b2400e64c5edb1068ba909dcf48a"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
2
packages/hdnode/_version.d.ts
vendored
2
packages/hdnode/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.127";
|
||||
export declare const version = "5.0.0-beta.128";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.127";
|
||||
exports.version = "5.0.0-beta.128";
|
||||
|
@ -1,14 +1,6 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var basex_1 = require("@ethersproject/basex");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var strings_1 = require("@ethersproject/strings");
|
||||
@ -18,6 +10,9 @@ var signing_key_1 = require("@ethersproject/signing-key");
|
||||
var sha2_1 = require("@ethersproject/sha2");
|
||||
var transactions_1 = require("@ethersproject/transactions");
|
||||
var wordlists_1 = require("@ethersproject/wordlists");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var N = bignumber_1.BigNumber.from("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");
|
||||
// "Bitcoin seed"
|
||||
var MasterSecret = strings_1.toUtf8Bytes("Bitcoin seed");
|
||||
@ -49,7 +44,7 @@ var HDNode = /** @class */ (function () {
|
||||
*/
|
||||
function HDNode(constructorGuard, privateKey, publicKey, parentFingerprint, chainCode, index, depth, mnemonic, path) {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, HDNode);
|
||||
logger.checkNew(_newTarget, HDNode);
|
||||
if (constructorGuard !== _constructorGuard) {
|
||||
throw new Error("HDNode constructor cannot be called directly");
|
||||
}
|
||||
@ -191,10 +186,7 @@ var HDNode = /** @class */ (function () {
|
||||
HDNode.fromExtendedKey = function (extendedKey) {
|
||||
var bytes = basex_1.Base58.decode(extendedKey);
|
||||
if (bytes.length !== 82 || base58check(bytes.slice(0, 78)) !== extendedKey) {
|
||||
errors.throwError("invalid extended key", errors.INVALID_ARGUMENT, {
|
||||
argument: "extendedKey",
|
||||
value: "[REDACTED]"
|
||||
});
|
||||
logger.throwArgumentError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
}
|
||||
var depth = bytes[4];
|
||||
var parentFingerprint = bytes_1.hexlify(bytes.slice(5, 9));
|
||||
@ -214,10 +206,7 @@ var HDNode = /** @class */ (function () {
|
||||
}
|
||||
return new HDNode(_constructorGuard, bytes_1.hexlify(key.slice(1)), null, parentFingerprint, chainCode, index, depth, null, null);
|
||||
}
|
||||
return errors.throwError("invalid extended key", errors.INVALID_ARGUMENT, {
|
||||
argument: "extendedKey",
|
||||
value: "[REDACTED]"
|
||||
});
|
||||
return logger.throwError("invalid extended key", "extendedKey", "[REDACTED]");
|
||||
};
|
||||
return HDNode;
|
||||
}());
|
||||
@ -234,7 +223,7 @@ function mnemonicToEntropy(mnemonic, wordlist) {
|
||||
if (!wordlist) {
|
||||
wordlist = wordlists_1.wordlists["en"];
|
||||
}
|
||||
errors.checkNormalize();
|
||||
logger.checkNormalize();
|
||||
var words = wordlist.split(mnemonic);
|
||||
if ((words.length % 3) !== 0) {
|
||||
throw new Error("invalid mnemonic");
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/hdnode",
|
||||
"version": "5.0.0-beta.127",
|
||||
"version": "5.0.0-beta.128",
|
||||
"description": "BIP32 Hierarchal Deterministic Node operations.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -29,5 +29,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xff879047a41e893228ed4e40a5d1d800f3c4c7793ffefda57df068c819f43666"
|
||||
"tarballHash": "0xa673c44201745fdb3d607e53ac3923dd3c1e94ee44dbda2c3058d1936433a076"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.127";
|
||||
export const version = "5.0.0-beta.128";
|
||||
|
2
packages/json-wallets/_version.d.ts
vendored
2
packages/json-wallets/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
@ -15,22 +15,17 @@ var __extends = (this && this.__extends) || (function () {
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var aes_js_1 = __importDefault(require("aes-js"));
|
||||
var address_1 = require("@ethersproject/address");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var keccak256_1 = require("@ethersproject/keccak256");
|
||||
var pbkdf2_1 = require("@ethersproject/pbkdf2");
|
||||
var strings_1 = require("@ethersproject/strings");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var utils_1 = require("./utils");
|
||||
var CrowdsaleAccount = /** @class */ (function (_super) {
|
||||
__extends(CrowdsaleAccount, _super);
|
||||
@ -52,10 +47,7 @@ function decrypt(json, password) {
|
||||
// Encrypted Seed
|
||||
var encseed = utils_1.looseArrayify(utils_1.searchPath(data, "encseed"));
|
||||
if (!encseed || (encseed.length % 16) !== 0) {
|
||||
errors.throwError("invalid encseed", errors.INVALID_ARGUMENT, {
|
||||
argument: "json",
|
||||
value: json
|
||||
});
|
||||
logger.throwArgumentError("invalid encseed", "json", json);
|
||||
}
|
||||
var key = bytes_1.arrayify(pbkdf2_1.pbkdf2(password, password, 2000, 32, "sha256")).slice(0, 16);
|
||||
var iv = encseed.slice(0, 16);
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/json-wallets",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Wallet management utilities for KeyStore and Crowdsale JSON wallets.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -31,5 +31,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x35570cafbf9fb9db5ec66349d16e14d327c98c60ae2ecf4d5a3c084c274a5dad"
|
||||
"tarballHash": "0xbe8e8166ebbe7eab0bfb951e596dab6573588cd61169f466871da61b752aff61"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
1
packages/logger/_version.d.ts
vendored
Normal file
1
packages/logger/_version.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare const version = "willbeaddedlater";
|
3
packages/logger/_version.js
Normal file
3
packages/logger/_version.js
Normal file
@ -0,0 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "willbeaddedlater";
|
42
packages/logger/index.d.ts
vendored
Normal file
42
packages/logger/index.d.ts
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
export declare type LogLevel = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "OFF";
|
||||
export declare class Logger {
|
||||
readonly version: string;
|
||||
static errors: {
|
||||
UNKNOWN_ERROR: string;
|
||||
NOT_IMPLEMENTED: string;
|
||||
UNSUPPORTED_OPERATION: string;
|
||||
NETWORK_ERROR: string;
|
||||
SERVER_ERROR: string;
|
||||
TIMEOUT: string;
|
||||
BUFFER_OVERRUN: string;
|
||||
NUMERIC_FAULT: string;
|
||||
MISSING_NEW: string;
|
||||
INVALID_ARGUMENT: string;
|
||||
MISSING_ARGUMENT: string;
|
||||
UNEXPECTED_ARGUMENT: string;
|
||||
CALL_EXCEPTION: string;
|
||||
INSUFFICIENT_FUNDS: string;
|
||||
NONCE_EXPIRED: string;
|
||||
REPLACEMENT_UNDERPRICED: string;
|
||||
UNPREDICTABLE_GAS_LIMIT: string;
|
||||
};
|
||||
static levels: {
|
||||
[name: string]: LogLevel;
|
||||
};
|
||||
constructor(version: string);
|
||||
setLogLevel(logLevel: LogLevel): void;
|
||||
_log(logLevel: LogLevel, args: Array<any>): void;
|
||||
debug(...args: Array<any>): void;
|
||||
info(...args: Array<any>): void;
|
||||
warn(...args: Array<any>): void;
|
||||
makeError(message: string, code?: string, params?: any): Error;
|
||||
throwError(message: string, code?: string, params?: any): never;
|
||||
throwArgumentError(message: string, name: string, value: any): never;
|
||||
checkNormalize(message?: string): void;
|
||||
checkSafeUint53(value: number, message?: string): void;
|
||||
checkArgumentCount(count: number, expectedCount: number, message?: string): void;
|
||||
checkNew(target: any, kind: any): void;
|
||||
checkAbstract(target: any, kind: any): void;
|
||||
static globalLogger(): Logger;
|
||||
static setCensorship(censorship: boolean, permanent?: boolean): void;
|
||||
}
|
279
packages/logger/index.js
Normal file
279
packages/logger/index.js
Normal file
@ -0,0 +1,279 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var _permanentCensorErrors = false;
|
||||
var _censorErrors = false;
|
||||
var LogLevels = { debug: 1, "default": 2, info: 2, warn: 3, error: 4, off: 5 };
|
||||
var LogLevel = LogLevels["default"];
|
||||
var _version_1 = require("./_version");
|
||||
var _globalLogger = null;
|
||||
function _checkNormalize() {
|
||||
try {
|
||||
var missing_1 = [];
|
||||
// Make sure all forms of normalization are supported
|
||||
["NFD", "NFC", "NFKD", "NFKC"].forEach(function (form) {
|
||||
try {
|
||||
if ("test".normalize(form) !== "test") {
|
||||
throw new Error("bad normalize");
|
||||
}
|
||||
;
|
||||
}
|
||||
catch (error) {
|
||||
missing_1.push(form);
|
||||
}
|
||||
});
|
||||
if (missing_1.length) {
|
||||
throw new Error("missing " + missing_1.join(", "));
|
||||
}
|
||||
if (String.fromCharCode(0xe9).normalize("NFD") !== String.fromCharCode(0x65, 0x0301)) {
|
||||
throw new Error("broken implementation");
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
return error.message;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
var _normalizeError = _checkNormalize();
|
||||
var Logger = /** @class */ (function () {
|
||||
function Logger(version) {
|
||||
Object.defineProperty(this, "version", {
|
||||
enumerable: true,
|
||||
value: version,
|
||||
writable: false
|
||||
});
|
||||
}
|
||||
Logger.prototype.setLogLevel = function (logLevel) {
|
||||
var level = LogLevels[logLevel];
|
||||
if (level == null) {
|
||||
this.warn("invliad log level - " + logLevel);
|
||||
return;
|
||||
}
|
||||
LogLevel = level;
|
||||
};
|
||||
Logger.prototype._log = function (logLevel, args) {
|
||||
if (LogLevel > LogLevels[logLevel]) {
|
||||
return;
|
||||
}
|
||||
console.log.apply(console, args);
|
||||
};
|
||||
Logger.prototype.debug = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
this._log(Logger.levels.DEBUG, args);
|
||||
};
|
||||
Logger.prototype.info = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
this._log(Logger.levels.INFO, args);
|
||||
};
|
||||
Logger.prototype.warn = function () {
|
||||
var args = [];
|
||||
for (var _i = 0; _i < arguments.length; _i++) {
|
||||
args[_i] = arguments[_i];
|
||||
}
|
||||
this._log(Logger.levels.WARNING, args);
|
||||
};
|
||||
Logger.prototype.makeError = function (message, code, params) {
|
||||
if (_censorErrors) {
|
||||
return new Error("unknown error");
|
||||
}
|
||||
if (!code) {
|
||||
code = Logger.errors.UNKNOWN_ERROR;
|
||||
}
|
||||
if (!params) {
|
||||
params = {};
|
||||
}
|
||||
var messageDetails = [];
|
||||
Object.keys(params).forEach(function (key) {
|
||||
try {
|
||||
messageDetails.push(key + "=" + JSON.stringify(params[key]));
|
||||
}
|
||||
catch (error) {
|
||||
messageDetails.push(key + "=" + JSON.stringify(params[key].toString()));
|
||||
}
|
||||
});
|
||||
messageDetails.push("version=" + this.version);
|
||||
var reason = message;
|
||||
if (messageDetails.length) {
|
||||
message += " (" + messageDetails.join(", ") + ")";
|
||||
}
|
||||
// @TODO: Any??
|
||||
var error = new Error(message);
|
||||
error.reason = reason;
|
||||
error.code = code;
|
||||
Object.keys(params).forEach(function (key) {
|
||||
error[key] = params[key];
|
||||
});
|
||||
return error;
|
||||
};
|
||||
Logger.prototype.throwError = function (message, code, params) {
|
||||
throw this.makeError(message, code, params);
|
||||
};
|
||||
Logger.prototype.throwArgumentError = function (message, name, value) {
|
||||
return this.throwError(message, Logger.errors.INVALID_ARGUMENT, {
|
||||
argument: name,
|
||||
value: value
|
||||
});
|
||||
};
|
||||
Logger.prototype.checkNormalize = function (message) {
|
||||
if (message == null) {
|
||||
message = "platform missing String.prototype.normalize";
|
||||
}
|
||||
if (_normalizeError) {
|
||||
this.throwError("platform missing String.prototype.normalize", Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "String.prototype.normalize", form: _normalizeError
|
||||
});
|
||||
}
|
||||
};
|
||||
Logger.prototype.checkSafeUint53 = function (value, message) {
|
||||
if (typeof (value) !== "number") {
|
||||
return;
|
||||
}
|
||||
if (message == null) {
|
||||
message = "value not safe";
|
||||
}
|
||||
if (value < 0 || value >= 0x1fffffffffffff) {
|
||||
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
|
||||
operation: "checkSafeInteger",
|
||||
fault: "out-of-safe-range",
|
||||
value: value
|
||||
});
|
||||
}
|
||||
if (value % 1) {
|
||||
this.throwError(message, Logger.errors.NUMERIC_FAULT, {
|
||||
operation: "checkSafeInteger",
|
||||
fault: "non-integer",
|
||||
value: value
|
||||
});
|
||||
}
|
||||
};
|
||||
Logger.prototype.checkArgumentCount = function (count, expectedCount, message) {
|
||||
if (message) {
|
||||
message = ": " + message;
|
||||
}
|
||||
else {
|
||||
message = "";
|
||||
}
|
||||
if (count < expectedCount) {
|
||||
this.throwError("missing argument" + message, Logger.errors.MISSING_ARGUMENT, {
|
||||
count: count,
|
||||
expectedCount: expectedCount
|
||||
});
|
||||
}
|
||||
if (count > expectedCount) {
|
||||
this.throwError("too many arguments" + message, Logger.errors.UNEXPECTED_ARGUMENT, {
|
||||
count: count,
|
||||
expectedCount: expectedCount
|
||||
});
|
||||
}
|
||||
};
|
||||
Logger.prototype.checkNew = function (target, kind) {
|
||||
if (target === Object || target == null) {
|
||||
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
|
||||
}
|
||||
};
|
||||
Logger.prototype.checkAbstract = function (target, kind) {
|
||||
if (target === kind) {
|
||||
this.throwError("cannot instantiate abstract class " + JSON.stringify(kind.name) + " directly; use a sub-class", Logger.errors.UNSUPPORTED_OPERATION, { name: target.name, operation: "new" });
|
||||
}
|
||||
else if (target === Object || target == null) {
|
||||
this.throwError("missing new", Logger.errors.MISSING_NEW, { name: kind.name });
|
||||
}
|
||||
};
|
||||
Logger.globalLogger = function () {
|
||||
if (!_globalLogger) {
|
||||
_globalLogger = new Logger(_version_1.version);
|
||||
}
|
||||
return _globalLogger;
|
||||
};
|
||||
Logger.setCensorship = function (censorship, permanent) {
|
||||
if (_permanentCensorErrors) {
|
||||
if (!censorship) {
|
||||
return;
|
||||
}
|
||||
this.globalLogger().throwError("error censorship permanent", Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "setCensorship"
|
||||
});
|
||||
}
|
||||
_censorErrors = !!censorship;
|
||||
_permanentCensorErrors = !!permanent;
|
||||
};
|
||||
Logger.errors = {
|
||||
///////////////////
|
||||
// Generic Errors
|
||||
// Unknown Error
|
||||
UNKNOWN_ERROR: "UNKNOWN_ERROR",
|
||||
// Not Implemented
|
||||
NOT_IMPLEMENTED: "NOT_IMPLEMENTED",
|
||||
// Unsupported Operation
|
||||
// - operation
|
||||
UNSUPPORTED_OPERATION: "UNSUPPORTED_OPERATION",
|
||||
// Network Error (i.e. Ethereum Network, such as an invalid chain ID)
|
||||
NETWORK_ERROR: "NETWORK_ERROR",
|
||||
// Some sort of bad response from the server
|
||||
SERVER_ERROR: "SERVER_ERROR",
|
||||
// Timeout
|
||||
TIMEOUT: "TIMEOUT",
|
||||
///////////////////
|
||||
// Operational Errors
|
||||
// Buffer Overrun
|
||||
BUFFER_OVERRUN: "BUFFER_OVERRUN",
|
||||
// Numeric Fault
|
||||
// - operation: the operation being executed
|
||||
// - fault: the reason this faulted
|
||||
NUMERIC_FAULT: "NUMERIC_FAULT",
|
||||
///////////////////
|
||||
// Argument Errors
|
||||
// Missing new operator to an object
|
||||
// - name: The name of the class
|
||||
MISSING_NEW: "MISSING_NEW",
|
||||
// Invalid argument (e.g. value is incompatible with type) to a function:
|
||||
// - argument: The argument name that was invalid
|
||||
// - value: The value of the argument
|
||||
INVALID_ARGUMENT: "INVALID_ARGUMENT",
|
||||
// Missing argument to a function:
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
MISSING_ARGUMENT: "MISSING_ARGUMENT",
|
||||
// Too many arguments
|
||||
// - count: The number of arguments received
|
||||
// - expectedCount: The number of arguments expected
|
||||
UNEXPECTED_ARGUMENT: "UNEXPECTED_ARGUMENT",
|
||||
///////////////////
|
||||
// Blockchain Errors
|
||||
// Call exception
|
||||
// - transaction: the transaction
|
||||
// - address?: the contract address
|
||||
// - args?: The arguments passed into the function
|
||||
// - method?: The Solidity method signature
|
||||
// - errorSignature?: The EIP848 error signature
|
||||
// - errorArgs?: The EIP848 error parameters
|
||||
// - reason: The reason (only for EIP848 "Error(string)")
|
||||
CALL_EXCEPTION: "CALL_EXCEPTION",
|
||||
// Insufficien funds (< value + gasLimit * gasPrice)
|
||||
// - transaction: the transaction attempted
|
||||
INSUFFICIENT_FUNDS: "INSUFFICIENT_FUNDS",
|
||||
// Nonce has already been used
|
||||
// - transaction: the transaction attempted
|
||||
NONCE_EXPIRED: "NONCE_EXPIRED",
|
||||
// The replacement fee for the transaction is too low
|
||||
// - transaction: the transaction attempted
|
||||
REPLACEMENT_UNDERPRICED: "REPLACEMENT_UNDERPRICED",
|
||||
// The gas limit could not be estimated
|
||||
// - transaction: the transaction passed to estimateGas
|
||||
UNPREDICTABLE_GAS_LIMIT: "UNPREDICTABLE_GAS_LIMIT",
|
||||
};
|
||||
Logger.levels = {
|
||||
DEBUG: "DEBUG",
|
||||
INFO: "INFO",
|
||||
WARNING: "WARNING",
|
||||
ERROR: "ERROR",
|
||||
OFF: "OFF"
|
||||
};
|
||||
return Logger;
|
||||
}());
|
||||
exports.Logger = Logger;
|
@ -15,5 +15,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0xd285051d17a97638f3840564e5121f34ac194907818e337e0a1339784d8daeff"
|
||||
"tarballHash": "0x2ae65375ebea6f1d85e3583ff312fb0e25950bdb6e286e13f712fed11d780f55"
|
||||
}
|
||||
|
2
packages/networks/_version.d.ts
vendored
2
packages/networks/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.125";
|
||||
export declare const version = "5.0.0-beta.126";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.125";
|
||||
exports.version = "5.0.0-beta.126";
|
||||
|
@ -1,13 +1,8 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
function ethDefaultProvider(network) {
|
||||
return function (providers, options) {
|
||||
if (options == null) {
|
||||
@ -153,13 +148,13 @@ function getNetwork(network) {
|
||||
// Not a standard network; check that it is a valid network in general
|
||||
if (!standard) {
|
||||
if (typeof (network.chainId) !== "number") {
|
||||
errors.throwError("invalid network chainId", errors.INVALID_ARGUMENT, { arg: "network", value: network });
|
||||
logger.throwArgumentError("invalid network chainId", "network", network);
|
||||
}
|
||||
return network;
|
||||
}
|
||||
// Make sure the chainId matches the expected network chainId (or is 0; disable EIP-155)
|
||||
if (network.chainId !== 0 && network.chainId !== standard.chainId) {
|
||||
errors.throwError("network chainId mismatch", errors.INVALID_ARGUMENT, { arg: "network", value: network });
|
||||
logger.throwArgumentError("network chainId mismatch", "network", network);
|
||||
}
|
||||
// Standard Network (allow overriding the ENS address)
|
||||
return {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/networks",
|
||||
"version": "5.0.0-beta.125",
|
||||
"version": "5.0.0-beta.126",
|
||||
"description": "Network definitions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -18,5 +18,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x00ddc55c9d4a55e9bdb76344f8fed34b0733a4e132666e505f227c40a91748f3"
|
||||
"tarballHash": "0x48b2dafc0ae52ee5960b9478575ca59e8d205f5e302f0730402cdd30e5e85d0b"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.125";
|
||||
export const version = "5.0.0-beta.126";
|
||||
|
2
packages/properties/_version.d.ts
vendored
2
packages/properties/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.128";
|
||||
export declare const version = "5.0.0-beta.129";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.128";
|
||||
exports.version = "5.0.0-beta.129";
|
||||
|
@ -1,13 +1,8 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
function defineReadOnly(object, name, value) {
|
||||
Object.defineProperty(object, name, {
|
||||
enumerable: true,
|
||||
@ -51,18 +46,11 @@ function resolveProperties(object) {
|
||||
exports.resolveProperties = resolveProperties;
|
||||
function checkProperties(object, properties) {
|
||||
if (!object || typeof (object) !== "object") {
|
||||
errors.throwError("invalid object", errors.INVALID_ARGUMENT, {
|
||||
argument: "object",
|
||||
value: object
|
||||
});
|
||||
logger.throwArgumentError("invalid object", "object", object);
|
||||
}
|
||||
Object.keys(object).forEach(function (key) {
|
||||
if (!properties[key]) {
|
||||
errors.throwError("invalid object key - " + key, errors.INVALID_ARGUMENT, {
|
||||
argument: "transaction",
|
||||
value: object,
|
||||
key: key
|
||||
});
|
||||
logger.throwArgumentError("invalid object key - " + key, "transaction:" + key, object);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/properties",
|
||||
"version": "5.0.0-beta.128",
|
||||
"version": "5.0.0-beta.129",
|
||||
"description": "Properties utility functions for ethers.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
@ -20,5 +20,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x1e88d190889fba825112c1149176e055da2078d78ada4c4afbd88c6c95610420"
|
||||
"tarballHash": "0xe866191971f6ab5c46cc461b30fd772d4f4e3541398fb7f54e960f8722b333bd"
|
||||
}
|
||||
|
@ -1 +1 @@
|
||||
export const version = "5.0.0-beta.128";
|
||||
export const version = "5.0.0-beta.129";
|
||||
|
2
packages/providers/_version.d.ts
vendored
2
packages/providers/_version.d.ts
vendored
@ -1 +1 @@
|
||||
export declare const version = "5.0.0-beta.136";
|
||||
export declare const version = "5.0.0-beta.137";
|
||||
|
@ -1,3 +1,3 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.version = "5.0.0-beta.136";
|
||||
exports.version = "5.0.0-beta.137";
|
||||
|
@ -12,15 +12,10 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var url_json_rpc_provider_1 = require("./url-json-rpc-provider");
|
||||
// This key was provided to ethers.js by Alchemy to be used by the
|
||||
// default provider, but it is recommended that for your own
|
||||
@ -54,7 +49,7 @@ var AlchemyProvider = /** @class */ (function (_super) {
|
||||
host = "eth-kovan.alchemyapi.io/jsonrpc/";
|
||||
break;
|
||||
default:
|
||||
errors.throwArgumentError("unsupported network", "network", arguments[0]);
|
||||
logger.throwArgumentError("unsupported network", "network", arguments[0]);
|
||||
}
|
||||
return ("https:/" + "/" + host + apiKey);
|
||||
};
|
||||
|
@ -12,23 +12,18 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var abstract_provider_1 = require("@ethersproject/abstract-provider");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var hash_1 = require("@ethersproject/hash");
|
||||
var networks_1 = require("@ethersproject/networks");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var strings_1 = require("@ethersproject/strings");
|
||||
var web_1 = require("@ethersproject/web");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var formatter_1 = require("./formatter");
|
||||
//////////////////////////////
|
||||
// Event Serializeing
|
||||
@ -37,7 +32,7 @@ function checkTopic(topic) {
|
||||
return "null";
|
||||
}
|
||||
if (bytes_1.hexDataLength(topic) !== 32) {
|
||||
errors.throwArgumentError("invalid topic", "topic", topic);
|
||||
logger.throwArgumentError("invalid topic", "topic", topic);
|
||||
}
|
||||
return topic.toLowerCase();
|
||||
}
|
||||
@ -85,7 +80,7 @@ function getEventTag(eventName) {
|
||||
return "filter:*:" + serializeTopics(eventName);
|
||||
}
|
||||
else if (abstract_provider_1.ForkEvent.isForkEvent(eventName)) {
|
||||
errors.warn("not implemented");
|
||||
logger.warn("not implemented");
|
||||
throw new Error("not implemented");
|
||||
}
|
||||
else if (eventName && typeof (eventName) === "object") {
|
||||
@ -127,7 +122,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
function BaseProvider(network) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, abstract_provider_1.Provider);
|
||||
logger.checkNew(_newTarget, abstract_provider_1.Provider);
|
||||
_this = _super.call(this) || this;
|
||||
_this.formatter = _newTarget.getFormatter();
|
||||
if (network instanceof Promise) {
|
||||
@ -145,7 +140,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
properties_1.defineReadOnly(_this, "ready", Promise.resolve(_this._network));
|
||||
}
|
||||
else {
|
||||
errors.throwError("invalid network", errors.INVALID_ARGUMENT, { arg: "network", value: network });
|
||||
logger.throwArgumentError("invalid network", "network", network);
|
||||
}
|
||||
}
|
||||
_this._lastBlockNumber = -2;
|
||||
@ -446,7 +441,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
var result = tx;
|
||||
// Check the hash we expect is the same as the hash the server reported
|
||||
if (hash != null && tx.hash !== hash) {
|
||||
errors.throwError("Transaction hash mismatch from Provider.sendTransaction.", errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
||||
logger.throwError("Transaction hash mismatch from Provider.sendTransaction.", logger_1.Logger.errors.UNKNOWN_ERROR, { expectedHash: tx.hash, returnedHash: hash });
|
||||
}
|
||||
// @TODO: (confirmations? number, timeout? number)
|
||||
result.wait = function (confirmations) {
|
||||
@ -463,7 +458,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
// No longer pending, allow the polling loop to garbage collect this
|
||||
_this._emitted["t:" + tx.hash] = receipt.blockNumber;
|
||||
if (receipt.status === 0) {
|
||||
errors.throwError("transaction failed", errors.CALL_EXCEPTION, {
|
||||
logger.throwError("transaction failed", logger_1.Logger.errors.CALL_EXCEPTION, {
|
||||
transactionHash: tx.hash,
|
||||
transaction: tx
|
||||
});
|
||||
@ -548,7 +543,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
BaseProvider.prototype._getAddress = function (addressOrName) {
|
||||
return this.resolveName(addressOrName).then(function (address) {
|
||||
if (address == null) {
|
||||
errors.throwError("ENS name not configured", errors.UNSUPPORTED_OPERATION, {
|
||||
logger.throwError("ENS name not configured", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "resolveName(" + JSON.stringify(addressOrName) + ")"
|
||||
});
|
||||
}
|
||||
@ -578,7 +573,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
errors.throwError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
||||
logger.throwArgumentError("invalid block hash or block tag", "blockHashOrBlockTag", blockHashOrBlockTag);
|
||||
}
|
||||
}
|
||||
return web_1.poll(function () {
|
||||
@ -712,7 +707,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
}
|
||||
if (typeof (blockTag) === "number" && blockTag < 0) {
|
||||
if (blockTag % 1) {
|
||||
errors.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
||||
logger.throwArgumentError("invalid BlockTag", "blockTag", blockTag);
|
||||
}
|
||||
return this._getFastBlockNumber().then(function (bn) {
|
||||
bn += blockTag;
|
||||
@ -730,7 +725,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
return this.getNetwork().then(function (network) {
|
||||
// No ENS...
|
||||
if (!network.ensAddress) {
|
||||
errors.throwError("network does support ENS", errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
||||
logger.throwError("network does support ENS", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "ENS", network: network.name });
|
||||
}
|
||||
// keccak256("resolver(bytes32)")
|
||||
var data = "0x0178b8bf" + hash_1.namehash(name).substring(2);
|
||||
@ -804,7 +799,7 @@ var BaseProvider = /** @class */ (function (_super) {
|
||||
});
|
||||
};
|
||||
BaseProvider.prototype.perform = function (method, params) {
|
||||
return errors.throwError(method + " not implemented", errors.NOT_IMPLEMENTED, { operation: method });
|
||||
return logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method });
|
||||
};
|
||||
BaseProvider.prototype._startPending = function () {
|
||||
console.log("WARNING: this provider does not support pending events");
|
||||
|
@ -12,18 +12,13 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var web_1 = require("@ethersproject/web");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var base_provider_1 = require("./base-provider");
|
||||
// The transaction has already been sanitized by the calls in Provider
|
||||
function getTransactionString(transaction) {
|
||||
@ -88,7 +83,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
function EtherscanProvider(network, apiKey) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, EtherscanProvider);
|
||||
logger.checkNew(_newTarget, EtherscanProvider);
|
||||
_this = _super.call(this, network) || this;
|
||||
var name = "invalid";
|
||||
if (_this.network) {
|
||||
@ -126,11 +121,16 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
apiKey += "&apikey=" + this.apiKey;
|
||||
}
|
||||
var get = function (url, procFunc) {
|
||||
_this.emit("debug", {
|
||||
action: "request",
|
||||
request: url,
|
||||
provider: _this
|
||||
});
|
||||
return web_1.fetchJson(url, null, procFunc || getJsonResult).then(function (result) {
|
||||
_this.emit("debug", {
|
||||
action: "perform",
|
||||
action: "response",
|
||||
request: url,
|
||||
response: result,
|
||||
response: properties_1.deepCopy(result),
|
||||
provider: _this
|
||||
});
|
||||
return result;
|
||||
@ -168,15 +168,15 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
if (error.responseText) {
|
||||
// "Insufficient funds. The account you tried to send transaction from does not have enough funds. Required 21464000000000 and got: 0"
|
||||
if (error.responseText.toLowerCase().indexOf("insufficient funds") >= 0) {
|
||||
errors.throwError("insufficient funds", errors.INSUFFICIENT_FUNDS, {});
|
||||
logger.throwError("insufficient funds", logger_1.Logger.errors.INSUFFICIENT_FUNDS, {});
|
||||
}
|
||||
// "Transaction with the same hash was already imported."
|
||||
if (error.responseText.indexOf("same hash was already imported") >= 0) {
|
||||
errors.throwError("nonce has already been used", errors.NONCE_EXPIRED, {});
|
||||
logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, {});
|
||||
}
|
||||
// "Transaction gas price is too low. There is another transaction with same nonce in the queue. Try increasing the gas price or incrementing the nonce."
|
||||
if (error.responseText.indexOf("another transaction with same nonce") >= 0) {
|
||||
errors.throwError("replacement fee too low", errors.REPLACEMENT_UNDERPRICED, {});
|
||||
logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, {});
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
@ -309,11 +309,16 @@ var EtherscanProvider = /** @class */ (function (_super) {
|
||||
url += "&startblock=" + startBlock;
|
||||
url += "&endblock=" + endBlock;
|
||||
url += "&sort=asc" + apiKey;
|
||||
_this.emit("debug", {
|
||||
action: "request",
|
||||
request: url,
|
||||
provider: _this
|
||||
});
|
||||
return web_1.fetchJson(url, null, getResult).then(function (result) {
|
||||
_this.emit("debug", {
|
||||
action: "getHistory",
|
||||
action: "response",
|
||||
request: url,
|
||||
response: result,
|
||||
response: properties_1.deepCopy(result),
|
||||
provider: _this
|
||||
});
|
||||
var output = [];
|
||||
|
@ -12,17 +12,12 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var random_1 = require("@ethersproject/random");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var base_provider_1 = require("./base-provider");
|
||||
function now() { return (new Date()).getTime(); }
|
||||
// Returns:
|
||||
@ -50,7 +45,7 @@ function checkNetworks(networks) {
|
||||
(check.ensAddress == null && network.ensAddress == null))) {
|
||||
return;
|
||||
}
|
||||
errors.throwError("provider mismatch", errors.INVALID_ARGUMENT, { arg: "networks", value: networks });
|
||||
logger.throwArgumentError("provider mismatch", "networks", networks);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
@ -82,12 +77,12 @@ var FallbackProvider = /** @class */ (function (_super) {
|
||||
function FallbackProvider(providers, quorum, weights) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, FallbackProvider);
|
||||
logger.checkNew(_newTarget, FallbackProvider);
|
||||
if (providers.length === 0) {
|
||||
errors.throwArgumentError("missing providers", "providers", providers);
|
||||
logger.throwArgumentError("missing providers", "providers", providers);
|
||||
}
|
||||
if (weights != null && weights.length !== providers.length) {
|
||||
errors.throwArgumentError("too many weights", "weights", weights);
|
||||
logger.throwArgumentError("too many weights", "weights", weights);
|
||||
}
|
||||
else if (!weights) {
|
||||
weights = providers.map(function (p) { return 1; });
|
||||
@ -95,7 +90,7 @@ var FallbackProvider = /** @class */ (function (_super) {
|
||||
else {
|
||||
weights.forEach(function (w) {
|
||||
if (w % 1 || w > 512 || w < 1) {
|
||||
errors.throwArgumentError("invalid weight; must be integer in [1, 512]", "weights", weights);
|
||||
logger.throwArgumentError("invalid weight; must be integer in [1, 512]", "weights", weights);
|
||||
}
|
||||
});
|
||||
}
|
||||
@ -105,7 +100,7 @@ var FallbackProvider = /** @class */ (function (_super) {
|
||||
}
|
||||
else {
|
||||
if (quorum > total) {
|
||||
errors.throwArgumentError("quorum will always fail; larger than total weight", "quorum", quorum);
|
||||
logger.throwArgumentError("quorum will always fail; larger than total weight", "quorum", quorum);
|
||||
}
|
||||
}
|
||||
// All networks are ready, we can know the network for certain
|
||||
@ -117,7 +112,7 @@ var FallbackProvider = /** @class */ (function (_super) {
|
||||
// The network won't be known until all child providers know
|
||||
var ready_1 = Promise.all(providers.map(function (p) { return p.getNetwork(); })).then(function (networks) {
|
||||
if (!checkNetworks(networks)) {
|
||||
errors.throwError("getNetwork returned null", errors.UNKNOWN_ERROR, {});
|
||||
logger.throwError("getNetwork returned null", logger_1.Logger.errors.UNKNOWN_ERROR);
|
||||
}
|
||||
return networks[0];
|
||||
});
|
||||
@ -139,14 +134,32 @@ var FallbackProvider = /** @class */ (function (_super) {
|
||||
run: function () {
|
||||
var t0 = now();
|
||||
var start = t0 - T0;
|
||||
_this.emit("debug", "perform", rid, { weight: weight, start: start, provider: provider, method: method, params: params });
|
||||
_this.emit("debug", {
|
||||
action: "request",
|
||||
rid: rid,
|
||||
backend: { weight: weight, start: start, provider: provider },
|
||||
request: { method: method, params: properties_1.deepCopy(params) },
|
||||
provider: _this
|
||||
});
|
||||
return provider.perform(method, params).then(function (result) {
|
||||
var duration = now() - t0;
|
||||
_this.emit("debug", "result", rid, { duration: duration, result: result });
|
||||
_this.emit("debug", {
|
||||
action: "response",
|
||||
rid: rid,
|
||||
backend: { weight: weight, start: start, duration: duration, provider: provider },
|
||||
request: { method: method, params: properties_1.deepCopy(params) },
|
||||
response: properties_1.deepCopy(result)
|
||||
});
|
||||
return { weight: weight, result: result };
|
||||
}, function (error) {
|
||||
var duration = now() - t0;
|
||||
_this.emit("debug", "error", rid, { duration: duration, error: error });
|
||||
_this.emit("debug", {
|
||||
action: "response",
|
||||
rid: rid,
|
||||
backend: { weight: weight, start: start, duration: duration, provider: provider },
|
||||
request: { method: method, params: properties_1.deepCopy(params) },
|
||||
error: error
|
||||
});
|
||||
return { weight: weight, error: error };
|
||||
});
|
||||
},
|
||||
|
@ -1,23 +1,18 @@
|
||||
"use strict";
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var address_1 = require("@ethersproject/address");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var constants_1 = require("@ethersproject/constants");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var transactions_1 = require("@ethersproject/transactions");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var Formatter = /** @class */ (function () {
|
||||
function Formatter() {
|
||||
var _newTarget = this.constructor;
|
||||
errors.checkNew(_newTarget, Formatter);
|
||||
logger.checkNew(_newTarget, Formatter);
|
||||
this.formats = this.getDefaultFormats();
|
||||
}
|
||||
Formatter.prototype.getDefaultFormats = function () {
|
||||
@ -155,10 +150,7 @@ var Formatter = /** @class */ (function () {
|
||||
return value.toLowerCase();
|
||||
}
|
||||
}
|
||||
return errors.throwError("invalid hash", errors.INVALID_ARGUMENT, {
|
||||
argument: "value",
|
||||
value: value
|
||||
});
|
||||
return logger.throwArgumentError("invalid hash", "value", value);
|
||||
};
|
||||
Formatter.prototype.data = function (value, strict) {
|
||||
var result = this.hex(value, strict);
|
||||
@ -202,10 +194,7 @@ var Formatter = /** @class */ (function () {
|
||||
Formatter.prototype.hash = function (value, strict) {
|
||||
var result = this.hex(value, strict);
|
||||
if (bytes_1.hexDataLength(result) !== 32) {
|
||||
return errors.throwError("invalid hash", errors.INVALID_ARGUMENT, {
|
||||
argument: "value",
|
||||
value: value
|
||||
});
|
||||
return logger.throwArgumentError("invalid hash", "value", value);
|
||||
}
|
||||
return result;
|
||||
};
|
||||
|
@ -12,15 +12,10 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var url_json_rpc_provider_1 = require("./url-json-rpc-provider");
|
||||
var defaultProjectId = "84842078b09946638c03157f83405213";
|
||||
var InfuraProvider = /** @class */ (function (_super) {
|
||||
@ -58,7 +53,7 @@ var InfuraProvider = /** @class */ (function (_super) {
|
||||
host = "goerli.infura.io";
|
||||
break;
|
||||
default:
|
||||
errors.throwError("unsupported network", errors.INVALID_ARGUMENT, {
|
||||
logger.throwError("unsupported network", logger_1.Logger.errors.INVALID_ARGUMENT, {
|
||||
argument: "network",
|
||||
value: network
|
||||
});
|
||||
|
@ -15,26 +15,21 @@ var __extends = (this && this.__extends) || (function () {
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var net_1 = __importDefault(require("net"));
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var json_rpc_provider_1 = require("./json-rpc-provider");
|
||||
var IpcProvider = /** @class */ (function (_super) {
|
||||
__extends(IpcProvider, _super);
|
||||
function IpcProvider(path, network) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, IpcProvider);
|
||||
logger.checkNew(_newTarget, IpcProvider);
|
||||
if (path == null) {
|
||||
errors.throwError("missing path", errors.MISSING_ARGUMENT, { arg: "path" });
|
||||
logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" });
|
||||
}
|
||||
_this = _super.call(this, "ipc://" + path, network) || this;
|
||||
properties_1.defineReadOnly(_this, "path", path);
|
||||
|
@ -12,22 +12,17 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var abstract_signer_1 = require("@ethersproject/abstract-signer");
|
||||
var bignumber_1 = require("@ethersproject/bignumber");
|
||||
var bytes_1 = require("@ethersproject/bytes");
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var networks_1 = require("@ethersproject/networks");
|
||||
var properties_1 = require("@ethersproject/properties");
|
||||
var strings_1 = require("@ethersproject/strings");
|
||||
var web_1 = require("@ethersproject/web");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
var base_provider_1 = require("./base-provider");
|
||||
function timer(timeout) {
|
||||
return new Promise(function (resolve) {
|
||||
@ -58,7 +53,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, JsonRpcSigner);
|
||||
logger.checkNew(_newTarget, JsonRpcSigner);
|
||||
_this = _super.call(this) || this;
|
||||
if (constructorGuard !== _constructorGuard) {
|
||||
throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");
|
||||
@ -76,12 +71,12 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
properties_1.defineReadOnly(_this, "_address", null);
|
||||
}
|
||||
else {
|
||||
errors.throwError("invalid address or index", errors.INVALID_ARGUMENT, { argument: "addressOrIndex", value: addressOrIndex });
|
||||
logger.throwArgumentError("invalid address or index", "addressOrIndex", addressOrIndex);
|
||||
}
|
||||
return _this;
|
||||
}
|
||||
JsonRpcSigner.prototype.connect = function (provider) {
|
||||
return errors.throwError("cannot alter JSON-RPC Signer connection", errors.UNSUPPORTED_OPERATION, {
|
||||
return logger.throwError("cannot alter JSON-RPC Signer connection", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "connect"
|
||||
});
|
||||
};
|
||||
@ -95,7 +90,9 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
}
|
||||
return this.provider.send("eth_accounts", []).then(function (accounts) {
|
||||
if (accounts.length <= _this._index) {
|
||||
errors.throwError("unknown account #" + _this._index, errors.UNSUPPORTED_OPERATION, { operation: "getAddress" });
|
||||
logger.throwError("unknown account #" + _this._index, logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "getAddress"
|
||||
});
|
||||
}
|
||||
return _this.provider.formatter.address(accounts[_this._index]);
|
||||
});
|
||||
@ -130,17 +127,17 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
if (error.responseText) {
|
||||
// See: JsonRpcProvider.sendTransaction (@TODO: Expose a ._throwError??)
|
||||
if (error.responseText.indexOf("insufficient funds") >= 0) {
|
||||
errors.throwError("insufficient funds", errors.INSUFFICIENT_FUNDS, {
|
||||
logger.throwError("insufficient funds", logger_1.Logger.errors.INSUFFICIENT_FUNDS, {
|
||||
transaction: tx
|
||||
});
|
||||
}
|
||||
if (error.responseText.indexOf("nonce too low") >= 0) {
|
||||
errors.throwError("nonce has already been used", errors.NONCE_EXPIRED, {
|
||||
logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, {
|
||||
transaction: tx
|
||||
});
|
||||
}
|
||||
if (error.responseText.indexOf("replacement transaction underpriced") >= 0) {
|
||||
errors.throwError("replacement fee too low", errors.REPLACEMENT_UNDERPRICED, {
|
||||
logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, {
|
||||
transaction: tx
|
||||
});
|
||||
}
|
||||
@ -150,7 +147,7 @@ var JsonRpcSigner = /** @class */ (function (_super) {
|
||||
});
|
||||
};
|
||||
JsonRpcSigner.prototype.signTransaction = function (transaction) {
|
||||
return errors.throwError("signing transactions is unsupported", errors.UNSUPPORTED_OPERATION, {
|
||||
return logger.throwError("signing transactions is unsupported", logger_1.Logger.errors.UNSUPPORTED_OPERATION, {
|
||||
operation: "signTransaction"
|
||||
});
|
||||
};
|
||||
@ -219,7 +216,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
function JsonRpcProvider(url, network) {
|
||||
var _newTarget = this.constructor;
|
||||
var _this = this;
|
||||
errors.checkNew(_newTarget, JsonRpcProvider);
|
||||
logger.checkNew(_newTarget, JsonRpcProvider);
|
||||
// One parameter, but it is a network name, so swap it with the URL
|
||||
if (typeof (url) === "string") {
|
||||
if (network === null && networks_1.getNetwork(url)) {
|
||||
@ -241,7 +238,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
_this.send("net_version", []).then(function (result) {
|
||||
resolve(networks_1.getNetwork(bignumber_1.BigNumber.from(result).toNumber()));
|
||||
}).catch(function (error) {
|
||||
reject(errors.makeError("could not detect network", errors.NETWORK_ERROR, {}));
|
||||
reject(logger.makeError("could not detect network", logger_1.Logger.errors.NETWORK_ERROR));
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -283,9 +280,14 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
id: (this._nextId++),
|
||||
jsonrpc: "2.0"
|
||||
};
|
||||
this.emit("debug", {
|
||||
action: "request",
|
||||
request: properties_1.deepCopy(request),
|
||||
provider: this
|
||||
});
|
||||
return web_1.fetchJson(this.connection, JSON.stringify(request), getResult).then(function (result) {
|
||||
_this.emit("debug", {
|
||||
action: "send",
|
||||
action: "response",
|
||||
request: request,
|
||||
response: result,
|
||||
provider: _this
|
||||
@ -312,15 +314,15 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
if (error.responseText) {
|
||||
// "insufficient funds for gas * price + value"
|
||||
if (error.responseText.indexOf("insufficient funds") > 0) {
|
||||
errors.throwError("insufficient funds", errors.INSUFFICIENT_FUNDS, {});
|
||||
logger.throwError("insufficient funds", logger_1.Logger.errors.INSUFFICIENT_FUNDS, {});
|
||||
}
|
||||
// "nonce too low"
|
||||
if (error.responseText.indexOf("nonce too low") > 0) {
|
||||
errors.throwError("nonce has already been used", errors.NONCE_EXPIRED, {});
|
||||
logger.throwError("nonce has already been used", logger_1.Logger.errors.NONCE_EXPIRED, {});
|
||||
}
|
||||
// "replacement transaction underpriced"
|
||||
if (error.responseText.indexOf("replacement transaction underpriced") > 0) {
|
||||
errors.throwError("replacement fee too low", errors.REPLACEMENT_UNDERPRICED, {});
|
||||
logger.throwError("replacement fee too low", logger_1.Logger.errors.REPLACEMENT_UNDERPRICED, {});
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
@ -349,7 +351,7 @@ var JsonRpcProvider = /** @class */ (function (_super) {
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return errors.throwError(method + " not implemented", errors.NOT_IMPLEMENTED, { operation: method });
|
||||
return logger.throwError(method + " not implemented", logger_1.Logger.errors.NOT_IMPLEMENTED, { operation: method });
|
||||
};
|
||||
JsonRpcProvider.prototype._startPending = function () {
|
||||
if (this._pendingFilter != null) {
|
||||
|
@ -12,16 +12,11 @@ var __extends = (this && this.__extends) || (function () {
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var __importStar = (this && this.__importStar) || function (mod) {
|
||||
if (mod && mod.__esModule) return mod;
|
||||
var result = {};
|
||||
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
|
||||
result["default"] = mod;
|
||||
return result;
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
var errors = __importStar(require("@ethersproject/errors"));
|
||||
var url_json_rpc_provider_1 = require("./url-json-rpc-provider");
|
||||
var logger_1 = require("@ethersproject/logger");
|
||||
var _version_1 = require("./_version");
|
||||
var logger = new logger_1.Logger(_version_1.version);
|
||||
// Special API key provided by Nodesmith for ethers.js
|
||||
var defaultApiKey = "ETHERS_JS_SHARED";
|
||||
var NodesmithProvider = /** @class */ (function (_super) {
|
||||
@ -51,7 +46,7 @@ var NodesmithProvider = /** @class */ (function (_super) {
|
||||
host = "https://ethereum.api.nodesmith.io/v1/kovan/jsonrpc";
|
||||
break;
|
||||
default:
|
||||
errors.throwArgumentError("unsupported network", "network", arguments[0]);
|
||||
logger.throwArgumentError("unsupported network", "network", arguments[0]);
|
||||
}
|
||||
return (host + "?apiKey=" + apiKey);
|
||||
};
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@ethersproject/providers",
|
||||
"version": "5.0.0-beta.136",
|
||||
"version": "5.0.0-beta.137",
|
||||
"description": "Ethereum Providers for ethers.",
|
||||
"main": "index.js",
|
||||
"browser": {
|
||||
@ -39,5 +39,5 @@
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"tarballHash": "0x98a9a7dbc038ccc8e2f907c25f179cdb3fe4bddc75ad9258462ef80d0053ec7e"
|
||||
"tarballHash": "0x8164e7f8bce73f0b1329a5c445823fa27c5c372f84d202d3986e459d8368334f"
|
||||
}
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user