pub struct Sender(_);
Expand description
A struct that a sender of funds uses in combination with a recipient’s PaymentCode
in order
to send notifications and calculate payment addresses. This is invariant with regard to
recipient and needs to be constructed only once per account (unique per BIP32 seed + account).
Implementations§
source§impl Sender
impl Sender
sourcepub fn from_seed<C: Signing>(
secp: &Secp256k1<C>,
seed: &[u8],
network: Network,
account: u32
) -> Result<Self, Error>
pub fn from_seed<C: Signing>(
secp: &Secp256k1<C>,
seed: &[u8],
network: Network,
account: u32
) -> Result<Self, Error>
Construct a sender side from a BIP32 seed.
sourcepub fn from_master_xprv<C: Signing>(
secp: &Secp256k1<C>,
master: ExtendedPrivKey,
account: u32
) -> Result<Self, Error>
pub fn from_master_xprv<C: Signing>(
secp: &Secp256k1<C>,
master: ExtendedPrivKey,
account: u32
) -> Result<Self, Error>
Construct a sender side from a master extended private key. Not supplying a master key here produces an error.
sourcepub fn notify(
&self,
secp: &Secp256k1<All>,
payment_code: &PaymentCode,
recipient_index: u32,
address_type: AddressType
) -> Result<(TxOut, SenderCommitment), Error>
pub fn notify(
&self,
secp: &Secp256k1<All>,
payment_code: &PaymentCode,
recipient_index: u32,
address_type: AddressType
) -> Result<(TxOut, SenderCommitment), Error>
Construct a notification for a payment code. The txout is an OP_RETURN
consuming 0 sats.
The returned SenderCommitment
is used for subsequent interaction with the payment code.
recipient_index
must be unique for each recipient as it uniquely defines the relationship
between a sender and a recipient.