Onboarding and Account Access

1. Import useWallet hook to access embedded wallet functions

import { useWallet } from "@enclavemoney/enclave-wallet-sdk/dist/components/WalletProvider";

export function Page() {
     const {
          isLoggedIn,
          username,
          connect,
          walletSDK,
          disconnect,
     } = useWallet();

     return (
          <div>
               <!-- -->
               {
                    isLoggedIn ? 
                    <div>
                         <button onClick = {() => walletSDK.openWalletModal()}>Welcome {username}</button>
                         <button onClick = {() => disconnect()}>Log Out</button>
                    </div> :
                    <div>
                         <button onClick = {() => connect()}>Log In</button>
                    </div>
               }
          </div>
     )
     
}

1.a. Login modal after calling connect()

Calling the connect() funtion triggers the modal displayed below where user's can continue onboarding

1.b. Wallet modal after calling walletSDK.openWalletModal()

Last updated