This guide will show you how to create an embedded wallet for a user, and use it to sign a transaction.
DynamicContextProvider
.Note that you can still generate a wallet if the user has one already, please read about embedded wallet accounts if that’s something you’d like to do. For this guide we’ll assume we want to generate an initial wallet.
This can take two forms, if it’s the only wallet a user has, then we can access primaryWallet
from useDynamicContext
and that is guaranteed to be the embedded wallet:
If however the user signed up with a branded wallet, then they will have multiple. In this case we can check via the useUserWallets hook and use the walletId returned by the create wallet call:
On the connector interface for each wallet, you’ll find an isEmbeddedWallet
boolean which we can use:
An alternative to blend both approaches would be to make embedded wallet the primary one using useSwitchWallet
:
Creating a transaction for the embedded wallet to sign follows exactly the same steps as our other examples here. We’ll assume you accessed the wallet via primaryWallet
.
Once the sendTransaction call is triggered, there can be an optional transaction confirmation UI step. You can either keep the confirmation screen or disable it entirely - read morehere.
This guide will show you how to create an embedded wallet for a user, and use it to sign a transaction.
DynamicContextProvider
.Note that you can still generate a wallet if the user has one already, please read about embedded wallet accounts if that’s something you’d like to do. For this guide we’ll assume we want to generate an initial wallet.
This can take two forms, if it’s the only wallet a user has, then we can access primaryWallet
from useDynamicContext
and that is guaranteed to be the embedded wallet:
If however the user signed up with a branded wallet, then they will have multiple. In this case we can check via the useUserWallets hook and use the walletId returned by the create wallet call:
On the connector interface for each wallet, you’ll find an isEmbeddedWallet
boolean which we can use:
An alternative to blend both approaches would be to make embedded wallet the primary one using useSwitchWallet
:
Creating a transaction for the embedded wallet to sign follows exactly the same steps as our other examples here. We’ll assume you accessed the wallet via primaryWallet
.
Once the sendTransaction call is triggered, there can be an optional transaction confirmation UI step. You can either keep the confirmation screen or disable it entirely - read morehere.