1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import java.lang.ref.Reference;
8 import javax.annotation.Nullable;
12 * Information about a spendable output to a P2WSH script. See
13 * SpendableOutputDescriptor::DelayedPaymentOutput for more details on how to spend this.
15 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
16 public class DelayedPaymentOutputDescriptor extends CommonBase {
17 DelayedPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
18 @Override @SuppressWarnings("deprecation")
19 protected void finalize() throws Throwable {
21 if (ptr != 0) { bindings.DelayedPaymentOutputDescriptor_free(ptr); }
25 * The outpoint which is spendable
27 public OutPoint get_outpoint() {
28 long ret = bindings.DelayedPaymentOutputDescriptor_get_outpoint(this.ptr);
29 Reference.reachabilityFence(this);
30 if (ret >= 0 && ret <= 4096) { return null; }
31 org.ldk.structs.OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OutPoint(null, ret); }
32 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
37 * The outpoint which is spendable
39 public void set_outpoint(OutPoint val) {
40 bindings.DelayedPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr);
41 Reference.reachabilityFence(this);
42 Reference.reachabilityFence(val);
43 if (this != null) { this.ptrs_to.add(val); };
47 * Per commitment point to derive delayed_payment_key by key holder
49 public byte[] get_per_commitment_point() {
50 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr);
51 Reference.reachabilityFence(this);
56 * Per commitment point to derive delayed_payment_key by key holder
58 public void set_per_commitment_point(byte[] val) {
59 bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
60 Reference.reachabilityFence(this);
61 Reference.reachabilityFence(val);
65 * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
68 public short get_to_self_delay() {
69 short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr);
70 Reference.reachabilityFence(this);
75 * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
78 public void set_to_self_delay(short val) {
79 bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val);
80 Reference.reachabilityFence(this);
81 Reference.reachabilityFence(val);
85 * The output which is referenced by the given outpoint
87 * Returns a copy of the field.
89 public TxOut get_output() {
90 long ret = bindings.DelayedPaymentOutputDescriptor_get_output(this.ptr);
91 Reference.reachabilityFence(this);
92 if (ret >= 0 && ret <= 4096) { return null; }
93 TxOut ret_conv = new TxOut(null, ret);
98 * The output which is referenced by the given outpoint
100 public void set_output(TxOut val) {
101 bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
102 Reference.reachabilityFence(this);
103 Reference.reachabilityFence(val);
107 * The revocation point specific to the commitment transaction which was broadcast. Used to
108 * derive the witnessScript for this output.
110 public byte[] get_revocation_pubkey() {
111 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr);
112 Reference.reachabilityFence(this);
117 * The revocation point specific to the commitment transaction which was broadcast. Used to
118 * derive the witnessScript for this output.
120 public void set_revocation_pubkey(byte[] val) {
121 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
122 Reference.reachabilityFence(this);
123 Reference.reachabilityFence(val);
127 * Arbitrary identification information returned by a call to
128 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
129 * the channel to spend the output.
131 public byte[] get_channel_keys_id() {
132 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
133 Reference.reachabilityFence(this);
138 * Arbitrary identification information returned by a call to
139 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
140 * the channel to spend the output.
142 public void set_channel_keys_id(byte[] val) {
143 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
144 Reference.reachabilityFence(this);
145 Reference.reachabilityFence(val);
149 * The value of the channel which this output originated from, possibly indirectly.
151 public long get_channel_value_satoshis() {
152 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
153 Reference.reachabilityFence(this);
158 * The value of the channel which this output originated from, possibly indirectly.
160 public void set_channel_value_satoshis(long val) {
161 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
162 Reference.reachabilityFence(this);
163 Reference.reachabilityFence(val);
167 * Constructs a new DelayedPaymentOutputDescriptor given each field
169 public static DelayedPaymentOutputDescriptor of(OutPoint outpoint_arg, byte[] per_commitment_point_arg, short to_self_delay_arg, TxOut output_arg, byte[] revocation_pubkey_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
170 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);
171 Reference.reachabilityFence(outpoint_arg);
172 Reference.reachabilityFence(per_commitment_point_arg);
173 Reference.reachabilityFence(to_self_delay_arg);
174 Reference.reachabilityFence(output_arg);
175 Reference.reachabilityFence(revocation_pubkey_arg);
176 Reference.reachabilityFence(channel_keys_id_arg);
177 Reference.reachabilityFence(channel_value_satoshis_arg);
178 if (ret >= 0 && ret <= 4096) { return null; }
179 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
180 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
181 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(outpoint_arg); };
186 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
187 Reference.reachabilityFence(this);
192 * Creates a copy of the DelayedPaymentOutputDescriptor
194 public DelayedPaymentOutputDescriptor clone() {
195 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
196 Reference.reachabilityFence(this);
197 if (ret >= 0 && ret <= 4096) { return null; }
198 org.ldk.structs.DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.DelayedPaymentOutputDescriptor(null, ret); }
199 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
204 * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
206 public byte[] write() {
207 byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
208 Reference.reachabilityFence(this);
213 * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
215 public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
216 long ret = bindings.DelayedPaymentOutputDescriptor_read(ser);
217 Reference.reachabilityFence(ser);
218 if (ret >= 0 && ret <= 4096) { return null; }
219 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);