From 0832e14625cd5a0eab6f7af876b1b8df67d77cc3 Mon Sep 17 00:00:00 2001 From: 0xBunzy Date: Fri, 1 Nov 2024 13:41:08 -0700 Subject: [PATCH] fix: demo page update --- src/templates/next/app/page.txt | 29 +++++++++--------- .../next/components/ConnectWallet.txt | 30 +++++++++++-------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/src/templates/next/app/page.txt b/src/templates/next/app/page.txt index 6adb633..d9e0f8b 100644 --- a/src/templates/next/app/page.txt +++ b/src/templates/next/app/page.txt @@ -1,23 +1,24 @@ /** @format */ "use client"; -import { UNISAT, useLaserEyes } from "@omnisat/lasereyes"; +import { useLaserEyes } from "@omnisat/lasereyes"; +import { ConnectWallet } from "@/components/ConnectWallet"; export default function Home() { - const { connect, address } = useLaserEyes(); + const { address } = useLaserEyes(); return ( -
-
-

- Welcome to LaserEyes Template -

- +
+

+ Welcome to LaserEyes Template +

+
+ + {address && ( +
+

Connected Address: {address}

+
+ )}
); -} +} \ No newline at end of file diff --git a/src/templates/next/components/ConnectWallet.txt b/src/templates/next/components/ConnectWallet.txt index 49a9e2f..17d41bf 100644 --- a/src/templates/next/components/ConnectWallet.txt +++ b/src/templates/next/components/ConnectWallet.txt @@ -1,26 +1,30 @@ /** @format */ +"use client"; + import { useLaserEyes, UNISAT } from "@omnisat/lasereyes"; import { Button } from "@/components/ui/button"; export function ConnectWallet() { - const { connect, disconnect, connected, address } = useLaserEyes(); + const { connect, disconnect, connected, hasUnisat } = useLaserEyes(); - const handleClick = () => { - if (connected) { - disconnect(); - } else { - connect(UNISAT); + const handleConnect = async () => { + if (!hasUnisat) { + console.error("Please install Unisat wallet"); + return; } + await connect(UNISAT); }; return ( - +
+ +
); }