Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / StaticPaymentOutputDescriptor.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 a spendable output to our \"payment key\". See
11  * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
12  */
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class StaticPaymentOutputDescriptor extends CommonBase {
15         StaticPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
16         @Override @SuppressWarnings("deprecation")
17         protected void finalize() throws Throwable {
18                 super.finalize();
19                 if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); }
20         }
21
22         /**
23          * The outpoint which is spendable
24          */
25         public OutPoint get_outpoint() {
26                 long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr);
27                 OutPoint ret_hu_conv = new OutPoint(null, ret);
28                 ret_hu_conv.ptrs_to.add(this);
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The outpoint which is spendable
34          */
35         public void set_outpoint(OutPoint val) {
36                 bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
37                 this.ptrs_to.add(val);
38         }
39
40         /**
41          * The output which is referenced by the given outpoint
42          */
43         public void set_output(TxOut val) {
44                 bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
45         }
46
47         /**
48          * Arbitrary identification information returned by a call to
49          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
50          * the channel to spend the output.
51          */
52         public byte[] get_channel_keys_id() {
53                 byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
54                 return ret;
55         }
56
57         /**
58          * Arbitrary identification information returned by a call to
59          * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
60          * the channel to spend the output.
61          */
62         public void set_channel_keys_id(byte[] val) {
63                 bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val);
64         }
65
66         /**
67          * The value of the channel which this transactions spends.
68          */
69         public long get_channel_value_satoshis() {
70                 long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
71                 return ret;
72         }
73
74         /**
75          * The value of the channel which this transactions spends.
76          */
77         public void set_channel_value_satoshis(long val) {
78                 bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
79         }
80
81         /**
82          * Constructs a new StaticPaymentOutputDescriptor given each field
83          */
84         public static StaticPaymentOutputDescriptor of(OutPoint outpoint_arg, TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
85                 long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, channel_keys_id_arg, channel_value_satoshis_arg);
86                 StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret);
87                 ret_hu_conv.ptrs_to.add(ret_hu_conv);
88                 ret_hu_conv.ptrs_to.add(outpoint_arg);
89                 return ret_hu_conv;
90         }
91
92         /**
93          * Creates a copy of the StaticPaymentOutputDescriptor
94          */
95         public StaticPaymentOutputDescriptor clone() {
96                 long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr);
97                 StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret);
98                 ret_hu_conv.ptrs_to.add(this);
99                 return ret_hu_conv;
100         }
101
102         /**
103          * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
104          */
105         public byte[] write() {
106                 byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr);
107                 return ret;
108         }
109
110         /**
111          * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
112          */
113         public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
114                 long ret = bindings.StaticPaymentOutputDescriptor_read(ser);
115                 Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
116                 return ret_hu_conv;
117         }
118
119 }