The web3 context.
The sender address.
The domain data.
A map of records pointing from field name to field type.
A single record value.
The Ethers signature.
import { Wallet, utils, constants, Provider, EIP712Signer } from "web3-plugin-zksync";
const ADDRESS = "<WALLET_ADDRESS>";
const PRIVATE_KEY = "<WALLET_PRIVATE_KEY>";
const context = Provider.getDefaultProvider(types.Network.Sepolia);
const tx: types.TransactionRequest = {
type: 113,
chainId: 270,
from: ADDRESS,
to: "0xa61464658AfeAf65CccaaFD3a512b69A83B77618",
value: BigInt(7_000_000),
};
const eip712Signer = new EIP712Signer(
new Wallet(PRIVATE_KEY), // or web3Accounts.privateKeyToAccount(PRIVATE_KEY),
Number((await context.getNetwork()).chainId)
);
const signature = await eip712Signer.sign(tx);
const isValidSignature = await utils.isTypedDataSignatureCorrect(context, ADDRESS, await eip712Signer.getDomain(), constants.EIP712_TYPES, 'Transaction', EIP712Signer.getSignInput(tx), signature);
// isValidSignature = true
Returns whether the account abstraction EIP712 signature is correct.