Skip to content

Commit

Permalink
Merge pull request #3197 from getAlby/error-handle-bip353
Browse files Browse the repository at this point in the history
proper error handling for bip353 dns addresses from phoenix + self hosted dns addresses
  • Loading branch information
bumi authored Jul 15, 2024
2 parents afa4934 + 4c37870 commit 9347f5c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/app/screens/Send/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ function Send() {
lnurl = invoice;
}

if (lnurl?.endsWith("phoenixwallet.me")) {
throw new Error(
"Paying Phoenix addresses is not possible. Phoenix is not compatible with the current state of lightning addresses as they use a different protocol."
);
}

if (lnurl) {
const lnurlDetails = await lnurlLib.getDetails(lnurl);
if (isLNURLDetailsError(lnurlDetails)) {
Expand Down
4 changes: 4 additions & 0 deletions src/common/lib/lnurl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ const lnurl = {
if (axios.isAxiosError(e)) {
error =
(e.response?.data as { reason?: string })?.reason || e.message;

if (this.isLightningAddress(lnurlString)) {
error = `This is not a valid lightning address. Either the address is invalid or it is using a different and unsupported protocol: ${error}`;
}
} else if (e instanceof Error) {
error = e.message;
}
Expand Down

0 comments on commit 9347f5c

Please sign in to comment.