Update java bindings with new generator and new upstream code
[ldk-java] / src / main / java / org / ldk / structs / FundingCreated.java
index 0101c77f71b6a579a311ffede4f6b712dd0225ea..6faf150f17f28c6633c42749eb65504a56969445 100644 (file)
@@ -2,55 +2,117 @@ package org.ldk.structs;
 
 import org.ldk.impl.bindings;
 import org.ldk.enums.*;
+import org.ldk.util.*;
+import java.util.Arrays;
 
+
+/**
+ * A funding_created message to be sent or received from a peer
+ */
+@SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class FundingCreated extends CommonBase {
        FundingCreated(Object _dummy, long ptr) { super(ptr); }
        @Override @SuppressWarnings("deprecation")
        protected void finalize() throws Throwable {
-               bindings.FundingCreated_free(ptr); super.finalize();
+               super.finalize();
+               if (ptr != 0) { bindings.FundingCreated_free(ptr); }
+       }
+
+       /**
+        * A temporary channel ID, until the funding is established
+        */
+       public byte[] get_temporary_channel_id() {
+               byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this.ptr);
+               return ret;
        }
 
-       public FundingCreated(FundingCreated orig) {
-               super(bindings.FundingCreated_clone(orig.ptr & ~1));
-               this.ptrs_to.add(orig);
+       /**
+        * A temporary channel ID, until the funding is established
+        */
+       public void set_temporary_channel_id(byte[] val) {
+               bindings.FundingCreated_set_temporary_channel_id(this.ptr, val);
        }
 
-       public byte[] get_temporary_channel_id(FundingCreated this_ptr) {
-               byte[] ret = bindings.FundingCreated_get_temporary_channel_id(this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The funding transaction ID
+        */
+       public byte[] get_funding_txid() {
+               byte[] ret = bindings.FundingCreated_get_funding_txid(this.ptr);
                return ret;
        }
 
-       public void set_temporary_channel_id(FundingCreated this_ptr, byte[] val) {
-               bindings.FundingCreated_set_temporary_channel_id(this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The funding transaction ID
+        */
+       public void set_funding_txid(byte[] val) {
+               bindings.FundingCreated_set_funding_txid(this.ptr, val);
        }
 
-       public byte[] get_funding_txid(FundingCreated this_ptr) {
-               byte[] ret = bindings.FundingCreated_get_funding_txid(this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The specific output index funding this channel
+        */
+       public short get_funding_output_index() {
+               short ret = bindings.FundingCreated_get_funding_output_index(this.ptr);
                return ret;
        }
 
-       public void set_funding_txid(FundingCreated this_ptr, byte[] val) {
-               bindings.FundingCreated_set_funding_txid(this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * The specific output index funding this channel
+        */
+       public void set_funding_output_index(short val) {
+               bindings.FundingCreated_set_funding_output_index(this.ptr, val);
+       }
+
+       /**
+        * The signature of the channel initiator (funder) on the funding transaction
+        */
+       public byte[] get_signature() {
+               byte[] ret = bindings.FundingCreated_get_signature(this.ptr);
+               return ret;
+       }
+
+       /**
+        * The signature of the channel initiator (funder) on the funding transaction
+        */
+       public void set_signature(byte[] val) {
+               bindings.FundingCreated_set_signature(this.ptr, val);
+       }
+
+       /**
+        * Constructs a new FundingCreated given each field
+        */
+       public static FundingCreated constructor_new(byte[] temporary_channel_id_arg, byte[] funding_txid_arg, short funding_output_index_arg, byte[] signature_arg) {
+               long ret = bindings.FundingCreated_new(temporary_channel_id_arg, funding_txid_arg, funding_output_index_arg, signature_arg);
+               FundingCreated ret_hu_conv = new FundingCreated(null, ret);
+               ret_hu_conv.ptrs_to.add(ret_hu_conv);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates a copy of the FundingCreated
+        */
+       public FundingCreated clone() {
+               long ret = bindings.FundingCreated_clone(this.ptr);
+               FundingCreated ret_hu_conv = new FundingCreated(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
        }
 
-       public short get_funding_output_index(FundingCreated this_ptr) {
-               short ret = bindings.FundingCreated_get_funding_output_index(this_ptr.ptr & ~1);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Serialize the FundingCreated object into a byte array which can be read by FundingCreated_read
+        */
+       public byte[] write() {
+               byte[] ret = bindings.FundingCreated_write(this.ptr);
                return ret;
        }
 
-       public void set_funding_output_index(FundingCreated this_ptr, short val) {
-               bindings.FundingCreated_set_funding_output_index(this_ptr.ptr & ~1, val);
-               this.ptrs_to.add(this_ptr);
+       /**
+        * Read a FundingCreated from a byte array, created by FundingCreated_write
+        */
+       public static Result_FundingCreatedDecodeErrorZ constructor_read(byte[] ser) {
+               long ret = bindings.FundingCreated_read(ser);
+               Result_FundingCreatedDecodeErrorZ ret_hu_conv = Result_FundingCreatedDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
        }
 
-       // Skipped FundingCreated_get_signature
-       // Skipped FundingCreated_set_signature
-       // Skipped FundingCreated_new
-       // Skipped FundingCreated_write
-       // Skipped FundingCreated_read
 }