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
|
2023-01-31 02:38:46 +00:00
|
|
|
#[cfg_attr(not(target_arch = "wasm32"), async_trait)]
|
|
|
|
#[cfg_attr(target_arch = "wasm32", async_trait(?Send))]
|
2023-02-23 09:18:09 +00:00
|
|
|
pub trait ConsensusNetworkInterface {
|
2022-09-04 23:32:16 +00:00
|
|
|
fn new(path: &str) -> Self;
|
2022-11-30 01:31:25 +00:00
|
|
|
async fn get_bootstrap(&self, block_root: &'_ [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>;
|
2023-01-23 15:07:11 +00:00
|
|
|
async fn chain_id(&self) -> Result<u64>;
|
2022-09-04 23:32:16 +00:00
|
|
|
}
|