6 namespace org { namespace ldk { namespace structs {
10 * Information about an HTLC that is part of a payment that can be claimed.
12 public class ClaimedHTLC : CommonBase {
13 internal ClaimedHTLC(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.ClaimedHTLC_free(ptr); }
19 * The `channel_id` of the channel over which the HTLC was received.
21 public ChannelId get_channel_id() {
22 long ret = bindings.ClaimedHTLC_get_channel_id(this.ptr);
24 if (ret >= 0 && ret <= 4096) { return null; }
25 org.ldk.structs.ChannelId ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelId(null, ret); }
26 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
31 * The `channel_id` of the channel over which the HTLC was received.
33 public void set_channel_id(org.ldk.structs.ChannelId val) {
34 bindings.ClaimedHTLC_set_channel_id(this.ptr, val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The `user_channel_id` of the channel over which the HTLC was received. This is the value
42 * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
43 * [`ChannelManager::accept_inbound_channel`] for inbound channels if
44 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
45 * `user_channel_id` will be randomized for an inbound channel.
47 * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
48 * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
49 * was not actually claimed until after upgrading.)
51 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
52 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
53 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
55 public UInt128 get_user_channel_id() {
56 long ret = bindings.ClaimedHTLC_get_user_channel_id(this.ptr);
58 if (ret >= 0 && ret <= 4096) { return null; }
59 org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
64 * The `user_channel_id` of the channel over which the HTLC was received. This is the value
65 * passed in to [`ChannelManager::create_channel`] for outbound channels, or to
66 * [`ChannelManager::accept_inbound_channel`] for inbound channels if
67 * [`UserConfig::manually_accept_inbound_channels`] config flag is set to true. Otherwise
68 * `user_channel_id` will be randomized for an inbound channel.
70 * This field will be zero for a payment that was serialized prior to LDK version 0.0.117. (This
71 * should only happen in the case that a payment was claimable prior to LDK version 0.0.117, but
72 * was not actually claimed until after upgrading.)
74 * [`ChannelManager::create_channel`]: crate::ln::channelmanager::ChannelManager::create_channel
75 * [`ChannelManager::accept_inbound_channel`]: crate::ln::channelmanager::ChannelManager::accept_inbound_channel
76 * [`UserConfig::manually_accept_inbound_channels`]: crate::util::config::UserConfig::manually_accept_inbound_channels
78 public void set_user_channel_id(org.ldk.util.UInt128 val) {
79 bindings.ClaimedHTLC_set_user_channel_id(this.ptr, InternalUtils.encodeUint8Array(val.getLEBytes()));
85 * The block height at which this HTLC expires.
87 public int get_cltv_expiry() {
88 int ret = bindings.ClaimedHTLC_get_cltv_expiry(this.ptr);
94 * The block height at which this HTLC expires.
96 public void set_cltv_expiry(int val) {
97 bindings.ClaimedHTLC_set_cltv_expiry(this.ptr, val);
103 * The amount (in msats) of this part of an MPP.
105 public long get_value_msat() {
106 long ret = bindings.ClaimedHTLC_get_value_msat(this.ptr);
112 * The amount (in msats) of this part of an MPP.
114 public void set_value_msat(long val) {
115 bindings.ClaimedHTLC_set_value_msat(this.ptr, val);
121 * The extra fee our counterparty skimmed off the top of this HTLC, if any.
123 * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
126 public long get_counterparty_skimmed_fee_msat() {
127 long ret = bindings.ClaimedHTLC_get_counterparty_skimmed_fee_msat(this.ptr);
133 * The extra fee our counterparty skimmed off the top of this HTLC, if any.
135 * This value will always be 0 for [`ClaimedHTLC`]s serialized with LDK versions prior to
138 public void set_counterparty_skimmed_fee_msat(long val) {
139 bindings.ClaimedHTLC_set_counterparty_skimmed_fee_msat(this.ptr, val);
145 * Constructs a new ClaimedHTLC given each field
147 public static ClaimedHTLC of(org.ldk.structs.ChannelId channel_id_arg, org.ldk.util.UInt128 user_channel_id_arg, int cltv_expiry_arg, long value_msat_arg, long counterparty_skimmed_fee_msat_arg) {
148 long ret = bindings.ClaimedHTLC_new(channel_id_arg.ptr, InternalUtils.encodeUint8Array(user_channel_id_arg.getLEBytes()), cltv_expiry_arg, value_msat_arg, counterparty_skimmed_fee_msat_arg);
149 GC.KeepAlive(channel_id_arg);
150 GC.KeepAlive(user_channel_id_arg);
151 GC.KeepAlive(cltv_expiry_arg);
152 GC.KeepAlive(value_msat_arg);
153 GC.KeepAlive(counterparty_skimmed_fee_msat_arg);
154 if (ret >= 0 && ret <= 4096) { return null; }
155 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
156 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
157 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_id_arg); };
161 internal long clone_ptr() {
162 long ret = bindings.ClaimedHTLC_clone_ptr(this.ptr);
168 * Creates a copy of the ClaimedHTLC
170 public ClaimedHTLC clone() {
171 long ret = bindings.ClaimedHTLC_clone(this.ptr);
173 if (ret >= 0 && ret <= 4096) { return null; }
174 org.ldk.structs.ClaimedHTLC ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClaimedHTLC(null, ret); }
175 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180 * Checks if two ClaimedHTLCs contain equal inner contents.
181 * This ignores pointers and is_owned flags and looks at the values in fields.
182 * Two objects with NULL inner values will be considered "equal" here.
184 public bool eq(org.ldk.structs.ClaimedHTLC b) {
185 bool ret = bindings.ClaimedHTLC_eq(this.ptr, b.ptr);
188 if (this != null) { this.ptrs_to.AddLast(b); };
192 public override bool Equals(object o) {
193 if (!(o is ClaimedHTLC)) return false;
194 return this.eq((ClaimedHTLC)o);
197 * Serialize the ClaimedHTLC object into a byte array which can be read by ClaimedHTLC_read
199 public byte[] write() {
200 long ret = bindings.ClaimedHTLC_write(this.ptr);
202 if (ret >= 0 && ret <= 4096) { return null; }
203 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
208 * Read a ClaimedHTLC from a byte array, created by ClaimedHTLC_write
210 public static Result_ClaimedHTLCDecodeErrorZ read(byte[] ser) {
211 long ret = bindings.ClaimedHTLC_read(InternalUtils.encodeUint8Array(ser));
213 if (ret >= 0 && ret <= 4096) { return null; }
214 Result_ClaimedHTLCDecodeErrorZ ret_hu_conv = Result_ClaimedHTLCDecodeErrorZ.constr_from_ptr(ret);