stratus::eth::external_rpc

Trait ExternalRpc

Source
pub trait ExternalRpc: Send + Sync {
    // Required methods
    async fn read_max_block_number_in_range(
        &self,
        start: BlockNumber,
        end: BlockNumber,
    ) -> Result<Option<BlockNumber>>;
    async fn read_block_and_receipts_in_range(
        &self,
        start: BlockNumber,
        end: BlockNumber,
    ) -> Result<Vec<ExternalBlockWithReceipts>>;
    async fn read_initial_accounts(&self) -> Result<Vec<Account>>;
    async fn save_initial_account(
        &self,
        address: Address,
        balance: Wei,
    ) -> Result<()>;
    async fn save_block_and_receipts(
        &self,
        number: BlockNumber,
        block: JsonValue,
        receipts: Vec<(Hash, ExternalReceipt)>,
    ) -> Result<()>;
}

Required Methods§

Source

async fn read_max_block_number_in_range( &self, start: BlockNumber, end: BlockNumber, ) -> Result<Option<BlockNumber>>

Read the largest block number saved inside a block range.

Source

async fn read_block_and_receipts_in_range( &self, start: BlockNumber, end: BlockNumber, ) -> Result<Vec<ExternalBlockWithReceipts>>

Read all blocks and its receipts inside a block range.

Source

async fn read_initial_accounts(&self) -> Result<Vec<Account>>

Read all initial accounts saved.

Source

async fn save_initial_account( &self, address: Address, balance: Wei, ) -> Result<()>

Saves an initial account with its starting balance.

Source

async fn save_block_and_receipts( &self, number: BlockNumber, block: JsonValue, receipts: Vec<(Hash, ExternalReceipt)>, ) -> Result<()>

Save an external block and its receipts to the storage.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§