1 package org.ldk.structs;
3 import org.ldk.impl.bindings;
4 import org.ldk.enums.*;
6 import java.util.Arrays;
7 import javax.annotation.Nullable;
11 * A closing_signed message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class ClosingSigned extends CommonBase {
15 ClosingSigned(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.ClosingSigned_free(ptr); }
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.ClosingSigned_get_channel_id(this.ptr);
33 public void set_channel_id(byte[] val) {
34 bindings.ClosingSigned_set_channel_id(this.ptr, val);
38 * The proposed total fee for the closing transaction
40 public long get_fee_satoshis() {
41 long ret = bindings.ClosingSigned_get_fee_satoshis(this.ptr);
46 * The proposed total fee for the closing transaction
48 public void set_fee_satoshis(long val) {
49 bindings.ClosingSigned_set_fee_satoshis(this.ptr, val);
53 * A signature on the closing transaction
55 public byte[] get_signature() {
56 byte[] ret = bindings.ClosingSigned_get_signature(this.ptr);
61 * A signature on the closing transaction
63 public void set_signature(byte[] val) {
64 bindings.ClosingSigned_set_signature(this.ptr, val);
68 * The minimum and maximum fees which the sender is willing to accept, provided only by new
71 * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
74 public ClosingSignedFeeRange get_fee_range() {
75 long ret = bindings.ClosingSigned_get_fee_range(this.ptr);
76 if (ret < 1024) { return null; }
77 ClosingSignedFeeRange ret_hu_conv = new ClosingSignedFeeRange(null, ret);
78 ret_hu_conv.ptrs_to.add(this);
83 * The minimum and maximum fees which the sender is willing to accept, provided only by new
86 * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
88 public void set_fee_range(@Nullable ClosingSignedFeeRange val) {
89 bindings.ClosingSigned_set_fee_range(this.ptr, val == null ? 0 : val.ptr & ~1);
90 this.ptrs_to.add(val);
94 * Constructs a new ClosingSigned given each field
96 public static ClosingSigned of(byte[] channel_id_arg, long fee_satoshis_arg, byte[] signature_arg, ClosingSignedFeeRange fee_range_arg) {
97 long ret = bindings.ClosingSigned_new(channel_id_arg, fee_satoshis_arg, signature_arg, fee_range_arg == null ? 0 : fee_range_arg.ptr & ~1);
98 if (ret < 1024) { return null; }
99 ClosingSigned ret_hu_conv = new ClosingSigned(null, ret);
100 ret_hu_conv.ptrs_to.add(ret_hu_conv);
101 ret_hu_conv.ptrs_to.add(fee_range_arg);
106 * Creates a copy of the ClosingSigned
108 public ClosingSigned clone() {
109 long ret = bindings.ClosingSigned_clone(this.ptr);
110 if (ret < 1024) { return null; }
111 ClosingSigned ret_hu_conv = new ClosingSigned(null, ret);
112 ret_hu_conv.ptrs_to.add(this);
117 * Serialize the ClosingSigned object into a byte array which can be read by ClosingSigned_read
119 public byte[] write() {
120 byte[] ret = bindings.ClosingSigned_write(this.ptr);
125 * Read a ClosingSigned from a byte array, created by ClosingSigned_write
127 public static Result_ClosingSignedDecodeErrorZ read(byte[] ser) {
128 long ret = bindings.ClosingSigned_read(ser);
129 if (ret < 1024) { return null; }
130 Result_ClosingSignedDecodeErrorZ ret_hu_conv = Result_ClosingSignedDecodeErrorZ.constr_from_ptr(ret);