[TS] Update auto-generated bindings to LDK-C-Bindings 0.0.123.1
[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.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 RevocationKey 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                 org.ldk.structs.RevocationKey ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RevocationKey(null, ret); }
111                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
112                 return ret_hu_conv;
113         }
114
115         /**
116          * The revocation point specific to the commitment transaction which was broadcast. Used to
117          * derive the witnessScript for this output.
118          */
119         public void set_revocation_pubkey(org.ldk.structs.RevocationKey val) {
120                 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, val.ptr);
121                 GC.KeepAlive(this);
122                 GC.KeepAlive(val);
123                 if (this != null) { this.ptrs_to.AddLast(val); };
124         }
125
126         /**
127          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
128          * This may be useful in re-deriving keys used in the channel to spend the output.
129          */
130         public byte[] get_channel_keys_id() {
131                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
132                 GC.KeepAlive(this);
133                 if (ret >= 0 && ret <= 4096) { return null; }
134                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
135                 return ret_conv;
136         }
137
138         /**
139          * Arbitrary identification information returned by a call to [`ChannelSigner::channel_keys_id`].
140          * This may be useful in re-deriving keys used in the channel to spend the output.
141          */
142         public void set_channel_keys_id(byte[] val) {
143                 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(val, 32)));
144                 GC.KeepAlive(this);
145                 GC.KeepAlive(val);
146         }
147
148         /**
149          * The value of the channel which this output originated from, possibly indirectly.
150          */
151         public long get_channel_value_satoshis() {
152                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
153                 GC.KeepAlive(this);
154                 return ret;
155         }
156
157         /**
158          * The value of the channel which this output originated from, possibly indirectly.
159          */
160         public void set_channel_value_satoshis(long val) {
161                 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
162                 GC.KeepAlive(this);
163                 GC.KeepAlive(val);
164         }
165
166         /**
167          * The channel public keys and other parameters needed to generate a spending transaction or
168          * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`].
169          * 
170          * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later.
171          * 
172          * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
173          */
174         public ChannelTransactionParameters get_channel_transaction_parameters() {
175                 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_transaction_parameters(this.ptr);
176                 GC.KeepAlive(this);
177                 if (ret >= 0 && ret <= 4096) { return null; }
178                 org.ldk.structs.ChannelTransactionParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelTransactionParameters(null, ret); }
179                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
180                 return ret_hu_conv;
181         }
182
183         /**
184          * The channel public keys and other parameters needed to generate a spending transaction or
185          * to provide to a re-derived signer through [`ChannelSigner::provide_channel_parameters`].
186          * 
187          * Added as optional, but always `Some` if the descriptor was produced in v0.0.123 or later.
188          * 
189          * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
190          */
191         public void set_channel_transaction_parameters(org.ldk.structs.ChannelTransactionParameters val) {
192                 bindings.DelayedPaymentOutputDescriptor_set_channel_transaction_parameters(this.ptr, val == null ? 0 : val.ptr);
193                 GC.KeepAlive(this);
194                 GC.KeepAlive(val);
195                 if (this != null) { this.ptrs_to.AddLast(val); };
196         }
197
198         /**
199          * Constructs a new DelayedPaymentOutputDescriptor given each field
200          * 
201          * Note that channel_transaction_parameters_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
202          */
203         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, org.ldk.structs.RevocationKey revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg, org.ldk.structs.ChannelTransactionParameters channel_transaction_parameters_arg) {
204                 long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point_arg, 33)), to_self_delay_arg, output_arg.ptr, revocation_pubkey_arg.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(channel_keys_id_arg, 32)), channel_value_satoshis_arg, channel_transaction_parameters_arg == null ? 0 : channel_transaction_parameters_arg.ptr);
205                 GC.KeepAlive(outpoint_arg);
206                 GC.KeepAlive(per_commitment_point_arg);
207                 GC.KeepAlive(to_self_delay_arg);
208                 GC.KeepAlive(output_arg);
209                 GC.KeepAlive(revocation_pubkey_arg);
210                 GC.KeepAlive(channel_keys_id_arg);
211                 GC.KeepAlive(channel_value_satoshis_arg);
212                 GC.KeepAlive(channel_transaction_parameters_arg);
213                 if (ret >= 0 && ret <= 4096) { return null; }
214                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
215                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
216                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outpoint_arg); };
217                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(revocation_pubkey_arg); };
218                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_transaction_parameters_arg); };
219                 return ret_hu_conv;
220         }
221
222         internal long clone_ptr() {
223                 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
224                 GC.KeepAlive(this);
225                 return ret;
226         }
227
228         /**
229          * Creates a copy of the DelayedPaymentOutputDescriptor
230          */
231         public DelayedPaymentOutputDescriptor clone() {
232                 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
233                 GC.KeepAlive(this);
234                 if (ret >= 0 && ret <= 4096) { return null; }
235                 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
236                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
237                 return ret_hu_conv;
238         }
239
240         /**
241          * Generates a non-cryptographic 64-bit hash of the DelayedPaymentOutputDescriptor.
242          */
243         public long hash() {
244                 long ret = bindings.DelayedPaymentOutputDescriptor_hash(this.ptr);
245                 GC.KeepAlive(this);
246                 return ret;
247         }
248
249         public override int GetHashCode() {
250                 return (int)this.hash();
251         }
252         /**
253          * Checks if two DelayedPaymentOutputDescriptors contain equal inner contents.
254          * This ignores pointers and is_owned flags and looks at the values in fields.
255          * Two objects with NULL inner values will be considered "equal" here.
256          */
257         public bool eq(org.ldk.structs.DelayedPaymentOutputDescriptor b) {
258                 bool ret = bindings.DelayedPaymentOutputDescriptor_eq(this.ptr, b.ptr);
259                 GC.KeepAlive(this);
260                 GC.KeepAlive(b);
261                 if (this != null) { this.ptrs_to.AddLast(b); };
262                 return ret;
263         }
264
265         public override bool Equals(object o) {
266                 if (!(o is DelayedPaymentOutputDescriptor)) return false;
267                 return this.eq((DelayedPaymentOutputDescriptor)o);
268         }
269         /**
270          * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
271          */
272         public byte[] write() {
273                 long ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
274                 GC.KeepAlive(this);
275                 if (ret >= 0 && ret <= 4096) { return null; }
276                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
277                 return ret_conv;
278         }
279
280         /**
281          * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
282          */
283         public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
284                 long ret = bindings.DelayedPaymentOutputDescriptor_read(InternalUtils.encodeUint8Array(ser));
285                 GC.KeepAlive(ser);
286                 if (ret >= 0 && ret <= 4096) { return null; }
287                 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);
288                 return ret_hu_conv;
289         }
290
291 }
292 } } }