pub struct Descriptor {
pub extended_descriptor: ExtendedDescriptor,
pub key_map: KeyMap,
}Expand description
An expression of how to derive output scripts: https://github.com/bitcoin/bitcoin/blob/master/doc/descriptors.md
Fields§
§extended_descriptor: ExtendedDescriptor§key_map: KeyMapImplementations§
Source§impl Descriptor
impl Descriptor
Sourcepub fn new(
descriptor: String,
network_kind: NetworkKind,
) -> Result<Self, DescriptorError>
pub fn new( descriptor: String, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>
Parse a string as a descriptor for the given network.
Sourcepub fn new_bip44(
secret_key: &DescriptorSecretKey,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Self
pub fn new_bip44( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self
Multi-account hierarchy descriptor: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
Sourcepub fn new_bip44_public(
public_key: &DescriptorPublicKey,
fingerprint: String,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Result<Self, DescriptorError>
pub fn new_bip44_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>
Multi-account hierarchy descriptor: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
Sourcepub fn new_bip49(
secret_key: &DescriptorSecretKey,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Self
pub fn new_bip49( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self
P2SH nested P2WSH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki
Sourcepub fn new_bip49_public(
public_key: &DescriptorPublicKey,
fingerprint: String,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Result<Self, DescriptorError>
pub fn new_bip49_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>
P2SH nested P2WSH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0049.mediawiki
Sourcepub fn new_bip84(
secret_key: &DescriptorSecretKey,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Self
pub fn new_bip84( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self
Pay to witness PKH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki
Sourcepub fn new_bip84_public(
public_key: &DescriptorPublicKey,
fingerprint: String,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Result<Self, DescriptorError>
pub fn new_bip84_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>
Pay to witness PKH descriptor: https://github.com/bitcoin/bips/blob/master/bip-0084.mediawiki
Sourcepub fn new_bip86(
secret_key: &DescriptorSecretKey,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Self
pub fn new_bip86( secret_key: &DescriptorSecretKey, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Self
Single key P2TR descriptor: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki
Sourcepub fn new_bip86_public(
public_key: &DescriptorPublicKey,
fingerprint: String,
keychain_kind: KeychainKind,
network_kind: NetworkKind,
) -> Result<Self, DescriptorError>
pub fn new_bip86_public( public_key: &DescriptorPublicKey, fingerprint: String, keychain_kind: KeychainKind, network_kind: NetworkKind, ) -> Result<Self, DescriptorError>
Single key P2TR descriptor: https://github.com/bitcoin/bips/blob/master/bip-0086.mediawiki
Sourcepub fn new_wsh_sortedmulti(
k: u32,
pks: Vec<String>,
) -> Result<Self, DescriptorError>
pub fn new_wsh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>
Create a new wsh sorted multi descriptor Errors when miniscript exceeds resource limits under p2sh context
Sourcepub fn new_sh_sortedmulti(
k: u32,
pks: Vec<String>,
) -> Result<Self, DescriptorError>
pub fn new_sh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>
Create a new sh sortedmulti descriptor with threshold k and Vec of pks. Errors when miniscript exceeds resource limits under p2sh context
Sourcepub fn new_sh_wsh_sortedmulti(
k: u32,
pks: Vec<String>,
) -> Result<Self, DescriptorError>
pub fn new_sh_wsh_sortedmulti( k: u32, pks: Vec<String>, ) -> Result<Self, DescriptorError>
Create a new sh wrapped wsh sortedmulti descriptor from threshold k and Vec of pks Errors when miniscript exceeds resource limits under segwit context
Sourcepub fn new_pk(pk: String) -> Result<Self, DescriptorError>
pub fn new_pk(pk: String) -> Result<Self, DescriptorError>
Create a new pay-to-pubkey descriptor from a public key string.
Sourcepub fn new_pkh(pk: String) -> Result<Self, DescriptorError>
pub fn new_pkh(pk: String) -> Result<Self, DescriptorError>
Create a new PkH descriptor
Sourcepub fn new_wpkh(pk: String) -> Result<Self, DescriptorError>
pub fn new_wpkh(pk: String) -> Result<Self, DescriptorError>
Create a new Wpkh descriptor Will return Err if uncompressed key is used
Sourcepub fn new_sh_wpkh(pk: String) -> Result<Self, DescriptorError>
pub fn new_sh_wpkh(pk: String) -> Result<Self, DescriptorError>
Create a new sh wrapped wpkh from Pk. Errors when uncompressed keys are supplied
Sourcepub fn new_wsh(mini_script: String) -> Result<Self, DescriptorError>
pub fn new_wsh(mini_script: String) -> Result<Self, DescriptorError>
Create a new wsh descriptor from witness script Errors when miniscript exceeds resource limits under p2sh context or does not type check at the top level
Sourcepub fn new_sh_wsh(mini_script: String) -> Result<Self, DescriptorError>
pub fn new_sh_wsh(mini_script: String) -> Result<Self, DescriptorError>
Create a new sh wrapped wsh descriptor with witness script Errors when miniscript exceeds resource limits under wsh context or does not type check at the top level
Sourcepub fn new_sh(mini_script: String) -> Result<Self, DescriptorError>
pub fn new_sh(mini_script: String) -> Result<Self, DescriptorError>
Create a new sh for a given redeem script Errors when miniscript exceeds resource limits under p2sh context or does not type check at the top level
Sourcepub fn new_bare(mini_script: String) -> Result<Self, DescriptorError>
pub fn new_bare(mini_script: String) -> Result<Self, DescriptorError>
Create a new bare descriptor from witness script Errors when miniscript exceeds resource limits under bare context or does not type check at the top level
Sourcepub fn to_string_with_secret(&self) -> String
pub fn to_string_with_secret(&self) -> String
Dangerously convert the descriptor to a string.
Sourcepub fn is_multipath(&self) -> bool
pub fn is_multipath(&self) -> bool
Does this descriptor contain paths: https://github.com/bitcoin/bips/blob/master/bip-0389.mediawiki
Sourcepub fn descriptor_id(&self) -> Arc<DescriptorId>
pub fn descriptor_id(&self) -> Arc<DescriptorId>
A unique identifier for the descriptor.
Sourcepub fn to_single_descriptors(
&self,
) -> Result<Vec<Arc<Descriptor>>, MiniscriptError>
pub fn to_single_descriptors( &self, ) -> Result<Vec<Arc<Descriptor>>, MiniscriptError>
Return descriptors for all valid paths.
Sourcepub fn max_weight_to_satisfy(&self) -> Result<u64, DescriptorError>
pub fn max_weight_to_satisfy(&self) -> Result<u64, DescriptorError>
Computes an upper bound on the difference between a non-satisfied TxIn’s
segwit_weight and a satisfied TxIn’s segwit_weight.
pub fn desc_type(&self) -> DescriptorType
pub fn derive_address( &self, index: u32, network: Network, ) -> Result<Arc<Address>, DescriptorError>
Sourcepub fn has_wildcard(&self) -> bool
pub fn has_wildcard(&self) -> bool
Whether or not the descriptor has any wildcards.
Sourcepub fn sanity_check(&self) -> Result<(), DescriptorError>
pub fn sanity_check(&self) -> Result<(), DescriptorError>
Checks whether the descriptor is safe.
Checks whether all the spend paths in the descriptor are possible on the bitcoin network under the current standardness and consensus rules. Also checks whether the descriptor requires signatures on all spend paths and whether the script is malleable.
In general, all the guarantees of miniscript hold only for safe scripts. The signer may not be able to find satisfactions even if one exists.
Trait Implementations§
Source§impl Debug for Descriptor
impl Debug for Descriptor
Source§impl Display for Descriptor
impl Display for Descriptor
Source§impl<UT> LiftRef<UT> for Descriptor
impl<UT> LiftRef<UT> for Descriptor
type LiftType = Arc<Descriptor>
Source§impl<UT> LowerError<UT> for Descriptor
impl<UT> LowerError<UT> for Descriptor
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for Descriptor
impl<UT> LowerReturn<UT> for Descriptor
Source§type ReturnType = <Arc<Descriptor> as LowerReturn<UniFfiTag>>::ReturnType
type ReturnType = <Arc<Descriptor> as LowerReturn<UniFfiTag>>::ReturnType
Source§fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(obj: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl<UT> TypeId<UT> for Descriptor
impl<UT> TypeId<UT> for Descriptor
const TYPE_ID_META: MetadataBuffer
Auto Trait Implementations§
impl !Freeze for Descriptor
impl RefUnwindSafe for Descriptor
impl Send for Descriptor
impl Sync for Descriptor
impl Unpin for Descriptor
impl UnwindSafe for Descriptor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read more