Allow BigInt for blockTag (#3780).
This commit is contained in:
parent
f1a810dcb5
commit
fe1f04c6e5
@ -537,10 +537,14 @@ export class AbstractProvider implements Provider {
|
||||
return toQuantity(blockTag);
|
||||
}
|
||||
|
||||
if (typeof(blockTag) === "bigint") {
|
||||
blockTag = getNumber(blockTag, "blockTag");
|
||||
}
|
||||
|
||||
if (typeof(blockTag) === "number") {
|
||||
if (blockTag >= 0) { return toQuantity(blockTag); }
|
||||
if (this.#lastBlockNumber >= 0) { return toQuantity(this.#lastBlockNumber + blockTag); }
|
||||
return this.getBlockNumber().then((b) => toQuantity(b + blockTag));
|
||||
return this.getBlockNumber().then((b) => toQuantity(b + <number>blockTag));
|
||||
}
|
||||
|
||||
assertArgument(false, "invalid blockTag", "blockTag", blockTag);
|
||||
|
@ -16,7 +16,7 @@ import type { Network } from "./network.js";
|
||||
|
||||
const BN_0 = BigInt(0);
|
||||
|
||||
export type BlockTag = number | string;
|
||||
export type BlockTag = BigNumberish | string;
|
||||
|
||||
import {
|
||||
BlockParams, LogParams, TransactionReceiptParams,
|
||||
|
Loading…
Reference in New Issue
Block a user