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 * An update_fee message to be sent or received from a peer
13 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
14 public class UpdateFee extends CommonBase {
15 UpdateFee(Object _dummy, long ptr) { super(ptr); }
16 @Override @SuppressWarnings("deprecation")
17 protected void finalize() throws Throwable {
19 if (ptr != 0) { bindings.UpdateFee_free(ptr); }
25 public byte[] get_channel_id() {
26 byte[] ret = bindings.UpdateFee_get_channel_id(this.ptr);
33 public void set_channel_id(byte[] val) {
34 bindings.UpdateFee_set_channel_id(this.ptr, val);
38 * Fee rate per 1000-weight of the transaction
40 public int get_feerate_per_kw() {
41 int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
46 * Fee rate per 1000-weight of the transaction
48 public void set_feerate_per_kw(int val) {
49 bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
53 * Constructs a new UpdateFee given each field
55 public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) {
56 long ret = bindings.UpdateFee_new(channel_id_arg, feerate_per_kw_arg);
57 if (ret < 1024) { return null; }
58 UpdateFee ret_hu_conv = new UpdateFee(null, ret);
59 ret_hu_conv.ptrs_to.add(ret_hu_conv);
64 * Creates a copy of the UpdateFee
66 public UpdateFee clone() {
67 long ret = bindings.UpdateFee_clone(this.ptr);
68 if (ret < 1024) { return null; }
69 UpdateFee ret_hu_conv = new UpdateFee(null, ret);
70 ret_hu_conv.ptrs_to.add(this);
75 * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
77 public byte[] write() {
78 byte[] ret = bindings.UpdateFee_write(this.ptr);
83 * Read a UpdateFee from a byte array, created by UpdateFee_write
85 public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
86 long ret = bindings.UpdateFee_read(ser);
87 if (ret < 1024) { return null; }
88 Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);