diff --git a/src/validator/rpc/interface.ts b/src/validator/rpc/interface.ts new file mode 100644 index 000000000000..b6fef94bc890 --- /dev/null +++ b/src/validator/rpc/interface.ts @@ -0,0 +1,44 @@ +import {BeaconAPI} from "../../rpc/api"; +import {AttestationData, BeaconState, Slot} from "../../types"; + +export interface RpcClient { + + beacon: BeaconAPI; + + //validator: ValidatorAPI + + /** + * Initiates connection to rpc server. + */ + connect(): Promise; + + /** + * Destroys connection to rpc server. + */ + disconnect(): Promise; + + /** + * Invokes callback on new slot. + * Depending on implementation it will poll for new slot or getting notified(Websockets) + * @param cb + */ + onNewSlot(cb: (slot: Slot) => void); + + + /** + * Invokes callback on new head block. + * Depending on implementation it will poll for new head block or getting notified(Websockets) + * @param cb + */ + onNewBeaconState(cb: (state: BeaconState) => void); + + /** + * Invokes callback on new attestation data. + * Depending on implementation it will poll for attestation data or getting notified(Websockets) + * @param cb + */ + onNewAttestation(cb: (attestation: AttestationData) => void); + + + +}