pub enum DescriptorPublicKey {
Single(SinglePub),
XPub(DescriptorXKey<Xpub>),
MultiXPub(DescriptorMultiXKey<Xpub>),
}
Expand description
The descriptor pubkey, either a single pubkey or an xpub.
Variants§
Single(SinglePub)
Single public key.
XPub(DescriptorXKey<Xpub>)
Extended public key (xpub).
MultiXPub(DescriptorMultiXKey<Xpub>)
Multiple extended public keys.
Implementations§
source§impl DescriptorPublicKey
impl DescriptorPublicKey
sourcepub fn master_fingerprint(&self) -> Fingerprint
pub fn master_fingerprint(&self) -> Fingerprint
The fingerprint of the master key associated with this key, 0x00000000
if none.
sourcepub fn full_derivation_path(&self) -> Option<DerivationPath>
pub fn full_derivation_path(&self) -> Option<DerivationPath>
Full path, from the master key
For wildcard keys this will return the path up to the wildcard, so you can get full paths by appending one additional derivation step, according to the wildcard type (hardened or normal).
For multipath extended keys, this returns None
.
sourcepub fn full_derivation_paths(&self) -> Vec<DerivationPath>
pub fn full_derivation_paths(&self) -> Vec<DerivationPath>
Returns a vector containing the full derivation paths from the master key. The vector will contain just one element for single keys, and multiple elements for multipath extended keys.
For wildcard keys this will return the path up to the wildcard, so you can get full paths by appending one additional derivation step, according to the wildcard type (hardened or normal).
sourcepub fn is_deriveable(&self) -> bool
👎Deprecated: use has_wildcard instead
pub fn is_deriveable(&self) -> bool
Whether or not the key has a wildcard
sourcepub fn has_wildcard(&self) -> bool
pub fn has_wildcard(&self) -> bool
Whether or not the key has a wildcard
sourcepub fn derive(
self,
index: u32
) -> Result<DefiniteDescriptorKey, ConversionError>
👎Deprecated: use at_derivation_index instead
pub fn derive( self, index: u32 ) -> Result<DefiniteDescriptorKey, ConversionError>
Deprecated name for Self::at_derivation_index
.
sourcepub fn at_derivation_index(
self,
index: u32
) -> Result<DefiniteDescriptorKey, ConversionError>
pub fn at_derivation_index( self, index: u32 ) -> Result<DefiniteDescriptorKey, ConversionError>
Replaces any wildcard (i.e. /*
) in the key with a particular derivation index, turning it into a
definite key (i.e. one where all the derivation paths are set).
Returns
- If this key is not an xpub, returns
self
. - If this key is an xpub but does not have a wildcard, returns
self
. - Otherwise, returns the xpub at derivation
index
(removing the wildcard).
Errors
- If
index
is hardened.
sourcepub fn is_multipath(&self) -> bool
pub fn is_multipath(&self) -> bool
Whether or not this key has multiple derivation paths.
sourcepub fn into_single_keys(self) -> Vec<DescriptorPublicKey>
pub fn into_single_keys(self) -> Vec<DescriptorPublicKey>
Get as many keys as derivation paths in this key.
For raw public key and single-path extended keys it will return the key itself. For multipath extended keys it will return a single-path extended key per derivation path.
Trait Implementations§
source§impl Borrow<DescriptorPublicKey> for DefiniteDescriptorKey
impl Borrow<DescriptorPublicKey> for DefiniteDescriptorKey
source§fn borrow(&self) -> &DescriptorPublicKey
fn borrow(&self) -> &DescriptorPublicKey
source§impl Clone for DescriptorPublicKey
impl Clone for DescriptorPublicKey
source§fn clone(&self) -> DescriptorPublicKey
fn clone(&self) -> DescriptorPublicKey
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for DescriptorPublicKey
impl Debug for DescriptorPublicKey
source§impl Display for DescriptorPublicKey
impl Display for DescriptorPublicKey
source§impl From<DefiniteDescriptorKey> for DescriptorPublicKey
impl From<DefiniteDescriptorKey> for DescriptorPublicKey
source§fn from(d: DefiniteDescriptorKey) -> Self
fn from(d: DefiniteDescriptorKey) -> Self
source§impl FromIterator<DescriptorPublicKey> for Assets
impl FromIterator<DescriptorPublicKey> for Assets
source§fn from_iter<I: IntoIterator<Item = DescriptorPublicKey>>(iter: I) -> Self
fn from_iter<I: IntoIterator<Item = DescriptorPublicKey>>(iter: I) -> Self
source§impl FromStr for DescriptorPublicKey
impl FromStr for DescriptorPublicKey
source§impl Hash for DescriptorPublicKey
impl Hash for DescriptorPublicKey
source§impl IntoAssets for DescriptorPublicKey
impl IntoAssets for DescriptorPublicKey
source§fn into_assets(self) -> Assets
fn into_assets(self) -> Assets
self
into a Assets
structsource§impl MiniscriptKey for DescriptorPublicKey
impl MiniscriptKey for DescriptorPublicKey
§type Sha256 = Hash
type Sha256 = Hash
bitcoin::hashes::sha256::Hash
for this MiniscriptKey
, used in the
sha256 fragment.§type Hash256 = Hash
type Hash256 = Hash
miniscript::hash256::Hash
for this MiniscriptKey
, used in the
hash256 fragment.§type Ripemd160 = Hash
type Ripemd160 = Hash
bitcoin::hashes::ripemd160::Hash
for this MiniscriptKey
type, used
in the ripemd160 fragment.§type Hash160 = Hash
type Hash160 = Hash
bitcoin::hashes::hash160::Hash
for this MiniscriptKey
type, used in
the hash160 fragment.source§fn is_uncompressed(&self) -> bool
fn is_uncompressed(&self) -> bool
false
.source§fn is_x_only_key(&self) -> bool
fn is_x_only_key(&self) -> bool
false
.source§fn num_der_paths(&self) -> usize
fn num_der_paths(&self) -> usize
source§impl Ord for DescriptorPublicKey
impl Ord for DescriptorPublicKey
source§fn cmp(&self, other: &DescriptorPublicKey) -> Ordering
fn cmp(&self, other: &DescriptorPublicKey) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
source§impl PartialEq<DescriptorPublicKey> for DescriptorPublicKey
impl PartialEq<DescriptorPublicKey> for DescriptorPublicKey
source§fn eq(&self, other: &DescriptorPublicKey) -> bool
fn eq(&self, other: &DescriptorPublicKey) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<DescriptorPublicKey> for DescriptorPublicKey
impl PartialOrd<DescriptorPublicKey> for DescriptorPublicKey
source§fn partial_cmp(&self, other: &DescriptorPublicKey) -> Option<Ordering>
fn partial_cmp(&self, other: &DescriptorPublicKey) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read more