Skip to main content
function toViemAccount(address: `0x${string}`): Promise<{
}>;
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

ParameterTypeDescription
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

Throws

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

Example

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