Skip to main content

Recommended: JavaScript SDK with React Hooks

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.
Only available from v4.61.0 onwards.

Summary

The useWalletPassword hook provides methods to manage wallet password functionality for Dynamic WaaS embedded wallets, allowing users to update passwords, unlock wallets, and check wallet lock states. To create a wallet with a password, use the createWalletAccount function with the password parameter. The hook needs to be initialized within a child of DynamicContextProvider.

Functions

updatePassword

Updates the password for an embedded wallet. Can be used to set an initial password or change an existing one. Parameters:
  • params: Object containing:
    • accountAddress: string - The wallet address
    • chainName: ChainEnum - The chain the wallet is associated with
    • newPassword: string - The new password to set
    • existingPassword (optional): string - The current password (required when changing an existing password)
Returns: Promise<boolean> - true if password update was successful, false otherwise. Example:

unlockWallet

Unlocks a wallet using the provided password. Once unlocked, the wallet remains unlocked for the rest of the user session. Parameters:
  • params: Object containing:
    • accountAddress: string - The wallet address
    • chainName: ChainEnum - The chain the wallet is associated with
    • password: string - The password to unlock the wallet
Returns: Promise<boolean> - true if wallet was unlocked successfully, false otherwise. Example:

checkWalletLockState

Checks the current lock/recovery state of a wallet. Parameters:
  • params: Object containing:
    • accountAddress: string - The wallet address
    • chainName: ChainEnum - The chain the wallet is associated with
Returns: Promise<WalletRecoveryState | null> - The wallet’s recovery state, or null if the check failed. Example:

resetState

Resets the hook’s state back to its initial values, clearing any errors and loading states. Returns: void Example:

Properties

state

An object containing the current state of wallet password operations. Type: WalletPasswordState
Example:

Usage

Return Value

The hook returns an object with the following properties:

Types

Last modified on June 25, 2026