[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / Route.cs
index a13f5e08d3fe2cd0f79f8e6d8d99caa21c2a6ffb..666b6dfbb414ebd11375242d80f03d1ddbcaff2e 100644 (file)
@@ -22,16 +22,18 @@ public class Route : CommonBase {
         * the same.
         */
        public Path[] get_paths() {
-               long[] ret = bindings.Route_get_paths(this.ptr);
+               long ret = bindings.Route_get_paths(this.ptr);
                GC.KeepAlive(this);
-               int ret_conv_6_len = ret.Length;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               int ret_conv_6_len = InternalUtils.getArrayLength(ret);
                Path[] ret_conv_6_arr = new Path[ret_conv_6_len];
                for (int g = 0; g < ret_conv_6_len; g++) {
-                       long ret_conv_6 = ret[g];
+                       long ret_conv_6 = InternalUtils.getU64ArrayElem(ret, g);
                        org.ldk.structs.Path ret_conv_6_hu_conv = null; if (ret_conv_6 < 0 || ret_conv_6 > 4096) { ret_conv_6_hu_conv = new org.ldk.structs.Path(null, ret_conv_6); }
                        if (ret_conv_6_hu_conv != null) { ret_conv_6_hu_conv.ptrs_to.AddLast(this); };
                        ret_conv_6_arr[g] = ret_conv_6_hu_conv;
                }
+               bindings.free_buffer(ret);
                return ret_conv_6_arr;
        }
 
@@ -41,37 +43,41 @@ public class Route : CommonBase {
         * the same.
         */
        public void set_paths(Path[] val) {
-               bindings.Route_set_paths(this.ptr, val != null ? InternalUtils.mapArray(val, val_conv_6 => val_conv_6 == null ? 0 : val_conv_6.ptr) : null);
+               bindings.Route_set_paths(this.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(val, val_conv_6 => val_conv_6 == null ? 0 : val_conv_6.ptr)));
                GC.KeepAlive(this);
                GC.KeepAlive(val);
                foreach (Path val_conv_6 in val) { if (this != null) { this.ptrs_to.AddLast(val_conv_6); }; };
        }
 
        /**
-        * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`].
+        * The `route_params` parameter passed to [`find_route`].
         * 
         * This is used by `ChannelManager` to track information which may be required for retries.
         * 
+        * Will be `None` for objects serialized with LDK versions prior to 0.0.117.
+        * 
         * Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public PaymentParameters get_payment_params() {
-               long ret = bindings.Route_get_payment_params(this.ptr);
+       public RouteParameters get_route_params() {
+               long ret = bindings.Route_get_route_params(this.ptr);
                GC.KeepAlive(this);
                if (ret >= 0 && ret <= 4096) { return null; }
-               org.ldk.structs.PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentParameters(null, ret); }
+               org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); }
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
                return ret_hu_conv;
        }
 
        /**
-        * The `payment_params` parameter passed via [`RouteParameters`] to [`find_route`].
+        * The `route_params` parameter passed to [`find_route`].
         * 
         * This is used by `ChannelManager` to track information which may be required for retries.
         * 
+        * Will be `None` for objects serialized with LDK versions prior to 0.0.117.
+        * 
         * Note that val (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public void set_payment_params(org.ldk.structs.PaymentParameters val) {
-               bindings.Route_set_payment_params(this.ptr, val == null ? 0 : val.ptr);
+       public void set_route_params(org.ldk.structs.RouteParameters val) {
+               bindings.Route_set_route_params(this.ptr, val == null ? 0 : val.ptr);
                GC.KeepAlive(this);
                GC.KeepAlive(val);
                if (this != null) { this.ptrs_to.AddLast(val); };
@@ -79,16 +85,18 @@ public class Route : CommonBase {
 
        /**
         * Constructs a new Route given each field
+        * 
+        * Note that route_params_arg (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public static Route of(Path[] paths_arg, org.ldk.structs.PaymentParameters payment_params_arg) {
-               long ret = bindings.Route_new(paths_arg != null ? InternalUtils.mapArray(paths_arg, paths_arg_conv_6 => paths_arg_conv_6 == null ? 0 : paths_arg_conv_6.ptr) : null, payment_params_arg == null ? 0 : payment_params_arg.ptr);
+       public static Route of(Path[] paths_arg, org.ldk.structs.RouteParameters route_params_arg) {
+               long ret = bindings.Route_new(InternalUtils.encodeUint64Array(InternalUtils.mapArray(paths_arg, paths_arg_conv_6 => paths_arg_conv_6 == null ? 0 : paths_arg_conv_6.ptr)), route_params_arg == null ? 0 : route_params_arg.ptr);
                GC.KeepAlive(paths_arg);
-               GC.KeepAlive(payment_params_arg);
+               GC.KeepAlive(route_params_arg);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Route ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.Route(null, ret); }
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
                foreach (Path paths_arg_conv_6 in paths_arg) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(paths_arg_conv_6); }; };
-               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_params_arg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(route_params_arg); };
                return ret_hu_conv;
        }
 
@@ -142,8 +150,11 @@ public class Route : CommonBase {
        /**
         * Returns the total amount of fees paid on this [`Route`].
         * 
-        * This doesn't include any extra payment made to the recipient, which can happen in excess of
-        * the amount passed to [`find_route`]'s `route_params.final_value_msat`.
+        * For objects serialized with LDK 0.0.117 and after, this includes any extra payment made to
+        * the recipient, which can happen in excess of the amount passed to [`find_route`] via
+        * [`RouteParameters::final_value_msat`], if we had to reach the [`htlc_minimum_msat`] limits.
+        * 
+        * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
         */
        public long get_total_fees() {
                long ret = bindings.Route_get_total_fees(this.ptr);
@@ -152,8 +163,12 @@ public class Route : CommonBase {
        }
 
        /**
-        * Returns the total amount paid on this [`Route`], excluding the fees. Might be more than
-        * requested if we had to reach htlc_minimum_msat.
+        * Returns the total amount paid on this [`Route`], excluding the fees.
+        * 
+        * Might be more than requested as part of the given [`RouteParameters::final_value_msat`] if
+        * we had to reach the [`htlc_minimum_msat`] limits.
+        * 
+        * [`htlc_minimum_msat`]: https://github.com/lightning/bolts/blob/master/07-routing-gossip.md#the-channel_update-message
         */
        public long get_total_amount() {
                long ret = bindings.Route_get_total_amount(this.ptr);
@@ -165,16 +180,18 @@ public class Route : CommonBase {
         * 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);
+               long ret = bindings.Route_write(this.ptr);
                GC.KeepAlive(this);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Read a Route from a byte array, created by Route_write
         */
        public static Result_RouteDecodeErrorZ read(byte[] ser) {
-               long ret = bindings.Route_read(ser);
+               long ret = bindings.Route_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_RouteDecodeErrorZ ret_hu_conv = Result_RouteDecodeErrorZ.constr_from_ptr(ret);