UNPKG

lightningdevkit

Version:
229 lines (228 loc) 8.77 kB
import { Address } from '../structs/Address.mjs'; 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 { BlindedPaymentPath } from '../structs/BlindedPaymentPath.mjs'; import { Option_CVec_ThirtyTwoBytesZZ } from '../structs/Option_CVec_ThirtyTwoBytesZZ.mjs'; import { Option_AmountZ } from '../structs/Option_AmountZ.mjs'; import { Option_QuantityZ } from '../structs/Option_QuantityZ.mjs'; import { Bolt12InvoiceFeatures } from '../structs/Bolt12InvoiceFeatures.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 [`Bolt12Invoice`] 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 UnsignedBolt12Invoice extends CommonBase { clone_ptr(): bigint; /** * Creates a copy of the UnsignedBolt12Invoice */ clone(): UnsignedBolt12Invoice; /** * Returns the [`TaggedHash`] of the invoice to sign. */ tagged_hash(): TaggedHash; /** * Paths to the recipient originating from publicly reachable nodes, including information * needed for routing payments across them. * * Blinded paths provide recipient privacy by obfuscating its node id. Note, however, that this * privacy is lost if a public node id is used for * [`UnsignedBolt12Invoice::signing_pubkey`]. */ payment_paths(): BlindedPaymentPath[]; /** * Duration since the Unix epoch when the invoice was created. */ created_at(): bigint; /** * Duration since * [`UnsignedBolt12Invoice::created_at`] * when the invoice has expired and therefore should no longer be paid. */ relative_expiry(): bigint; /** * Fallback addresses for paying the invoice on-chain, in order of most-preferred to * least-preferred. */ fallbacks(): Address[]; /** * Features pertaining to paying an invoice. */ invoice_features(): Bolt12InvoiceFeatures; /** * A typically transient public key corresponding to the key used to sign the invoice. * * If the invoices was created in response to an [`Offer`], then this will be: * - [`Offer::issuer_signing_pubkey`] if it's `Some`, otherwise * - the final blinded node id from a [`BlindedMessagePath`] in [`Offer::paths`] if `None`. * * If the invoice was created in response to a [`Refund`], then it is a valid pubkey chosen by * the recipient. * * [`Offer`]: crate::offers::offer::Offer * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_signing_pubkey * [`Offer::paths`]: crate::offers::offer::Offer::paths * [`Refund`]: crate::offers::refund::Refund */ signing_pubkey(): Uint8Array; /** * The chains that may be used when paying a requested invoice. * * From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`]. * * [`Offer::chains`]: crate::offers::offer::Offer::chains */ offer_chains(): Option_CVec_ThirtyTwoBytesZZ; /** * The chain that must be used when paying the invoice; selected from [`offer_chains`] if the * invoice originated from an offer. * * From [`InvoiceRequest::chain`] or [`Refund::chain`]. * * [`offer_chains`]: Self::offer_chains * [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain */ chain(): Uint8Array; /** * Opaque bytes set by the originating [`Offer`]. * * From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or * if the [`Offer`] did not set it. * * [`Offer`]: crate::offers::offer::Offer * [`Offer::metadata`]: crate::offers::offer::Offer::metadata */ metadata(): Option_CVec_u8ZZ; /** * The minimum amount required for a successful payment of a single item. * * From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if * the [`Offer`] did not set it. * * [`Offer`]: crate::offers::offer::Offer * [`Offer::amount`]: crate::offers::offer::Offer::amount */ amount(): Option_AmountZ; /** * Features pertaining to the originating [`Offer`]. * * From [`Offer::offer_features`]; `None` if the invoice was created in response to a * [`Refund`]. * * [`Offer`]: crate::offers::offer::Offer * [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ offer_features(): OfferFeatures; /** * A complete description of the purpose of the originating offer or refund. * * From [`Offer::description`] or [`Refund::description`]. * * [`Offer::description`]: crate::offers::offer::Offer::description * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ description(): PrintableString; /** * Duration since the Unix epoch when an invoice should no longer be requested. * * From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`]. * * [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry */ absolute_expiry(): Option_u64Z; /** * The issuer of the offer or refund. * * From [`Offer::issuer`] or [`Refund::issuer`]. * * [`Offer::issuer`]: crate::offers::offer::Offer::issuer * * 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. * * From [`Offer::paths`] or [`Refund::paths`]. * * [`Offer::paths`]: crate::offers::offer::Offer::paths */ message_paths(): BlindedMessagePath[]; /** * The quantity of items supported. * * From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a * [`Refund`]. * * [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity */ supported_quantity(): Option_QuantityZ; /** * The public key used by the recipient to sign invoices. * * From [`Offer::issuer_signing_pubkey`] and may be `None`; also `None` if the invoice was * created in response to a [`Refund`]. * * [`Offer::issuer_signing_pubkey`]: crate::offers::offer::Offer::issuer_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 from the payer. * * From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`]. */ payer_metadata(): Uint8Array; /** * Features pertaining to requesting an invoice. * * From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`]. */ invoice_request_features(): InvoiceRequestFeatures; /** * The quantity of items requested or refunded for. * * From [`InvoiceRequest::quantity`] or [`Refund::quantity`]. */ quantity(): Option_u64Z; /** * A possibly transient pubkey used to sign the invoice request or to send an invoice for a * refund in case there are no [`message_paths`]. * * [`message_paths`]: Self::message_paths */ payer_signing_pubkey(): Uint8Array; /** * A payer-provided note reflected back in the invoice. * * From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`]. * * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None */ payer_note(): PrintableString; /** * SHA256 hash of the payment preimage that will be given in return for paying the invoice. */ payment_hash(): Uint8Array; /** * The minimum amount required for a successful payment of the invoice. */ amount_msats(): bigint; /** * Serialize the UnsignedBolt12Invoice object into a byte array which can be read by UnsignedBolt12Invoice_read */ write(): Uint8Array; }