6 namespace org { namespace ldk { namespace structs {
10 * Parameters needed to find a [`Route`].
12 * Passed to [`find_route`] and [`build_route_from_hops`], but also provided in
13 * [`Event::PaymentPathFailed`] for retrying a failed payment path.
15 * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
17 public class RouteParameters : CommonBase {
18 internal RouteParameters(object _dummy, long ptr) : base(ptr) { }
20 if (ptr != 0) { bindings.RouteParameters_free(ptr); }
24 * The parameters of the failed payment path.
26 public PaymentParameters get_payment_params() {
27 long ret = bindings.RouteParameters_get_payment_params(this.ptr);
29 if (ret >= 0 && ret <= 4096) { return null; }
30 org.ldk.structs.PaymentParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.PaymentParameters(null, ret); }
31 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
36 * The parameters of the failed payment path.
38 public void set_payment_params(org.ldk.structs.PaymentParameters val) {
39 bindings.RouteParameters_set_payment_params(this.ptr, val == null ? 0 : val.ptr);
42 if (this != null) { this.ptrs_to.AddLast(val); };
46 * The amount in msats sent on the failed payment path.
48 public long get_final_value_msat() {
49 long ret = bindings.RouteParameters_get_final_value_msat(this.ptr);
55 * The amount in msats sent on the failed payment path.
57 public void set_final_value_msat(long val) {
58 bindings.RouteParameters_set_final_value_msat(this.ptr, val);
64 * The CLTV on the final hop of the failed payment path.
66 public int get_final_cltv_expiry_delta() {
67 int ret = bindings.RouteParameters_get_final_cltv_expiry_delta(this.ptr);
73 * The CLTV on the final hop of the failed payment path.
75 public void set_final_cltv_expiry_delta(int val) {
76 bindings.RouteParameters_set_final_cltv_expiry_delta(this.ptr, val);
82 * Constructs a new RouteParameters given each field
84 public static RouteParameters of(org.ldk.structs.PaymentParameters payment_params_arg, long final_value_msat_arg, int final_cltv_expiry_delta_arg) {
85 long ret = bindings.RouteParameters_new(payment_params_arg == null ? 0 : payment_params_arg.ptr, final_value_msat_arg, final_cltv_expiry_delta_arg);
86 GC.KeepAlive(payment_params_arg);
87 GC.KeepAlive(final_value_msat_arg);
88 GC.KeepAlive(final_cltv_expiry_delta_arg);
89 if (ret >= 0 && ret <= 4096) { return null; }
90 org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); }
91 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(ret_hu_conv); };
92 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payment_params_arg); };
96 internal long clone_ptr() {
97 long ret = bindings.RouteParameters_clone_ptr(this.ptr);
103 * Creates a copy of the RouteParameters
105 public RouteParameters clone() {
106 long ret = bindings.RouteParameters_clone(this.ptr);
108 if (ret >= 0 && ret <= 4096) { return null; }
109 org.ldk.structs.RouteParameters ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.RouteParameters(null, ret); }
110 if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(this); };
115 * Serialize the RouteParameters object into a byte array which can be read by RouteParameters_read
117 public byte[] write() {
118 byte[] ret = bindings.RouteParameters_write(this.ptr);
124 * Read a RouteParameters from a byte array, created by RouteParameters_write
126 public static Result_RouteParametersDecodeErrorZ read(byte[] ser) {
127 long ret = bindings.RouteParameters_read(ser);
129 if (ret >= 0 && ret <= 4096) { return null; }
130 Result_RouteParametersDecodeErrorZ ret_hu_conv = Result_RouteParametersDecodeErrorZ.constr_from_ptr(ret);