pub struct MeltQuote {Show 14 fields
pub id: QuoteId,
pub unit: CurrencyUnit,
pub request: MeltPaymentRequest,
pub state: MeltQuoteState,
pub expiry: u64,
pub payment_proof: Option<String>,
pub request_lookup_id: Option<PaymentIdentifier>,
pub options: Option<MeltOptions>,
pub created_time: u64,
pub paid_time: Option<u64>,
pub payment_method: PaymentMethod,
pub extra_json: Option<Value>,
pub estimated_blocks: Option<u32>,
pub selected_fee_index: Option<u32>,
/* private fields */
}Expand description
Melt Quote Info
Fields§
§id: QuoteIdQuote id
unit: CurrencyUnitQuote unit
request: MeltPaymentRequestQuote Payment request e.g. bolt11
state: MeltQuoteStateQuote state
expiry: u64Expiration time of quote
payment_proof: Option<String>Payment proof (e.g. Lightning preimage or onchain outpoint)
request_lookup_id: Option<PaymentIdentifier>Value used by ln backend to look up state of request
options: Option<MeltOptions>Payment options
Used for amountless invoices and MPP payments
created_time: u64Unix time quote was created
paid_time: Option<u64>Unix time quote was paid
payment_method: PaymentMethodPayment method
extra_json: Option<Value>Extra payment-method-specific response fields
estimated_blocks: Option<u32>Estimated confirmation target in blocks for onchain quotes
selected_fee_index: Option<u32>Selected fee option index once an onchain quote is executed
Implementations§
Source§impl MeltQuote
impl MeltQuote
Sourcepub fn new(
id: Option<QuoteId>,
request: MeltPaymentRequest,
unit: CurrencyUnit,
amount: Amount<CurrencyUnit>,
fee_reserve: Amount<CurrencyUnit>,
expiry: u64,
request_lookup_id: Option<PaymentIdentifier>,
options: Option<MeltOptions>,
payment_method: PaymentMethod,
extra_json: Option<Value>,
estimated_blocks: Option<u32>,
) -> Self
pub fn new( id: Option<QuoteId>, request: MeltPaymentRequest, unit: CurrencyUnit, amount: Amount<CurrencyUnit>, fee_reserve: Amount<CurrencyUnit>, expiry: u64, request_lookup_id: Option<PaymentIdentifier>, options: Option<MeltOptions>, payment_method: PaymentMethod, extra_json: Option<Value>, estimated_blocks: Option<u32>, ) -> Self
Create new MeltQuote
Sourcepub fn new_onchain(
id: Option<QuoteId>,
request: MeltPaymentRequest,
unit: CurrencyUnit,
amount: Amount<CurrencyUnit>,
expiry: u64,
request_lookup_id: Option<PaymentIdentifier>,
extra_json: Option<Value>,
fee_options: Vec<MeltQuoteOnchainFeeOption>,
) -> Result<Self, Error>
pub fn new_onchain( id: Option<QuoteId>, request: MeltPaymentRequest, unit: CurrencyUnit, amount: Amount<CurrencyUnit>, expiry: u64, request_lookup_id: Option<PaymentIdentifier>, extra_json: Option<Value>, fee_options: Vec<MeltQuoteOnchainFeeOption>, ) -> Result<Self, Error>
Create a new onchain MeltQuote with explicit fee_options.
Preserves backend-provided fee_index values and validates that the
quote contains at least one option (OnchainFeeOptionsEmpty).
fee_reserve is initialized to the lowest-fee option so the quote has
a definite reserve before the wallet selects a tier. Once the wallet
calls MeltQuote::select_onchain_fee_option the reserve is updated
to match the selected option. fee_options itself is never mutated
after this call; that invariant is enforced by making the field
private.
Sourcepub fn fee_options(&self) -> &[MeltQuoteOnchainFeeOption]
pub fn fee_options(&self) -> &[MeltQuoteOnchainFeeOption]
Onchain fee options for this quote.
For non-onchain quotes this returns an empty slice. For onchain quotes
this is guaranteed non-empty (enforced at construction in
MeltQuote::new_onchain and on reload in MeltQuote::from_db).
Sourcepub fn amount(&self) -> Amount<CurrencyUnit>
pub fn amount(&self) -> Amount<CurrencyUnit>
Quote amount
Sourcepub fn fee_reserve(&self) -> Amount<CurrencyUnit>
pub fn fee_reserve(&self) -> Amount<CurrencyUnit>
Fee reserve
Sourcepub fn select_onchain_fee_option(&mut self, fee_index: u32) -> Result<(), Error>
pub fn select_onchain_fee_option(&mut self, fee_index: u32) -> Result<(), Error>
Select an onchain fee option by its fee_index.
Sourcepub fn into_response(
self,
change: Option<Vec<BlindSignature>>,
) -> MeltQuoteResponse<QuoteId>
pub fn into_response( self, change: Option<Vec<BlindSignature>>, ) -> MeltQuoteResponse<QuoteId>
Convert into MeltQuoteResponse, overriding change on the inner
response with the provided signatures.
Dispatches to the per-variant From<MeltQuote> conversions so that
field mapping stays centralized. Note that MeltQuoteBolt12Response
is a type alias for MeltQuoteBolt11Response, so both Bolt11 and
Bolt12 go through the same conversion.
Sourcepub fn total_needed(&self) -> Result<Amount, Error>
pub fn total_needed(&self) -> Result<Amount, Error>
Total amount needed (amount + fee_reserve)
Sourcepub fn from_db(
id: QuoteId,
unit: CurrencyUnit,
request: MeltPaymentRequest,
amount: u64,
fee_reserve: u64,
state: MeltQuoteState,
expiry: u64,
payment_proof: Option<String>,
request_lookup_id: Option<PaymentIdentifier>,
options: Option<MeltOptions>,
created_time: u64,
paid_time: Option<u64>,
payment_method: PaymentMethod,
extra_json: Option<Value>,
estimated_blocks: Option<u32>,
fee_options: Vec<MeltQuoteOnchainFeeOption>,
selected_fee_index: Option<u32>,
) -> Result<Self, Error>
pub fn from_db( id: QuoteId, unit: CurrencyUnit, request: MeltPaymentRequest, amount: u64, fee_reserve: u64, state: MeltQuoteState, expiry: u64, payment_proof: Option<String>, request_lookup_id: Option<PaymentIdentifier>, options: Option<MeltOptions>, created_time: u64, paid_time: Option<u64>, payment_method: PaymentMethod, extra_json: Option<Value>, estimated_blocks: Option<u32>, fee_options: Vec<MeltQuoteOnchainFeeOption>, selected_fee_index: Option<u32>, ) -> Result<Self, Error>
Create MeltQuote from database fields (for deserialization)
Trait Implementations§
impl Eq for MeltQuote
Source§impl<Q> From<MeltQuote> for MeltQuoteResponse<Q>
Available on crate feature mint only.
impl<Q> From<MeltQuote> for MeltQuoteResponse<Q>
mint only.