[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / AnchorDescriptor.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  * A descriptor used to sign for a commitment transaction's anchor output.
11  */
12 public class AnchorDescriptor : CommonBase {
13         internal AnchorDescriptor(object _dummy, long ptr) : base(ptr) { }
14         ~AnchorDescriptor() {
15                 if (ptr != 0) { bindings.AnchorDescriptor_free(ptr); }
16         }
17
18         /**
19          * The parameters required to derive the signer for the anchor input.
20          */
21         public ChannelDerivationParameters get_channel_derivation_parameters() {
22                 long ret = bindings.AnchorDescriptor_get_channel_derivation_parameters(this.ptr);
23                 GC.KeepAlive(this);
24                 if (ret >= 0 && ret <= 4096) { return null; }
25                 org.ldk.structs.ChannelDerivationParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ChannelDerivationParameters(null, ret); }
26                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
27                 return ret_hu_conv;
28         }
29
30         /**
31          * The parameters required to derive the signer for the anchor input.
32          */
33         public void set_channel_derivation_parameters(org.ldk.structs.ChannelDerivationParameters val) {
34                 bindings.AnchorDescriptor_set_channel_derivation_parameters(this.ptr, val == null ? 0 : val.ptr);
35                 GC.KeepAlive(this);
36                 GC.KeepAlive(val);
37                 if (this != null) { this.ptrs_to.AddLast(val); };
38         }
39
40         /**
41          * The transaction input's outpoint corresponding to the commitment transaction's anchor
42          * output.
43          */
44         public OutPoint get_outpoint() {
45                 long ret = bindings.AnchorDescriptor_get_outpoint(this.ptr);
46                 GC.KeepAlive(this);
47                 if (ret >= 0 && ret <= 4096) { return null; }
48                 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
49                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
50                 return ret_hu_conv;
51         }
52
53         /**
54          * The transaction input's outpoint corresponding to the commitment transaction's anchor
55          * output.
56          */
57         public void set_outpoint(org.ldk.structs.OutPoint val) {
58                 bindings.AnchorDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr);
59                 GC.KeepAlive(this);
60                 GC.KeepAlive(val);
61                 if (this != null) { this.ptrs_to.AddLast(val); };
62         }
63
64         /**
65          * Constructs a new AnchorDescriptor given each field
66          */
67         public static AnchorDescriptor of(org.ldk.structs.ChannelDerivationParameters channel_derivation_parameters_arg, org.ldk.structs.OutPoint outpoint_arg) {
68                 long ret = bindings.AnchorDescriptor_new(channel_derivation_parameters_arg == null ? 0 : channel_derivation_parameters_arg.ptr, outpoint_arg == null ? 0 : outpoint_arg.ptr);
69                 GC.KeepAlive(channel_derivation_parameters_arg);
70                 GC.KeepAlive(outpoint_arg);
71                 if (ret >= 0 && ret <= 4096) { return null; }
72                 org.ldk.structs.AnchorDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AnchorDescriptor(null, ret); }
73                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
74                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channel_derivation_parameters_arg); };
75                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(outpoint_arg); };
76                 return ret_hu_conv;
77         }
78
79         internal long clone_ptr() {
80                 long ret = bindings.AnchorDescriptor_clone_ptr(this.ptr);
81                 GC.KeepAlive(this);
82                 return ret;
83         }
84
85         /**
86          * Creates a copy of the AnchorDescriptor
87          */
88         public AnchorDescriptor clone() {
89                 long ret = bindings.AnchorDescriptor_clone(this.ptr);
90                 GC.KeepAlive(this);
91                 if (ret >= 0 && ret <= 4096) { return null; }
92                 org.ldk.structs.AnchorDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.AnchorDescriptor(null, ret); }
93                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
94                 return ret_hu_conv;
95         }
96
97         /**
98          * Checks if two AnchorDescriptors contain equal inner contents.
99          * This ignores pointers and is_owned flags and looks at the values in fields.
100          * Two objects with NULL inner values will be considered "equal" here.
101          */
102         public bool eq(org.ldk.structs.AnchorDescriptor b) {
103                 bool ret = bindings.AnchorDescriptor_eq(this.ptr, b == null ? 0 : b.ptr);
104                 GC.KeepAlive(this);
105                 GC.KeepAlive(b);
106                 if (this != null) { this.ptrs_to.AddLast(b); };
107                 return ret;
108         }
109
110         public override bool Equals(object o) {
111                 if (!(o is AnchorDescriptor)) return false;
112                 return this.eq((AnchorDescriptor)o);
113         }
114         /**
115          * Returns the UTXO to be spent by the anchor input, which can be obtained via
116          * [`Self::unsigned_tx_input`].
117          */
118         public TxOut previous_utxo() {
119                 long ret = bindings.AnchorDescriptor_previous_utxo(this.ptr);
120                 GC.KeepAlive(this);
121                 if (ret >= 0 && ret <= 4096) { return null; }
122                 TxOut ret_conv = new TxOut(null, ret);
123                 return ret_conv;
124         }
125
126         /**
127          * Returns the unsigned transaction input spending the anchor output in the commitment
128          * transaction.
129          */
130         public TxIn unsigned_tx_input() {
131                 long ret = bindings.AnchorDescriptor_unsigned_tx_input(this.ptr);
132                 GC.KeepAlive(this);
133                 if (ret >= 0 && ret <= 4096) { return null; }
134                 TxIn ret_conv = new TxIn(null, ret);
135                 return ret_conv;
136         }
137
138         /**
139          * Returns the witness script of the anchor output in the commitment transaction.
140          */
141         public byte[] witness_script() {
142                 long ret = bindings.AnchorDescriptor_witness_script(this.ptr);
143                 GC.KeepAlive(this);
144                 if (ret >= 0 && ret <= 4096) { return null; }
145                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
146                 return ret_conv;
147         }
148
149         /**
150          * Returns the fully signed witness required to spend the anchor output in the commitment
151          * transaction.
152          */
153         public byte[] tx_input_witness(byte[] signature) {
154                 long ret = bindings.AnchorDescriptor_tx_input_witness(this.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(signature, 64)));
155                 GC.KeepAlive(this);
156                 GC.KeepAlive(signature);
157                 if (ret >= 0 && ret <= 4096) { return null; }
158                 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
159                 return ret_conv;
160         }
161
162         /**
163          * Derives the channel signer required to sign the anchor input.
164          */
165         public WriteableEcdsaChannelSigner derive_channel_signer(org.ldk.structs.SignerProvider signer_provider) {
166                 long ret = bindings.AnchorDescriptor_derive_channel_signer(this.ptr, signer_provider.ptr);
167                 GC.KeepAlive(this);
168                 GC.KeepAlive(signer_provider);
169                 if (ret >= 0 && ret <= 4096) { return null; }
170                 WriteableEcdsaChannelSigner ret_hu_conv = new WriteableEcdsaChannelSigner(null, ret);
171                 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
172                 if (this != null) { this.ptrs_to.AddLast(signer_provider); };
173                 return ret_hu_conv;
174         }
175
176 }
177 } } }