pub enum Descriptor {
Pkh(DescriptorKey),
Wpkh(DescriptorKey),
ShWpkh(DescriptorKey),
Tr(DescriptorKey),
Raw(Vec<u8>),
OpReturn(Vec<u8>),
}Expand description
A Bitcoin output script descriptor.
Variants§
Pkh(DescriptorKey)
BIP-381: Pay to Public Key Hash — pkh(KEY).
Wpkh(DescriptorKey)
BIP-382: Pay to Witness Public Key Hash — wpkh(KEY).
ShWpkh(DescriptorKey)
BIP-381: Pay to Script Hash wrapping wpkh — sh(wpkh(KEY)).
Tr(DescriptorKey)
BIP-386: Pay to Taproot — tr(KEY) (key-path only).
Raw(Vec<u8>)
Raw script — raw(HEX).
OpReturn(Vec<u8>)
OP_RETURN data — raw(6a...).
Implementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn pkh(key: DescriptorKey) -> Self
pub fn pkh(key: DescriptorKey) -> Self
Create a pkh(KEY) descriptor (BIP-381).
Sourcepub fn wpkh(key: DescriptorKey) -> Self
pub fn wpkh(key: DescriptorKey) -> Self
Create a wpkh(KEY) descriptor (BIP-382).
Sourcepub fn sh_wpkh(key: DescriptorKey) -> Self
pub fn sh_wpkh(key: DescriptorKey) -> Self
Create a sh(wpkh(KEY)) descriptor (BIP-381).
Sourcepub fn tr(key: DescriptorKey) -> Self
pub fn tr(key: DescriptorKey) -> Self
Create a tr(KEY) descriptor (BIP-386, key-path only).
Sourcepub fn script_pubkey(&self) -> Result<Vec<u8>, SignerError>
pub fn script_pubkey(&self) -> Result<Vec<u8>, SignerError>
Compute the scriptPubKey for this descriptor.
Sourcepub fn address(&self, hrp: &str) -> Result<String, SignerError>
pub fn address(&self, hrp: &str) -> Result<String, SignerError>
Generate the Bitcoin address for this descriptor.
Sourcepub fn to_string_repr(&self) -> String
pub fn to_string_repr(&self) -> String
Convert the descriptor to its string representation.
Sourcepub fn to_string_with_checksum(&self) -> String
pub fn to_string_with_checksum(&self) -> String
Get the full descriptor string with checksum.
Trait Implementations§
Source§impl Clone for Descriptor
impl Clone for Descriptor
Source§fn clone(&self) -> Descriptor
fn clone(&self) -> Descriptor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Descriptor
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnsafeUnpin for Descriptor
impl UnwindSafe for Descriptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more