diff --git a/src.ts/providers/abstract-provider.ts b/src.ts/providers/abstract-provider.ts index 511db792f3..c53c4b6a2b 100644 --- a/src.ts/providers/abstract-provider.ts +++ b/src.ts/providers/abstract-provider.ts @@ -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 + blockTag)); } assertArgument(false, "invalid blockTag", "blockTag", blockTag); diff --git a/src.ts/providers/provider.ts b/src.ts/providers/provider.ts index 528a75b477..5731f8fea8 100644 --- a/src.ts/providers/provider.ts +++ b/src.ts/providers/provider.ts @@ -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,