Managing multiple wallets

Your end users can of course connect one wallet during signup/login, but they can also connect multiple! Lots of users have multiple wallets but managing multiple wallets and multiple accounts for each wallet is challenging. You have to manage event listeners, various connection states, wallets shared across accounts, and much much more. That’s why we introduced multi-wallet. You can see it in action on our demo site.

Our multiwallet widget allows your users to easily:

  1. Add multiple wallets
  2. Add multiple accounts from the same wallet
  3. Transfer wallets between accounts
  4. It is mobile friendly
  5. Keep track of the active account in a wallet
  6. Swap primary wallets
  7. and so much more.

To enable multiwallet, simply visit the “Advanced Wallet Options” tile in the Configurations tab, and toggle on the multiwallet option. That’s it!

Add extra logic during any wallet connection (handleConnectedWallet)

Sometimes you may want to inject some of your own logic during the process of a wallet becoming connected. Dynamic has a concept of “handlers”, which is a particular kind of callback to allow custom code to run as part of a process (i.e. signup).

handleConnectedWallet is a handler that runs before we establish the wallet connection. You can use this callback to run your logic and reject (by returning boolean false). For example, running a fraud check before establishing the connection.

The args returned by handleConnectedWallet is a Wallet but without the connected boolean.
<DynamicContextProvider
  settings={{
    handlers: {
      handleConnectedWallet: (args) => {
        console.log("handleConnectedWallet was called", args);
        // if runYourOwnLogic return true, the connection will be established, otherwise it will not
        return runYourOwnLogic();
      },
    },
  }}
>
  {/* ... rest of your app ... */}
</DynamicContextProvider>