pub struct PaymentInstructions { /* private fields */ }Expand description
Parsed payment instructions representing a set of possible ways to pay, as well as some associated metadata.
It supports:
- BIP 321 bitcoin: URIs
- Lightning BOLT 11 invoices (optionally with the lightning: URI prefix)
- Lightning BOLT 12 offers
- On-chain addresses
- BIP 353 human-readable names in the name@domain format.
- LN-Address human-readable names in the name@domain format.
Implementations§
Source§impl PaymentInstructions
impl PaymentInstructions
Sourcepub fn max_amount(&self) -> Option<Amount>
pub fn max_amount(&self) -> Option<Amount>
The maximum amount any payment instruction requires payment for.
If None, any amount can be paid.
Note that we may allow different Self::methods to have slightly different amounts (e.g.
if a recipient wishes to be paid more for on-chain payments to offset their future fees),
but only up to MAX_AMOUNT_DIFFERENCE.
Sourcepub fn ln_payment_amount(&self) -> Option<Amount>
pub fn ln_payment_amount(&self) -> Option<Amount>
The amount which the payment instruction requires payment for when paid over lightning.
We require that all lightning payment methods in payment instructions require an identical
amount for payment, and thus if this method returns None it indicates either:
- no lightning payment instructions exist,
- there is no required amount and any amount can be paid
- the only lightning payment instructions are for a BOLT 12 offer denominated in a non-Bitcoin currency.
Sourcepub fn onchain_payment_amount(&self) -> Option<Amount>
pub fn onchain_payment_amount(&self) -> Option<Amount>
The amount which the payment instruction requires payment for when paid on-chain.
There is no way to encode different payment amounts for multiple on-chain formats
currently, and as such all on-chain PaymentMethods will contain the same
PaymentMethod::amount.
Sourcepub fn methods(&self) -> &[PaymentMethod]
pub fn methods(&self) -> &[PaymentMethod]
The list of PaymentMethods.
Sourcepub fn recipient_description(&self) -> Option<&str>
pub fn recipient_description(&self) -> Option<&str>
A recipient-provided description of the payment instructions.
This may be:
- the
labelormessageparameter in a BIP 321 bitcoin: URI - the
descriptionfield in a lightning BOLT 11 invoice - the
descriptionfield in a lightning BOLT 12 offer
Sourcepub fn pop_callback(&self) -> Option<&str>
pub fn pop_callback(&self) -> Option<&str>
Fetches the proof-of-payment callback URI.
Once a payment has been completed, the proof-of-payment (hex-encoded payment preimage for a lightning BOLT 11 invoice, raw transaction serialized in hex for on-chain payments, not-yet-defined for lightning BOLT 12 invoices) must be appended to this URI and the URI opened with the default system URI handler.
Sourcepub fn human_readable_name(&self) -> &Option<HumanReadableName>
pub fn human_readable_name(&self) -> &Option<HumanReadableName>
Fetches the HumanReadableName which was resolved, if the resolved payment instructions
were for a Human Readable Name.
Sourcepub fn bip_353_dnssec_proof(&self) -> &Option<Vec<u8>>
pub fn bip_353_dnssec_proof(&self) -> &Option<Vec<u8>>
Fetches the BIP 353 DNSSEC proof which was used to resolve these payment instructions, if they were resolved from a HumanReadable Name using BIP 353.
This proof should be included in any PSBT output (as type PSBT_OUT_DNSSEC_PROOF)
generated using these payment instructions.
It should also be stored to allow us to later prove that this payment was made to
Self::human_readable_name.
Source§impl PaymentInstructions
impl PaymentInstructions
Sourcepub async fn parse_payment_instructions<H: HrnResolver>(
instructions: &str,
network: Network,
hrn_resolver: H,
supports_proof_of_payment_callbacks: bool,
) -> Result<PaymentInstructions, ParseError>
pub async fn parse_payment_instructions<H: HrnResolver>( instructions: &str, network: Network, hrn_resolver: H, supports_proof_of_payment_callbacks: bool, ) -> Result<PaymentInstructions, ParseError>
Resolves a string into PaymentInstructions.