[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / ClaimedHTLC.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  * Information about an HTLC that is part of a payment that can be claimed.
11  */
12 public class ClaimedHTLC : CommonBase {
13         internal ClaimedHTLC(object _dummy, long ptr) : base(ptr) { }
14         ~ClaimedHTLC() {
15                 if (ptr != 0) { bindings.ClaimedHTLC_free(ptr); }
16         }
17
18         /**
19          * The `channel_id` of the channel over which the HTLC was received.
20          */
21         public byte[] get_channel_id() {
22                 long ret = bindings.ClaimedHTLC_get_channel_id(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
26                 return ret_conv;
27         }
28
29         /**
30          * The `channel_id` of the channel over which the HTLC was received.
31          */
32         public void set_channel_id(byte[] val) {
33                 bindings.ClaimedHTLC_set_channel_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
34                 GC.KeepAlive(this);
35                 GC.KeepAlive(val);
36         }
37
38         /**
39          * The `user_channel_id` of the channel over which the HTLC was received. This is the value
40          * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
41          * [`ChannelManager::accept_inbound_channel`] for inbound channels if
42          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
43          * `user_channel_id` will be randomized for an inbound channel.
44          * 
45          * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
46          * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
47          * was not actually claimed until after upgrading.)
48          * 
49          * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
50          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
51          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
52          */
53         public UInt128 get_user_channel_id() {
54                 long ret = bindings.ClaimedHTLC_get_user_channel_id(this.ptr);
55                 GC.KeepAlive(this);
56                 if (ret >= 0 && ret <= 4096) { return null; }
57                 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
58                 return ret_conv;
59         }
60
61         /**
62          * The `user_channel_id` of the channel over which the HTLC was received. This is the value
63          * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
64          * [`ChannelManager::accept_inbound_channel`] for inbound channels if
65          * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
66          * `user_channel_id` will be randomized for an inbound channel.
67          * 
68          * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
69          * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
70          * was not actually claimed until after upgrading.)
71          * 
72          * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
73          * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
74          * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
75          */
76         public void set_user_channel_id(org.ldk.util.UInt128 val) {
77                 bindings.ClaimedHTLC_set_user_channel_id(this.ptr, InternalUtils.encodeUint8Array(val.getLEBytes()));
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(val);
80         }
81
82         /**
83          * The block height at which this HTLC expires.
84          */
85         public int get_cltv_expiry() {
86                 int ret = bindings.ClaimedHTLC_get_cltv_expiry(this.ptr);
87                 GC.KeepAlive(this);
88                 return ret;
89         }
90
91         /**
92          * The block height at which this HTLC expires.
93          */
94         public void set_cltv_expiry(int val) {
95                 bindings.ClaimedHTLC_set_cltv_expiry(this.ptr, val);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98         }
99
100         /**
101          * The amount (in msats) of this part of an MPP.
102          */
103         public long get_value_msat() {
104                 long ret = bindings.ClaimedHTLC_get_value_msat(this.ptr);
105                 GC.KeepAlive(this);
106                 return ret;
107         }
108
109         /**
110          * The amount (in msats) of this part of an MPP.
111          */
112         public void set_value_msat(long val) {
113                 bindings.ClaimedHTLC_set_value_msat(this.ptr, val);
114                 GC.KeepAlive(this);
115                 GC.KeepAlive(val);
116         }
117
118         /**
119          * Constructs a new ClaimedHTLC given each field
120          */
121         public static ClaimedHTLC of(byte[] channel_id_arg, org.ldk.util.UInt128 user_channel_id_arg, int cltv_expiry_arg, long value_msat_arg) {
122                 long ret = bindings.ClaimedHTLC_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_id_arg, 32)), InternalUtils.encodeUint8Array(user_channel_id_arg.getLEBytes()), cltv_expiry_arg, value_msat_arg);
123                 GC.KeepAlive(channel_id_arg);
124                 GC.KeepAlive(user_channel_id_arg);
125                 GC.KeepAlive(cltv_expiry_arg);
126                 GC.KeepAlive(value_msat_arg);
127                 if (ret >= 0 && ret <= 4096) { return null; }
128                 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
129                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
130                 return ret_hu_conv;
131         }
132
133         internal long clone_ptr() {
134                 long ret = bindings.ClaimedHTLC_clone_ptr(this.ptr);
135                 GC.KeepAlive(this);
136                 return ret;
137         }
138
139         /**
140          * Creates a copy of the ClaimedHTLC
141          */
142         public ClaimedHTLC clone() {
143                 long ret = bindings.ClaimedHTLC_clone(this.ptr);
144                 GC.KeepAlive(this);
145                 if (ret >= 0 && ret <= 4096) { return null; }
146                 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
147                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
148                 return ret_hu_conv;
149         }
150
151         /**
152          * Checks if two ClaimedHTLCs contain equal inner contents.
153          * This ignores pointers and is_owned flags and looks at the values in fields.
154          * Two objects with NULL inner values will be considered "equal" here.
155          */
156         public bool eq(org.ldk.structs.ClaimedHTLC b) {
157                 bool ret = bindings.ClaimedHTLC_eq(this.ptr, b == null ? 0 : b.ptr);
158                 GC.KeepAlive(this);
159                 GC.KeepAlive(b);
160                 if (this != null) { this.ptrs_to.AddLast(b); };
161                 return ret;
162         }
163
164         public override bool Equals(object o) {
165                 if (!(o is ClaimedHTLC)) return false;
166                 return this.eq((ClaimedHTLC)o);
167         }
168         /**
169          * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read
170          */
171         public byte[] write() {
172                 long ret = bindings.ClaimedHTLC_write(this.ptr);
173                 GC.KeepAlive(this);
174                 if (ret >= 0 && ret <= 4096) { return null; }
175                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
176                 return ret_conv;
177         }
178
179         /**
180          * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write
181          */
182         public static Result_ClaimedHTLCDecodeErrorZ read(byte[] ser) {
183                 long ret = bindings.ClaimedHTLC_read(InternalUtils.encodeUint8Array(ser));
184                 GC.KeepAlive(ser);
185                 if (ret >= 0 && ret <= 4096) { return null; }
186                 Result_ClaimedHTLCDecodeErrorZ ret_hu_conv = Result_ClaimedHTLCDecodeErrorZ.constr_from_ptr(ret);
187                 return ret_hu_conv;
188         }
189
190 }
191 } } }