2022-09-04 23:32:16 +00:00
|
|
|
pub mod mock_rpc;
|
|
|
|
pub mod nimbus_rpc;
|
|
|
|
|
|
|
|
use async_trait::async_trait;
|
|
|
|
use eyre::Result;
|
|
|
|
|
|
|
|
use crate::types::{BeaconBlock, Bootstrap, FinalityUpdate, OptimisticUpdate, Update};
|
|
|
|
|
2022-11-02 03:52:28 +00:00
|
|
|
// implements https://github.com/ethereum/beacon-APIs/tree/master/apis/beacon/light_client
|
2022-09-04 23:32:16 +00:00
|
|
|
#[async_trait]
|
2022-11-02 03:52:28 +00:00
|
|
|
pub trait ConsensusRpc {
|
2022-09-04 23:32:16 +00:00
|
|
|
fn new(path: &str) -> Self;
|
|
|
|
async fn get_bootstrap(&self, block_root: &Vec<u8>) -> Result<Bootstrap>;
|
2022-11-08 21:24:55 +00:00
|
|
|
async fn get_updates(&self, period: u64, count: u8) -> Result<Vec<Update>>;
|
2022-09-04 23:32:16 +00:00
|
|
|
async fn get_finality_update(&self) -> Result<FinalityUpdate>;
|
|
|
|
async fn get_optimistic_update(&self) -> Result<OptimisticUpdate>;
|
|
|
|
async fn get_block(&self, slot: u64) -> Result<BeaconBlock>;
|
|
|
|
}
|