From a22cbf9af5cb364b12d7b652d2e5cddfed10c425 Mon Sep 17 00:00:00 2001 From: Roland Bewick Date: Thu, 4 Apr 2024 13:26:59 +0700 Subject: [PATCH] chore: change error to confirmation if incorrect methods are provided --- src/pages/Home.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/pages/Home.tsx b/src/pages/Home.tsx index 07be7df..c204499 100644 --- a/src/pages/Home.tsx +++ b/src/pages/Home.tsx @@ -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");