]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/ReceiveTlvs.cs
Update CI references to LDK 0.0.124 drop stale memchr pins
[ldk-java] / c_sharp / src / org / ldk / structs / ReceiveTlvs.cs
1 using org.ldk.impl;
2 using org.ldk.enums;
3 using org.ldk.util;
4 using System;
5
6 namespace org { namespace ldk { namespace structs {
7
8
9 /**
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.
12  */
13 public class ReceiveTlvs : CommonBase {
14         internal ReceiveTlvs(object _dummy, long ptr) : base(ptr) { }
15         ~ReceiveTlvs() {
16                 if (ptr != 0) { bindings.ReceiveTlvs_free(ptr); }
17         }
18
19         /**
20          * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
21          */
22         public byte[] get_payment_secret() {
23                 long ret = bindings.ReceiveTlvs_get_payment_secret(this.ptr);
24                 GC.KeepAlive(this);
25                 if (ret >= 0 && ret <= 4096) { return null; }
26                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
27                 return ret_conv;
28         }
29
30         /**
31          * Used to authenticate the sender of a payment to the receiver and tie MPP HTLCs together.
32          */
33         public void set_payment_secret(byte[] val) {
34                 bindings.ReceiveTlvs_set_payment_secret(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37         }
38
39         /**
40          * Constraints for the receiver of this payment.
41          */
42         public PaymentConstraints get_payment_constraints() {
43                 long ret = bindings.ReceiveTlvs_get_payment_constraints(this.ptr);
44                 GC.KeepAlive(this);
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); };
48                 return ret_hu_conv;
49         }
50
51         /**
52          * Constraints for the receiver of this payment.
53          */
54         public void set_payment_constraints(org.ldk.structs.PaymentConstraints val) {
55                 bindings.ReceiveTlvs_set_payment_constraints(this.ptr, val.ptr);
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * Context for the receiver of this payment.
62          */
63         public PaymentContext get_payment_context() {
64                 long ret = bindings.ReceiveTlvs_get_payment_context(this.ptr);
65                 GC.KeepAlive(this);
66                 if (ret >= 0 && ret <= 4096) { return null; }
67                 org.ldk.structs.PaymentContext ret_hu_conv = org.ldk.structs.PaymentContext.constr_from_ptr(ret);
68                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
69                 return ret_hu_conv;
70         }
71
72         /**
73          * Context for the receiver of this payment.
74          */
75         public void set_payment_context(org.ldk.structs.PaymentContext val) {
76                 bindings.ReceiveTlvs_set_payment_context(this.ptr, val.ptr);
77                 GC.KeepAlive(this);
78                 GC.KeepAlive(val);
79         }
80
81         /**
82          * Constructs a new ReceiveTlvs given each field
83          */
84         public static ReceiveTlvs of(byte[] payment_secret_arg, org.ldk.structs.PaymentConstraints payment_constraints_arg, org.ldk.structs.PaymentContext payment_context_arg) {
85                 long ret = bindings.ReceiveTlvs_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_secret_arg, 32)), payment_constraints_arg.ptr, payment_context_arg.ptr);
86                 GC.KeepAlive(payment_secret_arg);
87                 GC.KeepAlive(payment_constraints_arg);
88                 GC.KeepAlive(payment_context_arg);
89                 if (ret >= 0 && ret <= 4096) { return null; }
90                 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
91                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
92                 return ret_hu_conv;
93         }
94
95         internal long clone_ptr() {
96                 long ret = bindings.ReceiveTlvs_clone_ptr(this.ptr);
97                 GC.KeepAlive(this);
98                 return ret;
99         }
100
101         /**
102          * Creates a copy of the ReceiveTlvs
103          */
104         public ReceiveTlvs clone() {
105                 long ret = bindings.ReceiveTlvs_clone(this.ptr);
106                 GC.KeepAlive(this);
107                 if (ret >= 0 && ret <= 4096) { return null; }
108                 org.ldk.structs.ReceiveTlvs ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ReceiveTlvs(null, ret); }
109                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
110                 return ret_hu_conv;
111         }
112
113         /**
114          * Serialize the ReceiveTlvs object into a byte array which can be read by ReceiveTlvs_read
115          */
116         public byte[] write() {
117                 long ret = bindings.ReceiveTlvs_write(this.ptr);
118                 GC.KeepAlive(this);
119                 if (ret >= 0 && ret <= 4096) { return null; }
120                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
121                 return ret_conv;
122         }
123
124 }
125 } } }