feat: add getCurrentBlock and getLastBlock methods

This commit is contained in:
Derrick Hammer 2023-07-13 04:31:55 -04:00
parent 256f29b692
commit 661e146636
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 13 additions and 0 deletions

View File

@ -77,6 +77,19 @@ export default abstract class BaseClient {
);
}
public getCurrentBlock(): number {
return getCurrentSlot(this.config.chainConfig, this.genesisTime);
}
public getLastBlock(): number | null {
if (this._latestOptimisticUpdate) {
return capella.ssz.LightClientOptimisticUpdate.deserialize(
this._latestOptimisticUpdate,
).attestedHeader.beacon.slot;
}
return null;
}
public async getNextValidExecutionInfo(
retry: number = 10,
): Promise<ExecutionInfo> {