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) # [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", "name": "@lumeweb/libethclient",
"version": "0.1.0-develop.24", "version": "0.1.0-develop.25",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "@lumeweb/libethclient", "name": "@lumeweb/libethclient",
"version": "0.1.0-develop.24", "version": "0.1.0-develop.25",
"dependencies": { "dependencies": {
"@chainsafe/as-sha256": "^0.3.1", "@chainsafe/as-sha256": "^0.3.1",
"@chainsafe/bls": "7.1.1", "@chainsafe/bls": "7.1.1",

View File

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

View File

@ -28,14 +28,8 @@ interface Config extends BaseClientOptions {
} }
export default class Client extends BaseClient { export default class Client extends BaseClient {
async sync(): Promise<void> {
await super.sync();
this.subscribe();
}
private beaconUrl: string; private beaconUrl: string;
private blockCache = new NodeCache({ stdTTL: 60 * 60 * 12 }); private http: AxiosInstance = consensusClient;
private blockHashCache = new NodeCache({ stdTTL: 60 * 60 * 12 });
constructor(config: Config) { constructor(config: Config) {
super(config); super(config);
@ -48,7 +42,17 @@ export default class Client extends BaseClient {
this.http.defaults.baseURL = this.beaconUrl; 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( async syncProver(
startPeriod: number, startPeriod: number,
@ -106,6 +110,8 @@ export default class Client extends BaseClient {
return null; return null;
} }
this._latestOptimisticUpdate = updateJSON;
return { return {
blockHash: toHexString(update.attestedHeader.execution.blockHash), blockHash: toHexString(update.attestedHeader.execution.blockHash),
blockNumber: update.attestedHeader.execution.blockNumber, blockNumber: update.attestedHeader.execution.blockNumber,