diff --git a/src/node/client.ts b/src/node/client.ts index 1e92914..45f402d 100644 --- a/src/node/client.ts +++ b/src/node/client.ts @@ -28,14 +28,8 @@ interface Config extends BaseClientOptions { } export default class Client extends BaseClient { - async sync(): Promise { - await super.sync(); - - this.subscribe(); - } private beaconUrl: string; - private blockCache = new NodeCache({ stdTTL: 60 * 60 * 12 }); - private blockHashCache = new NodeCache({ stdTTL: 60 * 60 * 12 }); + private http: AxiosInstance = consensusClient; constructor(config: Config) { super(config); @@ -48,7 +42,17 @@ export default class Client extends BaseClient { this.http.defaults.baseURL = this.beaconUrl; } - private http: AxiosInstance = consensusClient; + private _latestOptimisticUpdate: any; + + get latestOptimisticUpdate(): any { + return this._latestOptimisticUpdate; + } + + async sync(): Promise { + await super.sync(); + + this.subscribe(); + } async syncProver( startPeriod: number, @@ -106,6 +110,8 @@ export default class Client extends BaseClient { return null; } + this._latestOptimisticUpdate = updateJSON; + return { blockHash: toHexString(update.attestedHeader.execution.blockHash), blockNumber: update.attestedHeader.execution.blockNumber,