Enum bdk::keys::ExtendedKey
source · [−]pub enum ExtendedKey<Ctx: ScriptContext = Legacy> {
Private((ExtendedPrivKey, PhantomData<Ctx>)),
Public((ExtendedPubKey, PhantomData<Ctx>)),
}
Expand description
Enum for extended keys that can be either xprv
or xpub
An instance of ExtendedKey
can be constructed from an ExtendedPrivKey
or an ExtendedPubKey
by using the From
trait.
Defaults to the Legacy
context.
Variants
Private((ExtendedPrivKey, PhantomData<Ctx>))
A private extended key, aka an xprv
Public((ExtendedPubKey, PhantomData<Ctx>))
A public extended key, aka an xpub
Implementations
sourceimpl<Ctx: ScriptContext> ExtendedKey<Ctx>
impl<Ctx: ScriptContext> ExtendedKey<Ctx>
sourcepub fn has_secret(&self) -> bool
pub fn has_secret(&self) -> bool
Return whether or not the key contains the private data
sourcepub fn into_xprv(self, network: Network) -> Option<ExtendedPrivKey>
pub fn into_xprv(self, network: Network) -> Option<ExtendedPrivKey>
Transform the ExtendedKey
into an ExtendedPrivKey
for the
given Network
, if the key contains the private data
sourcepub fn into_xpub<C: Signing>(
self,
network: Network,
secp: &Secp256k1<C>
) -> ExtendedPubKey
pub fn into_xpub<C: Signing>(
self,
network: Network,
secp: &Secp256k1<C>
) -> ExtendedPubKey
Transform the ExtendedKey
into an ExtendedPubKey
for the
given Network
Trait Implementations
sourceimpl<Ctx: ScriptContext> DerivableKey<Ctx> for ExtendedKey<Ctx>
impl<Ctx: ScriptContext> DerivableKey<Ctx> for ExtendedKey<Ctx>
Identity conversion
sourcefn into_extended_key(self) -> Result<ExtendedKey<Ctx>, KeyError>
fn into_extended_key(self) -> Result<ExtendedKey<Ctx>, KeyError>
Consume self
and turn it into an ExtendedKey
Read more
sourcefn into_descriptor_key(
self,
origin: Option<KeySource>,
derivation_path: DerivationPath
) -> Result<DescriptorKey<Ctx>, KeyError>
fn into_descriptor_key(
self,
origin: Option<KeySource>,
derivation_path: DerivationPath
) -> Result<DescriptorKey<Ctx>, KeyError>
Consume self
and turn it into a DescriptorKey
by adding the extra metadata, such as
key origin and derivation path Read more
sourceimpl<Ctx: ScriptContext> From<ExtendedPrivKey> for ExtendedKey<Ctx>
impl<Ctx: ScriptContext> From<ExtendedPrivKey> for ExtendedKey<Ctx>
sourcefn from(xprv: ExtendedPrivKey) -> Self
fn from(xprv: ExtendedPrivKey) -> Self
Converts to this type from the input type.
sourceimpl<Ctx: ScriptContext> From<ExtendedPubKey> for ExtendedKey<Ctx>
impl<Ctx: ScriptContext> From<ExtendedPubKey> for ExtendedKey<Ctx>
sourcefn from(xpub: ExtendedPubKey) -> Self
fn from(xpub: ExtendedPubKey) -> Self
Converts to this type from the input type.
Auto Trait Implementations
impl<Ctx> RefUnwindSafe for ExtendedKey<Ctx> where
Ctx: RefUnwindSafe,
impl<Ctx> Send for ExtendedKey<Ctx> where
Ctx: Send,
impl<Ctx> Sync for ExtendedKey<Ctx> where
Ctx: Sync,
impl<Ctx> Unpin for ExtendedKey<Ctx> where
Ctx: Unpin,
impl<Ctx> UnwindSafe for ExtendedKey<Ctx> where
Ctx: UnwindSafe,
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