6 namespace org { namespace ldk { namespace structs {
9 * Used by [`ChannelManager::list_recent_payments`] to express the status of recent payments.
10 * These include payments that have yet to find a successful path, or have unresolved HTLCs.
12 public class RecentPaymentDetails : CommonBase {
13 protected RecentPaymentDetails(object _dummy, long ptr) : base(ptr) { }
14 ~RecentPaymentDetails() {
15 if (ptr != 0) { bindings.RecentPaymentDetails_free(ptr); }
18 internal static RecentPaymentDetails constr_from_ptr(long ptr) {
19 long raw_ty = bindings.LDKRecentPaymentDetails_ty_from_ptr(ptr);
21 case 0: return new RecentPaymentDetails_Pending(ptr);
22 case 1: return new RecentPaymentDetails_Fulfilled(ptr);
23 case 2: return new RecentPaymentDetails_Abandoned(ptr);
25 throw new ArgumentException("Impossible enum variant");
29 /** A RecentPaymentDetails of type Pending */
30 public class RecentPaymentDetails_Pending : RecentPaymentDetails {
32 * Hash of the payment that is currently being sent but has yet to be fulfilled or
35 public byte[] payment_hash;
37 * Total amount (in msat, excluding fees) across all paths for this payment,
38 * not just the amount currently inflight.
40 public long total_msat;
41 internal RecentPaymentDetails_Pending(long ptr) : base(null, ptr) {
42 this.payment_hash = bindings.LDKRecentPaymentDetails_Pending_get_payment_hash(ptr);
43 this.total_msat = bindings.LDKRecentPaymentDetails_Pending_get_total_msat(ptr);
46 /** A RecentPaymentDetails of type Fulfilled */
47 public class RecentPaymentDetails_Fulfilled : RecentPaymentDetails {
49 * Hash of the payment that was claimed. `None` for serializations of [`ChannelManager`]
50 * made before LDK version 0.0.104.
52 public Option_PaymentHashZ payment_hash;
53 internal RecentPaymentDetails_Fulfilled(long ptr) : base(null, ptr) {
54 long payment_hash = bindings.LDKRecentPaymentDetails_Fulfilled_get_payment_hash(ptr);
55 org.ldk.structs.Option_PaymentHashZ payment_hash_hu_conv = org.ldk.structs.Option_PaymentHashZ.constr_from_ptr(payment_hash);
56 if (payment_hash_hu_conv != null) { payment_hash_hu_conv.ptrs_to.AddLast(this); };
57 this.payment_hash = payment_hash_hu_conv;
60 /** A RecentPaymentDetails of type Abandoned */
61 public class RecentPaymentDetails_Abandoned : RecentPaymentDetails {
63 * Hash of the payment that we have given up trying to send.
65 public byte[] payment_hash;
66 internal RecentPaymentDetails_Abandoned(long ptr) : base(null, ptr) {
67 this.payment_hash = bindings.LDKRecentPaymentDetails_Abandoned_get_payment_hash(ptr);
70 internal long clone_ptr() {
71 long ret = bindings.RecentPaymentDetails_clone_ptr(this.ptr);
77 * Creates a copy of the RecentPaymentDetails
79 public RecentPaymentDetails clone() {
80 long ret = bindings.RecentPaymentDetails_clone(this.ptr);
82 if (ret >= 0 && ret <= 4096) { return null; }
83 org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret);
84 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
89 * Utility method to constructs a new Pending-variant RecentPaymentDetails
91 public static RecentPaymentDetails pending(byte[] payment_hash, long total_msat) {
92 long ret = bindings.RecentPaymentDetails_pending(InternalUtils.check_arr_len(payment_hash, 32), total_msat);
93 GC.KeepAlive(payment_hash);
94 GC.KeepAlive(total_msat);
95 if (ret >= 0 && ret <= 4096) { return null; }
96 org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret);
97 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
102 * Utility method to constructs a new Fulfilled-variant RecentPaymentDetails
104 public static RecentPaymentDetails fulfilled(org.ldk.structs.Option_PaymentHashZ payment_hash) {
105 long ret = bindings.RecentPaymentDetails_fulfilled(payment_hash.ptr);
106 GC.KeepAlive(payment_hash);
107 if (ret >= 0 && ret <= 4096) { return null; }
108 org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret);
109 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_hash); };
115 * Utility method to constructs a new Abandoned-variant RecentPaymentDetails
117 public static RecentPaymentDetails abandoned(byte[] payment_hash) {
118 long ret = bindings.RecentPaymentDetails_abandoned(InternalUtils.check_arr_len(payment_hash, 32));
119 GC.KeepAlive(payment_hash);
120 if (ret >= 0 && ret <= 4096) { return null; }
121 org.ldk.structs.RecentPaymentDetails ret_hu_conv = org.ldk.structs.RecentPaymentDetails.constr_from_ptr(ret);
122 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };