For new React apps, we recommend the JavaScript SDK with React Hooks (@dynamic-labs-sdk/react-hooks) instead of the legacy React SDK documented here. The JS SDK comes with many benefits such as a much smaller bundle size and other optimizations. Use the React quickstart (JavaScript SDK) to get started.
This hook gives you control over when you create an embedded wallet for any given user, the ability to check if a user currently has an embedded wallet, the ability to create and validate user sessions, and other helpful methods.You can also utilize the methods in combination with each other to create a fully custom UI implementation of embedded wallet onboarding flows.
Create an embedded wallet session whenever you need to validate the user authenticity to perform transactions without the need to prompt user confirmation every single time.
Create a passkey whenever you need to validate the user authenticity to perform a transaction or to access a specific feature as well as to handle cases where the user lost access to their device.
createEmbeddedWallet returns a promise which will resolve to a wallet ID once the creation flow has been successful.
createEmbeddedWalletAccount returns a promise which will resolve to a user once the creation flow has been successful.
createOrRestoreSession returns a promise which will resolve to a string session_created or session_restored if the session has been created or restored successfully.
createPasskey returns a promise which will resolve to a passkey data (attestation, challenge, displayName) once the creation flow has been successful.
getPasskeys returns a promise which will resolve to an array of passkeys info.
isLoadingEmbeddedWallet returns a boolean which will be true if the embedded wallet is being created.
isSessionActive returns a boolean which will be true if the user has an active session.
sendOneTimeCode returns a promise which will resolve to a string code_sent if the code has been sent successfully.
userHasEmbeddedWallet returns a boolean which will be true if the user has an embedded wallet at that time.