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 OutPoint ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new OutPoint(null, ret); }
32 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 & ~1);
41 Reference.reachabilityFence(this);
42 Reference.reachabilityFence(val);
46 * Per commitment point to derive delayed_payment_key by key holder
48 public byte[] get_per_commitment_point() {
49 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_per_commitment_point(this.ptr);
50 Reference.reachabilityFence(this);
55 * Per commitment point to derive delayed_payment_key by key holder
57 public void set_per_commitment_point(byte[] val) {
58 bindings.DelayedPaymentOutputDescriptor_set_per_commitment_point(this.ptr, InternalUtils.check_arr_len(val, 33));
59 Reference.reachabilityFence(this);
60 Reference.reachabilityFence(val);
64 * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
67 public short get_to_self_delay() {
68 short ret = bindings.DelayedPaymentOutputDescriptor_get_to_self_delay(this.ptr);
69 Reference.reachabilityFence(this);
74 * The nSequence value which must be set in the spending input to satisfy the OP_CSV in
77 public void set_to_self_delay(short val) {
78 bindings.DelayedPaymentOutputDescriptor_set_to_self_delay(this.ptr, val);
79 Reference.reachabilityFence(this);
80 Reference.reachabilityFence(val);
84 * The output which is referenced by the given outpoint
86 public void set_output(TxOut val) {
87 bindings.DelayedPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
88 Reference.reachabilityFence(this);
89 Reference.reachabilityFence(val);
93 * The revocation point specific to the commitment transaction which was broadcast. Used to
94 * derive the witnessScript for this output.
96 public byte[] get_revocation_pubkey() {
97 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_revocation_pubkey(this.ptr);
98 Reference.reachabilityFence(this);
103 * The revocation point specific to the commitment transaction which was broadcast. Used to
104 * derive the witnessScript for this output.
106 public void set_revocation_pubkey(byte[] val) {
107 bindings.DelayedPaymentOutputDescriptor_set_revocation_pubkey(this.ptr, InternalUtils.check_arr_len(val, 33));
108 Reference.reachabilityFence(this);
109 Reference.reachabilityFence(val);
113 * Arbitrary identification information returned by a call to
114 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
115 * the channel to spend the output.
117 public byte[] get_channel_keys_id() {
118 byte[] ret = bindings.DelayedPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
119 Reference.reachabilityFence(this);
124 * Arbitrary identification information returned by a call to
125 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
126 * the channel to spend the output.
128 public void set_channel_keys_id(byte[] val) {
129 bindings.DelayedPaymentOutputDescriptor_set_channel_keys_id(this.ptr, InternalUtils.check_arr_len(val, 32));
130 Reference.reachabilityFence(this);
131 Reference.reachabilityFence(val);
135 * The value of the channel which this output originated from, possibly indirectly.
137 public long get_channel_value_satoshis() {
138 long ret = bindings.DelayedPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
139 Reference.reachabilityFence(this);
144 * The value of the channel which this output originated from, possibly indirectly.
146 public void set_channel_value_satoshis(long val) {
147 bindings.DelayedPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
148 Reference.reachabilityFence(this);
149 Reference.reachabilityFence(val);
153 * Constructs a new DelayedPaymentOutputDescriptor given each field
155 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) {
156 long ret = bindings.DelayedPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, 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);
157 Reference.reachabilityFence(outpoint_arg);
158 Reference.reachabilityFence(per_commitment_point_arg);
159 Reference.reachabilityFence(to_self_delay_arg);
160 Reference.reachabilityFence(output_arg);
161 Reference.reachabilityFence(revocation_pubkey_arg);
162 Reference.reachabilityFence(channel_keys_id_arg);
163 Reference.reachabilityFence(channel_value_satoshis_arg);
164 if (ret >= 0 && ret <= 4096) { return null; }
165 DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); }
166 ret_hu_conv.ptrs_to.add(ret_hu_conv);
171 long ret = bindings.DelayedPaymentOutputDescriptor_clone_ptr(this.ptr);
172 Reference.reachabilityFence(this);
177 * Creates a copy of the DelayedPaymentOutputDescriptor
179 public DelayedPaymentOutputDescriptor clone() {
180 long ret = bindings.DelayedPaymentOutputDescriptor_clone(this.ptr);
181 Reference.reachabilityFence(this);
182 if (ret >= 0 && ret <= 4096) { return null; }
183 DelayedPaymentOutputDescriptor ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new DelayedPaymentOutputDescriptor(null, ret); }
184 ret_hu_conv.ptrs_to.add(this);
189 * Serialize the DelayedPaymentOutputDescriptor object into a byte array which can be read by DelayedPaymentOutputDescriptor_read
191 public byte[] write() {
192 byte[] ret = bindings.DelayedPaymentOutputDescriptor_write(this.ptr);
193 Reference.reachabilityFence(this);
198 * Read a DelayedPaymentOutputDescriptor from a byte array, created by DelayedPaymentOutputDescriptor_write
200 public static Result_DelayedPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
201 long ret = bindings.DelayedPaymentOutputDescriptor_read(ser);
202 Reference.reachabilityFence(ser);
203 if (ret >= 0 && ret <= 4096) { return null; }
204 Result_DelayedPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_DelayedPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);