privateKeyToAccountSigner

Creates a LocalAccountSigner instance using the provided private key.

Import

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

Usage

1import { LocalAccountSigner } from "@aa-sdk/core";
2import { generatePrivateKey } from "viem";
3
4const signer = LocalAccountSigner.privateKeyToAccountSigner(
5 generatePrivateKey()
6);

Parameters

key

Hex The private key in hexadecimal format

Returns

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