pub enum DescriptorKey {
Single(PublicKey),
Xpub {
xpub: ExtendedPublicKey,
origin: Option<KeyOrigin>,
derivation: Vec<ChildNumber>,
wildcard: Wildcard,
},
Xprv {
xprv: ExtendedPrivateKey,
origin: Option<KeyOrigin>,
derivation: Vec<ChildNumber>,
wildcard: Wildcard,
},
}Expand description
A key expression in a descriptor
Variants§
Single(PublicKey)
Raw public key (compressed, 33 bytes)
Xpub
Extended public key with optional origin and derivation
Fields
§
xpub: ExtendedPublicKeyThe extended public key
§
derivation: Vec<ChildNumber>Additional derivation path after xpub
Xprv
Extended private key with optional origin and derivation
Fields
§
xprv: ExtendedPrivateKeyThe extended private key
§
derivation: Vec<ChildNumber>Additional derivation path after xprv
Implementations§
Source§impl DescriptorKey
impl DescriptorKey
Sourcepub fn from_public_key(pubkey: PublicKey) -> Self
pub fn from_public_key(pubkey: PublicKey) -> Self
Create from a single public key
Sourcepub fn from_xpub(xpub: ExtendedPublicKey) -> Self
pub fn from_xpub(xpub: ExtendedPublicKey) -> Self
Create from an extended public key
Sourcepub fn from_xprv(xprv: ExtendedPrivateKey) -> Self
pub fn from_xprv(xprv: ExtendedPrivateKey) -> Self
Create from an extended private key
Sourcepub fn has_wildcard(&self) -> bool
pub fn has_wildcard(&self) -> bool
Check if this key has a wildcard
Sourcepub fn derive_public_key(
&self,
index: u32,
) -> Result<PublicKey, DescriptorError>
pub fn derive_public_key( &self, index: u32, ) -> Result<PublicKey, DescriptorError>
Derive the public key at a specific index (for wildcards)
Sourcepub fn public_key(&self) -> Result<PublicKey, DescriptorError>
pub fn public_key(&self) -> Result<PublicKey, DescriptorError>
Get the public key (for non-wildcard keys)
Trait Implementations§
Source§impl Clone for DescriptorKey
impl Clone for DescriptorKey
Source§fn clone(&self) -> DescriptorKey
fn clone(&self) -> DescriptorKey
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 moreSource§impl Debug for DescriptorKey
impl Debug for DescriptorKey
Auto Trait Implementations§
impl Freeze for DescriptorKey
impl RefUnwindSafe for DescriptorKey
impl Send for DescriptorKey
impl Sync for DescriptorKey
impl Unpin for DescriptorKey
impl UnwindSafe for DescriptorKey
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