Socket
Socket
Sign inDemoInstall

@ethersproject/providers

Package Overview
Dependencies
Maintainers
1
Versions
114
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ethersproject/providers - npm Package Compare versions

Comparing version 5.6.5 to 5.6.6

2

lib.esm/_version.d.ts

@@ -1,2 +0,2 @@

export declare const version = "providers/5.6.5";
export declare const version = "providers/5.6.6";
//# sourceMappingURL=_version.d.ts.map

@@ -1,2 +0,2 @@

export const version = "providers/5.6.5";
export const version = "providers/5.6.6";
//# sourceMappingURL=_version.js.map

@@ -161,3 +161,2 @@ "use strict";

constructor(network, apiKey) {
logger.checkNew(new.target, EtherscanProvider);
super(network);

@@ -179,5 +178,7 @@ defineReadOnly(this, "baseUrl", this.getBaseUrl());

return "https:/\/api-goerli.etherscan.io";
case "optimism":
return "https:/\/api-optimistic.etherscan.io";
default:
}
return logger.throwArgumentError("unsupported network", "network", name);
return logger.throwArgumentError("unsupported network", "network", this.network.name);
}

@@ -184,0 +185,0 @@ getUrl(module, params) {

@@ -352,3 +352,2 @@ "use strict";

constructor(providers, quorum) {
logger.checkNew(new.target, FallbackProvider);
if (providers.length === 0) {

@@ -355,0 +354,0 @@ logger.throwArgumentError("missing providers", "providers", providers);

@@ -13,3 +13,2 @@ "use strict";

constructor() {
logger.checkNew(new.target, Formatter);
this.formats = this.getDefaultFormats();

@@ -16,0 +15,0 @@ }

@@ -24,3 +24,3 @@ "use strict";

const errorGas = ["call", "estimateGas"];
function spelunk(value) {
function spelunk(value, requireData) {
if (value == null) {

@@ -30,4 +30,7 @@ return null;

// These *are* the droids we're looking for.
if (typeof (value.message) === "string" && value.message.match("reverted") && isHexString(value.data)) {
return { message: value.message, data: value.data };
if (typeof (value.message) === "string" && value.message.match("reverted")) {
const data = isHexString(value.data) ? value.data : null;
if (!requireData || data) {
return { message: value.message, data };
}
}

@@ -37,3 +40,3 @@ // Spelunk further...

for (const key in value) {
const result = spelunk(value[key]);
const result = spelunk(value[key], requireData);
if (result) {

@@ -48,3 +51,3 @@ return result;

try {
return spelunk(JSON.parse(value));
return spelunk(JSON.parse(value), requireData);
}

@@ -56,13 +59,28 @@ catch (error) { }

function checkError(method, error, params) {
const transaction = params.transaction || params.signedTransaction;
// Undo the "convenience" some nodes are attempting to prevent backwards
// incompatibility; maybe for v6 consider forwarding reverts as errors
if (method === "call") {
const result = spelunk(error);
const result = spelunk(error, true);
if (result) {
return result.data;
}
// Nothing descriptive..
logger.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger.errors.CALL_EXCEPTION, {
error, data: "0x"
data: "0x", transaction, error
});
}
if (method === "estimateGas") {
// Try to find something, with a preference on SERVER_ERROR body
let result = spelunk(error.body, false);
if (result == null) {
result = spelunk(error, false);
}
// Found "reverted", this is a CALL_EXCEPTION
if (result) {
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
reason: result.message, method, transaction, error
});
}
}
// @TODO: Should we spelunk for message too?

@@ -80,3 +98,2 @@ let message = error.message;

message = (message || "").toLowerCase();
const transaction = params.transaction || params.signedTransaction;
// "insufficient funds for gas * price + value + cost(data)"

@@ -137,3 +154,2 @@ if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {

constructor(constructorGuard, provider, addressOrIndex) {
logger.checkNew(new.target, JsonRpcSigner);
super();

@@ -318,3 +334,2 @@ if (constructorGuard !== _constructorGuard) {

constructor(url, network) {
logger.checkNew(new.target, JsonRpcProvider);
let networkOrReady = network;

@@ -321,0 +336,0 @@ // The network is unknown, query the JSON-RPC for it

@@ -88,3 +88,2 @@ "use strict";

constructor(provider, network) {
logger.checkNew(new.target, Web3Provider);
if (provider == null) {

@@ -91,0 +90,0 @@ logger.throwArgumentError("missing provider", "provider", provider);

@@ -1,2 +0,2 @@

export declare const version = "providers/5.6.5";
export declare const version = "providers/5.6.6";
//# sourceMappingURL=_version.d.ts.map
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.version = void 0;
exports.version = "providers/5.6.5";
exports.version = "providers/5.6.6";
//# sourceMappingURL=_version.js.map

@@ -215,6 +215,3 @@ "use strict";

function EtherscanProvider(network, apiKey) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, EtherscanProvider);
_this = _super.call(this, network) || this;
var _this = _super.call(this, network) || this;
(0, properties_1.defineReadOnly)(_this, "baseUrl", _this.getBaseUrl());

@@ -236,5 +233,7 @@ (0, properties_1.defineReadOnly)(_this, "apiKey", apiKey || defaultApiKey);

return "https:/\/api-goerli.etherscan.io";
case "optimism":
return "https:/\/api-optimistic.etherscan.io";
default:
}
return logger.throwArgumentError("unsupported network", "network", name);
return logger.throwArgumentError("unsupported network", "network", this.network.name);
};

@@ -241,0 +240,0 @@ EtherscanProvider.prototype.getUrl = function (module, params) {

@@ -423,5 +423,3 @@ "use strict";

function FallbackProvider(providers, quorum) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, FallbackProvider);
if (providers.length === 0) {

@@ -428,0 +426,0 @@ logger.throwArgumentError("missing providers", "providers", providers);

@@ -15,4 +15,2 @@ "use strict";

function Formatter() {
var _newTarget = this.constructor;
logger.checkNew(_newTarget, Formatter);
this.formats = this.getDefaultFormats();

@@ -19,0 +17,0 @@ }

@@ -28,5 +28,3 @@ "use strict";

function IpcProvider(path, network) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, IpcProvider);
if (path == null) {

@@ -33,0 +31,0 @@ logger.throwError("missing path", logger_1.Logger.errors.MISSING_ARGUMENT, { arg: "path" });

@@ -68,3 +68,3 @@ "use strict";

var errorGas = ["call", "estimateGas"];
function spelunk(value) {
function spelunk(value, requireData) {
if (value == null) {

@@ -74,4 +74,7 @@ return null;

// These *are* the droids we're looking for.
if (typeof (value.message) === "string" && value.message.match("reverted") && (0, bytes_1.isHexString)(value.data)) {
return { message: value.message, data: value.data };
if (typeof (value.message) === "string" && value.message.match("reverted")) {
var data = (0, bytes_1.isHexString)(value.data) ? value.data : null;
if (!requireData || data) {
return { message: value.message, data: data };
}
}

@@ -81,3 +84,3 @@ // Spelunk further...

for (var key in value) {
var result = spelunk(value[key]);
var result = spelunk(value[key], requireData);
if (result) {

@@ -92,3 +95,3 @@ return result;

try {
return spelunk(JSON.parse(value));
return spelunk(JSON.parse(value), requireData);
}

@@ -100,14 +103,33 @@ catch (error) { }

function checkError(method, error, params) {
var transaction = params.transaction || params.signedTransaction;
// Undo the "convenience" some nodes are attempting to prevent backwards
// incompatibility; maybe for v6 consider forwarding reverts as errors
if (method === "call") {
var result = spelunk(error);
var result = spelunk(error, true);
if (result) {
return result.data;
}
// Nothing descriptive..
logger.throwError("missing revert data in call exception; Transaction reverted without a reason string", logger_1.Logger.errors.CALL_EXCEPTION, {
error: error,
data: "0x"
data: "0x",
transaction: transaction,
error: error
});
}
if (method === "estimateGas") {
// Try to find something, with a preference on SERVER_ERROR body
var result = spelunk(error.body, false);
if (result == null) {
result = spelunk(error, false);
}
// Found "reverted", this is a CALL_EXCEPTION
if (result) {
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", logger_1.Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
reason: result.message,
method: method,
transaction: transaction,
error: error
});
}
}
// @TODO: Should we spelunk for message too?

@@ -125,3 +147,2 @@ var message = error.message;

message = (message || "").toLowerCase();
var transaction = params.transaction || params.signedTransaction;
// "insufficient funds for gas * price + value + cost(data)"

@@ -193,6 +214,3 @@ if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {

function JsonRpcSigner(constructorGuard, provider, addressOrIndex) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, JsonRpcSigner);
_this = _super.call(this) || this;
var _this = _super.call(this) || this;
if (constructorGuard !== _constructorGuard) {

@@ -453,5 +471,3 @@ throw new Error("do not call the JsonRpcSigner constructor directly; use provider.getSigner");

function JsonRpcProvider(url, network) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, JsonRpcProvider);
var networkOrReady = network;

@@ -458,0 +474,0 @@ // The network is unknown, query the JSON-RPC for it

@@ -108,5 +108,3 @@ "use strict";

function Web3Provider(provider, network) {
var _newTarget = this.constructor;
var _this = this;
logger.checkNew(_newTarget, Web3Provider);
if (provider == null) {

@@ -113,0 +111,0 @@ logger.throwArgumentError("missing provider", "provider", provider);

@@ -49,3 +49,3 @@ {

],
"gitHead": "fc1e006575d59792fa97b4efb9ea2f8cca1944cf",
"gitHead": "01aea705ce60b1c42d2f465b162cb339a0e94392",
"keywords": [

@@ -71,5 +71,5 @@ "Ethereum",

"sideEffects": false,
"tarballHash": "0x7a45763f3e787cc940b0f2717661a0a248e2d6d8c9bceb0e845f75cc83422144",
"tarballHash": "0x01fefbdfa8f078c70c374802bb403588311eb19b5e6faed77d34f3e3b8607237",
"types": "./lib/index.d.ts",
"version": "5.6.5"
"version": "5.6.6"
}

@@ -1,1 +0,1 @@

export const version = "providers/5.6.5";
export const version = "providers/5.6.6";

@@ -166,4 +166,2 @@ "use strict";

constructor(network?: Networkish, apiKey?: string) {
logger.checkNew(new.target, EtherscanProvider);
super(network);

@@ -187,6 +185,8 @@

return "https:/\/api-goerli.etherscan.io";
case "optimism":
return "https:/\/api-optimistic.etherscan.io";
default:
}
return logger.throwArgumentError("unsupported network", "network", name);
return logger.throwArgumentError("unsupported network", "network", this.network.name);
}

@@ -193,0 +193,0 @@

@@ -413,4 +413,2 @@ "use strict";

constructor(providers: Array<Provider | FallbackProviderConfig>, quorum?: number) {
logger.checkNew(new.target, FallbackProvider);
if (providers.length === 0) {

@@ -417,0 +415,0 @@ logger.throwArgumentError("missing providers", "providers", providers);

@@ -34,3 +34,2 @@ "use strict";

constructor() {
logger.checkNew(new.target, Formatter);
this.formats = this.getDefaultFormats();

@@ -37,0 +36,0 @@ }

@@ -19,4 +19,2 @@ "use strict";

constructor(path: string, network?: Networkish) {
logger.checkNew(new.target, IpcProvider);
if (path == null) {

@@ -23,0 +21,0 @@ logger.throwError("missing path", Logger.errors.MISSING_ARGUMENT, { arg: "path" });

@@ -25,8 +25,11 @@ "use strict";

function spelunk(value: any): null | { message: string, data: string } {
function spelunk(value: any, requireData: boolean): null | { message: string, data: null | string } {
if (value == null) { return null; }
// These *are* the droids we're looking for.
if (typeof(value.message) === "string" && value.message.match("reverted") && isHexString(value.data)) {
return { message: value.message, data: value.data };
if (typeof(value.message) === "string" && value.message.match("reverted")) {
const data = isHexString(value.data) ? value.data: null;
if (!requireData || data) {
return { message: value.message, data };
}
}

@@ -37,3 +40,3 @@

for (const key in value) {
const result = spelunk(value[key]);
const result = spelunk(value[key], requireData);
if (result) { return result; }

@@ -47,3 +50,3 @@ }

try {
return spelunk(JSON.parse(value));
return spelunk(JSON.parse(value), requireData);
} catch (error) { }

@@ -57,13 +60,29 @@ }

const transaction = params.transaction || params.signedTransaction;
// Undo the "convenience" some nodes are attempting to prevent backwards
// incompatibility; maybe for v6 consider forwarding reverts as errors
if (method === "call") {
const result = spelunk(error);
const result = spelunk(error, true);
if (result) { return result.data; }
// Nothing descriptive..
logger.throwError("missing revert data in call exception; Transaction reverted without a reason string", Logger.errors.CALL_EXCEPTION, {
error, data: "0x"
data: "0x", transaction, error
});
}
if (method === "estimateGas") {
// Try to find something, with a preference on SERVER_ERROR body
let result = spelunk(error.body, false);
if (result == null) { result = spelunk(error, false); }
// Found "reverted", this is a CALL_EXCEPTION
if (result) {
logger.throwError("cannot estimate gas; transaction may fail or may require manual gas limit", Logger.errors.UNPREDICTABLE_GAS_LIMIT, {
reason: result.message, method, transaction, error
});
}
}
// @TODO: Should we spelunk for message too?

@@ -81,4 +100,2 @@

const transaction = params.transaction || params.signedTransaction;
// "insufficient funds for gas * price + value + cost(data)"

@@ -152,4 +169,2 @@ if (message.match(/insufficient funds|base fee exceeds gas limit/i)) {

constructor(constructorGuard: any, provider: JsonRpcProvider, addressOrIndex?: string | number) {
logger.checkNew(new.target, JsonRpcSigner);
super();

@@ -363,4 +378,2 @@

constructor(url?: ConnectionInfo | string, network?: Networkish) {
logger.checkNew(new.target, JsonRpcProvider);
let networkOrReady: Networkish | Promise<Network> = network;

@@ -367,0 +380,0 @@

@@ -126,4 +126,2 @@ "use strict";

constructor(provider: ExternalProvider | JsonRpcFetchFunc, network?: Networkish) {
logger.checkNew(new.target, Web3Provider);
if (provider == null) {

@@ -130,0 +128,0 @@ logger.throwArgumentError("missing provider", "provider", provider);

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc