pub struct PaymentCodeManager { /* private fields */ }Expand description
Payment code manager for BIP 47 operations
Implementations§
Source§impl PaymentCodeManager
impl PaymentCodeManager
Sourcepub fn generate_payment_code(&self) -> Result<PaymentCode, BitcoinError>
pub fn generate_payment_code(&self) -> Result<PaymentCode, BitcoinError>
Generate a payment code from extended public key
Sourcepub fn from_xpub(&self, xpub: &Xpub) -> Result<PaymentCode, BitcoinError>
pub fn from_xpub(&self, xpub: &Xpub) -> Result<PaymentCode, BitcoinError>
Generate a payment code from an extended public key
Sourcepub fn derive_receive_address(
&self,
_their_code: &PaymentCode,
_index: u32,
) -> Result<Address, BitcoinError>
pub fn derive_receive_address( &self, _their_code: &PaymentCode, _index: u32, ) -> Result<Address, BitcoinError>
Derive a payment address for receiving
§Arguments
their_code- The sender’s payment codeindex- The index for address derivation (increment for each payment)
Sourcepub fn derive_send_address(
&self,
_their_code: &PaymentCode,
_index: u32,
) -> Result<Address, BitcoinError>
pub fn derive_send_address( &self, _their_code: &PaymentCode, _index: u32, ) -> Result<Address, BitcoinError>
Derive a payment address for sending
§Arguments
their_code- The receiver’s payment codeindex- The index for address derivation (increment for each payment)
Sourcepub fn create_notification_transaction(
&self,
_their_code: &PaymentCode,
_input: OutPoint,
_change_address: Address,
) -> Result<NotificationTransaction, BitcoinError>
pub fn create_notification_transaction( &self, _their_code: &PaymentCode, _input: OutPoint, _change_address: Address, ) -> Result<NotificationTransaction, BitcoinError>
Create a notification transaction
The notification transaction is used to establish a payment channel between two parties. It includes the sender’s payment code in the OP_RETURN output.
Sourcepub fn extract_notification(
&self,
tx: &Transaction,
) -> Result<PaymentCode, BitcoinError>
pub fn extract_notification( &self, tx: &Transaction, ) -> Result<PaymentCode, BitcoinError>
Extract payment code from notification transaction
Auto Trait Implementations§
impl Freeze for PaymentCodeManager
impl RefUnwindSafe for PaymentCodeManager
impl Send for PaymentCodeManager
impl Sync for PaymentCodeManager
impl Unpin for PaymentCodeManager
impl UnwindSafe for PaymentCodeManager
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