Skip to content

privateKeyToAccountSigner

Creates a LocalAccountSigner instance using the provided private key.

Import

import { LocalAccountSigner } from "@aa-sdk/core";

Usage

import { LocalAccountSigner } from "@aa-sdk/core";
import { generatePrivateKey } from "viem";
 
const signer = LocalAccountSigner.mnemonicToAccountSigner(generatePrivateKey());

Parameters

key

Hex The private key in hexadecimal format

Returns

LocalAccountSigner<PrivateKeyAccount> An instance of LocalAccountSigner initialized with the provided private key