signMessage
This method signs messages using the connected account with ERC-191 standard.
Usage
ts
import { smartAccountClient } from "./smartAccountClient";
const signedMessage = await smartAccountClient.signMessage({ message: "msg" });
ts
import { createMultiOwnerModularAccount } from "@alchemy/aa-accounts";
import {
LocalAccountSigner,
SmartAccountSigner,
createSmartAccountClient,
polygonMumbai,
} from "@alchemy/aa-core";
import { http } from "viem";
const chain = polygonMumbai;
const signer: SmartAccountSigner = LocalAccountSigner.mnemonicToAccountSigner(
"YOUR_OWNER_MNEMONIC"
);
const rpcTransport = http("https://polygon-mumbai.g.alchemy.com/v2/demo");
export const smartAccountClient = createSmartAccountClient({
transport: rpcTransport,
chain,
account: await createMultiOwnerModularAccount({
transport: rpcTransport,
chain,
signer,
}),
});
Returns
Promise<Hash>
The signed hash for the message passed
Parameters
message: SignableMessage
Message to be signed represented as a viem SignableMessage
account?: SmartContractAccount
If your client was not instantiated with an account, then you will have to pass the account in to this call.