Updated dist files.

This commit is contained in:
Richard Moore 2020-10-07 20:10:50 -04:00
parent 5abc2f36e2
commit d78b7a3998
No known key found for this signature in database
GPG Key ID: 665176BE8E9DC651
77 changed files with 456 additions and 134 deletions

@ -3,6 +3,15 @@ Changelog
This change log is managed by `admin/cmds/update-versions` but may be manually updated.
ethers/v5.0.17 (2020-10-07 20:08)
---------------------------------
- Better error message for parseUnits of non-strings. ([#981](https://github.com/ethers-io/ethers.js/issues/981); [5abc2f3](https://github.com/ethers-io/ethers.js/commit/5abc2f36e20eef79a935961f3dd8133b5528d9e5))
- Add gzip support to AlchemyProivder and InfuraProvider fetching. ([#1085](https://github.com/ethers-io/ethers.js/issues/1085); [38a068b](https://github.com/ethers-io/ethers.js/commit/38a068bcea3f251c8f3a349a90fcb077a39d23ad))
- Add gzip support to getUrl in node. ([#1085](https://github.com/ethers-io/ethers.js/issues/1085); [65772a8](https://github.com/ethers-io/ethers.js/commit/65772a8e1a55d663bdb67e3a2b160fecc9f986ef))
- Added CommunityResourcable to mark Providers as highly throttled. ([a022093](https://github.com/ethers-io/ethers.js/commit/a022093ce03f55db7ba2cac36e365d1af39ac45b))
- Added debug event info to WebSocketProvider. ([#1018](https://github.com/ethers-io/ethers.js/issues/1018); [8e682cc](https://github.com/ethers-io/ethers.js/commit/8e682cc8481c6051a6f8115b29d78f4996120ccd))
ethers/v5.0.16 (2020-10-05 15:44)
---------------------------------

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

@ -17886,7 +17886,7 @@ var browser$2 = /*#__PURE__*/Object.freeze({
encode: encode$1
});
const version$l = "web/5.0.8";
const version$l = "web/5.0.9";
"use strict";
var __awaiter$4 = (window && window.__awaiter) || function (thisArg, _arguments, P, generator) {
@ -18010,6 +18010,7 @@ function _fetchData(connection, body, processFunc) {
}
}
}
options.allowGzip = !!connection.allowGzip;
if (connection.user != null && connection.password != null) {
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
logger$p.throwError("basic authentication requires a secure https url", Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" });
@ -18849,6 +18850,12 @@ class Formatter {
});
}
}
function isCommunityResourcable(value) {
return (value && typeof (value.isCommunityResource) === "function");
}
function isCommunityResource(value) {
return (isCommunityResourcable(value) && value.isCommunityResource());
}
// Show the throttle message only once
let throttleMessage = false;
function showThrottleMessage() {
@ -21016,6 +21023,9 @@ class UrlJsonRpcProvider extends StaticJsonRpcProvider {
_startPending() {
logger$u.warn("WARNING: API provider does not support pending filters");
}
isCommunityResource() {
return false;
}
getSigner(address) {
return logger$u.throwError("API provider does not support signing", Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" });
}
@ -21043,12 +21053,21 @@ const logger$v = new Logger(version$m);
// production environments, that you acquire your own API key at:
// https://dashboard.alchemyapi.io
const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
class AlchemyWebSocketProvider extends WebSocketProvider {
constructor(network, apiKey) {
const provider = new AlchemyProvider(network, apiKey);
const url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
return new WebSocketProvider(url, provider.network);
super(url, provider.network);
defineReadOnly(this, "apiKey", provider.apiKey);
}
isCommunityResource() {
return (this.apiKey === defaultApiKey);
}
}
class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
return new AlchemyWebSocketProvider(network, apiKey);
}
static getApiKey(apiKey) {
if (apiKey == null) {
@ -21081,6 +21100,7 @@ class AlchemyProvider extends UrlJsonRpcProvider {
logger$v.throwArgumentError("unsupported network", "network", arguments[0]);
}
return {
allowGzip: true,
url: ("https:/" + "/" + host + apiKey),
throttleCallback: (attempt, url) => {
if (apiKey === defaultApiKey) {
@ -21090,6 +21110,9 @@ class AlchemyProvider extends UrlJsonRpcProvider {
}
};
}
isCommunityResource() {
return (this.apiKey === defaultApiKey);
}
}
"use strict";
@ -21312,7 +21335,7 @@ class EtherscanProvider extends BaseProvider {
url: url,
throttleSlotInterval: 1000,
throttleCallback: (attempt, url) => {
if (this.apiKey === defaultApiKey$1) {
if (this.isCommunityResource()) {
showThrottleMessage();
}
return Promise.resolve(true);
@ -21528,6 +21551,9 @@ class EtherscanProvider extends BaseProvider {
});
});
}
isCommunityResource() {
return (this.apiKey === defaultApiKey$1);
}
}
"use strict";
@ -21877,14 +21903,16 @@ class FallbackProvider extends BaseProvider {
}
const providerConfigs = providers.map((configOrProvider, index) => {
if (Provider.isProvider(configOrProvider)) {
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: 750, priority: 1 });
const stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
const priority = 1;
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });
}
const config = shallowCopy(configOrProvider);
if (config.priority == null) {
config.priority = 1;
}
if (config.stallTimeout == null) {
config.stallTimeout = 750;
config.stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
}
if (config.weight == null) {
config.weight = 1;
@ -22111,8 +22139,8 @@ var browserIpcProvider = {
"use strict";
const logger$z = new Logger(version$m);
const defaultProjectId = "84842078b09946638c03157f83405213";
class InfuraProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
class InfuraWebSocketProvider extends WebSocketProvider {
constructor(network, apiKey) {
const provider = new InfuraProvider(network, apiKey);
const connection = provider.connection;
if (connection.password) {
@ -22121,7 +22149,18 @@ class InfuraProvider extends UrlJsonRpcProvider {
});
}
const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
return new WebSocketProvider(url, network);
super(url, network);
defineReadOnly(this, "apiKey", provider.projectId);
defineReadOnly(this, "projectId", provider.projectId);
defineReadOnly(this, "projectSecret", provider.projectSecret);
}
isCommunityResource() {
return (this.projectId === defaultProjectId);
}
}
class InfuraProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
return new InfuraWebSocketProvider(network, apiKey);
}
static getApiKey(apiKey) {
const apiKeyObj = {
@ -22172,6 +22211,7 @@ class InfuraProvider extends UrlJsonRpcProvider {
});
}
const connection = {
allowGzip: true,
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: (attempt, url) => {
if (apiKey.projectId === defaultProjectId) {
@ -22186,6 +22226,9 @@ class InfuraProvider extends UrlJsonRpcProvider {
}
return connection;
}
isCommunityResource() {
return (this.projectId === defaultProjectId);
}
}
/* istanbul ignore file */
@ -22371,9 +22414,11 @@ var index$2 = /*#__PURE__*/Object.freeze({
UrlJsonRpcProvider: UrlJsonRpcProvider,
FallbackProvider: FallbackProvider,
AlchemyProvider: AlchemyProvider,
AlchemyWebSocketProvider: AlchemyWebSocketProvider,
CloudflareProvider: CloudflareProvider,
EtherscanProvider: EtherscanProvider,
InfuraProvider: InfuraProvider,
InfuraWebSocketProvider: InfuraWebSocketProvider,
JsonRpcProvider: JsonRpcProvider,
NodesmithProvider: NodesmithProvider,
StaticJsonRpcProvider: StaticJsonRpcProvider,
@ -22383,6 +22428,9 @@ var index$2 = /*#__PURE__*/Object.freeze({
JsonRpcSigner: JsonRpcSigner,
getDefaultProvider: getDefaultProvider,
getNetwork: getNetwork,
isCommunityResource: isCommunityResource,
isCommunityResourcable: isCommunityResourcable,
showThrottleMessage: showThrottleMessage,
Formatter: Formatter
});
@ -22469,7 +22517,7 @@ function sha256$1(types, values) {
return browser_3(pack$1(types, values));
}
const version$n = "units/5.0.5";
const version$n = "units/5.0.6";
"use strict";
const logger$D = new Logger(version$n);
@ -22534,6 +22582,9 @@ function formatUnits(value, unitName) {
return formatFixed(value, (unitName != null) ? unitName : 18);
}
function parseUnits(value, unitName) {
if (typeof (value) !== "string") {
logger$D.throwArgumentError("value must be a string", "value", value);
}
if (typeof (unitName) === "string") {
const index = names.indexOf(unitName);
if (index !== -1) {

File diff suppressed because one or more lines are too long

@ -19661,7 +19661,7 @@
var _version$G = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.8";
exports.version = "web/5.0.9";
});
@ -19872,6 +19872,7 @@
}
}
}
options.allowGzip = !!connection.allowGzip;
if (connection.user != null && connection.password != null) {
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
logger.throwError("basic authentication requires a secure https url", lib.Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" });
@ -20772,6 +20773,14 @@
return Formatter;
}());
exports.Formatter = Formatter;
function isCommunityResourcable(value) {
return (value && typeof (value.isCommunityResource) === "function");
}
exports.isCommunityResourcable = isCommunityResourcable;
function isCommunityResource(value) {
return (isCommunityResourcable(value) && value.isCommunityResource());
}
exports.isCommunityResource = isCommunityResource;
// Show the throttle message only once
var throttleMessage = false;
function showThrottleMessage() {
@ -20798,7 +20807,9 @@
var formatter$1 = unwrapExports(formatter);
var formatter_1 = formatter.Formatter;
var formatter_2 = formatter.showThrottleMessage;
var formatter_2 = formatter.isCommunityResourcable;
var formatter_3 = formatter.isCommunityResource;
var formatter_4 = formatter.showThrottleMessage;
var baseProvider = createCommonjsModule(function (module, exports) {
"use strict";
@ -23645,6 +23656,9 @@
UrlJsonRpcProvider.prototype._startPending = function () {
logger.warn("WARNING: API provider does not support pending filters");
};
UrlJsonRpcProvider.prototype.isCommunityResource = function () {
return false;
};
UrlJsonRpcProvider.prototype.getSigner = function (address) {
return logger.throwError("API provider does not support signing", lib.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" });
};
@ -23693,6 +23707,7 @@
var logger = new lib.Logger(_version$I.version);
// This key was provided to ethers.js by Alchemy to be used by the
@ -23700,16 +23715,30 @@
// production environments, that you acquire your own API key at:
// https://dashboard.alchemyapi.io
var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
var AlchemyWebSocketProvider = /** @class */ (function (_super) {
__extends(AlchemyWebSocketProvider, _super);
function AlchemyWebSocketProvider(network, apiKey) {
var _this = this;
var provider = new AlchemyProvider(network, apiKey);
var url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
_this = _super.call(this, url, provider.network) || this;
lib$3.defineReadOnly(_this, "apiKey", provider.apiKey);
return _this;
}
AlchemyWebSocketProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return AlchemyWebSocketProvider;
}(websocketProvider.WebSocketProvider));
exports.AlchemyWebSocketProvider = AlchemyWebSocketProvider;
var AlchemyProvider = /** @class */ (function (_super) {
__extends(AlchemyProvider, _super);
function AlchemyProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlchemyProvider.getWebSocketProvider = function (network, apiKey) {
var provider = new AlchemyProvider(network, apiKey);
var url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
return new websocketProvider.WebSocketProvider(url, provider.network);
return new AlchemyWebSocketProvider(network, apiKey);
};
AlchemyProvider.getApiKey = function (apiKey) {
if (apiKey == null) {
@ -23742,6 +23771,7 @@
logger.throwArgumentError("unsupported network", "network", arguments[0]);
}
return {
allowGzip: true,
url: ("https:/" + "/" + host + apiKey),
throttleCallback: function (attempt, url) {
if (apiKey === defaultApiKey) {
@ -23751,6 +23781,9 @@
}
};
};
AlchemyProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return AlchemyProvider;
}(urlJsonRpcProvider.UrlJsonRpcProvider));
exports.AlchemyProvider = AlchemyProvider;
@ -23758,7 +23791,8 @@
});
var alchemyProvider$1 = unwrapExports(alchemyProvider);
var alchemyProvider_1 = alchemyProvider.AlchemyProvider;
var alchemyProvider_1 = alchemyProvider.AlchemyWebSocketProvider;
var alchemyProvider_2 = alchemyProvider.AlchemyProvider;
var cloudflareProvider = createCommonjsModule(function (module, exports) {
"use strict";
@ -24100,7 +24134,7 @@
url: url,
throttleSlotInterval: 1000,
throttleCallback: function (attempt, url) {
if (_this.apiKey === defaultApiKey) {
if (_this.isCommunityResource()) {
formatter.showThrottleMessage();
}
return Promise.resolve(true);
@ -24350,6 +24384,9 @@
});
});
};
EtherscanProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return EtherscanProvider;
}(baseProvider.BaseProvider));
exports.EtherscanProvider = EtherscanProvider;
@ -24420,6 +24457,7 @@
var logger = new lib.Logger(_version$I.version);
function now() { return (new Date()).getTime(); }
// Returns to network as long as all agree, or null if any is null.
@ -24786,14 +24824,16 @@
}
var providerConfigs = providers.map(function (configOrProvider, index) {
if (lib$b.Provider.isProvider(configOrProvider)) {
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: 750, priority: 1 });
var stallTimeout = formatter.isCommunityResource(configOrProvider) ? 2000 : 750;
var priority = 1;
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: stallTimeout, priority: priority });
}
var config = lib$3.shallowCopy(configOrProvider);
if (config.priority == null) {
config.priority = 1;
}
if (config.stallTimeout == null) {
config.stallTimeout = 750;
config.stallTimeout = formatter.isCommunityResource(configOrProvider) ? 2000 : 750;
}
if (config.weight == null) {
config.weight = 1;
@ -25084,15 +25124,14 @@
var logger = new lib.Logger(_version$I.version);
var defaultProjectId = "84842078b09946638c03157f83405213";
var InfuraProvider = /** @class */ (function (_super) {
__extends(InfuraProvider, _super);
function InfuraProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
InfuraProvider.getWebSocketProvider = function (network, apiKey) {
var InfuraWebSocketProvider = /** @class */ (function (_super) {
__extends(InfuraWebSocketProvider, _super);
function InfuraWebSocketProvider(network, apiKey) {
var _this = this;
var provider = new InfuraProvider(network, apiKey);
var connection = provider.connection;
if (connection.password) {
@ -25101,7 +25140,25 @@
});
}
var url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
return new websocketProvider.WebSocketProvider(url, network);
_this = _super.call(this, url, network) || this;
lib$3.defineReadOnly(_this, "apiKey", provider.projectId);
lib$3.defineReadOnly(_this, "projectId", provider.projectId);
lib$3.defineReadOnly(_this, "projectSecret", provider.projectSecret);
return _this;
}
InfuraWebSocketProvider.prototype.isCommunityResource = function () {
return (this.projectId === defaultProjectId);
};
return InfuraWebSocketProvider;
}(websocketProvider.WebSocketProvider));
exports.InfuraWebSocketProvider = InfuraWebSocketProvider;
var InfuraProvider = /** @class */ (function (_super) {
__extends(InfuraProvider, _super);
function InfuraProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
InfuraProvider.getWebSocketProvider = function (network, apiKey) {
return new InfuraWebSocketProvider(network, apiKey);
};
InfuraProvider.getApiKey = function (apiKey) {
var apiKeyObj = {
@ -25152,6 +25209,7 @@
});
}
var connection = {
allowGzip: true,
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: function (attempt, url) {
if (apiKey.projectId === defaultProjectId) {
@ -25166,6 +25224,9 @@
}
return connection;
};
InfuraProvider.prototype.isCommunityResource = function () {
return (this.projectId === defaultProjectId);
};
return InfuraProvider;
}(urlJsonRpcProvider.UrlJsonRpcProvider));
exports.InfuraProvider = InfuraProvider;
@ -25173,7 +25234,8 @@
});
var infuraProvider$1 = unwrapExports(infuraProvider);
var infuraProvider_1 = infuraProvider.InfuraProvider;
var infuraProvider_1 = infuraProvider.InfuraWebSocketProvider;
var infuraProvider_2 = infuraProvider.InfuraProvider;
var nodesmithProvider = createCommonjsModule(function (module, exports) {
/* istanbul ignore file */
@ -25378,6 +25440,7 @@
exports.Resolver = baseProvider.Resolver;
exports.AlchemyProvider = alchemyProvider.AlchemyProvider;
exports.AlchemyWebSocketProvider = alchemyProvider.AlchemyWebSocketProvider;
exports.CloudflareProvider = cloudflareProvider.CloudflareProvider;
@ -25388,6 +25451,7 @@
exports.IpcProvider = browserIpcProvider.IpcProvider;
exports.InfuraProvider = infuraProvider.InfuraProvider;
exports.InfuraWebSocketProvider = infuraProvider.InfuraWebSocketProvider;
exports.JsonRpcProvider = jsonRpcProvider.JsonRpcProvider;
exports.JsonRpcSigner = jsonRpcProvider.JsonRpcSigner;
@ -25402,6 +25466,9 @@
exports.WebSocketProvider = websocketProvider.WebSocketProvider;
exports.Formatter = formatter.Formatter;
exports.isCommunityResourcable = formatter.isCommunityResourcable;
exports.isCommunityResource = formatter.isCommunityResource;
exports.showThrottleMessage = formatter.showThrottleMessage;
var logger = new lib.Logger(_version$I.version);
@ -25456,20 +25523,25 @@
var lib_3$g = lib$m.BaseProvider;
var lib_4$c = lib$m.Resolver;
var lib_5$b = lib$m.AlchemyProvider;
var lib_6$7 = lib$m.CloudflareProvider;
var lib_7$6 = lib$m.EtherscanProvider;
var lib_8$5 = lib$m.FallbackProvider;
var lib_9$5 = lib$m.IpcProvider;
var lib_10$3 = lib$m.InfuraProvider;
var lib_11$2 = lib$m.JsonRpcProvider;
var lib_12$2 = lib$m.JsonRpcSigner;
var lib_13$2 = lib$m.NodesmithProvider;
var lib_14$1 = lib$m.StaticJsonRpcProvider;
var lib_15$1 = lib$m.UrlJsonRpcProvider;
var lib_16$1 = lib$m.Web3Provider;
var lib_17 = lib$m.WebSocketProvider;
var lib_18 = lib$m.Formatter;
var lib_19 = lib$m.getDefaultProvider;
var lib_6$7 = lib$m.AlchemyWebSocketProvider;
var lib_7$6 = lib$m.CloudflareProvider;
var lib_8$5 = lib$m.EtherscanProvider;
var lib_9$5 = lib$m.FallbackProvider;
var lib_10$3 = lib$m.IpcProvider;
var lib_11$2 = lib$m.InfuraProvider;
var lib_12$2 = lib$m.InfuraWebSocketProvider;
var lib_13$2 = lib$m.JsonRpcProvider;
var lib_14$1 = lib$m.JsonRpcSigner;
var lib_15$1 = lib$m.NodesmithProvider;
var lib_16$1 = lib$m.StaticJsonRpcProvider;
var lib_17 = lib$m.UrlJsonRpcProvider;
var lib_18 = lib$m.Web3Provider;
var lib_19 = lib$m.WebSocketProvider;
var lib_20 = lib$m.Formatter;
var lib_21 = lib$m.isCommunityResourcable;
var lib_22 = lib$m.isCommunityResource;
var lib_23 = lib$m.showThrottleMessage;
var lib_24 = lib$m.getDefaultProvider;
var lib$n = createCommonjsModule(function (module, exports) {
"use strict";
@ -25574,7 +25646,7 @@
var _version$K = createCommonjsModule(function (module, exports) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "units/5.0.5";
exports.version = "units/5.0.6";
});
@ -25651,6 +25723,9 @@
}
exports.formatUnits = formatUnits;
function parseUnits(value, unitName) {
if (typeof (value) !== "string") {
logger.throwArgumentError("value must be a string", "value", value);
}
if (typeof (unitName) === "string") {
var index = names.indexOf(unitName);
if (index !== -1) {

File diff suppressed because one or more lines are too long

@ -28,9 +28,9 @@
"@ethersproject/solidity": "5.0.5",
"@ethersproject/strings": "5.0.5",
"@ethersproject/transactions": "5.0.6",
"@ethersproject/units": "5.0.5",
"@ethersproject/units": "5.0.6",
"@ethersproject/wallet": "5.0.5",
"@ethersproject/web": "5.0.8",
"@ethersproject/web": "5.0.9",
"@ethersproject/wordlists": "5.0.5"
},
"description": "Umbrella package for most common Ethers libraries.",
@ -50,7 +50,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xf7b224d3c14b3840848c392207148a10b0eeb6a96113ca3ed0b7d5514de25b8c",
"tarballHash": "0xf1d0e8625ba6f837a4f939029dde2b9d0e288a2f51a79d36d083f60b050d6913",
"types": "./lib/index.d.ts",
"version": "5.0.17"
}

@ -1,9 +1,16 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { CommunityResourcable } from "./formatter";
import { WebSocketProvider } from "./websocket-provider";
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
export declare class AlchemyWebSocketProvider extends WebSocketProvider implements CommunityResourcable {
readonly apiKey: string;
constructor(network?: Networkish, apiKey?: any);
isCommunityResource(): boolean;
}
export declare class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network?: Networkish, apiKey?: any): WebSocketProvider;
static getWebSocketProvider(network?: Networkish, apiKey?: any): AlchemyWebSocketProvider;
static getApiKey(apiKey: any): any;
static getUrl(network: Network, apiKey: string): ConnectionInfo;
isCommunityResource(): boolean;
}

@ -1,4 +1,5 @@
"use strict";
import { defineReadOnly } from "@ethersproject/properties";
import { showThrottleMessage } from "./formatter";
import { WebSocketProvider } from "./websocket-provider";
import { Logger } from "@ethersproject/logger";
@ -10,12 +11,21 @@ import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
// production environments, that you acquire your own API key at:
// https://dashboard.alchemyapi.io
const defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
export class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
export class AlchemyWebSocketProvider extends WebSocketProvider {
constructor(network, apiKey) {
const provider = new AlchemyProvider(network, apiKey);
const url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
return new WebSocketProvider(url, provider.network);
super(url, provider.network);
defineReadOnly(this, "apiKey", provider.apiKey);
}
isCommunityResource() {
return (this.apiKey === defaultApiKey);
}
}
export class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
return new AlchemyWebSocketProvider(network, apiKey);
}
static getApiKey(apiKey) {
if (apiKey == null) {
@ -48,6 +58,7 @@ export class AlchemyProvider extends UrlJsonRpcProvider {
logger.throwArgumentError("unsupported network", "network", arguments[0]);
}
return {
allowGzip: true,
url: ("https:/" + "/" + host + apiKey),
throttleCallback: (attempt, url) => {
if (apiKey === defaultApiKey) {
@ -57,5 +68,8 @@ export class AlchemyProvider extends UrlJsonRpcProvider {
}
};
}
isCommunityResource() {
return (this.apiKey === defaultApiKey);
}
}
//# sourceMappingURL=alchemy-provider.js.map

@ -1 +1 @@
{"version":3,"file":"alchemy-provider.js","sourceRoot":"","sources":["../src.ts/alchemy-provider.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAKb,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE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MAAM;YACV,KAAK,SAAS;gBACV,IAAI,GAAG,+BAA+B,CAAC;gBACvC,MAAM;YACV,KAAK,QAAQ;gBACT,IAAI,GAAG,8BAA8B,CAAC;gBACtC,MAAM;YACV,KAAK,OAAO;gBACR,IAAI,GAAG,6BAA6B,CAAC;gBACrC,MAAM;YACV;gBACG,MAAM,CAAC,kBAAkB,CAAC,qBAAqB,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAChF;QAED,OAAO;YACH,SAAS,EAAE,IAAI;YACf,GAAG,EAAE,CAAC,SAAS,GAAG,GAAG,GAAG,IAAI,GAAG,MAAM,CAAC;YACtC,gBAAgB,EAAE,CAAC,OAAe,EAAE,GAAW,EAAE,EAAE;gBAC/C,IAAI,MAAM,KAAK,aAAa,EAAE;oBAC1B,mBAAmB,EAAE,CAAC;iBACzB;gBACD,OAAO,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;SACJ,CAAC;IACN,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;CACJ"}

@ -8,4 +8,5 @@ export declare class EtherscanProvider extends BaseProvider {
detectNetwork(): Promise<Network>;
perform(method: string, params: any): Promise<any>;
getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>>;
isCommunityResource(): boolean;
}

@ -180,7 +180,7 @@ export class EtherscanProvider extends BaseProvider {
url: url,
throttleSlotInterval: 1000,
throttleCallback: (attempt, url) => {
if (this.apiKey === defaultApiKey) {
if (this.isCommunityResource()) {
showThrottleMessage();
}
return Promise.resolve(true);
@ -396,5 +396,8 @@ export class EtherscanProvider extends BaseProvider {
});
});
}
isCommunityResource() {
return (this.apiKey === defaultApiKey);
}
}
//# sourceMappingURL=etherscan-provider.js.map

File diff suppressed because one or more lines are too long

@ -15,6 +15,7 @@ import { deepCopy, defineReadOnly, shallowCopy } from "@ethersproject/properties
import { shuffled } from "@ethersproject/random";
import { poll } from "@ethersproject/web";
import { BaseProvider } from "./base-provider";
import { isCommunityResource } from "./formatter";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
@ -354,14 +355,16 @@ export class FallbackProvider extends BaseProvider {
}
const providerConfigs = providers.map((configOrProvider, index) => {
if (Provider.isProvider(configOrProvider)) {
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: 750, priority: 1 });
const stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
const priority = 1;
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout, priority });
}
const config = shallowCopy(configOrProvider);
if (config.priority == null) {
config.priority = 1;
}
if (config.stallTimeout == null) {
config.stallTimeout = 750;
config.stallTimeout = isCommunityResource(configOrProvider) ? 2000 : 750;
}
if (config.weight == null) {
config.weight = 1;

File diff suppressed because one or more lines are too long

@ -48,4 +48,9 @@ export declare class Formatter {
static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc;
static arrayOf(format: FormatFunc): FormatFunc;
}
export interface CommunityResourcable {
isCommunityResource(): boolean;
}
export declare function isCommunityResourcable(value: any): value is CommunityResourcable;
export declare function isCommunityResource(value: any): boolean;
export declare function showThrottleMessage(): void;

@ -380,6 +380,12 @@ export class Formatter {
});
}
}
export function isCommunityResourcable(value) {
return (value && typeof (value.isCommunityResource) === "function");
}
export function isCommunityResource(value) {
return (isCommunityResourcable(value) && value.isCommunityResource());
}
// Show the throttle message only once
let throttleMessage = false;
export function showThrottleMessage() {

File diff suppressed because one or more lines are too long

@ -2,18 +2,18 @@ import { Block, BlockTag, EventType, Filter, Log, Listener, Provider, Transactio
import { getNetwork } from "@ethersproject/networks";
import { Network, Networkish } from "@ethersproject/networks";
import { BaseProvider, EnsProvider, EnsResolver, Resolver } from "./base-provider";
import { AlchemyProvider } from "./alchemy-provider";
import { AlchemyProvider, AlchemyWebSocketProvider } from "./alchemy-provider";
import { CloudflareProvider } from "./cloudflare-provider";
import { EtherscanProvider } from "./etherscan-provider";
import { FallbackProvider } from "./fallback-provider";
import { IpcProvider } from "./ipc-provider";
import { InfuraProvider } from "./infura-provider";
import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
import { NodesmithProvider } from "./nodesmith-provider";
import { StaticJsonRpcProvider, UrlJsonRpcProvider } from "./url-json-rpc-provider";
import { Web3Provider } from "./web3-provider";
import { WebSocketProvider } from "./websocket-provider";
import { ExternalProvider, JsonRpcFetchFunc } from "./web3-provider";
import { Formatter } from "./formatter";
import { CommunityResourcable, Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from "./formatter";
declare function getDefaultProvider(network?: Network | string, options?: any): BaseProvider;
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver };
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable };

@ -2,18 +2,18 @@
import { Provider } from "@ethersproject/abstract-provider";
import { getNetwork } from "@ethersproject/networks";
import { BaseProvider, Resolver } from "./base-provider";
import { AlchemyProvider } from "./alchemy-provider";
import { AlchemyProvider, AlchemyWebSocketProvider } from "./alchemy-provider";
import { CloudflareProvider } from "./cloudflare-provider";
import { EtherscanProvider } from "./etherscan-provider";
import { FallbackProvider } from "./fallback-provider";
import { IpcProvider } from "./ipc-provider";
import { InfuraProvider } from "./infura-provider";
import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
import { NodesmithProvider } from "./nodesmith-provider";
import { StaticJsonRpcProvider, UrlJsonRpcProvider } from "./url-json-rpc-provider";
import { Web3Provider } from "./web3-provider";
import { WebSocketProvider } from "./websocket-provider";
import { Formatter } from "./formatter";
import { Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from "./formatter";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
@ -65,13 +65,13 @@ export {
Provider, BaseProvider, Resolver, UrlJsonRpcProvider,
///////////////////////
// Concreate Providers
FallbackProvider, AlchemyProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider,
FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider,
///////////////////////
// Signer
JsonRpcSigner,
///////////////////////
// Functions
getDefaultProvider, getNetwork,
getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage,
///////////////////////
// Objects
Formatter };

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,EAOH,QAAQ,EAIX,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAA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EACZ,iBAAiB,EAEjB,WAAW;AAGX,uBAAuB;AACvB,SAAS;AAET,aAAa;AAGb,uBAAuB;AACvB,YAAY;AAEZ,kBAAkB,EAClB,UAAU,EACV,mBAAmB,EACnB,sBAAsB,EACtB,mBAAmB;AAGnB,uBAAuB;AACvB,UAAU;AAEV,SAAS,EA0BZ,CAAC"}

@ -1,11 +1,20 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { WebSocketProvider } from "./websocket-provider";
import { CommunityResourcable } from "./formatter";
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable {
readonly apiKey: string;
readonly projectId: string;
readonly projectSecret: string;
constructor(network?: Networkish, apiKey?: any);
isCommunityResource(): boolean;
}
export declare class InfuraProvider extends UrlJsonRpcProvider {
readonly projectId: string;
readonly projectSecret: string;
static getWebSocketProvider(network?: Networkish, apiKey?: any): WebSocketProvider;
static getWebSocketProvider(network?: Networkish, apiKey?: any): InfuraWebSocketProvider;
static getApiKey(apiKey: any): any;
static getUrl(network: Network, apiKey: any): ConnectionInfo;
isCommunityResource(): boolean;
}

@ -1,4 +1,5 @@
"use strict";
import { defineReadOnly } from "@ethersproject/properties";
import { WebSocketProvider } from "./websocket-provider";
import { showThrottleMessage } from "./formatter";
import { Logger } from "@ethersproject/logger";
@ -6,8 +7,8 @@ import { version } from "./_version";
const logger = new Logger(version);
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
const defaultProjectId = "84842078b09946638c03157f83405213";
export class InfuraProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
export class InfuraWebSocketProvider extends WebSocketProvider {
constructor(network, apiKey) {
const provider = new InfuraProvider(network, apiKey);
const connection = provider.connection;
if (connection.password) {
@ -16,7 +17,18 @@ export class InfuraProvider extends UrlJsonRpcProvider {
});
}
const url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
return new WebSocketProvider(url, network);
super(url, network);
defineReadOnly(this, "apiKey", provider.projectId);
defineReadOnly(this, "projectId", provider.projectId);
defineReadOnly(this, "projectSecret", provider.projectSecret);
}
isCommunityResource() {
return (this.projectId === defaultProjectId);
}
}
export class InfuraProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network, apiKey) {
return new InfuraWebSocketProvider(network, apiKey);
}
static getApiKey(apiKey) {
const apiKeyObj = {
@ -67,6 +79,7 @@ export class InfuraProvider extends UrlJsonRpcProvider {
});
}
const connection = {
allowGzip: true,
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: (attempt, url) => {
if (apiKey.projectId === defaultProjectId) {
@ -81,5 +94,8 @@ export class InfuraProvider extends UrlJsonRpcProvider {
}
return connection;
}
isCommunityResource() {
return (this.projectId === defaultProjectId);
}
}
//# sourceMappingURL=infura-provider.js.map

@ -1 +1 @@
{"version":3,"file":"infura-provider.js","sourceRoot":"","sources":["../src.ts/infura-provider.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAKb,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAG7D,MAAM,gBAAgB,GAAG,kCAAkC,CAAA;AAE3D,MAAM,OAAO,cAAe,SAAQ,kBAAkB;IAIlD,MAAM,CAAC,oBAAoB,CAAC,OAAoB,EAAE,MAAY;QAC1D,MAAM,QAAQ,GAAG,IAAI,cAAc,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;QACrD,MAAM,UAAU,GAAG,QAAQ,CAAC,UAAU,CAAC;QACvC,IAAI,UAAU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C;YACrB,UAAU,CAAC,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAA;SAC7C;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,mBAAmB;QACf,OAAO,CAAC,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC,CAAC;IACjD,CAAC;CACJ"}

@ -1,13 +1,15 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { CommunityResourcable } from "./formatter";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
export declare class StaticJsonRpcProvider extends JsonRpcProvider {
detectNetwork(): Promise<Network>;
}
export declare abstract class UrlJsonRpcProvider extends StaticJsonRpcProvider {
export declare abstract class UrlJsonRpcProvider extends StaticJsonRpcProvider implements CommunityResourcable {
readonly apiKey: any;
constructor(network?: Networkish, apiKey?: any);
_startPending(): void;
isCommunityResource(): boolean;
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
static getApiKey(apiKey: any): any;

@ -67,6 +67,9 @@ export class UrlJsonRpcProvider extends StaticJsonRpcProvider {
_startPending() {
logger.warn("WARNING: API provider does not support pending filters");
}
isCommunityResource() {
return false;
}
getSigner(address) {
return logger.throwError("API provider does not support signing", Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" });
}

@ -1 +1 @@
{"version":3,"file":"url-json-rpc-provider.js","sourceRoot":"","sources":["../src.ts/url-json-rpc-provider.ts"],"names":[],"mappings":"AACA,YAAY,CAAC;;;;;;;;;;AAGb,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAGtE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC,OAAO,EAAE,eAAe,EAAiB,MAAM,qBAAqB,CAAC;AAIrE,qEAAqE;AACrE,k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AAC,UAAU,CAAC,mDAAmD,EAAE,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE;YACzG,SAAS,EAAE,QAAQ;SACtB,CAAC,CAAC;IACP,CAAC;CACJ"}

@ -1,9 +1,16 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { CommunityResourcable } from "./formatter";
import { WebSocketProvider } from "./websocket-provider";
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
export declare class AlchemyWebSocketProvider extends WebSocketProvider implements CommunityResourcable {
readonly apiKey: string;
constructor(network?: Networkish, apiKey?: any);
isCommunityResource(): boolean;
}
export declare class AlchemyProvider extends UrlJsonRpcProvider {
static getWebSocketProvider(network?: Networkish, apiKey?: any): WebSocketProvider;
static getWebSocketProvider(network?: Networkish, apiKey?: any): AlchemyWebSocketProvider;
static getApiKey(apiKey: any): any;
static getUrl(network: Network, apiKey: string): ConnectionInfo;
isCommunityResource(): boolean;
}

@ -13,6 +13,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var properties_1 = require("@ethersproject/properties");
var formatter_1 = require("./formatter");
var websocket_provider_1 = require("./websocket-provider");
var logger_1 = require("@ethersproject/logger");
@ -24,16 +25,30 @@ var url_json_rpc_provider_1 = require("./url-json-rpc-provider");
// production environments, that you acquire your own API key at:
// https://dashboard.alchemyapi.io
var defaultApiKey = "_gg7wSSi0KMBsdKnGVfHDueq6xMB9EkC";
var AlchemyWebSocketProvider = /** @class */ (function (_super) {
__extends(AlchemyWebSocketProvider, _super);
function AlchemyWebSocketProvider(network, apiKey) {
var _this = this;
var provider = new AlchemyProvider(network, apiKey);
var url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
_this = _super.call(this, url, provider.network) || this;
properties_1.defineReadOnly(_this, "apiKey", provider.apiKey);
return _this;
}
AlchemyWebSocketProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return AlchemyWebSocketProvider;
}(websocket_provider_1.WebSocketProvider));
exports.AlchemyWebSocketProvider = AlchemyWebSocketProvider;
var AlchemyProvider = /** @class */ (function (_super) {
__extends(AlchemyProvider, _super);
function AlchemyProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
AlchemyProvider.getWebSocketProvider = function (network, apiKey) {
var provider = new AlchemyProvider(network, apiKey);
var url = provider.connection.url.replace(/^http/i, "ws")
.replace(".alchemyapi.", ".ws.alchemyapi.");
return new websocket_provider_1.WebSocketProvider(url, provider.network);
return new AlchemyWebSocketProvider(network, apiKey);
};
AlchemyProvider.getApiKey = function (apiKey) {
if (apiKey == null) {
@ -66,6 +81,7 @@ var AlchemyProvider = /** @class */ (function (_super) {
logger.throwArgumentError("unsupported network", "network", arguments[0]);
}
return {
allowGzip: true,
url: ("https:/" + "/" + host + apiKey),
throttleCallback: function (attempt, url) {
if (apiKey === defaultApiKey) {
@ -75,6 +91,9 @@ var AlchemyProvider = /** @class */ (function (_super) {
}
};
};
AlchemyProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return AlchemyProvider;
}(url_json_rpc_provider_1.UrlJsonRpcProvider));
exports.AlchemyProvider = AlchemyProvider;

@ -1 +1 @@
{"version":3,"file":"alchemy-provider.js","sourceRoot":"","sources":["../src.ts/alchemy-provider.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;AAKb,yCAAkD;AAClD,2DAAyD;AAEzD,gDAA+C;AAC/C,uCAAqC;AACrC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAEnC,iEAA6D;AAE7D,kEAAkE;AAClE,4DAA4D;AAC5D,iEAAiE;AACjE,oCAAoC;AAEpC,IAAM,aAAa,GAAG,kCAAkC,CAAA;AAExD;IAAqC,mCAAkB;IAAvD;;IAmDA,CAAC;IAjDU,oCAAoB,GAA3B,UAA4B,OAAoB,EAAE,MAAY;QAC1D,IAAM,QAAQ,GAA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CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YACjC,CAAC;SACJ,CAAC;IACN,CAAC;IAED,6CAAmB,GAAnB;QACI,OAAO,CAAC,IAAI,CAAC,MAAM,KAAK,aAAa,CAAC,CAAC;IAC3C,CAAC;IACL,sBAAC;AAAD,CAAC,AAnDD,CAAqC,0CAAkB,GAmDtD;AAnDY,0CAAe"}

@ -8,4 +8,5 @@ export declare class EtherscanProvider extends BaseProvider {
detectNetwork(): Promise<Network>;
perform(method: string, params: any): Promise<any>;
getHistory(addressOrName: string | Promise<string>, startBlock?: BlockTag, endBlock?: BlockTag): Promise<Array<TransactionResponse>>;
isCommunityResource(): boolean;
}

@ -234,7 +234,7 @@ var EtherscanProvider = /** @class */ (function (_super) {
url: url,
throttleSlotInterval: 1000,
throttleCallback: function (attempt, url) {
if (_this.apiKey === defaultApiKey) {
if (_this.isCommunityResource()) {
formatter_1.showThrottleMessage();
}
return Promise.resolve(true);
@ -484,6 +484,9 @@ var EtherscanProvider = /** @class */ (function (_super) {
});
});
};
EtherscanProvider.prototype.isCommunityResource = function () {
return (this.apiKey === defaultApiKey);
};
return EtherscanProvider;
}(base_provider_1.BaseProvider));
exports.EtherscanProvider = EtherscanProvider;

File diff suppressed because one or more lines are too long

@ -56,6 +56,7 @@ var properties_1 = require("@ethersproject/properties");
var random_1 = require("@ethersproject/random");
var web_1 = require("@ethersproject/web");
var base_provider_1 = require("./base-provider");
var formatter_1 = require("./formatter");
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);
@ -424,14 +425,16 @@ var FallbackProvider = /** @class */ (function (_super) {
}
var providerConfigs = providers.map(function (configOrProvider, index) {
if (abstract_provider_1.Provider.isProvider(configOrProvider)) {
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: 750, priority: 1 });
var stallTimeout = formatter_1.isCommunityResource(configOrProvider) ? 2000 : 750;
var priority = 1;
return Object.freeze({ provider: configOrProvider, weight: 1, stallTimeout: stallTimeout, priority: priority });
}
var config = properties_1.shallowCopy(configOrProvider);
if (config.priority == null) {
config.priority = 1;
}
if (config.stallTimeout == null) {
config.stallTimeout = 750;
config.stallTimeout = formatter_1.isCommunityResource(configOrProvider) ? 2000 : 750;
}
if (config.weight == null) {
config.weight = 1;

File diff suppressed because one or more lines are too long

@ -48,4 +48,9 @@ export declare class Formatter {
static allowFalsish(format: FormatFunc, replaceValue: any): FormatFunc;
static arrayOf(format: FormatFunc): FormatFunc;
}
export interface CommunityResourcable {
isCommunityResource(): boolean;
}
export declare function isCommunityResourcable(value: any): value is CommunityResourcable;
export declare function isCommunityResource(value: any): boolean;
export declare function showThrottleMessage(): void;

@ -386,6 +386,14 @@ var Formatter = /** @class */ (function () {
return Formatter;
}());
exports.Formatter = Formatter;
function isCommunityResourcable(value) {
return (value && typeof (value.isCommunityResource) === "function");
}
exports.isCommunityResourcable = isCommunityResourcable;
function isCommunityResource(value) {
return (isCommunityResourcable(value) && value.isCommunityResource());
}
exports.isCommunityResource = isCommunityResource;
// Show the throttle message only once
var throttleMessage = false;
function showThrottleMessage() {

File diff suppressed because one or more lines are too long

@ -2,18 +2,18 @@ import { Block, BlockTag, EventType, Filter, Log, Listener, Provider, Transactio
import { getNetwork } from "@ethersproject/networks";
import { Network, Networkish } from "@ethersproject/networks";
import { BaseProvider, EnsProvider, EnsResolver, Resolver } from "./base-provider";
import { AlchemyProvider } from "./alchemy-provider";
import { AlchemyProvider, AlchemyWebSocketProvider } from "./alchemy-provider";
import { CloudflareProvider } from "./cloudflare-provider";
import { EtherscanProvider } from "./etherscan-provider";
import { FallbackProvider } from "./fallback-provider";
import { IpcProvider } from "./ipc-provider";
import { InfuraProvider } from "./infura-provider";
import { InfuraProvider, InfuraWebSocketProvider } from "./infura-provider";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
import { NodesmithProvider } from "./nodesmith-provider";
import { StaticJsonRpcProvider, UrlJsonRpcProvider } from "./url-json-rpc-provider";
import { Web3Provider } from "./web3-provider";
import { WebSocketProvider } from "./websocket-provider";
import { ExternalProvider, JsonRpcFetchFunc } from "./web3-provider";
import { Formatter } from "./formatter";
import { CommunityResourcable, Formatter, isCommunityResourcable, isCommunityResource, showThrottleMessage } from "./formatter";
declare function getDefaultProvider(network?: Network | string, options?: any): BaseProvider;
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver };
export { Provider, BaseProvider, Resolver, UrlJsonRpcProvider, FallbackProvider, AlchemyProvider, AlchemyWebSocketProvider, CloudflareProvider, EtherscanProvider, InfuraProvider, InfuraWebSocketProvider, JsonRpcProvider, NodesmithProvider, StaticJsonRpcProvider, Web3Provider, WebSocketProvider, IpcProvider, JsonRpcSigner, getDefaultProvider, getNetwork, isCommunityResource, isCommunityResourcable, showThrottleMessage, Formatter, Block, BlockTag, EventType, Filter, Log, Listener, TransactionReceipt, TransactionRequest, TransactionResponse, ExternalProvider, JsonRpcFetchFunc, Network, Networkish, EnsProvider, EnsResolver, CommunityResourcable };

@ -9,6 +9,7 @@ exports.BaseProvider = base_provider_1.BaseProvider;
exports.Resolver = base_provider_1.Resolver;
var alchemy_provider_1 = require("./alchemy-provider");
exports.AlchemyProvider = alchemy_provider_1.AlchemyProvider;
exports.AlchemyWebSocketProvider = alchemy_provider_1.AlchemyWebSocketProvider;
var cloudflare_provider_1 = require("./cloudflare-provider");
exports.CloudflareProvider = cloudflare_provider_1.CloudflareProvider;
var etherscan_provider_1 = require("./etherscan-provider");
@ -19,6 +20,7 @@ var ipc_provider_1 = require("./ipc-provider");
exports.IpcProvider = ipc_provider_1.IpcProvider;
var infura_provider_1 = require("./infura-provider");
exports.InfuraProvider = infura_provider_1.InfuraProvider;
exports.InfuraWebSocketProvider = infura_provider_1.InfuraWebSocketProvider;
var json_rpc_provider_1 = require("./json-rpc-provider");
exports.JsonRpcProvider = json_rpc_provider_1.JsonRpcProvider;
exports.JsonRpcSigner = json_rpc_provider_1.JsonRpcSigner;
@ -33,6 +35,9 @@ var websocket_provider_1 = require("./websocket-provider");
exports.WebSocketProvider = websocket_provider_1.WebSocketProvider;
var formatter_1 = require("./formatter");
exports.Formatter = formatter_1.Formatter;
exports.isCommunityResourcable = formatter_1.isCommunityResourcable;
exports.isCommunityResource = formatter_1.isCommunityResource;
exports.showThrottleMessage = formatter_1.showThrottleMessage;
var logger_1 = require("@ethersproject/logger");
var _version_1 = require("./_version");
var logger = new logger_1.Logger(_version_1.version);

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,sEAW0C;AA+EtC,mBAnFA,4BAAQ,CAmFA;AA7EZ,oDAAqD;AAgHjD,qBAhHK,qBAAU,CAgHL;AA7Gd,iDAAmF;AA2E/E,uBA3EK,4BAAY,CA2EL;AAEZ,mBA7E6C,wBAAQ,CA6E7C;AA3EZ,uDAAqD;AAoFjD,0BApFK,kCAAe,CAoFL;AAnFnB,6DAA2D;AAoFvD,6BApFK,wCAAkB,CAoFL;AAnFtB,2DAAyD;AAoFrD,4BApFK,sCAAiB,CAoFL;AAnFrB,yDAAuD;AA+EnD,2BA/EK,oCAAgB,CA+EL;AA9EpB,+CAA6C;AA0FzC,sBA1FK,0BAAW,CA0FL;AAzFf,qDAAmD;AAkF/C,yBAlFK,gCAAc,CAkFL;AAjFlB,yDAAqE;AAkFjE,0BAlFK,mCAAe,CAkFL;AAYf,wBA9FsB,iCAAa,CA8FtB;AA7FjB,2DAAyD;AAkFrD,4BAlFK,sCAAiB,CAkFL;AAjFrB,iEAAo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,iBAAiB,wCAAA;QACjB,YAAY,8BAAA;QAEZ,WAAW,4BAAA;KACd,EAAE,OAAO,CAAC,CAAC;AAChB,CAAC;AA4CG,gDAAkB"}

@ -1,11 +1,20 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { WebSocketProvider } from "./websocket-provider";
import { CommunityResourcable } from "./formatter";
import { UrlJsonRpcProvider } from "./url-json-rpc-provider";
export declare class InfuraWebSocketProvider extends WebSocketProvider implements CommunityResourcable {
readonly apiKey: string;
readonly projectId: string;
readonly projectSecret: string;
constructor(network?: Networkish, apiKey?: any);
isCommunityResource(): boolean;
}
export declare class InfuraProvider extends UrlJsonRpcProvider {
readonly projectId: string;
readonly projectSecret: string;
static getWebSocketProvider(network?: Networkish, apiKey?: any): WebSocketProvider;
static getWebSocketProvider(network?: Networkish, apiKey?: any): InfuraWebSocketProvider;
static getApiKey(apiKey: any): any;
static getUrl(network: Network, apiKey: any): ConnectionInfo;
isCommunityResource(): boolean;
}

@ -13,6 +13,7 @@ var __extends = (this && this.__extends) || (function () {
};
})();
Object.defineProperty(exports, "__esModule", { value: true });
var properties_1 = require("@ethersproject/properties");
var websocket_provider_1 = require("./websocket-provider");
var formatter_1 = require("./formatter");
var logger_1 = require("@ethersproject/logger");
@ -20,12 +21,10 @@ 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) {
__extends(InfuraProvider, _super);
function InfuraProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
InfuraProvider.getWebSocketProvider = function (network, apiKey) {
var InfuraWebSocketProvider = /** @class */ (function (_super) {
__extends(InfuraWebSocketProvider, _super);
function InfuraWebSocketProvider(network, apiKey) {
var _this = this;
var provider = new InfuraProvider(network, apiKey);
var connection = provider.connection;
if (connection.password) {
@ -34,7 +33,25 @@ var InfuraProvider = /** @class */ (function (_super) {
});
}
var url = connection.url.replace(/^http/i, "ws").replace("/v3/", "/ws/v3/");
return new websocket_provider_1.WebSocketProvider(url, network);
_this = _super.call(this, url, network) || this;
properties_1.defineReadOnly(_this, "apiKey", provider.projectId);
properties_1.defineReadOnly(_this, "projectId", provider.projectId);
properties_1.defineReadOnly(_this, "projectSecret", provider.projectSecret);
return _this;
}
InfuraWebSocketProvider.prototype.isCommunityResource = function () {
return (this.projectId === defaultProjectId);
};
return InfuraWebSocketProvider;
}(websocket_provider_1.WebSocketProvider));
exports.InfuraWebSocketProvider = InfuraWebSocketProvider;
var InfuraProvider = /** @class */ (function (_super) {
__extends(InfuraProvider, _super);
function InfuraProvider() {
return _super !== null && _super.apply(this, arguments) || this;
}
InfuraProvider.getWebSocketProvider = function (network, apiKey) {
return new InfuraWebSocketProvider(network, apiKey);
};
InfuraProvider.getApiKey = function (apiKey) {
var apiKeyObj = {
@ -85,6 +102,7 @@ var InfuraProvider = /** @class */ (function (_super) {
});
}
var connection = {
allowGzip: true,
url: ("https:/" + "/" + host + "/v3/" + apiKey.projectId),
throttleCallback: function (attempt, url) {
if (apiKey.projectId === defaultProjectId) {
@ -99,6 +117,9 @@ var InfuraProvider = /** @class */ (function (_super) {
}
return connection;
};
InfuraProvider.prototype.isCommunityResource = function () {
return (this.projectId === defaultProjectId);
};
return InfuraProvider;
}(url_json_rpc_provider_1.UrlJsonRpcProvider));
exports.InfuraProvider = InfuraProvider;

@ -1 +1 @@
{"version":3,"file":"infura-provider.js","sourceRoot":"","sources":["../src.ts/infura-provider.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;AAKb,2DAAyD;AACzD,yCAAkD;AAElD,gDAA+C;AAC/C,uCAAqC;AACrC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAEnC,iEAA6D;AAG7D,IAAM,gBAAgB,GAAG,kCAAkC,CAAA;AAE3D;IAAoC,kCAAkB;IAAtD;;IAy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;SACJ,CAAC;QAEF,IAAI,MAAM,CAAC,aAAa,IAAI,IAAI,EAAE;YAC9B,UAAU,CAAC,IAAI,GAAG,EAAE,CAAC;YACrB,UAAU,CAAC,QAAQ,GAAG,MAAM,CAAC,aAAa,CAAA;SAC7C;QAED,OAAO,UAAU,CAAC;IACtB,CAAC;IAED,4CAAmB,GAAnB;QACI,OAAO,CAAC,IAAI,CAAC,SAAS,KAAK,gBAAgB,CAAC,CAAC;IACjD,CAAC;IACL,qBAAC;AAAD,CAAC,AArFD,CAAoC,0CAAkB,GAqFrD;AArFY,wCAAc"}

@ -1,13 +1,15 @@
import { Network, Networkish } from "@ethersproject/networks";
import { ConnectionInfo } from "@ethersproject/web";
import { CommunityResourcable } from "./formatter";
import { JsonRpcProvider, JsonRpcSigner } from "./json-rpc-provider";
export declare class StaticJsonRpcProvider extends JsonRpcProvider {
detectNetwork(): Promise<Network>;
}
export declare abstract class UrlJsonRpcProvider extends StaticJsonRpcProvider {
export declare abstract class UrlJsonRpcProvider extends StaticJsonRpcProvider implements CommunityResourcable {
readonly apiKey: any;
constructor(network?: Networkish, apiKey?: any);
_startPending(): void;
isCommunityResource(): boolean;
getSigner(address?: string): JsonRpcSigner;
listAccounts(): Promise<Array<string>>;
static getApiKey(apiKey: any): any;

@ -123,6 +123,9 @@ var UrlJsonRpcProvider = /** @class */ (function (_super) {
UrlJsonRpcProvider.prototype._startPending = function () {
logger.warn("WARNING: API provider does not support pending filters");
};
UrlJsonRpcProvider.prototype.isCommunityResource = function () {
return false;
};
UrlJsonRpcProvider.prototype.getSigner = function (address) {
return logger.throwError("API provider does not support signing", logger_1.Logger.errors.UNSUPPORTED_OPERATION, { operation: "getSigner" });
};

@ -1 +1 @@
{"version":3,"file":"url-json-rpc-provider.js","sourceRoot":"","sources":["../src.ts/url-json-rpc-provider.ts"],"names":[],"mappings":"AACA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGb,wD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OAAO,MAAM,CAAC;IAClB,CAAC;IAED,uEAAuE;IACvE,6EAA6E;IAC7E,wCAAwC;IACjC,yBAAM,GAAb,UAAc,OAAgB,EAAE,MAAW;QACvC,OAAO,MAAM,CAAC,UAAU,CAAC,mDAAmD,EAAE,eAAM,CAAC,MAAM,CAAC,eAAe,EAAE;YACzG,SAAS,EAAE,QAAQ;SACtB,CAAC,CAAC;IACP,CAAC;IACL,yBAAC;AAAD,CAAC,AAxDD,CAAiD,qBAAqB,GAwDrE;AAxDqB,gDAAkB"}

@ -56,7 +56,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xb282975f635594acf49430e2e41a632100d5956784217619eea54997f9791763",
"tarballHash": "0x473ceddb28dd396cfb35fc43187f2a09c4e752e908b80a933432bcb5ad5eae85",
"types": "./lib/index.d.ts",
"version": "5.0.12"
}

@ -1 +1 @@
export declare const version = "units/5.0.5";
export declare const version = "units/5.0.6";

@ -1,2 +1,2 @@
export const version = "units/5.0.5";
export const version = "units/5.0.6";
//# sourceMappingURL=_version.js.map

@ -64,6 +64,9 @@ export function formatUnits(value, unitName) {
return formatFixed(value, (unitName != null) ? unitName : 18);
}
export function parseUnits(value, unitName) {
if (typeof (value) !== "string") {
logger.throwArgumentError("value must be a string", "value", value);
}
if (typeof (unitName) === "string") {
const index = names.indexOf(unitName);
if (index !== -1) {

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAGb,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AACrC,MAAM,MAAM,GAAG,IAAI,MAAM,CAAC,OAAO,CAAC,CAAC;AAEnC,MAAM,KAAK,GAAG;IACV,KAAK;IACL,MAAM;IACN,MAAM;IACN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AAU,CAAC,KAAK,EAAE,CAAC,QAAQ,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAA,CAAC,CAAC,EAAE,CAAC,CAAC;AAChE,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,GAAiB;IACzC,OAAO,WAAW,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;AAChC,CAAC;AAED,MAAM,UAAU,UAAU,CAAC,KAAa;IACpC,OAAO,UAAU,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AACjC,CAAC"}

@ -1 +1 @@
export declare const version = "units/5.0.5";
export declare const version = "units/5.0.6";

@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "units/5.0.5";
exports.version = "units/5.0.6";
//# sourceMappingURL=_version.js.map

@ -67,6 +67,9 @@ function formatUnits(value, unitName) {
}
exports.formatUnits = formatUnits;
function parseUnits(value, unitName) {
if (typeof (value) !== "string") {
logger.throwArgumentError("value must be a string", "value", value);
}
if (typeof (unitName) === "string") {
var index = names.indexOf(unitName);
if (index !== -1) {

@ -1 +1 @@
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src.ts/index.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,sDAAmE;AAEnE,gDAA+C;AAC/C,uCAAqC;AACrC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAEnC,IAAM,KAAK,GAAG;IACV,KAAK;IACL,MAAM;IACN,MAAM;IACN,MAAM;IACN,OAAO;IACP,QAAQ;IACR,OAAO;CACV,CAAC;AAGF,oFAAoF;AACpF,YAAY;AACZ,SAAgB,OAAO,CAAC,KAAsB;IAC1C,IAAM,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAEvC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,YAAY,C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C"}

@ -27,7 +27,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0xce64e78086f460a418bde7c4d75c6b9a5dc145e6540110aca7b3410cec6b4875",
"tarballHash": "0xc3a7f3afe0b5e162e36bb100dd05933de763fc0772581103a6b59e3d2c487c9c",
"types": "./lib/index.d.ts",
"version": "5.0.5"
"version": "5.0.6"
}

@ -1 +1 @@
export const version = "units/5.0.5";
export const version = "units/5.0.6";

@ -1 +1 @@
export declare const version = "web/5.0.8";
export declare const version = "web/5.0.9";

@ -1,2 +1,2 @@
export const version = "web/5.0.8";
export const version = "web/5.0.9";
//# sourceMappingURL=_version.js.map

@ -10,8 +10,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
};
import http from "http";
import https from "https";
import { gunzipSync } from "zlib";
import { parse } from "url";
import { concat } from "@ethersproject/bytes";
import { arrayify, concat } from "@ethersproject/bytes";
import { shallowCopy } from "@ethersproject/properties";
import { Logger } from "@ethersproject/logger";
import { version } from "./_version";
const logger = new Logger(version);
@ -39,6 +41,11 @@ function getResponse(request) {
response.body = concat([response.body, chunk]);
});
resp.on("end", () => {
if (response.headers["content-encoding"] === "gzip") {
//const size = response.body.length;
response.body = arrayify(gunzipSync(response.body));
//console.log("Delta:", response.body.length - size, Buffer.from(response.body).toString());
}
resolve(response);
});
resp.on("error", (error) => {
@ -72,8 +79,11 @@ export function getUrl(href, options) {
port: nonnull(url.port),
path: (nonnull(url.pathname) + nonnull(url.search)),
method: (options.method || "GET"),
headers: (options.headers || {}),
headers: shallowCopy(options.headers || {}),
};
if (options.allowGzip) {
request.headers["accept-encoding"] = "gzip";
}
let req = null;
switch (nonnull(url.protocol)) {
case "http:":

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../src.ts/geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,KAAK,MAAM,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 +6,7 @@ export declare type ConnectionInfo = {
user?: string;
password?: string;
allowInsecureAuthentication?: boolean;
allowGzip?: boolean;
throttleLimit?: number;
throttleSlotInterval?: number;
throttleCallback?: (attempt: number, url: string) => Promise<boolean>;

@ -80,6 +80,7 @@ export function _fetchData(connection, body, processFunc) {
}
}
}
options.allowGzip = !!connection.allowGzip;
if (connection.user != null && connection.password != null) {
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
logger.throwError("basic authentication requires a secure https url", Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" });

File diff suppressed because one or more lines are too long

@ -8,6 +8,7 @@ export declare type GetUrlResponse = {
};
export declare type Options = {
method?: string;
allowGzip?: boolean;
body?: Uint8Array;
headers?: {
[key: string]: string;

@ -1 +1 @@
export declare const version = "web/5.0.8";
export declare const version = "web/5.0.9";

@ -1,4 +1,4 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = "web/5.0.8";
exports.version = "web/5.0.9";
//# sourceMappingURL=_version.js.map

@ -41,8 +41,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
Object.defineProperty(exports, "__esModule", { value: true });
var http_1 = __importDefault(require("http"));
var https_1 = __importDefault(require("https"));
var zlib_1 = require("zlib");
var url_1 = require("url");
var bytes_1 = require("@ethersproject/bytes");
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);
@ -70,6 +72,11 @@ function getResponse(request) {
response.body = bytes_1.concat([response.body, chunk]);
});
resp.on("end", function () {
if (response.headers["content-encoding"] === "gzip") {
//const size = response.body.length;
response.body = bytes_1.arrayify(zlib_1.gunzipSync(response.body));
//console.log("Delta:", response.body.length - size, Buffer.from(response.body).toString());
}
resolve(response);
});
resp.on("error", function (error) {
@ -104,8 +111,11 @@ function getUrl(href, options) {
port: nonnull(url.port),
path: (nonnull(url.pathname) + nonnull(url.search)),
method: (options.method || "GET"),
headers: (options.headers || {}),
headers: properties_1.shallowCopy(options.headers || {}),
};
if (options.allowGzip) {
request.headers["accept-encoding"] = "gzip";
}
req = null;
switch (nonnull(url.protocol)) {
case "http:":

@ -1 +1 @@
{"version":3,"file":"geturl.js","sourceRoot":"","sources":["../src.ts/geturl.ts"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,8CAAwB;AACxB,gDAA0B;AAC1B,2BAA2B;AAE3B,8CAA8C;AAI9C,gDAA+C;AAC/C,uCAAqC;AACrC,IAAM,MAAM,GAAG,IAAI,eAAM,CAAC,kBAAO,CAAC,CAAC;AAInC,SAAS,WAAW,CAAC,OAA2B;IAC5C,OAAO,IAAI,OAAO,CAAC,UAAC,OAAO,EAAE,MAAM;QAC/B,OAAO,CAAC,IAAI,CAAC,UAAU,EAAE,UAAC,IAA0B;YAChD,IAAM,QAAQ,GAAmB;gBAC7B,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM,CAAC,UAAC,KAAK,EAAE,IAAI;oBAClD,IAAI,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBAC/B,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;wBACtB,KAAK,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;qBAC5B;oBACD,KAAK,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;oBACpB,OAAO,KAAK,CAAC;gBACjB,CAAC,EAAgC,EAAG,CAAC;gBACrC,IAAI,EAAE,IAAI;aACb,CAAC;YACF,2BAA2B;YAE3B,IAAI,CAAC,EAAE,CAAC,MAAM,EAAE,UAAC,KAAiB;gBAC9B,IAAI,QAAQ,CAAC,IAAI,IAAI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OAAO,CAAC,OAAO,IAAI,EAAG,CAAC;qBAC/C,CAAC;oBAEF,IAAI,OAAO,CAAC,SAAS,EAAE;wBACnB,OAAO,CAAC,OAAO,CAAC,iBAAiB,CAAC,GAAG,MAAM,CAAC;qBAC/C;oBAEG,GAAG,GAAuB,IAAI,CAAC;oBACnC,QAAQ,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;wBAC3B,KAAK,OAAO;4BACR,GAAG,GAAG,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;4BAC5B,MAAM;wBACV,KAAK,QAAQ;4BACT,GAAG,GAAG,eAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;4BAC7B,MAAM;wBACV;4BACI,0BAA0B;4BAC1B,MAAM,CAAC,UAAU,CAAC,0BAAyB,GAAG,CAAC,QAAW,EAAE,eAAM,CAAC,MAAM,CAAC,qBAAqB,EAAE;gCAC7F,QAAQ,EAAE,GAAG,CAAC,QAAQ;gCACtB,SAAS,EAAE,SAAS;6BACvB,CAAC,CAAC;qBACV;oBAED,IAAI,OAAO,CAAC,IAAI,EAAE;wBACd,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;qBACxC;oBACD,GAAG,CAAC,GAAG,EAAE,CAAC;oBAEO,qBAAM,WAAW,CAAC,GAAG,CAAC,EAAA;;oBAAjC,QAAQ,GAAG,SAAsB;oBACvC,sBAAO,QAAQ,EAAC;;;;CACnB;AA7CD,wBA6CC"}

@ -6,6 +6,7 @@ export declare type ConnectionInfo = {
user?: string;
password?: string;
allowInsecureAuthentication?: boolean;
allowGzip?: boolean;
throttleLimit?: number;
throttleSlotInterval?: number;
throttleCallback?: (attempt: number, url: string) => Promise<boolean>;

@ -108,6 +108,7 @@ function _fetchData(connection, body, processFunc) {
}
}
}
options.allowGzip = !!connection.allowGzip;
if (connection.user != null && connection.password != null) {
if (url.substring(0, 6) !== "https:" && connection.allowInsecureAuthentication !== true) {
logger.throwError("basic authentication requires a secure https url", logger_1.Logger.errors.INVALID_ARGUMENT, { argument: "url", url: url, user: connection.user, password: "[REDACTED]" });

File diff suppressed because one or more lines are too long

@ -8,6 +8,7 @@ export declare type GetUrlResponse = {
};
export declare type Options = {
method?: string;
allowGzip?: boolean;
body?: Uint8Array;
headers?: {
[key: string]: string;

@ -36,7 +36,7 @@
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"tarballHash": "0x42701d8d5a4a2f01d4bee64412072a1a8738a99d570b0b576ae17c9472cc37a1",
"tarballHash": "0xffb63ec25a04effef1c5201b55770f2636a338339be2a7b770cc5e8914a6d56b",
"types": "./lib/index.d.ts",
"version": "5.0.8"
"version": "5.0.9"
}

@ -1 +1 @@
export const version = "web/5.0.8";
export const version = "web/5.0.9";