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§
§impl DescriptorPublicKey
impl DescriptorPublicKey
pub fn master_fingerprint(&self) -> Fingerprint
pub fn master_fingerprint(&self) -> Fingerprint
The fingerprint of the master key associated with this key, 0x00000000
if none.
pub 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
.
pub 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).
pub fn is_deriveable(&self) -> bool
👎Deprecated: use has_wildcard instead
pub fn is_deriveable(&self) -> bool
Whether or not the key has a wildcard
pub fn has_wildcard(&self) -> bool
pub fn has_wildcard(&self) -> bool
Whether or not the key has a wildcard
pub 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
.
pub 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.
pub fn is_multipath(&self) -> bool
pub fn is_multipath(&self) -> bool
Whether or not this key has multiple derivation paths.
pub 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§
§impl Clone for DescriptorPublicKey
impl Clone for DescriptorPublicKey
§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 more§impl Debug for DescriptorPublicKey
impl Debug for DescriptorPublicKey
§impl<'de> Deserialize<'de> for DescriptorPublicKey
impl<'de> Deserialize<'de> for DescriptorPublicKey
§fn deserialize<D>(
deserializer: D
) -> Result<DescriptorPublicKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<DescriptorPublicKey, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
§impl Display for DescriptorPublicKey
impl Display for DescriptorPublicKey
§impl From<DefiniteDescriptorKey> for DescriptorPublicKey
impl From<DefiniteDescriptorKey> for DescriptorPublicKey
§fn from(d: DefiniteDescriptorKey) -> DescriptorPublicKey
fn from(d: DefiniteDescriptorKey) -> DescriptorPublicKey
§impl FromStr for DescriptorPublicKey
impl FromStr for DescriptorPublicKey
§impl Hash for DescriptorPublicKey
impl Hash for DescriptorPublicKey
§impl IntoAssets for DescriptorPublicKey
impl IntoAssets for DescriptorPublicKey
§fn into_assets(self) -> Assets
fn into_assets(self) -> Assets
self
into a Assets
structsource§impl<Ctx: ScriptContext> IntoDescriptorKey<Ctx> for DescriptorPublicKey
impl<Ctx: ScriptContext> IntoDescriptorKey<Ctx> for DescriptorPublicKey
source§fn into_descriptor_key(self) -> Result<DescriptorKey<Ctx>, KeyError>
fn into_descriptor_key(self) -> Result<DescriptorKey<Ctx>, KeyError>
DescriptorKey
within the requested ScriptContext
§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.§fn is_uncompressed(&self) -> bool
fn is_uncompressed(&self) -> bool
false
.§fn is_x_only_key(&self) -> bool
fn is_x_only_key(&self) -> bool
false
.§fn num_der_paths(&self) -> usize
fn num_der_paths(&self) -> usize
§impl Ord for DescriptorPublicKey
impl Ord for DescriptorPublicKey
§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,
§impl PartialEq for DescriptorPublicKey
impl PartialEq for DescriptorPublicKey
§fn eq(&self, other: &DescriptorPublicKey) -> bool
fn eq(&self, other: &DescriptorPublicKey) -> bool
self
and other
values to be equal, and is used
by ==
.§impl PartialOrd for DescriptorPublicKey
impl PartialOrd for DescriptorPublicKey
§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