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 * A closing_signed message to be sent or received from a peer
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class ClosingSigned extends CommonBase {
16 ClosingSigned(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.ClosingSigned_free(ptr); }
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.ClosingSigned_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_channel_id(byte[] val) {
36 bindings.ClosingSigned_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * The proposed total fee for the closing transaction
44 public long get_fee_satoshis() {
45 long ret = bindings.ClosingSigned_get_fee_satoshis(this.ptr);
46 Reference.reachabilityFence(this);
51 * The proposed total fee for the closing transaction
53 public void set_fee_satoshis(long val) {
54 bindings.ClosingSigned_set_fee_satoshis(this.ptr, val);
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * A signature on the closing transaction
62 public byte[] get_signature() {
63 byte[] ret = bindings.ClosingSigned_get_signature(this.ptr);
64 Reference.reachabilityFence(this);
69 * A signature on the closing transaction
71 public void set_signature(byte[] val) {
72 bindings.ClosingSigned_set_signature(this.ptr, InternalUtils.check_arr_len(val, 64));
73 Reference.reachabilityFence(this);
74 Reference.reachabilityFence(val);
78 * The minimum and maximum fees which the sender is willing to accept, provided only by new
81 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
84 public ClosingSignedFeeRange get_fee_range() {
85 long ret = bindings.ClosingSigned_get_fee_range(this.ptr);
86 Reference.reachabilityFence(this);
87 if (ret >= 0 && ret <= 4096) { return null; }
88 org.ldk.structs.ClosingSignedFeeRange ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSignedFeeRange(null, ret); }
89 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
94 * The minimum and maximum fees which the sender is willing to accept, provided only by new
97 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
99 public void set_fee_range(@Nullable ClosingSignedFeeRange val) {
100 bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr);
101 Reference.reachabilityFence(this);
102 Reference.reachabilityFence(val);
103 if (this != null) { this.ptrs_to.add(val); };
107 * Constructs a new ClosingSigned given each field
109 public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, ClosingSignedFeeRange fee_range_arg) {
110 long ret = bindings.ClosingSigned_new(InternalUtils.check_arr_len(channel_id_arg, 32), fee_satoshis_arg, InternalUtils.check_arr_len(signature_arg, 64), fee_range_arg == null ? 0 : fee_range_arg.ptr);
111 Reference.reachabilityFence(channel_id_arg);
112 Reference.reachabilityFence(fee_satoshis_arg);
113 Reference.reachabilityFence(signature_arg);
114 Reference.reachabilityFence(fee_range_arg);
115 if (ret >= 0 && ret <= 4096) { return null; }
116 org.ldk.structs.ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSigned(null, ret); }
117 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
118 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(fee_range_arg); };
123 long ret = bindings.ClosingSigned_clone_ptr(this.ptr);
124 Reference.reachabilityFence(this);
129 * Creates a copy of the ClosingSigned
131 public ClosingSigned clone() {
132 long ret = bindings.ClosingSigned_clone(this.ptr);
133 Reference.reachabilityFence(this);
134 if (ret >= 0 && ret <= 4096) { return null; }
135 org.ldk.structs.ClosingSigned ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.ClosingSigned(null, ret); }
136 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
141 * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
143 public byte[] write() {
144 byte[] ret = bindings.ClosingSigned_write(this.ptr);
145 Reference.reachabilityFence(this);
150 * Read a ClosingSigned from a byte array, created by ClosingSigned_write
152 public static Result_ClosingSignedDecodeErrorZ read(byte[] ser) {
153 long ret = bindings.ClosingSigned_read(ser);
154 Reference.reachabilityFence(ser);
155 if (ret >= 0 && ret <= 4096) { return null; }
156 Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret);