#[cfg(doc)]
use crate::Filler;
use crate::OrdersAndFills;
#[cfg(doc)]
use alloy::providers::fillers::FillProvider;
use alloy::{
network::{Ethereum, Network},
providers::{fillers::FillerControlFlow, Provider, SendableTx},
transports::TransportResult,
};
use core::future::Future;
use futures_util::Stream;
use signet_bundle::SignetEthBundle;
#[cfg(doc)]
use signet_types::SignedFill;
use signet_types::SignedOrder;
pub trait OrderSubmitter {
type Error: core::error::Error + Send + Sync + 'static;
fn submit_order(
&self,
order: SignedOrder,
) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
pub trait OrderSource {
type Error: core::error::Error + Send + Sync + 'static;
fn get_orders(&self) -> impl Stream<Item = Result<SignedOrder, Self::Error>> + Send;
}
pub trait BundleSubmitter {
type Response;
type Error: core::error::Error + Send + Sync + 'static;
fn submit_bundle(
&self,
bundle: SignetEthBundle,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
}
pub trait TxBuilder<N: Network = Ethereum>: Provider<N> + Send + Sync {
fn fill(
&self,
tx: N::TransactionRequest,
) -> impl Future<Output = TransportResult<SendableTx<N>>> + Send;
fn status(&self, tx: &N::TransactionRequest) -> FillerControlFlow;
}
pub trait FillSubmitter {
type Response;
type Error: core::error::Error + Send + Sync + 'static;
fn submit_fills(
&self,
orders_and_fills: OrdersAndFills,
target_block_count: u8,
) -> impl Future<Output = Result<Self::Response, Self::Error>> + Send;
}