[C#] Update auto-generated files
[ldk-java] / c_sharp / src / org / ldk / structs / DelayedPaymentOutputDescriptor.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 a P2WSH script.
11  * 
12  * See [`SpendableOutputDescriptor::DelayedPaymentOutput`] for more details on how to spend this.
13  */
14 public class DelayedPaymentOutputDescriptor : CommonBase {
15         internal DelayedPaymentOutputDescriptor(object _dummy, long ptr) : base(ptr) { }
16         ~DelayedPaymentOutputDescriptor() {
17                 if (ptr != 0) { bindings.DelayedPaymentOutputDescriptor_free(ptr); }
18         }
19
20         /**
21          * The outpoint which is spendable.
22          */
23         public OutPoint get_outpoint() {
24                 long ret = bindings.DelayedPaymentOutputDescriptor_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.DelayedPaymentOutputDescriptor_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          * Per commitment point to derive the delayed payment key by key holder.
44          */
45         public byte[] get_per_commitment_point() {
46                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr);
47                 GC.KeepAlive(this);
48                 return ret;
49         }
50
51         /**
52          * Per commitment point to derive the delayed payment key by key holder.
53          */
54         public void set_per_commitment_point(byte[] val) {
55                 bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
56                 GC.KeepAlive(this);
57                 GC.KeepAlive(val);
58         }
59
60         /**
61          * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
62          * the witness_script.
63          */
64         public short get_to_self_delay() {
65                 short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr);
66                 GC.KeepAlive(this);
67                 return ret;
68         }
69
70         /**
71          * The `nSequence` value which must be set in the spending input to satisfy the `OP_CSV` in
72          * the witness_script.
73          */
74         public void set_to_self_delay(short val) {
75                 bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val);
76                 GC.KeepAlive(this);
77                 GC.KeepAlive(val);
78         }
79
80         /**
81          * The output which is referenced by the given outpoint.
82          */
83         public TxOut get_output() {
84                 long ret = bindings.DelayedPaymentOutputDescriptor_get_output(this.ptr);
85                 GC.KeepAlive(this);
86                 if (ret >= 0 && ret <= 4096) { return null; }
87                 TxOut ret_conv = new TxOut(null, ret);
88                 return ret_conv;
89         }
90
91         /**
92          * The output which is referenced by the given outpoint.
93          */
94         public void set_output(org.ldk.structs.TxOut val) {
95                 bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
96                 GC.KeepAlive(this);
97                 GC.KeepAlive(val);
98         }
99
100         /**
101          * The revocation point specific to the commitment transaction which was broadcast. Used to
102          * derive the witnessScript for this output.
103          */
104         public byte[] get_revocation_pubkey() {
105                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr);
106                 GC.KeepAlive(this);
107                 return ret;
108         }
109
110         /**
111          * The revocation point specific to the commitment transaction which was broadcast. Used to
112          * derive the witnessScript for this output.
113          */
114         public void set_revocation_pubkey(byte[] val) {
115                 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
116                 GC.KeepAlive(this);
117                 GC.KeepAlive(val);
118         }
119
120         /**
121          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
122          * This may be useful in re-deriving keys used in the channel to spend the output.
123          */
124         public byte[] get_channel_keys_id() {
125                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
126                 GC.KeepAlive(this);
127                 return ret;
128         }
129
130         /**
131          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
132          * This may be useful in re-deriving keys used in the channel to spend the output.
133          */
134         public void set_channel_keys_id(byte[] val) {
135                 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
136                 GC.KeepAlive(this);
137                 GC.KeepAlive(val);
138         }
139
140         /**
141          * The value of the channel which this output originated from, possibly indirectly.
142          */
143         public long get_channel_value_satoshis() {
144                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
145                 GC.KeepAlive(this);
146                 return ret;
147         }
148
149         /**
150          * The value of the channel which this output originated from, possibly indirectly.
151          */
152         public void set_channel_value_satoshis(long val) {
153                 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
154                 GC.KeepAlive(this);
155                 GC.KeepAlive(val);
156         }
157
158         /**
159          * Constructs a new DelayedPaymentOutputDescriptor given each field
160          */
161         public static DelayedPaymentOutputDescriptor of(org.ldk.structs.OutPoint outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, org.ldk.structs.TxOut output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
162                 long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr, InternalUtils.check_arr_len(per_commitment_point_arg, 33), to_self_delay_arg, output_arg.ptr, InternalUtils.check_arr_len(revocation_pubkey_arg, 33), InternalUtils.check_arr_len(channel_keys_id_arg, 32), channel_value_satoshis_arg);
163                 GC.KeepAlive(outpoint_arg);
164                 GC.KeepAlive(per_commitment_point_arg);
165                 GC.KeepAlive(to_self_delay_arg);
166                 GC.KeepAlive(output_arg);
167                 GC.KeepAlive(revocation_pubkey_arg);
168                 GC.KeepAlive(channel_keys_id_arg);
169                 GC.KeepAlive(channel_value_satoshis_arg);
170                 if (ret >= 0 && ret <= 4096) { return null; }
171                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
172                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
173                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outpoint_arg); };
174                 return ret_hu_conv;
175         }
176
177         internal long clone_ptr() {
178                 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
179                 GC.KeepAlive(this);
180                 return ret;
181         }
182
183         /**
184          * Creates a copy of the DelayedPaymentOutputDescriptor
185          */
186         public DelayedPaymentOutputDescriptor clone() {
187                 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
188                 GC.KeepAlive(this);
189                 if (ret >= 0 && ret <= 4096) { return null; }
190                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
191                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
192                 return ret_hu_conv;
193         }
194
195         /**
196          * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
197          * This ignores pointers and is_owned flags and looks at the values in fields.
198          * Two objects with NULL inner values will be considered "equal" here.
199          */
200         public bool eq(org.ldk.structs.DelayedPaymentOutputDescriptor b) {
201                 bool ret = bindings.DelayedPaymentOutputDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
202                 GC.KeepAlive(this);
203                 GC.KeepAlive(b);
204                 if (this != null) { this.ptrs_to.AddLast(b); };
205                 return ret;
206         }
207
208         public override bool Equals(object o) {
209                 if (!(o is DelayedPaymentOutputDescriptor)) return false;
210                 return this.eq((DelayedPaymentOutputDescriptor)o);
211         }
212         /**
213          * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
214          */
215         public byte[] write() {
216                 byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
217                 GC.KeepAlive(this);
218                 return ret;
219         }
220
221         /**
222          * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
223          */
224         public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
225                 long ret = bindings.DelayedPaymentOutputDescriptor_read(ser);
226                 GC.KeepAlive(ser);
227                 if (ret >= 0 && ret <= 4096) { return null; }
228                 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
229                 return ret_hu_conv;
230         }
231
232 }
233 } } }