use alloy::{
primitives::{Address, Bytes, U256},
rpc::types::Authorization,
};
use alloy_sol_types::Eip712Domain;
pub mod simple_7702_smart_account;
pub mod simple_smart_account;
#[cfg_attr(native, async_trait::async_trait)]
#[cfg_attr(wasm, async_trait::async_trait(?Send))]
pub trait SmartAccount {
type Call;
fn address(&self) -> Address;
fn entry_point(&self) -> Address;
fn domain(&self) -> Eip712Domain;
async fn nonce(&self) -> Result<U256, SmartAccountError>;
async fn authorization(&self) -> Result<Authorization, SmartAccountError>;
fn dummy_signature(&self) -> Bytes;
fn abi_encode_call(call_data: &Self::Call) -> Bytes;
}
#[derive(Debug, thiserror::Error)]
#[non_exhaustive]
pub enum SmartAccountError {
#[error("Provider error: {0}")]
ProviderError(#[from] alloy::transports::RpcError<alloy::transports::TransportErrorKind>),
#[error(transparent)]
Other(#[from] anyhow::Error),
}