use crate::{SignetCallBundle, SignetCallBundleResponse};
use alloy::{network::Network, providers::Provider, transports::TransportResult};
use core::future::Future;
pub trait SignetBundleApi<N: Network = alloy::network::Ethereum>: Send + Sync {
fn call_bundle(
&self,
bundle: SignetCallBundle,
) -> impl Future<Output = TransportResult<SignetCallBundleResponse>> + Send;
}
impl<N, P> SignetBundleApi<N> for P
where
N: Network,
P: Provider<N>,
{
async fn call_bundle(
&self,
bundle: SignetCallBundle,
) -> TransportResult<SignetCallBundleResponse> {
self.client().request("signet_callBundle", (bundle,)).await
}
}
#[cfg(test)]
mod tests {
use super::*;
use alloy::network::Ethereum;
use alloy::providers::RootProvider;
#[allow(dead_code)]
const fn assert_impl<T: SignetBundleApi>() {}
const _: () = assert_impl::<RootProvider<Ethereum>>();
}