generateAccount

Generates a new account with a random private key.

Example

import { generateAccount } from "thirdweb/wallets";
const account = await generateAccount({ client });
function generateAccount(
): Promise<Account>;

Parameters

The options for generating the account.

Type

let options: { client: ThirdwebClient };

Returns

let returnType: {
address: Address;
estimateGas?: (tx: PreparedTransaction) => Promise<bigint>;
onTransactionRequested?: (
transaction: PreparedTransaction<any>,
) => Promise<void>;
sendBatchTransaction?: (
txs: Array<SendTransactionOption>,
) => Promise<SendTransactionResult>;
sendRawTransaction?: (
tx: SendRawTransactionOptions,
) => Promise<SendTransactionResult>;
sendTransaction: (
tx: SendTransactionOption,
) => Promise<SendTransactionResult>;
signMessage: ({
message,
}: {
message: SignableMessage;
}) => Promise<Hex>;
signTransaction?: (tx: SerializableTransaction) => Promise<Hex>;
signTypedData: (
_typedData: ox__TypedData.Definition<typedData, primaryType>,
) => Promise<Hex>;
watchAsset?: (asset: WatchAssetParams) => Promise<boolean>;
};

A Thirdweb account.