Skip to content

Commit e8927d7

Browse files
SnowCaitfiatjaf
authored andcommitted
nip57: lud16 must take precedence over lud06
1 parent bc1294e commit e8927d7

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

nip57.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ export async function getZapEndpoint(metadata: Event): Promise<null | string> {
1818
try {
1919
let lnurl: string = ''
2020
let { lud06, lud16 } = JSON.parse(metadata.content)
21-
if (lud06) {
21+
if (lud16) {
22+
let [name, domain] = lud16.split('@')
23+
lnurl = new URL(`/.well-known/lnurlp/${name}`, `https://${domain}`).toString()
24+
} else if (lud06) {
2225
let { words } = bech32.decode(lud06, 1000)
2326
let data = bech32.fromWords(words)
2427
lnurl = utf8Decoder.decode(data)
25-
} else if (lud16) {
26-
let [name, domain] = lud16.split('@')
27-
lnurl = new URL(`/.well-known/lnurlp/${name}`, `https://${domain}`).toString()
2828
} else {
2929
return null
3030
}

0 commit comments

Comments
 (0)