Update auto-generated bindings
[ldk-java] / src / main / java / org / ldk / structs / Route.java
index cb0f6a2b290f56d944a1f4054892e6cdf731abd8..7c4e8275b4b6c0fb30305dc8e8bb00d15c47ac84 100644 (file)
@@ -5,6 +5,11 @@ import org.ldk.enums.*;
 import org.ldk.util.*;
 import java.util.Arrays;
 
+
+/**
+ * A route directs a payment from the sender (us) to the recipient. If the recipient supports MPP,
+ * it can take multiple paths. Each path is composed of one or more hops through the network.
+ */
 @SuppressWarnings("unchecked") // We correctly assign various generic arrays
 public class Route extends CommonBase {
        Route(Object _dummy, long ptr) { super(ptr); }
@@ -14,32 +19,52 @@ public class Route extends CommonBase {
                if (ptr != 0) { bindings.Route_free(ptr); }
        }
 
-       public Route clone() {
-               long ret = bindings.Route_clone(this.ptr);
-               Route ret_hu_conv = new Route(null, ret);
-               ret_hu_conv.ptrs_to.add(this);
-               return ret_hu_conv;
-       }
-
+       /**
+        * The list of routes taken for a single (potentially-)multi-part payment. The pubkey of the
+        * last RouteHop in each path must be the same.
+        * Each entry represents a list of hops, NOT INCLUDING our own, where the last hop is the
+        * destination. Thus, this must always be at least length one. While the maximum length of any
+        * given path is variable, keeping the length of any path to less than 20 should currently
+        * ensure it is viable.
+        */
        public void set_paths(RouteHop[][] val) {
-               bindings.Route_set_paths(this.ptr, (long[][])Arrays.stream(val).map(arr_conv_12 -> Arrays.stream(arr_conv_12).mapToLong(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray()).toArray());
+               bindings.Route_set_paths(this.ptr, Arrays.stream(val).map(val_conv_12 -> Arrays.stream(val_conv_12).mapToLong(val_conv_12_conv_10 -> val_conv_12_conv_10 == null ? 0 : val_conv_12_conv_10.ptr & ~1).toArray()).toArray(long[][]::new));
                /* TODO 2 RouteHop[]  */;
        }
 
-       public static Route constructor_new(RouteHop[][] paths_arg) {
-               long ret = bindings.Route_new((long[][])Arrays.stream(paths_arg).map(arr_conv_12 -> Arrays.stream(arr_conv_12).mapToLong(arr_conv_10 -> arr_conv_10 == null ? 0 : arr_conv_10.ptr & ~1).toArray()).toArray());
+       /**
+        * Constructs a new Route given each field
+        */
+       public static Route of(RouteHop[][] paths_arg) {
+               long ret = bindings.Route_new(Arrays.stream(paths_arg).map(paths_arg_conv_12 -> Arrays.stream(paths_arg_conv_12).mapToLong(paths_arg_conv_12_conv_10 -> paths_arg_conv_12_conv_10 == null ? 0 : paths_arg_conv_12_conv_10.ptr & ~1).toArray()).toArray(long[][]::new));
                Route ret_hu_conv = new Route(null, ret);
                ret_hu_conv.ptrs_to.add(ret_hu_conv);
                /* TODO 2 RouteHop[]  */;
                return ret_hu_conv;
        }
 
+       /**
+        * Creates a copy of the Route
+        */
+       public Route clone() {
+               long ret = bindings.Route_clone(this.ptr);
+               Route ret_hu_conv = new Route(null, ret);
+               ret_hu_conv.ptrs_to.add(this);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Serialize the Route object into a byte array which can be read by Route_read
+        */
        public byte[] write() {
                byte[] ret = bindings.Route_write(this.ptr);
                return ret;
        }
 
-       public static Result_RouteDecodeErrorZ constructor_read(byte[] ser) {
+       /**
+        * Read a Route from a byte array, created by Route_write
+        */
+       public static Result_RouteDecodeErrorZ read(byte[] ser) {
                long ret = bindings.Route_read(ser);
                Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;