From e8927d78e6281c4000384beefdac6d7da5ad8330 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=9B=AA=E7=8C=AB?= Date: Sun, 12 Oct 2025 15:31:39 +0900 Subject: [PATCH] nip57: lud16 must take precedence over lud06 --- nip57.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nip57.ts b/nip57.ts index 9aebf22..cbedb0e 100644 --- a/nip57.ts +++ b/nip57.ts @@ -18,13 +18,13 @@ export async function getZapEndpoint(metadata: Event): Promise { try { let lnurl: string = '' let { lud06, lud16 } = JSON.parse(metadata.content) - if (lud06) { + if (lud16) { + let [name, domain] = lud16.split('@') + lnurl = new URL(`/.well-known/lnurlp/${name}`, `https://${domain}`).toString() + } else if (lud06) { let { words } = bech32.decode(lud06, 1000) let data = bech32.fromWords(words) lnurl = utf8Decoder.decode(data) - } else if (lud16) { - let [name, domain] = lud16.split('@') - lnurl = new URL(`/.well-known/lnurlp/${name}`, `https://${domain}`).toString() } else { return null }