Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Quicknode provider update #7195

Merged
merged 10 commits into from
Aug 20, 2024
Merged
Prev Previous commit
Next Next commit
Web3ExternalProvider update
  • Loading branch information
jdevcs committed Aug 15, 2024
commit 8a00c4141ae5edfd68fc5a8d7a8cf6a54c49a223
12 changes: 1 addition & 11 deletions packages/web3-rpc-providers/src/web3_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@ import {
} from "web3-types";
import { Eip1193Provider } from "web3-utils";
import { Transport, Network } from "./types.js";
import { QuickNodeRateLimitError } from './errors.js';
import { ResponseError } from "web3-errors";

/*
This class can be used to create new providers only when there is custom logic required in each Request method like
Expand Down Expand Up @@ -74,15 +72,7 @@ export abstract class Web3ExternalProvider<
): Promise<JsonRpcResponseWithResult<ResultType>> {

if (this.transport === Transport.HTTPS) {
try {
return await ((this.provider as HttpProvider).request(payload, requestOptions)) as unknown as JsonRpcResponseWithResult<ResultType>;
} catch (error) {
if (error instanceof ResponseError && error.statusCode === 429){
throw new QuickNodeRateLimitError(error);
}
throw error;
}

return await ((this.provider as HttpProvider).request(payload, requestOptions)) as unknown as JsonRpcResponseWithResult<ResultType>;
}

return (this.provider as WebSocketProvider).request(payload);
Expand Down
Loading