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 * An update_fee message to be sent or received from a peer
14 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
15 public class UpdateFee extends CommonBase {
16 UpdateFee(Object _dummy, long ptr) { super(ptr); }
17 @Override @SuppressWarnings("deprecation")
18 protected void finalize() throws Throwable {
20 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
26 public byte[] get_channel_id() {
27 byte[] ret = bindings.UpdateFee_get_channel_id(this.ptr);
28 Reference.reachabilityFence(this);
35 public void set_channel_id(byte[] val) {
36 bindings.UpdateFee_set_channel_id(this.ptr, InternalUtils.check_arr_len(val, 32));
37 Reference.reachabilityFence(this);
38 Reference.reachabilityFence(val);
42 * Fee rate per 1000-weight of the transaction
44 public int get_feerate_per_kw() {
45 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
46 Reference.reachabilityFence(this);
51 * Fee rate per 1000-weight of the transaction
53 public void set_feerate_per_kw(int val) {
54 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
55 Reference.reachabilityFence(this);
56 Reference.reachabilityFence(val);
60 * Constructs a new UpdateFee given each field
62 public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) {
63 long ret = bindings.UpdateFee_new(InternalUtils.check_arr_len(channel_id_arg, 32), feerate_per_kw_arg);
64 Reference.reachabilityFence(channel_id_arg);
65 Reference.reachabilityFence(feerate_per_kw_arg);
66 if (ret >= 0 && ret <= 4096) { return null; }
67 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
68 ret_hu_conv.ptrs_to.add(ret_hu_conv);
73 long ret = bindings.UpdateFee_clone_ptr(this.ptr);
74 Reference.reachabilityFence(this);
79 * Creates a copy of the UpdateFee
81 public UpdateFee clone() {
82 long ret = bindings.UpdateFee_clone(this.ptr);
83 Reference.reachabilityFence(this);
84 if (ret >= 0 && ret <= 4096) { return null; }
85 org.ldk.structs.UpdateFee ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.UpdateFee(null, ret); }
86 ret_hu_conv.ptrs_to.add(this);
91 * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
93 public byte[] write() {
94 byte[] ret = bindings.UpdateFee_write(this.ptr);
95 Reference.reachabilityFence(this);
100 * Read a UpdateFee from a byte array, created by UpdateFee_write
102 public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
103 long ret = bindings.UpdateFee_read(ser);
104 Reference.reachabilityFence(ser);
105 if (ret >= 0 && ret <= 4096) { return null; }
106 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);