From de42e86eef1bdc2b853633e09cc0c7b65fb17dcc Mon Sep 17 00:00:00 2001 From: Franchesca <95731761+Fabbeauty@users.noreply.github.com> Date: Sat, 17 Sep 2022 03:38:13 -0400 Subject: [PATCH] Update app.js Added a function to check for Phantom Wallet --- src/App.js | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/App.js b/src/App.js index 3c4d64d91..6a1bd1f62 100644 --- a/src/App.js +++ b/src/App.js @@ -1,3 +1,4 @@ +import React, { useEffect } from 'react'; import twitterLogo from './assets/twitter-logo.svg'; import './App.css'; @@ -6,6 +7,32 @@ const TWITTER_HANDLE = '_buildspace'; const TWITTER_LINK = `https://twitter.com/${TWITTER_HANDLE}`; const App = () => { + + + + const checkIfWalletIsConnected = async () => { + try { + const ( solana } = window; + + if (solana.isPhantom) { + console.log('Phantom Wallet found!'); + } + } else { + alert('Solana object not found! Get a Phantom Wallet 👻'); + } +}; + + + + + +useEffect (() => { + const onLoad = async () => { + await checkIfWalletIsConnected(); + }; + window.addEventListener('Load, onLoad); + }, []); + return (