logo
pub trait DescriptorTemplate {
    fn build(self) -> Result<DescriptorTemplateOut, DescriptorError>;
}
Expand description

Trait for descriptor templates that can be built into a full descriptor

Since IntoWalletDescriptor is implemented for any DescriptorTemplate, they can also be passed directly to the Wallet constructor.

Example

use bdk::descriptor::error::Error as DescriptorError;
use bdk::keys::{IntoDescriptorKey, KeyError};
use bdk::miniscript::Legacy;
use bdk::template::{DescriptorTemplate, DescriptorTemplateOut};

struct MyP2PKH<K: IntoDescriptorKey<Legacy>>(K);

impl<K: IntoDescriptorKey<Legacy>> DescriptorTemplate for MyP2PKH<K> {
    fn build(self) -> Result<DescriptorTemplateOut, DescriptorError> {
        Ok(bdk::descriptor!(pkh(self.0))?)
    }
}

Required methods

Build the complete descriptor

Implementors