dAppBooster
    Preparing search index...

    Function useWeb3Status

    • Custom hook that provides comprehensive Web3 connection state and actions.

      Aggregates various Wagmi hooks to provide a unified interface for Web3 state management, including wallet connection status, chain information, and common actions.

      The hook provides three categories of data:

      • App Web3 Status: Information about the app's current blockchain context
      • Wallet Web3 Status: Information about the connected wallet
      • Web3 Actions: Functions to modify connection state

      Returns Web3Status

      Combined object containing:

      const {
      address,
      balance,
      isWalletConnected,
      appChainId,
      switchChain,
      disconnect
      } = useWeb3Status();

      return (
      <div>
      {isWalletConnected ? (
      <>
      <p>Connected to: {address}</p>
      <p>Balance: {balance?.formatted} {balance?.symbol}</p>
      <button onClick={() => switchChain(1)}>Switch to Ethereum</button>
      <button onClick={disconnect}>Disconnect</button>
      </>
      ) : (
      <p>Wallet not connected</p>
      )}
      </div>
      );