Skip to content

Commit 3327765

Browse files
committedNov 6, 2023
Minor fixes for bigint blocktags
1 parent d964ca1 commit 3327765

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed
 

‎packages/hardhat-ethers/src/internal/hardhat-ethers-provider.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -597,11 +597,13 @@ export class HardhatEthersProvider implements ethers.Provider {
597597
return this.getBlockNumber().then((b) => toQuantity(b + blockTag));
598598
}
599599

600-
if (typeof blockTag === 'bigint') {
601-
if (Number(blockTag) >= 0) {
602-
return toQuantity(Number(blockTag));
600+
if (typeof blockTag === "bigint") {
601+
if (blockTag >= 0n) {
602+
return toQuantity(blockTag);
603603
}
604-
return this.getBlockNumber().then((b) => toQuantity(b + Number(blockTag)));
604+
return this.getBlockNumber().then((b) =>
605+
toQuantity(b + Number(blockTag))
606+
);
605607
}
606608

607609
throw new HardhatEthersError(`Invalid blockTag: ${blockTag}`);

0 commit comments

Comments
 (0)
Please sign in to comment.