CDP Frontend SDK
    Preparing search index...

    Function toViemAccount

    • Converts a CDP EVM account into a Viem-compatible LocalAccount. This enables the CDP account to be used with any library or framework that accepts Viem accounts.

      Parameters

      • address: `0x${string}`

        The EVM address to create a Viem account for

      Returns Promise<{}>

      A Viem LocalAccount that can sign messages and transactions using CDP's signing functions

      If the user is not authenticated or the address is not in the user's EVM accounts

      const user = await getCurrentUser();
      const evmAccount = user.evmAccounts[0];
      const viemAccount = await toViemAccount(evmAccount);