6 namespace org { namespace ldk { namespace structs {
10 * Data to construct a [`BlindedHop`] for receiving a payment. This payload is custom to LDK and
11 * may not be valid if received by another lightning implementation.
13 public class ReceiveTlvs : CommonBase {
14 internal ReceiveTlvs(object _dummy, long ptr) : base(ptr) { }
16 if (ptr != 0) { bindings.ReceiveTlvs_free(ptr); }
20 * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
22 public byte[] get_payment_secret() {
23 long ret = bindings.ReceiveTlvs_get_payment_secret(this.ptr);
25 if (ret >= 0 && ret <= 4096) { return null; }
26 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
31 * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
33 public void set_payment_secret(byte[] val) {
34 bindings.ReceiveTlvs_set_payment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
40 * Constraints for the receiver of this payment.
42 public PaymentConstraints get_payment_constraints() {
43 long ret = bindings.ReceiveTlvs_get_payment_constraints(this.ptr);
45 if (ret >= 0 && ret <= 4096) { return null; }
46 org.ldk.structs.PaymentConstraints ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentConstraints(null, ret); }
47 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
52 * Constraints for the receiver of this payment.
54 public void set_payment_constraints(org.ldk.structs.PaymentConstraints val) {
55 bindings.ReceiveTlvs_set_payment_constraints(this.ptr, val.ptr);
58 if (this != null) { this.ptrs_to.AddLast(val); };
62 * Context for the receiver of this payment.
64 public PaymentContext get_payment_context() {
65 long ret = bindings.ReceiveTlvs_get_payment_context(this.ptr);
67 if (ret >= 0 && ret <= 4096) { return null; }
68 org.ldk.structs.PaymentContext ret_hu_conv = org.ldk.structs.PaymentContext.constr_from_ptr(ret);
69 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
74 * Context for the receiver of this payment.
76 public void set_payment_context(org.ldk.structs.PaymentContext val) {
77 bindings.ReceiveTlvs_set_payment_context(this.ptr, val.ptr);
80 if (this != null) { this.ptrs_to.AddLast(val); };
84 * Constructs a new ReceiveTlvs given each field
86 public static ReceiveTlvs of(byte[] payment_secret_arg, org.ldk.structs.PaymentConstraints payment_constraints_arg, org.ldk.structs.PaymentContext payment_context_arg) {
87 long ret = bindings.ReceiveTlvs_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), payment_constraints_arg.ptr, payment_context_arg.ptr);
88 GC.KeepAlive(payment_secret_arg);
89 GC.KeepAlive(payment_constraints_arg);
90 GC.KeepAlive(payment_context_arg);
91 if (ret >= 0 && ret <= 4096) { return null; }
92 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
93 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
94 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_constraints_arg); };
95 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_context_arg); };
99 internal long clone_ptr() {
100 long ret = bindings.ReceiveTlvs_clone_ptr(this.ptr);
106 * Creates a copy of the ReceiveTlvs
108 public ReceiveTlvs clone() {
109 long ret = bindings.ReceiveTlvs_clone(this.ptr);
111 if (ret >= 0 && ret <= 4096) { return null; }
112 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
113 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
118 * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read
120 public byte[] write() {
121 long ret = bindings.ReceiveTlvs_write(this.ptr);
123 if (ret >= 0 && ret <= 4096) { return null; }
124 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);