Trait WalletSource

Source
pub trait WalletSource {
    // Required methods
    fn list_confirmed_utxos<'a>(&'a self) -> AsyncResult<'a, Vec<Utxo>, ()>;
    fn get_change_script<'a>(&'a self) -> AsyncResult<'a, ScriptBuf, ()>;
    fn sign_psbt<'a>(&'a self, psbt: Psbt) -> AsyncResult<'a, Transaction, ()>;
}
Expand description

An alternative to CoinSelectionSource that can be implemented and used along Wallet to provide a default implementation to CoinSelectionSource.

For a synchronous version of this trait, see sync::WalletSourceSync.

This is not exported to bindings users as async is only supported in Rust.

Required Methods§

Source

fn list_confirmed_utxos<'a>(&'a self) -> AsyncResult<'a, Vec<Utxo>, ()>

Returns all UTXOs, with at least 1 confirmation each, that are available to spend.

Source

fn get_change_script<'a>(&'a self) -> AsyncResult<'a, ScriptBuf, ()>

Returns a script to use for change above dust resulting from a successful coin selection attempt.

Source

fn sign_psbt<'a>(&'a self, psbt: Psbt) -> AsyncResult<'a, Transaction, ()>

Signs and provides the full TxIn::script_sig and TxIn::witness for all inputs within the transaction known to the wallet (i.e., any provided via WalletSource::list_confirmed_utxos).

If your wallet does not support signing PSBTs you can call psbt.extract_tx() to get the unsigned transaction and then sign it with your wallet.

Implementors§