Struct bdk::descriptor::template::P2Wpkh

source ·
pub struct P2Wpkh<K: IntoDescriptorKey<Segwitv0>>(pub K);
Expand description

P2WPKH template. Expands to a descriptor wpkh(key)

Example

use bdk::template::P2Wpkh;

let key =
    bitcoin::PrivateKey::from_wif("cTc4vURSzdx6QE6KVynWGomDbLaA75dNALMNyfjh3p8DRRar84Um")?;
let wallet = Wallet::new(
    P2Wpkh(key),
    None,
    Network::Testnet,
    MemoryDatabase::default(),
)?;

assert_eq!(
    wallet.get_address(New)?.to_string(),
    "tb1q4525hmgw265tl3drrl8jjta7ayffu6jf68ltjd"
);

Tuple Fields

0: K

Trait Implementations

Build the complete descriptor

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Convert to wallet descriptor
The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.