diff --git a/src.ts/providers/abstract-provider.ts b/src.ts/providers/abstract-provider.ts index 02a3e1bc9..1af785e0a 100644 --- a/src.ts/providers/abstract-provider.ts +++ b/src.ts/providers/abstract-provider.ts @@ -363,7 +363,7 @@ export type PerformActionRequest = { method: "chainId" } | { method: "estimateGas", - transaction: PerformActionTransaction + transaction: PerformActionTransaction, blockTag: BlockTag } | { method: "getBalance", address: string, blockTag: BlockTag @@ -954,10 +954,13 @@ export class AbstractProvider implements Provider { async estimateGas(_tx: TransactionRequest): Promise { - let tx = this._getTransactionRequest(_tx); + let { tx, blockTag } = await resolveProperties({ + tx: this._getTransactionRequest(_tx), + blockTag: this._getBlockTag(_tx.blockTag) + }); if (isPromise(tx)) { tx = await tx; } return getBigInt(await this.#perform({ - method: "estimateGas", transaction: tx + method: "estimateGas", transaction: tx, blockTag: blockTag }), "%response"); } diff --git a/src.ts/providers/provider-jsonrpc.ts b/src.ts/providers/provider-jsonrpc.ts index 14ba6ad1b..3310a10ab 100644 --- a/src.ts/providers/provider-jsonrpc.ts +++ b/src.ts/providers/provider-jsonrpc.ts @@ -935,7 +935,7 @@ export abstract class JsonRpcApiProvider extends AbstractProvider { case "estimateGas": { return { method: "eth_estimateGas", - args: [ this.getRpcTransaction(req.transaction) ] + args: [ this.getRpcTransaction(req.transaction), req.blockTag ] }; }