Trait Signer

Source
pub trait Signer {
    // Required methods
    fn sign_raw_transaction_with_wallet(
        &self,
        tx: &Transaction,
        prev_outputs: Option<Vec<PreviousTransactionOutput>>,
    ) -> impl Future<Output = ClientResult<SignRawTransactionWithWallet>> + Send;
    fn get_xpriv(
        &self,
    ) -> impl Future<Output = ClientResult<Option<Xpriv>>> + Send;
    fn import_descriptors(
        &self,
        descriptors: Vec<ImportDescriptor>,
        wallet_name: String,
    ) -> impl Future<Output = ClientResult<Vec<ImportDescriptorResult>>> + Send;
}
Expand description

Signing functionality that any Bitcoin client with private keys that interacts with the Bitcoin network should provide.

§Note

This is a fully async trait. The user should be responsible for handling the async nature of the trait methods. And if implementing this trait for a specific type that is not async, the user should consider wrapping with tokio’s spawn_blocking or any other method.

Required Methods§

Source

fn sign_raw_transaction_with_wallet( &self, tx: &Transaction, prev_outputs: Option<Vec<PreviousTransactionOutput>>, ) -> impl Future<Output = ClientResult<SignRawTransactionWithWallet>> + Send

Signs a transaction using the keys available in the underlying Bitcoin client’s wallet and returns a signed transaction.

§Note

The returned signed transaction might not be consensus-valid if it requires additional signatures, such as in a multisignature context.

Source

fn get_xpriv(&self) -> impl Future<Output = ClientResult<Option<Xpriv>>> + Send

Gets the underlying Xpriv from the wallet.

Source

fn import_descriptors( &self, descriptors: Vec<ImportDescriptor>, wallet_name: String, ) -> impl Future<Output = ClientResult<Vec<ImportDescriptorResult>>> + Send

Imports the descriptors into the wallet.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§