[−]Enum bdk::descriptor::Descriptor
Script descriptor
Variants
Bare(Miniscript<Pk, Legacy>)
A raw scriptpubkey (including pay-to-pubkey) under Legacy context
Pay-to-Pubkey
Pay-to-PubKey-Hash
Pay-to-Witness-PubKey-Hash
Pay-to-Witness-PubKey-Hash inside P2SH
Sh(Miniscript<Pk, Legacy>)
Pay-to-ScriptHash with Legacy context
Wsh(Miniscript<Pk, Segwitv0>)
Pay-to-Witness-ScriptHash with Segwitv0 context
ShWsh(Miniscript<Pk, Segwitv0>)
P2SH-P2WSH with Segwitv0 context
Implementations
impl<Pk> Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
pub fn translate_pk<Fpk, Fpkh, Q, E>(
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Fpk: FnMut(&Pk) -> Result<Q, E>,
Fpkh: FnMut(&<Pk as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, E>,
Q: MiniscriptKey,
&self,
translatefpk: Fpk,
translatefpkh: Fpkh
) -> Result<Descriptor<Q>, E> where
Fpk: FnMut(&Pk) -> Result<Q, E>,
Fpkh: FnMut(&<Pk as MiniscriptKey>::Hash) -> Result<<Q as MiniscriptKey>::Hash, E>,
Q: MiniscriptKey,
Convert a descriptor using abstract keys to one using specific keys This will panic if translatefpk returns an uncompressed key when converting to a Segwit descriptor. To prevent this panic, ensure translatefpk returns an error in this case instead.
impl<Pk> Descriptor<Pk> where
Pk: MiniscriptKey + ToPublicKey,
Pk: MiniscriptKey + ToPublicKey,
pub fn address(&self, network: Network) -> Option<Address>
Computes the Bitcoin address of the descriptor, if one exists
pub fn script_pubkey(&self) -> Script
Computes the scriptpubkey of the descriptor
pub fn unsigned_script_sig(&self) -> Script
Computes the scriptSig that will be in place for an unsigned input spending an output with this descriptor. For pre-segwit descriptors, which use the scriptSig for signatures, this returns the empty script.
This is used in Segwit transactions to produce an unsigned transaction whose txid will not change during signing (since only the witness data will change).
pub fn witness_script(&self) -> Script
Computes the "witness script" of the descriptor, i.e. the underlying
script before any hashing is done. For Bare
, Pkh
and Wpkh
this
is the scriptPubkey; for ShWpkh
and Sh
this is the redeemScript;
for the others it is the witness script.
pub fn satisfy<S>(&self, txin: &mut TxIn, satisfier: S) -> Result<(), Error> where
S: Satisfier<Pk>,
S: Satisfier<Pk>,
Attempts to produce a satisfying witness and scriptSig to spend an
output controlled by the given descriptor; add the data to a given
TxIn
output.
pub fn max_satisfaction_weight(&self) -> usize
Computes an upper bound on the weight of a satisfying witness to the transaction. Assumes all signatures are 73 bytes, including push opcode and sighash suffix. Includes the weight of the VarInts encoding the scriptSig and witness stack length.
impl Descriptor<DescriptorPublicKey>
pub fn derive(&self, path: &[ChildNumber]) -> Descriptor<DescriptorPublicKey>
Derives all wildcard keys in the descriptor using the supplied path
pub fn parse_secret(
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>), Error>
s: &str
) -> Result<(Descriptor<DescriptorPublicKey>, HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>), Error>
pub fn to_string_with_secret(
&self,
key_map: &HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>
) -> String
&self,
key_map: &HashMap<DescriptorPublicKey, DescriptorSecretKey, RandomState>
) -> String
Trait Implementations
impl<Pk> Clone for Descriptor<Pk> where
Pk: MiniscriptKey + Clone,
Pk: MiniscriptKey + Clone,
fn clone(&self) -> Descriptor<Pk>
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Pk> Debug for Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
impl<Pk> Display for Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
impl<Pk> Eq for Descriptor<Pk> where
Pk: MiniscriptKey + Eq,
Pk: MiniscriptKey + Eq,
impl ExtractPolicy for Descriptor<DescriptorPublicKey>
[src]
fn extract_policy(
&self,
signers: Arc<SignersContainer<DescriptorPublicKey>>
) -> Result<Option<Policy>, Error>
[src]
&self,
signers: Arc<SignersContainer<DescriptorPublicKey>>
) -> Result<Option<Policy>, Error>
impl<Pk> FromStr for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
type Err = Error
The associated error which can be returned from parsing.
fn from_str(s: &str) -> Result<Descriptor<Pk>, Error>
impl<Pk> FromTree for Descriptor<Pk> where
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
Pk: MiniscriptKey,
<Pk as FromStr>::Err: ToString,
<<Pk as MiniscriptKey>::Hash as FromStr>::Err: ToString,
fn from_tree(top: &Tree) -> Result<Descriptor<Pk>, Error>
Parse an expression tree into a descriptor
impl<Pk> Liftable<Pk> for Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
fn lift(&self) -> Policy<Pk>
impl<Pk> Ord for Descriptor<Pk> where
Pk: MiniscriptKey + Ord,
Pk: MiniscriptKey + Ord,
fn cmp(&self, other: &Descriptor<Pk>) -> Ordering
#[must_use]fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]fn clamp(self, min: Self, max: Self) -> Self
[src]
impl<Pk> PartialEq<Descriptor<Pk>> for Descriptor<Pk> where
Pk: MiniscriptKey + PartialEq<Pk>,
Pk: MiniscriptKey + PartialEq<Pk>,
fn eq(&self, other: &Descriptor<Pk>) -> bool
fn ne(&self, other: &Descriptor<Pk>) -> bool
impl<Pk> PartialOrd<Descriptor<Pk>> for Descriptor<Pk> where
Pk: MiniscriptKey + PartialOrd<Pk>,
Pk: MiniscriptKey + PartialOrd<Pk>,
fn partial_cmp(&self, other: &Descriptor<Pk>) -> Option<Ordering>
fn lt(&self, other: &Descriptor<Pk>) -> bool
fn le(&self, other: &Descriptor<Pk>) -> bool
fn gt(&self, other: &Descriptor<Pk>) -> bool
fn ge(&self, other: &Descriptor<Pk>) -> bool
impl<Pk> StructuralEq for Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
impl<Pk> StructuralPartialEq for Descriptor<Pk> where
Pk: MiniscriptKey,
Pk: MiniscriptKey,
Auto Trait Implementations
impl<Pk> RefUnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
Pk: RefUnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe,
impl<Pk> Send for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Sync for Descriptor<Pk> where
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
Pk: Send + Sync,
<Pk as MiniscriptKey>::Hash: Send + Sync,
impl<Pk> Unpin for Descriptor<Pk> where
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
Pk: Unpin,
<Pk as MiniscriptKey>::Hash: Unpin,
impl<Pk> UnwindSafe for Descriptor<Pk> where
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Pk: RefUnwindSafe + UnwindSafe,
<Pk as MiniscriptKey>::Hash: RefUnwindSafe + UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<Q, K> Equivalent<K> for Q where
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
[src]
K: Borrow<Q> + ?Sized,
Q: Eq + ?Sized,
fn equivalent(&self, key: &K) -> bool
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,