Skip to content

Commit

Permalink
chore: change error to confirmation if incorrect methods are provided
Browse files Browse the repository at this point in the history
  • Loading branch information
rolznz committed Apr 4, 2024
1 parent 99da6da commit a22cbf9
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,15 @@ export function Home() {
info.methods.indexOf("lookupInvoice") < 0 ||
info.methods.indexOf("getInfo") < 0
) {
throw new Error(
"This provider must support exactly NWC getInfo, makeInvoice and lookupInvoice. Supports: " +
info.methods.join(",")
);
if (
!confirm(
"This provider should only support NWC getInfo, makeInvoice and lookupInvoice. Supports: " +
info.methods.join(",") +
"\nIf you share this URL your balance could be potentially drained. Are you sure you want to connect?"
)
) {
return;
}
}
if (!(provider instanceof WebLNProviders.NostrWebLNProvider)) {
throw new Error("WebLN provider is not an instance of NostrWebLNProvider");
Expand Down

0 comments on commit a22cbf9

Please sign in to comment.