#[tokio::main]
#[cfg(feature = "yubi")]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
use ethers::{prelude::*, utils::parse_ether};
use yubihsm::{Connector, Credentials, UsbConfig};
let provider = Provider::new(Ws::connect("ws://localhost:8545").await?);
let connector = Connector::usb(&UsbConfig::default());
let wallet = YubiWallet::connect(connector, Credentials::default(), 0);
let client = SignerMiddleware::new(provider, wallet);
let tx = TransactionRequest::new().to("vitalik.eth").value(parse_ether(10)?);
let pending_tx = client.send_transaction(tx, None).await?;
let _receipt = pending_tx.confirmations(3).await?;
Ok(())
}
#[cfg(not(feature = "yubi"))]
fn main() {}