@alchemy/aa-core
Version:
viem based SDK that enables interactions with ERC-4337 Smart Accounts. ABIs are based off the definitions generated in @account-abstraction/contracts
22 lines (19 loc) • 782 B
text/typescript
import type { Chain, Client, Hex, Transport } from "viem";
import type { SmartContractAccount } from "../../account/smartContractAccount";
import { AccountNotFoundError } from "../../errors/account.js";
import type { SignMessageParameters } from "./signMessage";
export const signMessageWith6492: <
TTransport extends Transport = Transport,
TChain extends Chain | undefined = Chain | undefined,
TAccount extends SmartContractAccount | undefined =
| SmartContractAccount
| undefined
>(
client: Client<TTransport, TChain, TAccount>,
args: SignMessageParameters<TAccount>
) => Promise<Hex> = async (client, { account = client.account, message }) => {
if (!account) {
throw new AccountNotFoundError();
}
return account.signMessageWith6492({ message });
};