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 == null ? 0 : val.ptr);
58 if (this != null) { this.ptrs_to.AddLast(val); };
62 * Constructs a new ReceiveTlvs given each field
64 public static ReceiveTlvs of(byte[] payment_secret_arg, org.ldk.structs.PaymentConstraints payment_constraints_arg) {
65 long ret = bindings.ReceiveTlvs_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), payment_constraints_arg == null ? 0 : payment_constraints_arg.ptr);
66 GC.KeepAlive(payment_secret_arg);
67 GC.KeepAlive(payment_constraints_arg);
68 if (ret >= 0 && ret <= 4096) { return null; }
69 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
70 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
71 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_constraints_arg); };
75 internal long clone_ptr() {
76 long ret = bindings.ReceiveTlvs_clone_ptr(this.ptr);
82 * Creates a copy of the ReceiveTlvs
84 public ReceiveTlvs clone() {
85 long ret = bindings.ReceiveTlvs_clone(this.ptr);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
89 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
94 * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read
96 public byte[] write() {
97 long ret = bindings.ReceiveTlvs_write(this.ptr);
99 if (ret >= 0 && ret <= 4096) { return null; }
100 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
105 * Read a ReceiveTlvs from a byte array, created by ReceiveTlvs_write
107 public static Result_ReceiveTlvsDecodeErrorZ read(byte[] ser) {
108 long ret = bindings.ReceiveTlvs_read(InternalUtils.encodeUint8Array(ser));
110 if (ret >= 0 && ret <= 4096) { return null; }
111 Result_ReceiveTlvsDecodeErrorZ ret_hu_conv = Result_ReceiveTlvsDecodeErrorZ.constr_from_ptr(ret);