feat: enable blocktag for estimategas

This commit is contained in:
theforager 2024-02-17 15:43:41 -06:00
parent ad5f1c5fc7
commit 62542d0680
2 changed files with 7 additions and 4 deletions

View File

@ -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<bigint> {
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");
}

View File

@ -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 ]
};
}