How to Get User's SC Wallet Address

import { useEffect, useState } from "react";
import { useBundler } from "./useBundler";

export const useUserSCWallet = () => {
  const { walletAPI } = useBundler();

  const [userSCWalletAddress, setUserSCWalletAddress] = useState<any>("");

  useEffect(() => {
    (async () => {
      if (walletAPI) {
        setUserSCWalletAddress(await walletAPI.getAccountAddress());
      }
    })();
  }, [walletAPI]);

  return userSCWalletAddress;
};

Last updated