UNPKG

viem

Version:

TypeScript Interface for Ethereum

25 lines 995 B
import { getAction } from '../../utils/getAction.js'; import { hashTypedData, } from '../../utils/signature/hashTypedData.js'; import { verifyHash, } from './verifyHash.js'; /** * Verify that typed data was signed by the provided address. * * - Docs {@link https://viem.sh/docs/actions/public/verifyTypedData} * * @param client - Client to use. * @param parameters - {@link VerifyTypedDataParameters} * @returns Whether or not the signature is valid. {@link VerifyTypedDataReturnType} */ export async function verifyTypedData(client, parameters) { const { address, factory, factoryData, signature, message, primaryType, types, domain, ...callRequest } = parameters; const hash = hashTypedData({ message, primaryType, types, domain }); return getAction(client, verifyHash, 'verifyHash')({ address, factory: factory, factoryData: factoryData, hash, signature, ...callRequest, }); } //# sourceMappingURL=verifyTypedData.js.map