import { useCallback } from 'react'; import Button from 'react-bootstrap/Button'; import Container from 'react-bootstrap/Container'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; import Stack from 'react-bootstrap/Stack'; import MainTabs from './components/tabs'; import useMainContext from './contexts/useMainContext'; function WebApp() { const { sdk, connected, chainId, account, reputation, totalReputation, balanceEther, } = useMainContext(); const connect = useCallback(async () => { try { await sdk?.connect(); console.log('connected'); console.log('connected', connected); } catch (err) { console.warn('failed to connect..', err); } }, [sdk, connected]); const disconnect = useCallback(async () => { try { sdk?.terminate(); } catch (err) { console.warn('failed to disconnect..', err); } }, [sdk]); return ( <> {!connected && } {connected && ( <> {chainId !== '0xaa36a7' && (
Please switch MetaMask to Sepolia testnet!
)}
{chainId && `Chain ID: ${chainId}`}
{`Account: ${account}`}
{`Balance: ${balanceEther} ETH`}
{`Your REP: ${reputation?.toString()}`}
{`Total REP: ${totalReputation?.toString()}`}
)} ); } export default WebApp;