Package org.ngengine.lnurl
Class LnUrl
- java.lang.Object
-
- org.ngengine.lnurl.LnUrl
-
- Direct Known Subclasses:
LnAddress
public class LnUrl extends java.lang.ObjectA lnurl or lud16 URL.
-
-
Field Summary
Fields Modifier and Type Field Description static java.time.DurationDEFAULT_TIMEOUT
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LnUrlencode(java.lang.String url)Encode an url to a lnurl bech32 representation.static LnUrlencode(java.net.URI url)Encode an url to a lnurl bech32 representation.booleanequals(java.lang.Object obj)<T extends LnUrlService>
org.ngengine.platform.AsyncTask<T>getService()Get an handler for the underlying service offered by this LNURL.<T extends LnUrlService>
org.ngengine.platform.AsyncTask<T>getService(java.time.Duration timeout)Get an handler for the underlying service offered by this LNURL.java.lang.StringgetTag()The tag for this LNURL service if applicable.inthashCode()static voidregisterServiceFactory(LnUrlServiceFactory factory)java.lang.StringtoBech32()Return the bech32 representation of the LNURL.java.lang.StringtoLnUrlLink()Returns a link that can be used in a browser or app to open the LNURL.java.lang.StringtoString()java.net.URItoURI()The decoded java URI representation of the LNURL after it is decoded from bech32.
-
-
-
Method Detail
-
registerServiceFactory
public static void registerServiceFactory(LnUrlServiceFactory factory)
-
encode
public static LnUrl encode(java.net.URI url) throws org.ngengine.bech32.Bech32DecodingException, org.ngengine.bech32.Bech32InvalidChecksumException, org.ngengine.bech32.Bech32InvalidRangeException, java.net.URISyntaxException, org.ngengine.bech32.Bech32EncodingException
Encode an url to a lnurl bech32 representation.- Throws:
org.ngengine.bech32.Bech32DecodingExceptionorg.ngengine.bech32.Bech32InvalidChecksumExceptionorg.ngengine.bech32.Bech32InvalidRangeExceptionjava.net.URISyntaxExceptionorg.ngengine.bech32.Bech32EncodingException
-
encode
public static LnUrl encode(java.lang.String url) throws org.ngengine.bech32.Bech32DecodingException, org.ngengine.bech32.Bech32InvalidChecksumException, org.ngengine.bech32.Bech32InvalidRangeException, java.net.URISyntaxException, org.ngengine.bech32.Bech32EncodingException
Encode an url to a lnurl bech32 representation.- Throws:
org.ngengine.bech32.Bech32DecodingExceptionorg.ngengine.bech32.Bech32InvalidChecksumExceptionorg.ngengine.bech32.Bech32InvalidRangeExceptionjava.net.URISyntaxExceptionorg.ngengine.bech32.Bech32EncodingException
-
toLnUrlLink
public java.lang.String toLnUrlLink()
Returns a link that can be used in a browser or app to open the LNURL.- Returns:
- A link in the format "lightning:bech32"
-
toURI
public java.net.URI toURI()
The decoded java URI representation of the LNURL after it is decoded from bech32. This can be used to fetch the service with any http client.- Returns:
- The decoded URI of the LNURL.
-
toBech32
public java.lang.String toBech32()
Return the bech32 representation of the LNURL. The classic shareable representation of a LNURL.- Returns:
- The bech32 encoded LNURL string.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
getTag
public java.lang.String getTag()
The tag for this LNURL service if applicable.
-
getService
public <T extends LnUrlService> org.ngengine.platform.AsyncTask<T> getService() throws LnUrlException
Get an handler for the underlying service offered by this LNURL.- Type Parameters:
T- The type of the service to be returned.- Returns:
- An AsyncTask that will return the service when completed.
- Throws:
LnUrlException
-
getService
public <T extends LnUrlService> org.ngengine.platform.AsyncTask<T> getService(java.time.Duration timeout) throws LnUrlException
Get an handler for the underlying service offered by this LNURL.- Type Parameters:
T- The type of the service to be returned.- Parameters:
timeout- The timeout for the request to fetch the service.- Returns:
- An AsyncTask that will return the service when completed.
- Throws:
LnUrlException
-
-