UNPKG

lightningdevkit

Version:
151 lines (150 loc) 6.11 kB
import { Option_u64Z } from '../structs/Option_u64Z.mjs'; import { BlindedMessagePath } from '../structs/BlindedMessagePath.mjs'; import { Option_CVec_u8ZZ } from '../structs/Option_CVec_u8ZZ.mjs'; import { HumanReadableName } from '../structs/HumanReadableName.mjs'; import { Option_AmountZ } from '../structs/Option_AmountZ.mjs'; import { Quantity } from '../structs/Quantity.mjs'; import { PrintableString } from '../structs/PrintableString.mjs'; import { OfferFeatures } from '../structs/OfferFeatures.mjs'; import { TaggedHash } from '../structs/TaggedHash.mjs'; import { InvoiceRequestFeatures } from '../structs/InvoiceRequestFeatures.mjs'; import { CommonBase } from './CommonBase.mjs'; /** * A semantically valid [`InvoiceRequest`] that hasn't been signed. * * # Serialization * * This is serialized as a TLV stream, which includes TLV records from the originating message. As * such, it may include unknown, odd TLV records. */ export declare class UnsignedInvoiceRequest extends CommonBase { clone_ptr(): bigint; /** * Creates a copy of the UnsignedInvoiceRequest */ clone(): UnsignedInvoiceRequest; /** * Returns the [`TaggedHash`] of the invoice to sign. */ tagged_hash(): TaggedHash; /** * The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet). * Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats) * for the selected chain. */ chains(): Uint8Array[]; /** * Opaque bytes set by the originator. Useful for authentication and validating fields since it * is reflected in `invoice_request` messages along with all the other fields from the `offer`. */ metadata(): Option_CVec_u8ZZ; /** * The minimum amount required for a successful payment of a single item. */ amount(): Option_AmountZ; /** * A complete description of the purpose of the payment. Intended to be displayed to the user * but with the caveat that it has not been verified in any way. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ description(): PrintableString; /** * Features pertaining to the offer. */ offer_features(): OfferFeatures; /** * Duration since the Unix epoch when an invoice should no longer be requested. * * If `None`, the offer does not expire. */ absolute_expiry(): Option_u64Z; /** * The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be * displayed to the user but with the caveat that it has not been verified in any way. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ issuer(): PrintableString; /** * Paths to the recipient originating from publicly reachable nodes. Blinded paths provide * recipient privacy by obfuscating its node id. */ paths(): BlindedMessagePath[]; /** * The quantity of items supported. */ supported_quantity(): Quantity; /** * The public key corresponding to the key used by the recipient to sign invoices. * - If [`Offer::paths`] is empty, MUST be `Some` and contain the recipient's node id for * sending an [`InvoiceRequest`]. * - If [`Offer::paths`] is not empty, MAY be `Some` and contain a transient id. * - If `None`, the signing pubkey will be the final blinded node id from the * [`BlindedMessagePath`] in [`Offer::paths`] used to send the [`InvoiceRequest`]. * * See also [`Bolt12Invoice::signing_pubkey`]. * * [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest * [`Bolt12Invoice::signing_pubkey`]: crate::offers::invoice::Bolt12Invoice::signing_pubkey * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ issuer_signing_pubkey(): Uint8Array; /** * An unpredictable series of bytes, typically containing information about the derivation of * [`payer_signing_pubkey`]. * * [`payer_signing_pubkey`]: Self::payer_signing_pubkey */ payer_metadata(): Uint8Array; /** * A chain from [`Offer::chains`] that the offer is valid for. */ chain(): Uint8Array; /** * The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which * must be greater than or equal to [`Offer::amount`], converted if necessary. * * [`chain`]: Self::chain */ amount_msats(): Option_u64Z; /** * Returns whether an amount was set in the request; otherwise, if [`amount_msats`] is `Some` * then it was inferred from the [`Offer::amount`] and [`quantity`]. * * [`amount_msats`]: Self::amount_msats * [`quantity`]: Self::quantity */ has_amount_msats(): boolean; /** * Features pertaining to requesting an invoice. */ invoice_request_features(): InvoiceRequestFeatures; /** * The quantity of the offer's item conforming to [`Offer::is_valid_quantity`]. */ quantity(): Option_u64Z; /** * A possibly transient pubkey used to sign the invoice request. */ payer_signing_pubkey(): Uint8Array; /** * A payer-provided note which will be seen by the recipient and reflected back in the invoice * response. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ payer_note(): PrintableString; /** * If the [`Offer`] was sourced from a BIP 353 Human Readable Name, this should be set by the * builder to indicate the original [`HumanReadableName`] which was resolved. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ offer_from_hrn(): HumanReadableName; /** * Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read */ write(): Uint8Array; }