pub struct Invoice {
Show 27 fields pub memo: String, pub r_preimage: Vec<u8>, pub r_hash: Vec<u8>, pub value: i64, pub value_msat: i64, pub settled: bool, pub creation_date: i64, pub settle_date: i64, pub payment_request: String, pub description_hash: Vec<u8>, pub expiry: i64, pub fallback_addr: String, pub cltv_expiry: u64, pub route_hints: Vec<RouteHint>, pub private: bool, pub add_index: u64, pub settle_index: u64, pub amt_paid: i64, pub amt_paid_sat: i64, pub amt_paid_msat: i64, pub state: i32, pub htlcs: Vec<InvoiceHtlc>, pub features: HashMap<u32, Feature>, pub is_keysend: bool, pub payment_addr: Vec<u8>, pub is_amp: bool, pub amp_invoice_state: HashMap<String, AmpInvoiceState>,
}

Fields§

§memo: String

An optional memo to attach along with the invoice. Used for record keeping purposes for the invoice’s creator, and will also be set in the description field of the encoded payment request if the description_hash field is not being used.

§r_preimage: Vec<u8>

The hex-encoded preimage (32 byte) which will allow settling an incoming HTLC payable to this preimage. When using REST, this field must be encoded as base64.

§r_hash: Vec<u8>

The hash of the preimage. When using REST, this field must be encoded as base64. Note: Output only, don’t specify for creating an invoice.

§value: i64

The value of this invoice in satoshis

The fields value and value_msat are mutually exclusive.

§value_msat: i64

The value of this invoice in millisatoshis

The fields value and value_msat are mutually exclusive.

§settled: bool
👎Deprecated

Whether this invoice has been fulfilled.

The field is deprecated. Use the state field instead (compare to SETTLED).

§creation_date: i64

When this invoice was created. Measured in seconds since the unix epoch. Note: Output only, don’t specify for creating an invoice.

§settle_date: i64

When this invoice was settled. Measured in seconds since the unix epoch. Note: Output only, don’t specify for creating an invoice.

§payment_request: String

A bare-bones invoice for a payment within the Lightning Network. With the details of the invoice, the sender has all the data necessary to send a payment to the recipient. Note: Output only, don’t specify for creating an invoice.

§description_hash: Vec<u8>

Hash (SHA-256) of a description of the payment. Used if the description of payment (memo) is too long to naturally fit within the description field of an encoded payment request. When using REST, this field must be encoded as base64.

§expiry: i64

Payment request expiry time in seconds. Default is 86400 (24 hours).

§fallback_addr: String

Fallback on-chain address.

§cltv_expiry: u64

Delta to use for the time-lock of the CLTV extended to the final hop.

§route_hints: Vec<RouteHint>

Route hints that can each be individually used to assist in reaching the invoice’s destination.

§private: bool

Whether this invoice should include routing hints for private channels. Note: When enabled, if value and value_msat are zero, a large number of hints with these channels can be included, which might not be desirable.

§add_index: u64

The “add” index of this invoice. Each newly created invoice will increment this index making it monotonically increasing. Callers to the SubscribeInvoices call can use this to instantly get notified of all added invoices with an add_index greater than this one. Note: Output only, don’t specify for creating an invoice.

§settle_index: u64

The “settle” index of this invoice. Each newly settled invoice will increment this index making it monotonically increasing. Callers to the SubscribeInvoices call can use this to instantly get notified of all settled invoices with an settle_index greater than this one. Note: Output only, don’t specify for creating an invoice.

§amt_paid: i64
👎Deprecated

Deprecated, use amt_paid_sat or amt_paid_msat.

§amt_paid_sat: i64

The amount that was accepted for this invoice, in satoshis. This will ONLY be set if this invoice has been settled or accepted. We provide this field as if the invoice was created with a zero value, then we need to record what amount was ultimately accepted. Additionally, it’s possible that the sender paid MORE that was specified in the original invoice. So we’ll record that here as well. Note: Output only, don’t specify for creating an invoice.

§amt_paid_msat: i64

The amount that was accepted for this invoice, in millisatoshis. This will ONLY be set if this invoice has been settled or accepted. We provide this field as if the invoice was created with a zero value, then we need to record what amount was ultimately accepted. Additionally, it’s possible that the sender paid MORE that was specified in the original invoice. So we’ll record that here as well. Note: Output only, don’t specify for creating an invoice.

§state: i32

The state the invoice is in. Note: Output only, don’t specify for creating an invoice.

§htlcs: Vec<InvoiceHtlc>

List of HTLCs paying to this invoice [EXPERIMENTAL]. Note: Output only, don’t specify for creating an invoice.

§features: HashMap<u32, Feature>

List of features advertised on the invoice. Note: Output only, don’t specify for creating an invoice.

§is_keysend: bool

Indicates if this invoice was a spontaneous payment that arrived via keysend [EXPERIMENTAL]. Note: Output only, don’t specify for creating an invoice.

§payment_addr: Vec<u8>

The payment address of this invoice. This value will be used in MPP payments, and also for newer invoices that always require the MPP payload for added end-to-end security. Note: Output only, don’t specify for creating an invoice.

§is_amp: bool

Signals whether or not this is an AMP invoice.

§amp_invoice_state: HashMap<String, AmpInvoiceState>

[EXPERIMENTAL]:

Maps a 32-byte hex-encoded set ID to the sub-invoice AMP state for the given set ID. This field is always populated for AMP invoices, and can be used along side LookupInvoice to obtain the HTLC information related to a given sub-invoice. Note: Output only, don’t specify for creating an invoice.

Implementations§

source§

impl Invoice

source

pub fn state(&self) -> InvoiceState

Returns the enum value of state, or the default if the field is set to an invalid enum value.

source

pub fn set_state(&mut self, value: InvoiceState)

Sets state to the provided enum value.

Trait Implementations§

source§

impl Clone for Invoice

source§

fn clone(&self) -> Invoice

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Invoice

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for Invoice

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for Invoice

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for Invoice

source§

fn eq(&self, other: &Invoice) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Invoice

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more