Skip to content

Commit

Permalink
Web3ExternalProvider update
Browse files Browse the repository at this point in the history
  • Loading branch information
jdevcs committed Aug 15, 2024
1 parent 7f6567c commit 8a00c41
Showing 1 changed file with 1 addition and 11 deletions.
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

0 comments on commit 8a00c41

Please sign in to comment.