1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use CurrencyUnit;
use Amount;
use Uuid;
use crateMakePaymentResponse;
use crateMeltQuote;
/// Initial state - only has operation ID.
///
/// The melt saga starts in this state. Only the `setup_melt` method is available.
/// The operation ID is generated upfront but the full Operation (with amounts) is created during setup.
/// Setup complete - has quote ready for payment.
///
/// After successful setup (proofs reserved, quote state set to Pending), the saga
/// transitions to this state. The `attempt_internal_settlement` and `make_payment`
/// methods are available.
///
/// Input proof Y values, blinded messages, operation, and fee breakdown are
/// persisted to the database during setup and retrieved from there during
/// finalization via the single shared finalization path.
/// Payment confirmed - has quote and payment result.
///
/// After successful payment (internal or external), the saga transitions to this state.
/// Only the `finalize` method is available, which delegates to the shared
/// `finalize_melt_quote` function — the single finalization path that handles
/// operation recording, saga deletion, and all cleanup atomically.
/// Result of attempting internal settlement for a melt operation.
///
/// This enum represents the decision point in the melt flow:
/// - Internal settlement succeeded → skip external Lightning payment
/// - External payment required → proceed with Lightning Network call