Compare commits

..

3 Commits

4 changed files with 19 additions and 11 deletions

View File

@ -1,3 +1,5 @@
# [0.1.0-develop.25](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.24...v0.1.0-develop.25) (2023-07-12)
# [0.1.0-develop.24](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.23...v0.1.0-develop.24) (2023-07-11)

4
npm-shrinkwrap.json generated
View File

@ -1,12 +1,12 @@
{
"name": "@lumeweb/libethclient",
"version": "0.1.0-develop.24",
"version": "0.1.0-develop.25",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "@lumeweb/libethclient",
"version": "0.1.0-develop.24",
"version": "0.1.0-develop.25",
"dependencies": {
"@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1",

View File

@ -1,6 +1,6 @@
{
"name": "@lumeweb/libethsync",
"version": "0.1.0-develop.24",
"version": "0.1.0-develop.25",
"type": "module",
"repository": {
"type": "git",

View File

@ -28,14 +28,8 @@ interface Config extends BaseClientOptions {
}
export default class Client extends BaseClient {
async sync(): Promise<void> {
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<void> {
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,