From 797fca71115013a070399636006e5338db950baa Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 22 Jan 2024 14:37:44 -0600 Subject: [PATCH] Add WebLN types, only show zap button when WebLN is available --- package.json | 1 + src/api/hooks/nostr/useSignerStream.ts | 2 -- src/components/status-action-bar.tsx | 2 +- tsconfig.json | 3 ++- yarn.lock | 5 +++++ 5 files changed, 9 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index ba82523fb..a9807be70 100644 --- a/package.json +++ b/package.json @@ -91,6 +91,7 @@ "@types/semver": "^7.3.9", "@types/uuid": "^9.0.0", "@vitejs/plugin-react": "^4.0.4", + "@webbtc/webln-types": "^3.0.0", "autoprefixer": "^10.4.15", "axios": "^1.2.2", "axios-mock-adapter": "^1.22.0", diff --git a/src/api/hooks/nostr/useSignerStream.ts b/src/api/hooks/nostr/useSignerStream.ts index 56db382b1..c2a0b13a1 100644 --- a/src/api/hooks/nostr/useSignerStream.ts +++ b/src/api/hooks/nostr/useSignerStream.ts @@ -57,9 +57,7 @@ function useSignerStream() { return; } - // @ts-ignore await window.webln?.enable(); - // @ts-ignore await window.webln?.sendPayment(reqMsg.data.params.invoice); } diff --git a/src/components/status-action-bar.tsx b/src/components/status-action-bar.tsx index f8d252dc4..3ee4f4aab 100644 --- a/src/components/status-action-bar.tsx +++ b/src/components/status-action-bar.tsx @@ -791,7 +791,7 @@ const StatusActionBar: React.FC = ({ /> )} - {acceptsZaps && ( + {(acceptsZaps && window.webln) && (