Skip to content

Commit

Permalink
hotfix: Adding 400ms delay to `getTransaction/eth_getTransactionByH…
Browse files Browse the repository at this point in the history
  • Loading branch information
0xRektora committed Jun 9, 2024
1 parent 8f038d2 commit 9192cf0
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/providers/src.ts/json-rpc-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ export class JsonRpcProvider extends BaseProvider {
return result;
}

prepareRequest(method: string, params: any): [ string, Array<any> ] {
async prepareRequest(method: string, params: any): Promise<[ string, Array<any> ]> {
switch (method) {
case "getBlockNumber":
return [ "eth_blockNumber", [] ];
Expand Down Expand Up @@ -584,6 +584,8 @@ export class JsonRpcProvider extends BaseProvider {
return null;

case "getTransaction":
console.log('[+] @ethers-arbitrum-hotfix package. Adding 400ms delay to getTransaction/eth_getTransactionByHash')
await new Promise(resolve => setTimeout(resolve, 400));
return [ "eth_getTransactionByHash", [ params.transactionHash ] ];

case "getTransactionReceipt":
Expand Down Expand Up @@ -631,7 +633,7 @@ export class JsonRpcProvider extends BaseProvider {
}
}

const args = this.prepareRequest(method, params);
const args = await this.prepareRequest(method, params);

if (args == null) {
logger.throwError(method + " not implemented", Logger.errors.NOT_IMPLEMENTED, { operation: method });
Expand Down

0 comments on commit 9192cf0

Please sign in to comment.