1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
10 * Information about a spendable output to our \"payment key\". See
11 * SpendableOutputDescriptor::StaticPaymentOutput for more details on how to spend this.
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class StaticPaymentOutputDescriptor extends CommonBase {
15 StaticPaymentOutputDescriptor(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.StaticPaymentOutputDescriptor_free(ptr); }
23 * The outpoint which is spendable
25 public OutPoint get_outpoint() {
26 long ret = bindings.StaticPaymentOutputDescriptor_get_outpoint(this.ptr);
27 if (ret < 1024) { return null; }
28 OutPoint ret_hu_conv = new OutPoint(null, ret);
29 ret_hu_conv.ptrs_to.add(this);
34 * The outpoint which is spendable
36 public void set_outpoint(OutPoint val) {
37 bindings.StaticPaymentOutputDescriptor_set_outpoint(this.ptr, val == null ? 0 : val.ptr & ~1);
38 this.ptrs_to.add(val);
42 * The output which is referenced by the given outpoint
44 public void set_output(TxOut val) {
45 bindings.StaticPaymentOutputDescriptor_set_output(this.ptr, val.ptr);
49 * Arbitrary identification information returned by a call to
50 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
51 * the channel to spend the output.
53 public byte[] get_channel_keys_id() {
54 byte[] ret = bindings.StaticPaymentOutputDescriptor_get_channel_keys_id(this.ptr);
59 * Arbitrary identification information returned by a call to
60 * `Sign::channel_keys_id()`. This may be useful in re-deriving keys used in
61 * the channel to spend the output.
63 public void set_channel_keys_id(byte[] val) {
64 bindings.StaticPaymentOutputDescriptor_set_channel_keys_id(this.ptr, val);
68 * The value of the channel which this transactions spends.
70 public long get_channel_value_satoshis() {
71 long ret = bindings.StaticPaymentOutputDescriptor_get_channel_value_satoshis(this.ptr);
76 * The value of the channel which this transactions spends.
78 public void set_channel_value_satoshis(long val) {
79 bindings.StaticPaymentOutputDescriptor_set_channel_value_satoshis(this.ptr, val);
83 * Constructs a new StaticPaymentOutputDescriptor given each field
85 public static StaticPaymentOutputDescriptor of(OutPoint outpoint_arg, TxOut output_arg, byte[] channel_keys_id_arg, long channel_value_satoshis_arg) {
86 long ret = bindings.StaticPaymentOutputDescriptor_new(outpoint_arg == null ? 0 : outpoint_arg.ptr & ~1, output_arg.ptr, channel_keys_id_arg, channel_value_satoshis_arg);
87 if (ret < 1024) { return null; }
88 StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret);
89 ret_hu_conv.ptrs_to.add(ret_hu_conv);
90 ret_hu_conv.ptrs_to.add(outpoint_arg);
95 * Creates a copy of the StaticPaymentOutputDescriptor
97 public StaticPaymentOutputDescriptor clone() {
98 long ret = bindings.StaticPaymentOutputDescriptor_clone(this.ptr);
99 if (ret < 1024) { return null; }
100 StaticPaymentOutputDescriptor ret_hu_conv = new StaticPaymentOutputDescriptor(null, ret);
101 ret_hu_conv.ptrs_to.add(this);
106 * Serialize the StaticPaymentOutputDescriptor object into a byte array which can be read by StaticPaymentOutputDescriptor_read
108 public byte[] write() {
109 byte[] ret = bindings.StaticPaymentOutputDescriptor_write(this.ptr);
114 * Read a StaticPaymentOutputDescriptor from a byte array, created by StaticPaymentOutputDescriptor_write
116 public static Result_StaticPaymentOutputDescriptorDecodeErrorZ read(byte[] ser) {
117 long ret = bindings.StaticPaymentOutputDescriptor_read(ser);
118 if (ret < 1024) { return null; }
119 Result_StaticPaymentOutputDescriptorDecodeErrorZ ret_hu_conv = Result_StaticPaymentOutputDescriptorDecodeErrorZ.constr_from_ptr(ret);