fuel_core_shared_sequencer/
ports.rs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//! Ports used by the shared sequencer to access the outside world

use cosmrs::crypto::PublicKey;
use fuel_core_services::stream::BoxStream;
use fuel_core_types::{
    fuel_crypto::Signature,
    services::block_importer::SharedImportResult,
};

/// A signer that can sign arbitrary data
#[async_trait::async_trait]
pub trait Signer: Send + Sync {
    /// Sign data using a key
    async fn sign(&self, data: &[u8]) -> anyhow::Result<Signature>;
    /// Get the public key of the signer. Panics if the key is not available.
    fn public_key(&self) -> PublicKey;
    /// Check if the signer is available
    fn is_available(&self) -> bool;
}

/// Provider of the blocks.
pub trait BlocksProvider {
    /// Subscribe to new blocks.
    fn subscribe(&self) -> BoxStream<SharedImportResult>;
}