Skip to content

signMessage

Signs a message using the account's signing method.

Import

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

Usage

import { WalletClientSigner } from "@aa-sdk/core";
import { createWalletClient, custom } from "viem";
import { mainnet } from "viem/chains";
 
const client = createWalletClient({
  chain: mainnet,
  transport: custom(window.ethereum!),
});
 
const signer = new WalletClientSigner(client, "wallet");
console.log(await signer.signMessage("hello"));

Parameters

message

string the message string that needs to be signed

Returns

Promise<string> a promise that resolves to the signed message