From f1136feda023b03ba88ea94bf545b4e8d6f68c55 Mon Sep 17 00:00:00 2001 From: Garvit Khatri Date: Mon, 5 Aug 2024 18:59:38 +0100 Subject: [PATCH] fix in rpc call too --- src/rpc/rpcHandler.ts | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) diff --git a/src/rpc/rpcHandler.ts b/src/rpc/rpcHandler.ts index ce38c5ea..2ccbba53 100644 --- a/src/rpc/rpcHandler.ts +++ b/src/rpc/rpcHandler.ts @@ -713,9 +713,28 @@ export class RpcHandler implements IRpcEndpoint { ): Promise => { while (true) { try { - return await this.publicClient.getTransactionReceipt({ - hash: txHash - }) + const transactionReceipt = + await this.publicClient.getTransactionReceipt({ + hash: txHash + }) + + let effectiveGasPrice: bigint | undefined = + transactionReceipt.effectiveGasPrice ?? + (transactionReceipt as any).gasPrice ?? + undefined + + if (effectiveGasPrice === undefined) { + const tx = await this.publicClient.getTransaction({ + hash: txHash + }) + effectiveGasPrice = tx.gasPrice ?? undefined + } + + if (effectiveGasPrice) { + transactionReceipt.effectiveGasPrice = effectiveGasPrice + } + + return transactionReceipt } catch (e) { if (e instanceof TransactionReceiptNotFoundError) { continue