Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@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.5.3 to 5.6.0

2

lib.esm/_version.d.ts

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

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

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

export const version = "providers/5.5.3";
export const version = "providers/5.6.0";
//# sourceMappingURL=_version.js.map

@@ -12,2 +12,4 @@ /// <reference types="node" />

readonly tag: string;
_lastBlockNumber: number;
_inflight: boolean;
constructor(tag: string, listener: Listener, once: boolean);

@@ -44,3 +46,6 @@ get event(): EventType;

readonly _resolvedAddress: null | string;
_supportsEip2544: null | Promise<boolean>;
constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string);
supportsWildcard(): Promise<boolean>;
_fetch(selector: string, parameters?: string): Promise<null | string>;
_fetchBytes(selector: string, parameters?: string): Promise<null | string>;

@@ -65,2 +70,3 @@ _getAddress(coinType: number, hexBytes: string): string;

_lastBlockNumber: number;
_maxFilterBlockRange: number;
_fastBlockNumber: number;

@@ -76,2 +82,3 @@ _fastBlockNumberPromise: Promise<number>;

readonly anyNetwork: boolean;
disableCcipRead: boolean;
/**

@@ -91,2 +98,3 @@ * ready

static getNetwork(network: Networkish): Network;
ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string>;
_getInternalBlockNumber(maxAge: number): Promise<number>;

@@ -124,2 +132,3 @@ poll(): Promise<void>;

_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
_call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;

@@ -137,3 +146,3 @@ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;

getResolver(name: string): Promise<null | Resolver>;
_getResolver(name: string): Promise<string>;
_getResolver(name: string, operation?: string): Promise<string>;
resolveName(name: string | Promise<string>): Promise<null | string>;

@@ -140,0 +149,0 @@ lookupAddress(address: string | Promise<string>): Promise<null | string>;

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

formats.block = {
hash: hash,
hash: Formatter.allowNull(hash),
parentHash: hash,

@@ -104,3 +104,3 @@ number: number,

gasUsed: bigNumber,
miner: address,
miner: Formatter.allowNull(address),
extraData: data,

@@ -107,0 +107,0 @@ transactions: Formatter.allowNull(Formatter.arrayOf(hash)),

@@ -567,4 +567,4 @@ "use strict";

const result = {};
// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) {
// JSON-RPC now requires numeric values to be "quantity" values
["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) {
if (transaction[key] == null) {

@@ -571,0 +571,0 @@ return;

@@ -12,2 +12,10 @@ import { Network, Networkish } from "@ethersproject/networks";

};
export interface WebSocketLike {
onopen: (...args: Array<any>) => any;
onmessage: (...args: Array<any>) => any;
onerror: (...args: Array<any>) => any;
readyState: number;
send(payload: any): void;
close(code?: number, reason?: string): void;
}
export declare class WebSocketProvider extends JsonRpcProvider {

@@ -26,3 +34,4 @@ readonly _websocket: any;

_wsReady: boolean;
constructor(url: string, network?: Networkish);
constructor(url: string | WebSocketLike, network?: Networkish);
get websocket(): WebSocketLike;
detectNetwork(): Promise<Network>;

@@ -29,0 +38,0 @@ get pollingInterval(): number;

@@ -43,6 +43,16 @@ "use strict";

}
super(url, network);
if (typeof (url) === "string") {
super(url, network);
}
else {
super("_websocket", network);
}
this._pollingInterval = -1;
this._wsReady = false;
defineReadOnly(this, "_websocket", new WebSocket(this.connection.url));
if (typeof (url) === "string") {
defineReadOnly(this, "_websocket", new WebSocket(this.connection.url));
}
else {
defineReadOnly(this, "_websocket", url);
}
defineReadOnly(this, "_requests", {});

@@ -53,9 +63,9 @@ defineReadOnly(this, "_subs", {});

// Stall sending requests until the socket is open...
this._websocket.onopen = () => {
this.websocket.onopen = () => {
this._wsReady = true;
Object.keys(this._requests).forEach((id) => {
this._websocket.send(this._requests[id].payload);
this.websocket.send(this._requests[id].payload);
});
};
this._websocket.onmessage = (messageEvent) => {
this.websocket.onmessage = (messageEvent) => {
const data = messageEvent.data;

@@ -117,2 +127,5 @@ const result = JSON.parse(data);

}
// Cannot narrow the type of _websocket, as that is not backwards compatible
// so we add a getter and let the WebSocket be a public API.
get websocket() { return this._websocket; }
detectNetwork() {

@@ -169,3 +182,3 @@ return this._detectNetwork;

if (this._wsReady) {
this._websocket.send(payload);
this.websocket.send(payload);
}

@@ -274,8 +287,8 @@ });

// Wait until we have connected before trying to disconnect
if (this._websocket.readyState === WebSocket.CONNECTING) {
if (this.websocket.readyState === WebSocket.CONNECTING) {
yield (new Promise((resolve) => {
this._websocket.onopen = function () {
this.websocket.onopen = function () {
resolve(true);
};
this._websocket.onerror = function () {
this.websocket.onerror = function () {
resolve(false);

@@ -287,3 +300,3 @@ };

// See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes
this._websocket.close(1000);
this.websocket.close(1000);
});

@@ -290,0 +303,0 @@ }

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

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

@@ -12,2 +12,4 @@ /// <reference types="node" />

readonly tag: string;
_lastBlockNumber: number;
_inflight: boolean;
constructor(tag: string, listener: Listener, once: boolean);

@@ -44,3 +46,6 @@ get event(): EventType;

readonly _resolvedAddress: null | string;
_supportsEip2544: null | Promise<boolean>;
constructor(provider: BaseProvider, address: string, name: string, resolvedAddress?: string);
supportsWildcard(): Promise<boolean>;
_fetch(selector: string, parameters?: string): Promise<null | string>;
_fetchBytes(selector: string, parameters?: string): Promise<null | string>;

@@ -65,2 +70,3 @@ _getAddress(coinType: number, hexBytes: string): string;

_lastBlockNumber: number;
_maxFilterBlockRange: number;
_fastBlockNumber: number;

@@ -76,2 +82,3 @@ _fastBlockNumberPromise: Promise<number>;

readonly anyNetwork: boolean;
disableCcipRead: boolean;
/**

@@ -91,2 +98,3 @@ * ready

static getNetwork(network: Networkish): Network;
ccipReadFetch(tx: Transaction, calldata: string, urls: Array<string>): Promise<null | string>;
_getInternalBlockNumber(maxAge: number): Promise<number>;

@@ -124,2 +132,3 @@ poll(): Promise<void>;

_getFilter(filter: Filter | FilterByBlockHash | Promise<Filter | FilterByBlockHash>): Promise<Filter | FilterByBlockHash>;
_call(transaction: TransactionRequest, blockTag: BlockTag, attempt: number): Promise<string>;
call(transaction: Deferrable<TransactionRequest>, blockTag?: BlockTag | Promise<BlockTag>): Promise<string>;

@@ -137,3 +146,3 @@ estimateGas(transaction: Deferrable<TransactionRequest>): Promise<BigNumber>;

getResolver(name: string): Promise<null | Resolver>;
_getResolver(name: string): Promise<string>;
_getResolver(name: string, operation?: string): Promise<string>;
resolveName(name: string | Promise<string>): Promise<null | string>;

@@ -140,0 +149,0 @@ lookupAddress(address: string | Promise<string>): Promise<null | string>;

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

formats.block = {
hash: hash,
hash: Formatter.allowNull(hash),
parentHash: hash,

@@ -108,3 +108,3 @@ number: number,

gasUsed: bigNumber,
miner: address,
miner: Formatter.allowNull(address),
extraData: data,

@@ -111,0 +111,0 @@ transactions: Formatter.allowNull(Formatter.arrayOf(hash)),

@@ -738,4 +738,4 @@ "use strict";

var result = {};
// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) {
// JSON-RPC now requires numeric values to be "quantity" values
["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function (key) {
if (transaction[key] == null) {

@@ -742,0 +742,0 @@ return;

@@ -12,2 +12,10 @@ import { Network, Networkish } from "@ethersproject/networks";

};
export interface WebSocketLike {
onopen: (...args: Array<any>) => any;
onmessage: (...args: Array<any>) => any;
onerror: (...args: Array<any>) => any;
readyState: number;
send(payload: any): void;
close(code?: number, reason?: string): void;
}
export declare class WebSocketProvider extends JsonRpcProvider {

@@ -26,3 +34,4 @@ readonly _websocket: any;

_wsReady: boolean;
constructor(url: string, network?: Networkish);
constructor(url: string | WebSocketLike, network?: Networkish);
get websocket(): WebSocketLike;
detectNetwork(): Promise<Network>;

@@ -29,0 +38,0 @@ get pollingInterval(): number;

@@ -89,6 +89,16 @@ "use strict";

}
_this = _super.call(this, url, network) || this;
if (typeof (url) === "string") {
_this = _super.call(this, url, network) || this;
}
else {
_this = _super.call(this, "_websocket", network) || this;
}
_this._pollingInterval = -1;
_this._wsReady = false;
(0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url));
if (typeof (url) === "string") {
(0, properties_1.defineReadOnly)(_this, "_websocket", new ws_1.WebSocket(_this.connection.url));
}
else {
(0, properties_1.defineReadOnly)(_this, "_websocket", url);
}
(0, properties_1.defineReadOnly)(_this, "_requests", {});

@@ -99,9 +109,9 @@ (0, properties_1.defineReadOnly)(_this, "_subs", {});

// Stall sending requests until the socket is open...
_this._websocket.onopen = function () {
_this.websocket.onopen = function () {
_this._wsReady = true;
Object.keys(_this._requests).forEach(function (id) {
_this._websocket.send(_this._requests[id].payload);
_this.websocket.send(_this._requests[id].payload);
});
};
_this._websocket.onmessage = function (messageEvent) {
_this.websocket.onmessage = function (messageEvent) {
var data = messageEvent.data;

@@ -164,2 +174,9 @@ var result = JSON.parse(data);

}
Object.defineProperty(WebSocketProvider.prototype, "websocket", {
// Cannot narrow the type of _websocket, as that is not backwards compatible
// so we add a getter and let the WebSocket be a public API.
get: function () { return this._websocket; },
enumerable: false,
configurable: true
});
WebSocketProvider.prototype.detectNetwork = function () {

@@ -227,3 +244,3 @@ return this._detectNetwork;

if (_this._wsReady) {
_this._websocket.send(payload);
_this.websocket.send(payload);
}

@@ -347,8 +364,8 @@ });

case 0:
if (!(this._websocket.readyState === ws_1.WebSocket.CONNECTING)) return [3 /*break*/, 2];
if (!(this.websocket.readyState === ws_1.WebSocket.CONNECTING)) return [3 /*break*/, 2];
return [4 /*yield*/, (new Promise(function (resolve) {
_this._websocket.onopen = function () {
_this.websocket.onopen = function () {
resolve(true);
};
_this._websocket.onerror = function () {
_this.websocket.onerror = function () {
resolve(false);

@@ -363,3 +380,3 @@ };

// See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes
this._websocket.close(1000);
this.websocket.close(1000);
return [2 /*return*/];

@@ -366,0 +383,0 @@ }

@@ -17,19 +17,19 @@ {

"dependencies": {
"@ethersproject/abstract-provider": "^5.5.0",
"@ethersproject/abstract-signer": "^5.5.0",
"@ethersproject/address": "^5.5.0",
"@ethersproject/basex": "^5.5.0",
"@ethersproject/bignumber": "^5.5.0",
"@ethersproject/bytes": "^5.5.0",
"@ethersproject/constants": "^5.5.0",
"@ethersproject/hash": "^5.5.0",
"@ethersproject/logger": "^5.5.0",
"@ethersproject/networks": "^5.5.0",
"@ethersproject/properties": "^5.5.0",
"@ethersproject/random": "^5.5.0",
"@ethersproject/rlp": "^5.5.0",
"@ethersproject/sha2": "^5.5.0",
"@ethersproject/strings": "^5.5.0",
"@ethersproject/transactions": "^5.5.0",
"@ethersproject/web": "^5.5.0",
"@ethersproject/abstract-provider": "^5.6.0",
"@ethersproject/abstract-signer": "^5.6.0",
"@ethersproject/address": "^5.6.0",
"@ethersproject/basex": "^5.6.0",
"@ethersproject/bignumber": "^5.6.0",
"@ethersproject/bytes": "^5.6.0",
"@ethersproject/constants": "^5.6.0",
"@ethersproject/hash": "^5.6.0",
"@ethersproject/logger": "^5.6.0",
"@ethersproject/networks": "^5.6.0",
"@ethersproject/properties": "^5.6.0",
"@ethersproject/random": "^5.6.0",
"@ethersproject/rlp": "^5.6.0",
"@ethersproject/sha2": "^5.6.0",
"@ethersproject/strings": "^5.6.0",
"@ethersproject/transactions": "^5.6.0",
"@ethersproject/web": "^5.6.0",
"bech32": "1.1.4",

@@ -50,3 +50,3 @@ "ws": "7.4.6"

],
"gitHead": "32c9a0976276245ad3191260157fb814e5c00080",
"gitHead": "dfaa8ee7e6f808dc7f363863243ea650bc629197",
"keywords": [

@@ -72,5 +72,5 @@ "Ethereum",

"sideEffects": false,
"tarballHash": "0x0976aab1e9e29f054b5e55d41359597400775eb87ea407447c62feefb732eaeb",
"tarballHash": "0x615e44f28981170d7b5073516db9e97d9917cc4cedb3b44bb3b74830238a53f2",
"types": "./lib/index.d.ts",
"version": "5.5.3"
"version": "5.6.0"
}

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

export const version = "providers/5.5.3";
export const version = "providers/5.6.0";

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

formats.block = {
hash: hash,
hash: Formatter.allowNull(hash),
parentHash: hash,

@@ -145,3 +145,3 @@ number: number,

miner: address,
miner: Formatter.allowNull(address),
extraData: data,

@@ -148,0 +148,0 @@

@@ -643,4 +643,4 @@ "use strict";

// Some nodes (INFURA ropsten; INFURA mainnet is fine) do not like leading zeros.
["gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key) {
// JSON-RPC now requires numeric values to be "quantity" values
["chainId", "gasLimit", "gasPrice", "type", "maxFeePerGas", "maxPriorityFeePerGas", "nonce", "value"].forEach(function(key) {
if ((<any>transaction)[key] == null) { return; }

@@ -647,0 +647,0 @@ const value = hexValue((<any>transaction)[key]);

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

export interface WebSocketLike {
onopen: (...args: Array<any>) => any;
onmessage: (...args: Array<any>) => any;
onerror: (...args: Array<any>) => any;
readyState: number;
send(payload: any): void;
close(code?: number, reason?: string): void;
}
// For more info about the Real-time Event API see:

@@ -60,3 +70,4 @@ // https://geth.ethereum.org/docs/rpc/pubsub

constructor(url: string, network?: Networkish) {
constructor(url: string | WebSocketLike, network?: Networkish) {
// This will be added in the future; please open an issue to expedite

@@ -69,3 +80,8 @@ if (network === "any") {

super(url, network);
if (typeof(url) === "string") {
super(url, network);
} else {
super("_websocket", network);
}
this._pollingInterval = -1;

@@ -75,3 +91,8 @@

defineReadOnly(this, "_websocket", new WebSocket(this.connection.url));
if (typeof(url) === "string") {
defineReadOnly(this, "_websocket", new WebSocket(this.connection.url));
} else {
defineReadOnly(this, "_websocket", url);
}
defineReadOnly(this, "_requests", { });

@@ -83,10 +104,10 @@ defineReadOnly(this, "_subs", { });

// Stall sending requests until the socket is open...
this._websocket.onopen = () => {
this.websocket.onopen = () => {
this._wsReady = true;
Object.keys(this._requests).forEach((id) => {
this._websocket.send(this._requests[id].payload);
this.websocket.send(this._requests[id].payload);
});
};
this._websocket.onmessage = (messageEvent: { data: string }) => {
this.websocket.onmessage = (messageEvent: { data: string }) => {
const data = messageEvent.data;

@@ -152,2 +173,6 @@ const result = JSON.parse(data);

// Cannot narrow the type of _websocket, as that is not backwards compatible
// so we add a getter and let the WebSocket be a public API.
get websocket(): WebSocketLike { return this._websocket; }
detectNetwork(): Promise<Network> {

@@ -209,3 +234,3 @@ return this._detectNetwork;

if (this._wsReady) { this._websocket.send(payload); }
if (this._wsReady) { this.websocket.send(payload); }
});

@@ -316,9 +341,9 @@ }

// Wait until we have connected before trying to disconnect
if (this._websocket.readyState === WebSocket.CONNECTING) {
if (this.websocket.readyState === WebSocket.CONNECTING) {
await (new Promise((resolve) => {
this._websocket.onopen = function() {
this.websocket.onopen = function() {
resolve(true);
};
this._websocket.onerror = function() {
this.websocket.onerror = function() {
resolve(false);

@@ -331,4 +356,4 @@ };

// See: https://developer.mozilla.org/en-US/docs/Web/API/CloseEvent#Status_codes
this._websocket.close(1000);
this.websocket.close(1000);
}
}

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 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 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