* An `Offer` is a potentially long-lived proposal for payment of a good or service.
*
* An offer is a precursor to an [`InvoiceRequest`]. A merchant publishes an offer from which a
- * customer may request an [`Invoice`] for a specific quantity and using an amount sufficient to
- * cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
+ * customer may request an [`Bolt12Invoice`] for a specific quantity and using an amount sufficient
+ * to cover that quantity (i.e., at least `quantity * amount`). See [`Offer::amount`].
*
* Offers may be denominated in currency other than bitcoin but are ultimately paid using the
* latter.
* Through the use of [`BlindedPath`]s, offers provide recipient privacy.
*
* [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
- * [`Invoice`]: crate::offers::invoice::Invoice
+ * [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
*/
@SuppressWarnings("unchecked") // We correctly assign various generic arrays
public class Offer extends CommonBase {
return ret;
}
- /**
- * Returns whether the given chain is supported by the offer.
- */
- public boolean supports_chain(byte[] chain) {
- boolean ret = bindings.Offer_supports_chain(this.ptr, InternalUtils.check_arr_len(chain, 32));
- Reference.reachabilityFence(this);
- Reference.reachabilityFence(chain);
- return ret;
- }
-
/**
* Opaque bytes set by the originator. Useful for authentication and validating fields since it
* is reflected in `invoice_request` messages along with all the other fields from the `offer`.
/**
* Features pertaining to the offer.
*/
- public OfferFeatures features() {
- long ret = bindings.Offer_features(this.ptr);
+ public OfferFeatures offer_features() {
+ long ret = bindings.Offer_offer_features(this.ptr);
Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
org.ldk.structs.OfferFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.OfferFeatures(null, ret); }
*
* If `None`, the offer does not expire.
*/
- public Option_DurationZ absolute_expiry() {
+ public Option_u64Z absolute_expiry() {
long ret = bindings.Offer_absolute_expiry(this.ptr);
Reference.reachabilityFence(this);
if (ret >= 0 && ret <= 4096) { return null; }
- org.ldk.structs.Option_DurationZ ret_hu_conv = org.ldk.structs.Option_DurationZ.constr_from_ptr(ret);
+ org.ldk.structs.Option_u64Z ret_hu_conv = org.ldk.structs.Option_u64Z.constr_from_ptr(ret);
if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(this); };
return ret_hu_conv;
}
- /**
- * Whether the offer has expired.
- */
- public boolean is_expired() {
- boolean ret = bindings.Offer_is_expired(this.ptr);
- Reference.reachabilityFence(this);
- return ret;
- }
-
/**
* The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
* displayed to the user but with the caveat that it has not been verified in any way.
return ret_hu_conv;
}
+ /**
+ * The public key used by the recipient to sign invoices.
+ */
+ public byte[] signing_pubkey() {
+ byte[] ret = bindings.Offer_signing_pubkey(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
+ /**
+ * Returns whether the given chain is supported by the offer.
+ */
+ public boolean supports_chain(byte[] chain) {
+ boolean ret = bindings.Offer_supports_chain(this.ptr, InternalUtils.check_arr_len(chain, 32));
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(chain);
+ return ret;
+ }
+
+ /**
+ * Whether the offer has expired.
+ */
+ public boolean is_expired() {
+ boolean ret = bindings.Offer_is_expired(this.ptr);
+ Reference.reachabilityFence(this);
+ return ret;
+ }
+
+ /**
+ * Whether the offer has expired given the duration since the Unix epoch.
+ */
+ public boolean is_expired_no_std(long duration_since_epoch) {
+ boolean ret = bindings.Offer_is_expired_no_std(this.ptr, duration_since_epoch);
+ Reference.reachabilityFence(this);
+ Reference.reachabilityFence(duration_since_epoch);
+ return ret;
+ }
+
/**
* Returns whether the given quantity is valid for the offer.
*/
}
/**
- * The public key used by the recipient to sign invoices.
+ * Serialize the Offer object into a byte array which can be read by Offer_read
*/
- public byte[] signing_pubkey() {
- byte[] ret = bindings.Offer_signing_pubkey(this.ptr);
+ public byte[] write() {
+ byte[] ret = bindings.Offer_write(this.ptr);
Reference.reachabilityFence(this);
return ret;
}
/**
- * Serialize the Offer object into a byte array which can be read by Offer_read
+ * Read a Offer object from a string
*/
- public byte[] write() {
- byte[] ret = bindings.Offer_write(this.ptr);
- Reference.reachabilityFence(this);
- return ret;
+ public static Result_OfferBolt12ParseErrorZ from_str(java.lang.String s) {
+ long ret = bindings.Offer_from_str(s);
+ Reference.reachabilityFence(s);
+ if (ret >= 0 && ret <= 4096) { return null; }
+ Result_OfferBolt12ParseErrorZ ret_hu_conv = Result_OfferBolt12ParseErrorZ.constr_from_ptr(ret);
+ return ret_hu_conv;
}
}