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

web3-rpc-providers

Package Overview
Dependencies
Maintainers
4
Versions
83
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

web3-rpc-providers - npm Package Compare versions

Comparing version 1.0.0-rc.0 to 1.0.0-rc.1

lib/commonjs/errors.d.ts

4

lib/commonjs/web3_provider.d.ts

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

import { EthExecutionAPI, JsonRpcResult, ProviderConnectInfo, ProviderMessage, ProviderRpcError, Web3APIMethod, Web3APIPayload, Web3APIReturnType, Web3APISpec, Web3BaseProvider, Web3Eip1193ProviderEventCallback, Web3ProviderEventCallback, Web3ProviderMessageEventCallback, Web3ProviderStatus } from "web3-types";
import { EthExecutionAPI, JsonRpcResult, ProviderConnectInfo, ProviderMessage, ProviderRpcError, Web3APIMethod, Web3APIPayload, Web3APIReturnType, Web3APISpec, Web3BaseProvider, Web3Eip1193ProviderEventCallback, Web3ProviderEventCallback, Web3ProviderMessageEventCallback, Web3ProviderStatus, JsonRpcResponseWithResult } from "web3-types";
import { Eip1193Provider } from "web3-utils";

@@ -9,3 +9,3 @@ import { Transport, Network } from "./types.js";

constructor(network: Network, transport: Transport, token: string, host: string);
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method>>(payload: Web3APIPayload<EthExecutionAPI, Method>, requestOptions?: RequestInit): Promise<ResultType>;
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method>>(payload: Web3APIPayload<EthExecutionAPI, Method>, requestOptions?: RequestInit): Promise<JsonRpcResponseWithResult<ResultType>>;
getStatus(): Web3ProviderStatus;

@@ -12,0 +12,0 @@ supportsSubscriptions(): boolean;

@@ -34,4 +34,6 @@ "use strict";

const web3_providers_ws_1 = __importDefault(require("web3-providers-ws"));
const web3_validator_1 = require("web3-validator");
const web3_utils_1 = require("web3-utils");
const types_js_1 = require("./types.js");
const errors_js_1 = require("./errors.js");
/*

@@ -58,5 +60,10 @@ This class can be used to create new providers only when there is custom logic required in each Request method like

if (this.transport === types_js_1.Transport.HTTPS) {
return (this.provider.request(payload, requestOptions));
const res = yield (this.provider.request(payload, requestOptions));
if (typeof res === 'object' && !(0, web3_validator_1.isNullish)(res) && 'error' in res && !(0, web3_validator_1.isNullish)(res.error) && 'code' in res.error && res.error.code === 429) {
// rate limiting error by quicknode;
throw new errors_js_1.QuickNodeRateLimitError();
}
return res;
}
return (this.provider.request(payload));
return this.provider.request(payload);
});

@@ -63,0 +70,0 @@ }

@@ -28,4 +28,6 @@ /*

import WebSocketProvider from "web3-providers-ws";
import { isNullish } from "web3-validator";
import { Eip1193Provider } from "web3-utils";
import { Transport } from "./types.js";
import { QuickNodeRateLimitError } from './errors.js';
/*

@@ -52,5 +54,10 @@ This class can be used to create new providers only when there is custom logic required in each Request method like

if (this.transport === Transport.HTTPS) {
return (this.provider.request(payload, requestOptions));
const res = yield (this.provider.request(payload, requestOptions));
if (typeof res === 'object' && !isNullish(res) && 'error' in res && !isNullish(res.error) && 'code' in res.error && res.error.code === 429) {
// rate limiting error by quicknode;
throw new QuickNodeRateLimitError();
}
return res;
}
return (this.provider.request(payload));
return this.provider.request(payload);
});

@@ -57,0 +64,0 @@ }

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

import { EthExecutionAPI, JsonRpcResult, ProviderConnectInfo, ProviderMessage, ProviderRpcError, Web3APIMethod, Web3APIPayload, Web3APIReturnType, Web3APISpec, Web3BaseProvider, Web3Eip1193ProviderEventCallback, Web3ProviderEventCallback, Web3ProviderMessageEventCallback, Web3ProviderStatus } from "web3-types";
import { EthExecutionAPI, JsonRpcResult, ProviderConnectInfo, ProviderMessage, ProviderRpcError, Web3APIMethod, Web3APIPayload, Web3APIReturnType, Web3APISpec, Web3BaseProvider, Web3Eip1193ProviderEventCallback, Web3ProviderEventCallback, Web3ProviderMessageEventCallback, Web3ProviderStatus, JsonRpcResponseWithResult } from "web3-types";
import { Eip1193Provider } from "web3-utils";

@@ -9,3 +9,3 @@ import { Transport, Network } from "./types.js";

constructor(network: Network, transport: Transport, token: string, host: string);
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method>>(payload: Web3APIPayload<EthExecutionAPI, Method>, requestOptions?: RequestInit): Promise<ResultType>;
request<Method extends Web3APIMethod<API>, ResultType = Web3APIReturnType<API, Method>>(payload: Web3APIPayload<EthExecutionAPI, Method>, requestOptions?: RequestInit): Promise<JsonRpcResponseWithResult<ResultType>>;
getStatus(): Web3ProviderStatus;

@@ -12,0 +12,0 @@ supportsSubscriptions(): boolean;

{
"name": "web3-rpc-providers",
"version": "1.0.0-rc.0",
"version": "1.0.0-rc.1",
"description": "Web3 Providers package",

@@ -59,8 +59,10 @@ "main": "./lib/commonjs/index.js",

"dependencies": {
"web3-errors": "^1.2.0",
"web3-providers-http": "^4.1.0",
"web3-providers-ws": "^4.0.7",
"web3-providers-ws": "^4.0.8",
"web3-types": "^1.7.0",
"web3-utils": "^4.3.0"
"web3-utils": "^4.3.1",
"web3-validator": "^2.0.6"
},
"gitHead": "d6d4c6df8f6b6323bc5fe277cbee969c28c845a7"
"gitHead": "2b6f7f5435230d860f55766f2d2a3c1358227e4f"
}

@@ -20,2 +20,3 @@ /*

import WebSocketProvider from "web3-providers-ws";
import { isNullish } from "web3-validator";
import {

@@ -27,6 +28,8 @@ EthExecutionAPI, JsonRpcResult, ProviderConnectInfo, ProviderMessage,

Web3ProviderMessageEventCallback,
Web3ProviderStatus
Web3ProviderStatus,
JsonRpcResponseWithResult,
} from "web3-types";
import { Eip1193Provider } from "web3-utils";
import { Transport, Network } from "./types.js";
import { QuickNodeRateLimitError } from './errors.js';

@@ -73,9 +76,16 @@ /*

requestOptions?: RequestInit,
): Promise<ResultType> {
): Promise<JsonRpcResponseWithResult<ResultType>> {
if (this.transport === Transport.HTTPS) {
return ( (this.provider as HttpProvider).request(payload, requestOptions)) as unknown as Promise<ResultType>;
}
const res = await ( (this.provider as HttpProvider).request(payload, requestOptions)) as unknown as JsonRpcResponseWithResult<ResultType>;
if (typeof res === 'object' && !isNullish(res) && 'error' in res && !isNullish(res.error) && 'code' in res.error && (res.error as { code: number }).code === 429){
// rate limiting error by quicknode;
throw new QuickNodeRateLimitError();
}
return res;
}
return ( (this.provider as WebSocketProvider).request(payload)) as unknown as Promise<ResultType>;
return (this.provider as WebSocketProvider).request(payload);

@@ -82,0 +92,0 @@ }

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

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