Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / UpdateFee.java
index 43623fb0f67c1f5ad5c11915256740cbbe4c84c6..38fceb240fe01b42b09da27250db56fbefb74638 100644 (file)
@@ -2,48 +2,87 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
 
+
+/**
+ * An update_fee message to be sent or received from a peer
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class UpdateFee extends CommonBase {
        UpdateFee(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.UpdateFee_free(ptr); super.finalize();
+               super.finalize();
+               if (ptr != 0) { bindings.UpdateFee_free(ptr); }
+       }
+
+       /**
+        * The channel ID
+        */
+       public byte[] get_channel_id() {
+               byte[] ret = bindings.UpdateFee_get_channel_id(this.ptr);
+               return ret;
        }
 
-       public UpdateFee(UpdateFee orig) {
-               super(bindings.UpdateFee_clone(orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       /**
+        * The channel ID
+        */
+       public void set_channel_id(byte[] val) {
+               bindings.UpdateFee_set_channel_id(this.ptr, val);
        }
 
-       public byte[] get_channel_id(UpdateFee this_ptr) {
-               byte[] ret = bindings.UpdateFee_get_channel_id(this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Fee rate per 1000-weight of the transaction
+        */
+       public int get_feerate_per_kw() {
+               int ret = bindings.UpdateFee_get_feerate_per_kw(this.ptr);
                return ret;
        }
 
-       public void set_channel_id(UpdateFee this_ptr, byte[] val) {
-               bindings.UpdateFee_set_channel_id(this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Fee rate per 1000-weight of the transaction
+        */
+       public void set_feerate_per_kw(int val) {
+               bindings.UpdateFee_set_feerate_per_kw(this.ptr, val);
        }
 
-       public int get_feerate_per_kw(UpdateFee this_ptr) {
-               int ret = bindings.UpdateFee_get_feerate_per_kw(this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
-               return ret;
+       /**
+        * Constructs a new UpdateFee given each field
+        */
+       public static UpdateFee of(byte[] channel_id_arg, int feerate_per_kw_arg) {
+               long ret = bindings.UpdateFee_new(channel_id_arg, feerate_per_kw_arg);
+               UpdateFee ret_hu_conv = new UpdateFee(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
        }
 
-       public void set_feerate_per_kw(UpdateFee this_ptr, int val) {
-               bindings.UpdateFee_set_feerate_per_kw(this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Creates a copy of the UpdateFee
+        */
+       public UpdateFee clone() {
+               long ret = bindings.UpdateFee_clone(this.ptr);
+               UpdateFee ret_hu_conv = new UpdateFee(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
-       public UpdateFee(byte[] channel_id_arg, int feerate_per_kw_arg) {
-               super(bindings.UpdateFee_new(channel_id_arg, feerate_per_kw_arg));
+       /**
+        * Serialize the UpdateFee object into a byte array which can be read by UpdateFee_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.UpdateFee_write(this.ptr);
+               return ret;
        }
 
-       // Skipped UpdateFee_write
-       public UpdateFee(byte[] ser) {
-               super(bindings.UpdateFee_read(ser));
+       /**
+        * Read a UpdateFee from a byte array, created by UpdateFee_write
+        */
+       public static Result_UpdateFeeDecodeErrorZ read(byte[] ser) {
+               long ret = bindings.UpdateFee_read(ser);
+               Result_UpdateFeeDecodeErrorZ ret_hu_conv = Result_UpdateFeeDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
        }
 
 }