X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Forg%2Fldk%2Fstructs%2FInvoice.java;h=3f209e3d22781115fedbec401245f0db754c84d5;hb=ff3dacec3be60f870d81f6df11bd9fff92aa6047;hp=5b02d9eb41f495bfb6143388ec2dba06d409ffa6;hpb=d2925e24ac4643ec22eb73495f0424e27def2545;p=ldk-java diff --git a/src/main/java/org/ldk/structs/Invoice.java b/src/main/java/org/ldk/structs/Invoice.java index 5b02d9eb..3f209e3d 100644 --- a/src/main/java/org/ldk/structs/Invoice.java +++ b/src/main/java/org/ldk/structs/Invoice.java @@ -115,7 +115,7 @@ public class Invoice extends CommonBase { } /** - * Returns the `Invoice`'s timestamp (should equal it's creation time) + * Returns the `Invoice`'s timestamp (should equal its creation time) */ public long timestamp() { long ret = bindings.Invoice_timestamp(this.ptr); @@ -123,6 +123,15 @@ public class Invoice extends CommonBase { return ret; } + /** + * Returns the `Invoice`'s timestamp as a duration since the Unix epoch + */ + public long duration_since_epoch() { + long ret = bindings.Invoice_duration_since_epoch(this.ptr); + Reference.reachabilityFence(this); + return ret; + } + /** * Returns the hash to which we will receive the preimage on completion of the payment */ @@ -195,6 +204,17 @@ public class Invoice extends CommonBase { return ret; } + /** + * Returns whether the expiry time would pass at the given point in time. + * `at_time` is the timestamp as a duration since the Unix epoch. + */ + public boolean would_expire(long at_time) { + boolean ret = bindings.Invoice_would_expire(this.ptr, at_time); + Reference.reachabilityFence(this); + Reference.reachabilityFence(at_time); + return ret; + } + /** * Returns the invoice's `min_final_cltv_expiry` time, if present, otherwise * [`DEFAULT_MIN_FINAL_CLTV_EXPIRY`]. @@ -211,8 +231,9 @@ public class Invoice extends CommonBase { public PrivateRoute[] private_routes() { long[] ret = bindings.Invoice_private_routes(this.ptr); Reference.reachabilityFence(this); - PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret.length]; - for (int o = 0; o < ret.length; o++) { + int ret_conv_14_len = ret.length; + PrivateRoute[] ret_conv_14_arr = new PrivateRoute[ret_conv_14_len]; + for (int o = 0; o < ret_conv_14_len; o++) { long ret_conv_14 = ret[o]; PrivateRoute ret_conv_14_hu_conv = null; if (ret_conv_14 < 0 || ret_conv_14 > 4096) { ret_conv_14_hu_conv = new PrivateRoute(null, ret_conv_14); } ret_conv_14_hu_conv.ptrs_to.add(this); @@ -227,8 +248,9 @@ public class Invoice extends CommonBase { public RouteHint[] route_hints() { long[] ret = bindings.Invoice_route_hints(this.ptr); Reference.reachabilityFence(this); - RouteHint[] ret_conv_11_arr = new RouteHint[ret.length]; - for (int l = 0; l < ret.length; l++) { + int ret_conv_11_len = ret.length; + RouteHint[] ret_conv_11_arr = new RouteHint[ret_conv_11_len]; + for (int l = 0; l < ret_conv_11_len; l++) { long ret_conv_11 = ret[l]; RouteHint ret_conv_11_hu_conv = null; if (ret_conv_11 < 0 || ret_conv_11 > 4096) { ret_conv_11_hu_conv = new RouteHint(null, ret_conv_11); } ret_conv_11_hu_conv.ptrs_to.add(this); @@ -253,7 +275,7 @@ public class Invoice extends CommonBase { long ret = bindings.Invoice_amount_milli_satoshis(this.ptr); Reference.reachabilityFence(this); if (ret >= 0 && ret <= 4096) { return null; } - Option_u64Z ret_hu_conv = Option_u64Z.constr_from_ptr(ret); + org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret); ret_hu_conv.ptrs_to.add(this); return ret_hu_conv; } @@ -261,11 +283,11 @@ public class Invoice extends CommonBase { /** * Read a Invoice object from a string */ - public static Result_InvoiceNoneZ from_str(java.lang.String s) { + public static Result_InvoiceParseOrSemanticErrorZ from_str(java.lang.String s) { long ret = bindings.Invoice_from_str(s); Reference.reachabilityFence(s); if (ret >= 0 && ret <= 4096) { return null; } - Result_InvoiceNoneZ ret_hu_conv = Result_InvoiceNoneZ.constr_from_ptr(ret); + Result_InvoiceParseOrSemanticErrorZ ret_hu_conv = Result_InvoiceParseOrSemanticErrorZ.constr_from_ptr(ret); return ret_hu_conv; }