-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: client and search params in evm provider constructor
- Loading branch information
Showing
5 changed files
with
158 additions
and
58 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { Block } from "viem"; | ||
|
||
export class LastBlockEpoch extends Error { | ||
constructor(block: Block) { | ||
super( | ||
`Cannot specify the start of the epoch with the last block only (number: ${block.number}), wait for it to be finalized.`, | ||
); | ||
|
||
this.name = "LastBlockEpoch"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
export class UnexpectedSearchRange extends Error { | ||
constructor(low: bigint, high: bigint) { | ||
super( | ||
`Lower bound of search range (${low}) must be less than or equal to upper bound (${high})`, | ||
); | ||
|
||
this.name = "UnexpectedSearchRange"; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
export interface BlockNumberProvider { | ||
/** | ||
* Get the epoch block number on a chain at a specific timestamp. | ||
* Get the block number corresponding to the beginning of the epoch. | ||
* | ||
* The input timestamp falls between the timestamps of the found block and | ||
* the immediately following block. | ||
* | ||
* @param timestamp UTC timestamp in ms since UNIX epoch | ||
* @param url url of the chain data provider | ||
* | ||
* @returns the corresponding block number of a chain at a specific timestamp | ||
*/ | ||
getEpochBlockNumber(timestamp: number, searchParams: unknown): Promise<bigint>; | ||
getEpochBlockNumber(timestamp: number): Promise<bigint>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters