mirror of
https://github.com/minibits-cash/minibits_wallet.git
synced 2026-10-05 19:28:26 +00:00
[#167] Support for decoding of LNURL links passed inside bitcoin URIs
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "minibits_wallet",
|
||||
"version": "0.3.0-beta.9",
|
||||
"version": "0.3.0-beta.10",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"android:clean": "cd android && ./gradlew clean",
|
||||
|
||||
@@ -43,15 +43,17 @@ const extractEncodedLnurl = function (maybeLnurl: string) {
|
||||
return maybeLnurl
|
||||
}
|
||||
|
||||
if (maybeLnurl && maybeLnurl.toLowerCase().startsWith('http')) { // e.g. lnbits withdraw extension links
|
||||
const parsed = new URL(maybeLnurl.toLowerCase())
|
||||
encodedLnurl = parsed.searchParams.get('lightning')
|
||||
|
||||
if(encodedLnurl) {
|
||||
const decoded = decodelnurl(encodedLnurl) // throws
|
||||
log.trace('[extractEncodedLnurl] Extracted lnurl from URL', encodedLnurl)
|
||||
return encodedLnurl
|
||||
}
|
||||
if (maybeLnurl &&
|
||||
(
|
||||
maybeLnurl.toLowerCase().startsWith('bitcoin:') ||
|
||||
maybeLnurl.toLowerCase().startsWith('http')
|
||||
)
|
||||
) {
|
||||
const url = new URL(maybeLnurl.toLowerCase())
|
||||
// Use URLSearchParams to get the value of the "lightning" parameter
|
||||
encodedLnurl = url.searchParams.get("lightning") as string
|
||||
const decoded = decodelnurl(encodedLnurl) // throws
|
||||
return encodedLnurl
|
||||
}
|
||||
|
||||
for (const prefix of LNURL_URI_PREFIXES) {
|
||||
|
||||
Reference in New Issue
Block a user