[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / StaticPaymentOutputDescriptor.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 a spendable output to our \"payment key\".
11  * 
12  * See [`SpendableOutputDescriptor::StaticPaymentOutput`] for more details on how to spend this.
13  */
14 public class StaticPaymentOutputDescriptor : CommonBase {
15         internal StaticPaymentOutputDescriptor(object _dummy, long ptr) : base(ptr) { }
16         ~StaticPaymentOutputDescriptor() {
17                 if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); }
18         }
19
20         /**
21          * The outpoint which is spendable.
22          */
23         public OutPoint get_outpoint() {
24                 long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr);
25                 GC.KeepAlive(this);
26                 if (ret >= 0 && ret <= 4096) { return null; }
27                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
28                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
29                 return ret_hu_conv;
30         }
31
32         /**
33          * The outpoint which is spendable.
34          */
35         public void set_outpoint(org.ldk.structs.OutPoint val) {
36                 bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr);
37                 GC.KeepAlive(this);
38                 GC.KeepAlive(val);
39                 if (this != null) { this.ptrs_to.AddLast(val); };
40         }
41
42         /**
43          * The output which is referenced by the given outpoint.
44          */
45         public TxOut get_output() {
46                 long ret = bindings.StaticPaymentOutputDescriptor_get_output(this.ptr);
47                 GC.KeepAlive(this);
48                 if (ret >= 0 && ret <= 4096) { return null; }
49                 TxOut ret_conv = new TxOut(null, ret);
50                 return ret_conv;
51         }
52
53         /**
54          * The output which is referenced by the given outpoint.
55          */
56         public void set_output(org.ldk.structs.TxOut val) {
57                 bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
58                 GC.KeepAlive(this);
59                 GC.KeepAlive(val);
60         }
61
62         /**
63          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
64          * This may be useful in re-deriving keys used in the channel to spend the output.
65          */
66         public byte[] get_channel_keys_id() {
67                 byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
68                 GC.KeepAlive(this);
69                 return ret;
70         }
71
72         /**
73          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
74          * This may be useful in re-deriving keys used in the channel to spend the output.
75          */
76         public void set_channel_keys_id(byte[] val) {
77                 bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
78                 GC.KeepAlive(this);
79                 GC.KeepAlive(val);
80         }
81
82         /**
83          * The value of the channel which this transactions spends.
84          */
85         public long get_channel_value_satoshis() {
86                 long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
87                 GC.KeepAlive(this);
88                 return ret;
89         }
90
91         /**
92          * The value of the channel which this transactions spends.
93          */
94         public void set_channel_value_satoshis(long val) {
95                 bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98         }
99
100         /**
101          * Constructs a new StaticPaymentOutputDescriptor given each field
102          */
103         public static StaticPaymentOutputDescriptor of(org.ldk.structs.OutPoint outpoint_arg, org.ldk.structs.TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
104                 long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr, output_arg.ptr, InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg);
105                 GC.KeepAlive(outpoint_arg);
106                 GC.KeepAlive(output_arg);
107                 GC.KeepAlive(channel_keys_id_arg);
108                 GC.KeepAlive(channel_value_satoshis_arg);
109                 if (ret >= 0 && ret <= 4096) { return null; }
110                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
111                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
112                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outpoint_arg); };
113                 return ret_hu_conv;
114         }
115
116         internal long clone_ptr() {
117                 long ret = bindings.StaticPaymentOutputDescriptor_clone_ptr(this.ptr);
118                 GC.KeepAlive(this);
119                 return ret;
120         }
121
122         /**
123          * Creates a copy of the StaticPaymentOutputDescriptor
124          */
125         public StaticPaymentOutputDescriptor clone() {
126                 long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr);
127                 GC.KeepAlive(this);
128                 if (ret >= 0 && ret <= 4096) { return null; }
129                 org.ldk.structs.StaticPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.StaticPaymentOutputDescriptor(null, ret); }
130                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
131                 return ret_hu_conv;
132         }
133
134         /**
135          * Checks if two StaticPaymentOutputDescriptors contain equal inner contents.
136          * This ignores pointers and is_owned flags and looks at the values in fields.
137          * Two objects with NULL inner values will be considered "equal" here.
138          */
139         public bool eq(org.ldk.structs.StaticPaymentOutputDescriptor b) {
140                 bool ret = bindings.StaticPaymentOutputDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
141                 GC.KeepAlive(this);
142                 GC.KeepAlive(b);
143                 if (this != null) { this.ptrs_to.AddLast(b); };
144                 return ret;
145         }
146
147         public override bool Equals(object o) {
148                 if (!(o is StaticPaymentOutputDescriptor)) return false;
149                 return this.eq((StaticPaymentOutputDescriptor)o);
150         }
151         /**
152          * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
153          */
154         public byte[] write() {
155                 byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr);
156                 GC.KeepAlive(this);
157                 return ret;
158         }
159
160         /**
161          * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
162          */
163         public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
164                 long ret = bindings.StaticPaymentOutputDescriptor_read(ser);
165                 GC.KeepAlive(ser);
166                 if (ret >= 0 && ret <= 4096) { return null; }
167                 Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
168                 return ret_hu_conv;
169         }
170
171 }
172 } } }