Enum miniscript::descriptor::DescriptorPublicKey
source · [−]pub enum DescriptorPublicKey {
SinglePub(DescriptorSinglePub),
XPub(DescriptorXKey<ExtendedPubKey>),
}
Expand description
The MiniscriptKey corresponding to Descriptors. This can either be Single public key or a Xpub
Variants
SinglePub(DescriptorSinglePub)
Single Public Key
XPub(DescriptorXKey<ExtendedPubKey>)
Xpub
Implementations
sourceimpl 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) -> DerivationPath
pub fn full_derivation_path(&self) -> 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)
sourcepub fn is_deriveable(&self) -> bool
pub fn is_deriveable(&self) -> bool
Whether or not the key has a wildcards
sourcepub fn derive(self, index: u32) -> DescriptorPublicKey
pub fn derive(self, index: u32) -> DescriptorPublicKey
If this public key has a wildcard, replace it by the given index
Panics if given an index ≥ 2^31
sourcepub fn derive_public_key<C: Verification>(
&self,
secp: &Secp256k1<C>
) -> Result<PublicKey, ConversionError>
pub fn derive_public_key<C: Verification>(
&self,
secp: &Secp256k1<C>
) -> Result<PublicKey, ConversionError>
Computes the public key corresponding to this descriptor key.
When deriving from an XOnlyPublicKey, it adds the default 0x02 y-coordinate
and returns the obtained full bitcoin::PublicKey
. All BIP32 derivations
always return a compressed key
Will return an error if the descriptor key has any hardened derivation steps in its path, or if the key has any wildcards.
To ensure there are no wildcards, call .derive(0)
or similar;
to avoid hardened derivation steps, start from a DescriptorSecretKey
and call as_public
, or call TranslatePk2::translate_pk2
with
some function which has access to secret key data.
Trait Implementations
sourceimpl Clone for DescriptorPublicKey
impl Clone for DescriptorPublicKey
sourcefn clone(&self) -> DescriptorPublicKey
fn clone(&self) -> DescriptorPublicKey
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl Debug for DescriptorPublicKey
impl Debug for DescriptorPublicKey
sourceimpl Display for DescriptorPublicKey
impl Display for DescriptorPublicKey
sourceimpl FromStr for DescriptorPublicKey
impl FromStr for DescriptorPublicKey
sourceimpl Hash for DescriptorPublicKey
impl Hash for DescriptorPublicKey
sourceimpl MiniscriptKey for DescriptorPublicKey
impl MiniscriptKey for DescriptorPublicKey
type Hash = DescriptorPublicKey
type Hash = DescriptorPublicKey
The associated Hash type with the publicKey
sourcefn is_uncompressed(&self) -> bool
fn is_uncompressed(&self) -> bool
Check if the publicKey is uncompressed. The default implementation returns false Read more
sourcefn is_x_only_key(&self) -> bool
fn is_x_only_key(&self) -> bool
Check if the publicKey is x-only. The default implementation returns false Read more
sourcefn to_pubkeyhash(&self) -> Self
fn to_pubkeyhash(&self) -> Self
Converts an object to PublicHash
sourceimpl Ord for DescriptorPublicKey
impl Ord for DescriptorPublicKey
sourceimpl PartialEq<DescriptorPublicKey> for DescriptorPublicKey
impl PartialEq<DescriptorPublicKey> for DescriptorPublicKey
sourcefn eq(&self, other: &DescriptorPublicKey) -> bool
fn eq(&self, other: &DescriptorPublicKey) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &DescriptorPublicKey) -> bool
fn ne(&self, other: &DescriptorPublicKey) -> bool
This method tests for !=
.
sourceimpl PartialOrd<DescriptorPublicKey> for DescriptorPublicKey
impl PartialOrd<DescriptorPublicKey> for DescriptorPublicKey
sourcefn partial_cmp(&self, other: &DescriptorPublicKey) -> Option<Ordering>
fn partial_cmp(&self, other: &DescriptorPublicKey) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl Eq for DescriptorPublicKey
impl StructuralEq for DescriptorPublicKey
impl StructuralPartialEq for DescriptorPublicKey
Auto Trait Implementations
impl RefUnwindSafe for DescriptorPublicKey
impl Send for DescriptorPublicKey
impl Sync for DescriptorPublicKey
impl Unpin for DescriptorPublicKey
impl UnwindSafe for DescriptorPublicKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more