If you are only interested in supporting signup/login with branded wallets i.e. Metamask, you can ignore this page. Otherwise, read on!

Manual Mode

By default, an embedded wallet will be created for your end users as long as you have it set up in the dashboard to do so. However there is one configuration that requires you to trigger the creation of wallets manually.

This configuration is called “Manual Mode” in the dashboard and if it is turned on, you will need to use the “useEmbeddedWallet” hook yourself in your application code. This section shows you how to do just that!

useEmbeddedWallet

Type

() => {
    createEmbeddedWallet: () => Promise<string>,
    userHasEmbeddedWallet: () => boolean
}
  • createEmbeddedWallet returns a promise which will resolve to a wallet ID once the creation flow has been successful.
  • userHasEmbeddedWallet returns a boolean which will be true if the user has an embedded wallet at that time.

Usage

import { useEmbeddedWallet } from “@dynamic-labs/sdk-react-core”

const { createEmbeddedWallet, userHasEmbeddedWallet } = useEmbeddedWallet();

const onClick = async () => {
    if(!userHasEmbeddedWallet()) {
      try {
        const walletId = await createEmbeddedWallet();
        // do whatever you want with that Id
      } catch(e) {
        // handle error
      }
    }
}

return (
    <button onClick={() => onClick()}>Create Wallet</button>
)