0f47affa2de9ab11b68100ce2eb881dfc3e00482
[ldk-java] / src / main / java / org / ldk / structs / HTLCOutputInCommitment.java
1 package org.ldk.structs;
2
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
5 import org.ldk.util.*;
6 import java.util.Arrays;
7
8
9 /**
10  * Information about an HTLC as it appears in a commitment transaction
11  */
12 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
13 public class HTLCOutputInCommitment extends CommonBase {
14         HTLCOutputInCommitment(Object _dummy, long ptr) { super(ptr); }
15         @Override @SuppressWarnings("deprecation")
16         protected void finalize() throws Throwable {
17                 super.finalize();
18                 if (ptr != 0) { bindings.HTLCOutputInCommitment_free(ptr); }
19         }
20
21         /**
22          * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
23          * Note that this is not the same as whether it is ountbound *from us*. To determine that you
24          * need to compare this value to whether the commitment transaction in question is that of
25          * the counterparty or our own.
26          */
27         public boolean get_offered() {
28                 boolean ret = bindings.HTLCOutputInCommitment_get_offered(this.ptr);
29                 return ret;
30         }
31
32         /**
33          * Whether the HTLC was \"offered\" (ie outbound in relation to this commitment transaction).
34          * Note that this is not the same as whether it is ountbound *from us*. To determine that you
35          * need to compare this value to whether the commitment transaction in question is that of
36          * the counterparty or our own.
37          */
38         public void set_offered(boolean val) {
39                 bindings.HTLCOutputInCommitment_set_offered(this.ptr, val);
40         }
41
42         /**
43          * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
44          * this divided by 1000.
45          */
46         public long get_amount_msat() {
47                 long ret = bindings.HTLCOutputInCommitment_get_amount_msat(this.ptr);
48                 return ret;
49         }
50
51         /**
52          * The value, in msat, of the HTLC. The value as it appears in the commitment transaction is
53          * this divided by 1000.
54          */
55         public void set_amount_msat(long val) {
56                 bindings.HTLCOutputInCommitment_set_amount_msat(this.ptr, val);
57         }
58
59         /**
60          * The CLTV lock-time at which this HTLC expires.
61          */
62         public int get_cltv_expiry() {
63                 int ret = bindings.HTLCOutputInCommitment_get_cltv_expiry(this.ptr);
64                 return ret;
65         }
66
67         /**
68          * The CLTV lock-time at which this HTLC expires.
69          */
70         public void set_cltv_expiry(int val) {
71                 bindings.HTLCOutputInCommitment_set_cltv_expiry(this.ptr, val);
72         }
73
74         /**
75          * The hash of the preimage which unlocks this HTLC.
76          */
77         public byte[] get_payment_hash() {
78                 byte[] ret = bindings.HTLCOutputInCommitment_get_payment_hash(this.ptr);
79                 return ret;
80         }
81
82         /**
83          * The hash of the preimage which unlocks this HTLC.
84          */
85         public void set_payment_hash(byte[] val) {
86                 bindings.HTLCOutputInCommitment_set_payment_hash(this.ptr, val);
87         }
88
89         /**
90          * Creates a copy of the HTLCOutputInCommitment
91          */
92         public HTLCOutputInCommitment clone() {
93                 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
94                 HTLCOutputInCommitment ret_hu_conv = new HTLCOutputInCommitment(null, ret);
95                 ret_hu_conv.ptrs_to.add(this);
96                 return ret_hu_conv;
97         }
98
99         /**
100          * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
101          */
102         public byte[] write() {
103                 byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr);
104                 return ret;
105         }
106
107         /**
108          * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
109          */
110         public static Result_HTLCOutputInCommitmentDecodeErrorZ constructor_read(byte[] ser) {
111                 long ret = bindings.HTLCOutputInCommitment_read(ser);
112                 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);
113                 return ret_hu_conv;
114         }
115
116 }