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