]> git.bitcoin.ninja Git - ldk-java/blob - c_sharp/src/org/ldk/structs/OutboundHTLCDetails.cs
[C#] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[ldk-java] / c_sharp / src / org / ldk / structs / OutboundHTLCDetails.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  * Exposes details around pending outbound HTLCs.
11  */
12 public class OutboundHTLCDetails : CommonBase {
13         internal OutboundHTLCDetails(object _dummy, long ptr) : base(ptr) { }
14         ~OutboundHTLCDetails() {
15                 if (ptr != 0) { bindings.OutboundHTLCDetails_free(ptr); }
16         }
17
18         /**
19          * The HTLC ID.
20          * The IDs are incremented by 1 starting from 0 for each offered HTLC.
21          * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced
22          * and not part of any commitment transaction.
23          * 
24          * Not present when we are awaiting a remote revocation and the HTLC is not added yet.
25          */
26         public Option_u64Z get_htlc_id() {
27                 long ret = bindings.OutboundHTLCDetails_get_htlc_id(this.ptr);
28                 GC.KeepAlive(this);
29                 if (ret >= 0 && ret <= 4096) { return null; }
30                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
31                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
32                 return ret_hu_conv;
33         }
34
35         /**
36          * The HTLC ID.
37          * The IDs are incremented by 1 starting from 0 for each offered HTLC.
38          * They are unique per channel and inbound/outbound direction, unless an HTLC was only announced
39          * and not part of any commitment transaction.
40          * 
41          * Not present when we are awaiting a remote revocation and the HTLC is not added yet.
42          */
43         public void set_htlc_id(org.ldk.structs.Option_u64Z val) {
44                 bindings.OutboundHTLCDetails_set_htlc_id(this.ptr, val.ptr);
45                 GC.KeepAlive(this);
46                 GC.KeepAlive(val);
47                 if (this != null) { this.ptrs_to.AddLast(val); };
48         }
49
50         /**
51          * The amount in msat.
52          */
53         public long get_amount_msat() {
54                 long ret = bindings.OutboundHTLCDetails_get_amount_msat(this.ptr);
55                 GC.KeepAlive(this);
56                 return ret;
57         }
58
59         /**
60          * The amount in msat.
61          */
62         public void set_amount_msat(long val) {
63                 bindings.OutboundHTLCDetails_set_amount_msat(this.ptr, val);
64                 GC.KeepAlive(this);
65                 GC.KeepAlive(val);
66         }
67
68         /**
69          * The block height at which this HTLC expires.
70          */
71         public int get_cltv_expiry() {
72                 int ret = bindings.OutboundHTLCDetails_get_cltv_expiry(this.ptr);
73                 GC.KeepAlive(this);
74                 return ret;
75         }
76
77         /**
78          * The block height at which this HTLC expires.
79          */
80         public void set_cltv_expiry(int val) {
81                 bindings.OutboundHTLCDetails_set_cltv_expiry(this.ptr, val);
82                 GC.KeepAlive(this);
83                 GC.KeepAlive(val);
84         }
85
86         /**
87          * The payment hash.
88          */
89         public byte[] get_payment_hash() {
90                 long ret = bindings.OutboundHTLCDetails_get_payment_hash(this.ptr);
91                 GC.KeepAlive(this);
92                 if (ret >= 0 && ret <= 4096) { return null; }
93                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
94                 return ret_conv;
95         }
96
97         /**
98          * The payment hash.
99          */
100         public void set_payment_hash(byte[] val) {
101                 bindings.OutboundHTLCDetails_set_payment_hash(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
102                 GC.KeepAlive(this);
103                 GC.KeepAlive(val);
104         }
105
106         /**
107          * The state of the HTLC in the state machine.
108          * 
109          * Determines on which commitment transactions the HTLC is included and what message the HTLC is
110          * waiting for to advance to the next state.
111          * 
112          * See [`OutboundHTLCStateDetails`] for information on the specific states.
113          * 
114          * LDK will always fill this field in, but when downgrading to prior versions of LDK, new
115          * states may result in `None` here.
116          */
117         public Option_OutboundHTLCStateDetailsZ get_state() {
118                 long ret = bindings.OutboundHTLCDetails_get_state(this.ptr);
119                 GC.KeepAlive(this);
120                 if (ret >= 0 && ret <= 4096) { return null; }
121                 org.ldk.structs.Option_OutboundHTLCStateDetailsZ ret_hu_conv = org.ldk.structs.Option_OutboundHTLCStateDetailsZ.constr_from_ptr(ret);
122                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
123                 return ret_hu_conv;
124         }
125
126         /**
127          * The state of the HTLC in the state machine.
128          * 
129          * Determines on which commitment transactions the HTLC is included and what message the HTLC is
130          * waiting for to advance to the next state.
131          * 
132          * See [`OutboundHTLCStateDetails`] for information on the specific states.
133          * 
134          * LDK will always fill this field in, but when downgrading to prior versions of LDK, new
135          * states may result in `None` here.
136          */
137         public void set_state(org.ldk.structs.Option_OutboundHTLCStateDetailsZ val) {
138                 bindings.OutboundHTLCDetails_set_state(this.ptr, val.ptr);
139                 GC.KeepAlive(this);
140                 GC.KeepAlive(val);
141                 if (this != null) { this.ptrs_to.AddLast(val); };
142         }
143
144         /**
145          * The extra fee being skimmed off the top of this HTLC.
146          */
147         public Option_u64Z get_skimmed_fee_msat() {
148                 long ret = bindings.OutboundHTLCDetails_get_skimmed_fee_msat(this.ptr);
149                 GC.KeepAlive(this);
150                 if (ret >= 0 && ret <= 4096) { return null; }
151                 org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
152                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
153                 return ret_hu_conv;
154         }
155
156         /**
157          * The extra fee being skimmed off the top of this HTLC.
158          */
159         public void set_skimmed_fee_msat(org.ldk.structs.Option_u64Z val) {
160                 bindings.OutboundHTLCDetails_set_skimmed_fee_msat(this.ptr, val.ptr);
161                 GC.KeepAlive(this);
162                 GC.KeepAlive(val);
163                 if (this != null) { this.ptrs_to.AddLast(val); };
164         }
165
166         /**
167          * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed
168          * from the local commitment transaction and added to the commitment transaction fee.
169          * For non-anchor channels, this takes into account the cost of the second-stage HTLC
170          * transactions as well.
171          * 
172          * When the local commitment transaction is broadcasted as part of a unilateral closure,
173          * the value of this HTLC will therefore not be claimable but instead burned as a transaction
174          * fee.
175          * 
176          * Note that dust limits are specific to each party. An HTLC can be dust for the local
177          * commitment transaction but not for the counterparty's commitment transaction and vice versa.
178          */
179         public bool get_is_dust() {
180                 bool ret = bindings.OutboundHTLCDetails_get_is_dust(this.ptr);
181                 GC.KeepAlive(this);
182                 return ret;
183         }
184
185         /**
186          * Whether the HTLC has an output below the local dust limit. If so, the output will be trimmed
187          * from the local commitment transaction and added to the commitment transaction fee.
188          * For non-anchor channels, this takes into account the cost of the second-stage HTLC
189          * transactions as well.
190          * 
191          * When the local commitment transaction is broadcasted as part of a unilateral closure,
192          * the value of this HTLC will therefore not be claimable but instead burned as a transaction
193          * fee.
194          * 
195          * Note that dust limits are specific to each party. An HTLC can be dust for the local
196          * commitment transaction but not for the counterparty's commitment transaction and vice versa.
197          */
198         public void set_is_dust(bool val) {
199                 bindings.OutboundHTLCDetails_set_is_dust(this.ptr, val);
200                 GC.KeepAlive(this);
201                 GC.KeepAlive(val);
202         }
203
204         /**
205          * Constructs a new OutboundHTLCDetails given each field
206          */
207         public static OutboundHTLCDetails of(org.ldk.structs.Option_u64Z htlc_id_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, org.ldk.structs.Option_OutboundHTLCStateDetailsZ state_arg, org.ldk.structs.Option_u64Z skimmed_fee_msat_arg, bool is_dust_arg) {
208                 long ret = bindings.OutboundHTLCDetails_new(htlc_id_arg.ptr, amount_msat_arg, cltv_expiry_arg, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash_arg, 32)), state_arg.ptr, skimmed_fee_msat_arg.ptr, is_dust_arg);
209                 GC.KeepAlive(htlc_id_arg);
210                 GC.KeepAlive(amount_msat_arg);
211                 GC.KeepAlive(cltv_expiry_arg);
212                 GC.KeepAlive(payment_hash_arg);
213                 GC.KeepAlive(state_arg);
214                 GC.KeepAlive(skimmed_fee_msat_arg);
215                 GC.KeepAlive(is_dust_arg);
216                 if (ret >= 0 && ret <= 4096) { return null; }
217                 org.ldk.structs.OutboundHTLCDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutboundHTLCDetails(null, ret); }
218                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
219                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(htlc_id_arg); };
220                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(state_arg); };
221                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(skimmed_fee_msat_arg); };
222                 return ret_hu_conv;
223         }
224
225         internal long clone_ptr() {
226                 long ret = bindings.OutboundHTLCDetails_clone_ptr(this.ptr);
227                 GC.KeepAlive(this);
228                 return ret;
229         }
230
231         /**
232          * Creates a copy of the OutboundHTLCDetails
233          */
234         public OutboundHTLCDetails clone() {
235                 long ret = bindings.OutboundHTLCDetails_clone(this.ptr);
236                 GC.KeepAlive(this);
237                 if (ret >= 0 && ret <= 4096) { return null; }
238                 org.ldk.structs.OutboundHTLCDetails ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutboundHTLCDetails(null, ret); }
239                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
240                 return ret_hu_conv;
241         }
242
243         /**
244          * Serialize the OutboundHTLCDetails object into a byte array which can be read by OutboundHTLCDetails_read
245          */
246         public byte[] write() {
247                 long ret = bindings.OutboundHTLCDetails_write(this.ptr);
248                 GC.KeepAlive(this);
249                 if (ret >= 0 && ret <= 4096) { return null; }
250                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
251                 return ret_conv;
252         }
253
254         /**
255          * Read a OutboundHTLCDetails from a byte array, created by OutboundHTLCDetails_write
256          */
257         public static Result_OutboundHTLCDetailsDecodeErrorZ read(byte[] ser) {
258                 long ret = bindings.OutboundHTLCDetails_read(InternalUtils.encodeUint8Array(ser));
259                 GC.KeepAlive(ser);
260                 if (ret >= 0 && ret <= 4096) { return null; }
261                 Result_OutboundHTLCDetailsDecodeErrorZ ret_hu_conv = Result_OutboundHTLCDetailsDecodeErrorZ.constr_from_ptr(ret);
262                 return ret_hu_conv;
263         }
264
265 }
266 } } }