Using Wallet Authentication

import { useWallet, useWalletAuth } from "@xircus-web3/react"

export default function Index() {
  const wallet = useWallet()
  const auth = useWalletAuth()

  if (wallet.status == "connected") {
    return (
      <div>
        <div>{wallet.account}</div>
        <div>{wallet.balance}</div>
        <button onClick={wallet.disconnect}>Disconnect</button>
        <div>{auth.authenticating && 'Authenticating'}</div>
        <button onClick={auth.auth}>Authenticate</button>
        { auth.isAuthed && <button onClick={auth.logout}>Logout</button>
      </div>            
    )    
  }
          
  return (
    <div>
      <button onClick={wallet.connectMetamask}>Connect Metamask</button>
    </div>
  )
}

Last updated