trident-evm-aa 0.5.0

Rust glue for the Trident minimal EIP-7702 smart account: deploy, install, and batch transactions.
Documentation
//! Install an EIP-7702 delegation on your EOA using the crate's default target.
//!
//! ```sh
//! export RPC_URL=https://...
//! export PRIVATE_KEY=0x...
//! cargo run --example install -p trident-evm-aa
//! ```

#![allow(clippy::print_stdout)]

use alloy_network::{AnyNetwork, ReceiptResponse};
use alloy_provider::ProviderBuilder;
use alloy_signer_local::PrivateKeySigner;
use trident_evm_aa::eip7702_installer::SelfInstaller;

#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
    let rpc_url = std::env::var("RPC_URL")?;
    let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")?.parse()?;

    let provider = ProviderBuilder::new()
        .network::<AnyNetwork>()
        .with_simple_nonce_management() // self-install double-bumps the nonce
        .wallet(signer.clone())
        .connect_http(rpc_url.parse()?);

    let tx_hash = SelfInstaller::new()
        .install(provider, &signer)
        .await?
        .get_receipt()
        .await?
        .transaction_hash();
    println!("install tx: {tx_hash}");

    Ok(())
}