Compare commits
3 Commits
v0.1.0-dev
...
v0.1.0-dev
Author | SHA1 | Date |
---|---|---|
semantic-release-bot | ed3cb23388 | |
Derrick Hammer | 432d4937a1 | |
Derrick Hammer | 232af830c9 |
|
@ -1,3 +1,10 @@
|
||||||
|
# [0.1.0-develop.43](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.42...v0.1.0-develop.43) (2023-07-23)
|
||||||
|
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* use event emitter and emit "update" on every light client update processed ([232af83](https://git.lumeweb.com/LumeWeb/libethsync/commit/232af830c9c844fa5b6f2e5b4c50c2f0a067188e))
|
||||||
|
|
||||||
# [0.1.0-develop.42](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.41...v0.1.0-develop.42) (2023-07-15)
|
# [0.1.0-develop.42](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.41...v0.1.0-develop.42) (2023-07-15)
|
||||||
|
|
||||||
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-07-14)
|
# [0.1.0-develop.41](https://git.lumeweb.com/LumeWeb/libethsync/compare/v0.1.0-develop.40...v0.1.0-develop.41) (2023-07-14)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libethclient",
|
"name": "@lumeweb/libethsync",
|
||||||
"version": "0.1.0-develop.42",
|
"version": "0.1.0-develop.43",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@lumeweb/libethclient",
|
"name": "@lumeweb/libethsync",
|
||||||
"version": "0.1.0-develop.42",
|
"version": "0.1.0-develop.43",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@chainsafe/as-sha256": "^0.3.1",
|
"@chainsafe/as-sha256": "^0.3.1",
|
||||||
"@chainsafe/bls": "7.1.1",
|
"@chainsafe/bls": "7.1.1",
|
||||||
|
@ -28,6 +28,7 @@
|
||||||
"axios-retry": "^3.5.1",
|
"axios-retry": "^3.5.1",
|
||||||
"detect-node": "^2.1.0",
|
"detect-node": "^2.1.0",
|
||||||
"ethereum-cryptography": "^2.0.0",
|
"ethereum-cryptography": "^2.0.0",
|
||||||
|
"events": "^3.3.0",
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"rlp": "^3.0.0",
|
"rlp": "^3.0.0",
|
||||||
"web3-types": "^1.0.1"
|
"web3-types": "^1.0.1"
|
||||||
|
@ -8734,7 +8735,6 @@
|
||||||
"version": "3.3.0",
|
"version": "3.3.0",
|
||||||
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
"resolved": "https://registry.npmjs.org/events/-/events-3.3.0.tgz",
|
||||||
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
"integrity": "sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q==",
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=0.8.x"
|
"node": ">=0.8.x"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lumeweb/libethsync",
|
"name": "@lumeweb/libethsync",
|
||||||
"version": "0.1.0-develop.42",
|
"version": "0.1.0-develop.43",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -47,6 +47,7 @@
|
||||||
"axios-retry": "^3.5.1",
|
"axios-retry": "^3.5.1",
|
||||||
"detect-node": "^2.1.0",
|
"detect-node": "^2.1.0",
|
||||||
"ethereum-cryptography": "^2.0.0",
|
"ethereum-cryptography": "^2.0.0",
|
||||||
|
"events": "^3.3.0",
|
||||||
"node-cache": "^5.1.2",
|
"node-cache": "^5.1.2",
|
||||||
"rlp": "^3.0.0",
|
"rlp": "^3.0.0",
|
||||||
"web3-types": "^1.0.1"
|
"web3-types": "^1.0.1"
|
||||||
|
|
|
@ -20,6 +20,7 @@ import {
|
||||||
} from "#types.js";
|
} from "#types.js";
|
||||||
import { assertValidLightClientUpdate } from "@lodestar/light-client/validation";
|
import { assertValidLightClientUpdate } from "@lodestar/light-client/validation";
|
||||||
import * as capella from "@lodestar/types/capella";
|
import * as capella from "@lodestar/types/capella";
|
||||||
|
import { EventEmitter } from "events";
|
||||||
|
|
||||||
export interface BaseClientOptions {
|
export interface BaseClientOptions {
|
||||||
prover: IProver;
|
prover: IProver;
|
||||||
|
@ -30,7 +31,7 @@ export interface BaseClientOptions {
|
||||||
loggerErr: (...any) => void;
|
loggerErr: (...any) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export default abstract class BaseClient {
|
export default abstract class BaseClient extends EventEmitter {
|
||||||
protected latestCommittee?: Uint8Array[];
|
protected latestCommittee?: Uint8Array[];
|
||||||
protected latestBlockHash?: string;
|
protected latestBlockHash?: string;
|
||||||
protected config: ClientConfig = getDefaultClientConfig();
|
protected config: ClientConfig = getDefaultClientConfig();
|
||||||
|
@ -45,6 +46,7 @@ export default abstract class BaseClient {
|
||||||
private optimisticMutex = new Mutex();
|
private optimisticMutex = new Mutex();
|
||||||
|
|
||||||
constructor(options: BaseClientOptions) {
|
constructor(options: BaseClientOptions) {
|
||||||
|
super();
|
||||||
this.options = options;
|
this.options = options;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,6 +145,8 @@ export default abstract class BaseClient {
|
||||||
|
|
||||||
startCommittee = validOrCommittee as Uint8Array[];
|
startCommittee = validOrCommittee as Uint8Array[];
|
||||||
|
|
||||||
|
this.emit("update", update);
|
||||||
|
|
||||||
if (this.options.syncDelay) {
|
if (this.options.syncDelay) {
|
||||||
await new Promise((resolve) =>
|
await new Promise((resolve) =>
|
||||||
setTimeout(resolve, this.options.syncDelay),
|
setTimeout(resolve, this.options.syncDelay),
|
||||||
|
|
Loading…
Reference in New Issue