[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / UpdateAddHTLC.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  * An [`update_add_htlc`] message to be sent to or received from a peer.
11  * 
12  * [`update_add_htlc`]: https://github.com/lightning/bolts/blob/master/02-peer-protocol.md#adding-an-htlc-update_add_htlc
13  */
14 public class UpdateAddHTLC : CommonBase {
15         internal UpdateAddHTLC(object _dummy, long ptr) : base(ptr) { }
16         ~UpdateAddHTLC() {
17                 if (ptr != 0) { bindings.UpdateAddHTLC_free(ptr); }
18         }
19
20         /**
21          * The channel ID
22          */
23         public byte[] get_channel_id() {
24                 long ret = bindings.UpdateAddHTLC_get_channel_id(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
28                 return ret_conv;
29         }
30
31         /**
32          * The channel ID
33          */
34         public void set_channel_id(byte[] val) {
35                 bindings.UpdateAddHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
36                 GC.KeepAlive(this);
37                 GC.KeepAlive(val);
38         }
39
40         /**
41          * The HTLC ID
42          */
43         public long get_htlc_id() {
44                 long ret = bindings.UpdateAddHTLC_get_htlc_id(this.ptr);
45                 GC.KeepAlive(this);
46                 return ret;
47         }
48
49         /**
50          * The HTLC ID
51          */
52         public void set_htlc_id(long val) {
53                 bindings.UpdateAddHTLC_set_htlc_id(this.ptr, val);
54                 GC.KeepAlive(this);
55                 GC.KeepAlive(val);
56         }
57
58         /**
59          * The HTLC value in milli-satoshi
60          */
61         public long get_amount_msat() {
62                 long ret = bindings.UpdateAddHTLC_get_amount_msat(this.ptr);
63                 GC.KeepAlive(this);
64                 return ret;
65         }
66
67         /**
68          * The HTLC value in milli-satoshi
69          */
70         public void set_amount_msat(long val) {
71                 bindings.UpdateAddHTLC_set_amount_msat(this.ptr, val);
72                 GC.KeepAlive(this);
73                 GC.KeepAlive(val);
74         }
75
76         /**
77          * The payment hash, the pre-image of which controls HTLC redemption
78          */
79         public byte[] get_payment_hash() {
80                 long ret = bindings.UpdateAddHTLC_get_payment_hash(this.ptr);
81                 GC.KeepAlive(this);
82                 if (ret >= 0 && ret <= 4096) { return null; }
83                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
84                 return ret_conv;
85         }
86
87         /**
88          * The payment hash, the pre-image of which controls HTLC redemption
89          */
90         public void set_payment_hash(byte[] val) {
91                 bindings.UpdateAddHTLC_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
92                 GC.KeepAlive(this);
93                 GC.KeepAlive(val);
94         }
95
96         /**
97          * The expiry height of the HTLC
98          */
99         public int get_cltv_expiry() {
100                 int ret = bindings.UpdateAddHTLC_get_cltv_expiry(this.ptr);
101                 GC.KeepAlive(this);
102                 return ret;
103         }
104
105         /**
106          * The expiry height of the HTLC
107          */
108         public void set_cltv_expiry(int val) {
109                 bindings.UpdateAddHTLC_set_cltv_expiry(this.ptr, val);
110                 GC.KeepAlive(this);
111                 GC.KeepAlive(val);
112         }
113
114         /**
115          * The extra fee skimmed by the sender of this message. See
116          * [`ChannelConfig::accept_underpaying_htlcs`].
117          * 
118          * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
119          */
120         public Option_u64Z get_skimmed_fee_msat() {
121                 long ret = bindings.UpdateAddHTLC_get_skimmed_fee_msat(this.ptr);
122                 GC.KeepAlive(this);
123                 if (ret >= 0 && ret <= 4096) { return null; }
124                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
125                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
126                 return ret_hu_conv;
127         }
128
129         /**
130          * The extra fee skimmed by the sender of this message. See
131          * [`ChannelConfig::accept_underpaying_htlcs`].
132          * 
133          * [`ChannelConfig::accept_underpaying_htlcs`]: crate::util::config::ChannelConfig::accept_underpaying_htlcs
134          */
135         public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
136                 bindings.UpdateAddHTLC_set_skimmed_fee_msat(this.ptr, val.ptr);
137                 GC.KeepAlive(this);
138                 GC.KeepAlive(val);
139                 if (this != null) { this.ptrs_to.AddLast(val); };
140         }
141
142         internal long clone_ptr() {
143                 long ret = bindings.UpdateAddHTLC_clone_ptr(this.ptr);
144                 GC.KeepAlive(this);
145                 return ret;
146         }
147
148         /**
149          * Creates a copy of the UpdateAddHTLC
150          */
151         public UpdateAddHTLC clone() {
152                 long ret = bindings.UpdateAddHTLC_clone(this.ptr);
153                 GC.KeepAlive(this);
154                 if (ret >= 0 && ret <= 4096) { return null; }
155                 org.ldk.structs.UpdateAddHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateAddHTLC(null, ret); }
156                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
157                 return ret_hu_conv;
158         }
159
160         /**
161          * Checks if two UpdateAddHTLCs contain equal inner contents.
162          * This ignores pointers and is_owned flags and looks at the values in fields.
163          * Two objects with NULL inner values will be considered "equal" here.
164          */
165         public bool eq(org.ldk.structs.UpdateAddHTLC b) {
166                 bool ret = bindings.UpdateAddHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
167                 GC.KeepAlive(this);
168                 GC.KeepAlive(b);
169                 if (this != null) { this.ptrs_to.AddLast(b); };
170                 return ret;
171         }
172
173         public override bool Equals(object o) {
174                 if (!(o is UpdateAddHTLC)) return false;
175                 return this.eq((UpdateAddHTLC)o);
176         }
177         /**
178          * Serialize the UpdateAddHTLC object into a byte array which can be read by UpdateAddHTLC_read
179          */
180         public byte[] write() {
181                 long ret = bindings.UpdateAddHTLC_write(this.ptr);
182                 GC.KeepAlive(this);
183                 if (ret >= 0 && ret <= 4096) { return null; }
184                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
185                 return ret_conv;
186         }
187
188         /**
189          * Read a UpdateAddHTLC from a byte array, created by UpdateAddHTLC_write
190          */
191         public static Result_UpdateAddHTLCDecodeErrorZ read(byte[] ser) {
192                 long ret = bindings.UpdateAddHTLC_read(InternalUtils.encodeUint8Array(ser));
193                 GC.KeepAlive(ser);
194                 if (ret >= 0 && ret <= 4096) { return null; }
195                 Result_UpdateAddHTLCDecodeErrorZ ret_hu_conv = Result_UpdateAddHTLCDecodeErrorZ.constr_from_ptr(ret);
196                 return ret_hu_conv;
197         }
198
199 }
200 } } }