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