pub struct SpDescriptor { /* private fields */ }Expand description
A BIP 392 Silent Payments descriptor.
Contains an SpAddress (scan + spend public keys) plus optional BIP 393
annotations for wallet configuration.
§Construction
use silent_payments_core::address::SpAddress;
use silent_payments_core::keys::{ScanPublicKey, SpendPublicKey};
use bitcoin::Network;
use bitcoin::secp256k1::{Secp256k1, SecretKey};
use silent_payments_descriptor::SpDescriptor;
let secp = Secp256k1::new();
let sk = SecretKey::from_slice(&[0x01; 32]).unwrap();
let pk = sk.public_key(&secp);
let addr = SpAddress::new(ScanPublicKey::from(pk), SpendPublicKey::from(pk), Network::Bitcoin);
let desc = SpDescriptor::from(addr).with_birthday_height(850000);
assert_eq!(desc.birthday_height(), Some(850000));Implementations§
Source§impl SpDescriptor
impl SpDescriptor
Sourcepub fn birthday_height(&self) -> Option<u32>
pub fn birthday_height(&self) -> Option<u32>
Returns the wallet birthday height annotation, if set.
Sourcepub fn max_labels(&self) -> Option<u32>
pub fn max_labels(&self) -> Option<u32>
Returns the max labels annotation, if set.
Sourcepub fn with_birthday_height(self, height: u32) -> SpDescriptor
pub fn with_birthday_height(self, height: u32) -> SpDescriptor
Returns a new descriptor with the birthday height annotation set.
Does not mutate self; returns a new value (immutable builder pattern).
Sourcepub fn with_gap_limit(self, limit: u32) -> SpDescriptor
pub fn with_gap_limit(self, limit: u32) -> SpDescriptor
Returns a new descriptor with the gap limit annotation set.
Does not mutate self; returns a new value (immutable builder pattern).
Sourcepub fn with_max_labels(self, max: u32) -> SpDescriptor
pub fn with_max_labels(self, max: u32) -> SpDescriptor
Returns a new descriptor with the max labels annotation set.
Does not mutate self; returns a new value (immutable builder pattern).
Trait Implementations§
Source§impl Clone for SpDescriptor
impl Clone for SpDescriptor
Source§fn clone(&self) -> SpDescriptor
fn clone(&self) -> SpDescriptor
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SpDescriptor
impl Debug for SpDescriptor
Source§impl Display for SpDescriptor
impl Display for SpDescriptor
Source§impl From<SpAddress> for SpDescriptor
impl From<SpAddress> for SpDescriptor
Source§fn from(address: SpAddress) -> SpDescriptor
fn from(address: SpAddress) -> SpDescriptor
Converts to this type from the input type.
Source§impl FromStr for SpDescriptor
impl FromStr for SpDescriptor
Source§type Err = DescriptorError
type Err = DescriptorError
The associated error which can be returned from parsing.
Source§fn from_str(s: &str) -> Result<SpDescriptor, <SpDescriptor as FromStr>::Err>
fn from_str(s: &str) -> Result<SpDescriptor, <SpDescriptor as FromStr>::Err>
Parses a string
s to return a value of this type. Read moreSource§impl PartialEq for SpDescriptor
impl PartialEq for SpDescriptor
impl Eq for SpDescriptor
impl StructuralPartialEq for SpDescriptor
Auto Trait Implementations§
impl Freeze for SpDescriptor
impl RefUnwindSafe for SpDescriptor
impl Send for SpDescriptor
impl Sync for SpDescriptor
impl Unpin for SpDescriptor
impl UnsafeUnpin for SpDescriptor
impl UnwindSafe for SpDescriptor
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
Mutably borrows from an owned value. Read more