Update auto-generated bindings
[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          * The position within the commitment transactions' outputs. This may be None if the value is
91          * below the dust limit (in which case no output appears in the commitment transaction and the
92          * value is spent to additional transaction fees).
93          */
94         public Option_u32Z get_transaction_output_index() {
95                 long ret = bindings.HTLCOutputInCommitment_get_transaction_output_index(this.ptr);
96                 Option_u32Z ret_hu_conv = Option_u32Z.constr_from_ptr(ret);
97                 ret_hu_conv.ptrs_to.add(this);
98                 return ret_hu_conv;
99         }
100
101         /**
102          * The position within the commitment transactions' outputs. This may be None if the value is
103          * below the dust limit (in which case no output appears in the commitment transaction and the
104          * value is spent to additional transaction fees).
105          */
106         public void set_transaction_output_index(Option_u32Z val) {
107                 bindings.HTLCOutputInCommitment_set_transaction_output_index(this.ptr, val.ptr);
108         }
109
110         /**
111          * Constructs a new HTLCOutputInCommitment given each field
112          */
113         public static HTLCOutputInCommitment constructor_new(boolean offered_arg, long amount_msat_arg, int cltv_expiry_arg, byte[] payment_hash_arg, Option_u32Z transaction_output_index_arg) {
114                 long ret = bindings.HTLCOutputInCommitment_new(offered_arg, amount_msat_arg, cltv_expiry_arg, payment_hash_arg, transaction_output_index_arg.ptr);
115                 HTLCOutputInCommitment ret_hu_conv = new HTLCOutputInCommitment(null, ret);
116                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
117                 return ret_hu_conv;
118         }
119
120         /**
121          * Creates a copy of the HTLCOutputInCommitment
122          */
123         public HTLCOutputInCommitment clone() {
124                 long ret = bindings.HTLCOutputInCommitment_clone(this.ptr);
125                 HTLCOutputInCommitment ret_hu_conv = new HTLCOutputInCommitment(null, ret);
126                 ret_hu_conv.ptrs_to.add(this);
127                 return ret_hu_conv;
128         }
129
130         /**
131          * Serialize the HTLCOutputInCommitment object into a byte array which can be read by HTLCOutputInCommitment_read
132          */
133         public byte[] write() {
134                 byte[] ret = bindings.HTLCOutputInCommitment_write(this.ptr);
135                 return ret;
136         }
137
138         /**
139          * Read a HTLCOutputInCommitment from a byte array, created by HTLCOutputInCommitment_write
140          */
141         public static Result_HTLCOutputInCommitmentDecodeErrorZ constructor_read(byte[] ser) {
142                 long ret = bindings.HTLCOutputInCommitment_read(ser);
143                 Result_HTLCOutputInCommitmentDecodeErrorZ ret_hu_conv = Result_HTLCOutputInCommitmentDecodeErrorZ.constr_from_ptr(ret);
144                 return ret_hu_conv;
145         }
146
147 }