6 namespace org { namespace ldk { namespace structs {
10 * A descriptor used to sign for a commitment transaction's anchor output.
12 public class AnchorDescriptor : CommonBase {
13 internal AnchorDescriptor(object _dummy, long ptr) : base(ptr) { }
15 if (ptr != 0) { bindings.AnchorDescriptor_free(ptr); }
19 * The parameters required to derive the signer for the anchor input.
21 public ChannelDerivationParameters get_channel_derivation_parameters() {
22 long ret = bindings.AnchorDescriptor_get_channel_derivation_parameters(this.ptr);
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); };
31 * The parameters required to derive the signer for the anchor input.
33 public void set_channel_derivation_parameters(org.ldk.structs.ChannelDerivationParameters val) {
34 bindings.AnchorDescriptor_set_channel_derivation_parameters(this.ptr, val.ptr);
37 if (this != null) { this.ptrs_to.AddLast(val); };
41 * The transaction input's outpoint corresponding to the commitment transaction's anchor
44 public OutPoint get_outpoint() {
45 long ret = bindings.AnchorDescriptor_get_outpoint(this.ptr);
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); };
54 * The transaction input's outpoint corresponding to the commitment transaction's anchor
57 public void set_outpoint(org.ldk.structs.OutPoint val) {
58 bindings.AnchorDescriptor_set_outpoint(this.ptr, val.ptr);
61 if (this != null) { this.ptrs_to.AddLast(val); };
65 * Constructs a new AnchorDescriptor given each field
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.ptr, 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); };
79 internal long clone_ptr() {
80 long ret = bindings.AnchorDescriptor_clone_ptr(this.ptr);
86 * Creates a copy of the AnchorDescriptor
88 public AnchorDescriptor clone() {
89 long ret = bindings.AnchorDescriptor_clone(this.ptr);
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); };
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.
102 public bool eq(org.ldk.structs.AnchorDescriptor b) {
103 bool ret = bindings.AnchorDescriptor_eq(this.ptr, b.ptr);
106 if (this != null) { this.ptrs_to.AddLast(b); };
110 public override bool Equals(object o) {
111 if (!(o is AnchorDescriptor)) return false;
112 return this.eq((AnchorDescriptor)o);
115 * Returns the UTXO to be spent by the anchor input, which can be obtained via
116 * [`Self::unsigned_tx_input`].
118 public TxOut previous_utxo() {
119 long ret = bindings.AnchorDescriptor_previous_utxo(this.ptr);
121 if (ret >= 0 && ret <= 4096) { return null; }
122 TxOut ret_conv = new TxOut(null, ret);
127 * Returns the unsigned transaction input spending the anchor output in the commitment
130 public TxIn unsigned_tx_input() {
131 long ret = bindings.AnchorDescriptor_unsigned_tx_input(this.ptr);
133 if (ret >= 0 && ret <= 4096) { return null; }
134 TxIn ret_conv = new TxIn(null, ret);
139 * Returns the witness script of the anchor output in the commitment transaction.
141 public byte[] witness_script() {
142 long ret = bindings.AnchorDescriptor_witness_script(this.ptr);
144 if (ret >= 0 && ret <= 4096) { return null; }
145 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
150 * Returns the fully signed witness required to spend the anchor output in the commitment
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)));
156 GC.KeepAlive(signature);
157 if (ret >= 0 && ret <= 4096) { return null; }
158 byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
163 * Derives the channel signer required to sign the anchor input.
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);
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); };