feat: enable blocktag for estimategas
This commit is contained in:
parent
ad5f1c5fc7
commit
62542d0680
@ -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");
|
||||
}
|
||||
|
||||
|
@ -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 ]
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user