use crate::error::Error;
use ark_core::UtxoCoinSelection;
use bitcoin::Address;
use bitcoin::Amount;
use bitcoin::FeeRate;
use bitcoin::Psbt;
use std::future::Future;
pub trait OnchainWallet {
fn get_onchain_address(&self) -> Result<Address, Error>;
fn sync(&self) -> impl Future<Output = Result<(), Error>>;
fn balance(&self) -> Result<Balance, Error>;
fn prepare_send_to_address(
&self,
address: Address,
amount: Amount,
fee_rate: FeeRate,
) -> Result<Psbt, Error>;
fn sign(&self, psbt: &mut Psbt) -> Result<bool, Error>;
fn select_coins(&self, target_amount: Amount) -> Result<UtxoCoinSelection, Error>;
}
#[derive(Debug, Clone, Copy)]
pub struct Balance {
pub immature: Amount,
pub trusted_pending: Amount,
pub untrusted_pending: Amount,
pub confirmed: Amount,
}