---
head:
    - - meta
      - property: og:title
        content: getEIP712DomainHash
    - - meta
      - name: description
        content: Encode a EIP712Domain into a hash and verify the decoded data to verify type compliance.
    - - meta
      - property: og:description
        content: Encode a EIP712Domain into a hash and verify the decoded data to verify type compliance.
notes:
    - - author: Auto generated by @nftchance/plug-types/cli
---
        
# getEIP712DomainHash

Encode a [EIP712Domain](/generated/base-types/EIP712Domain) into a hash and verify the decoded [EIP712Domain](/generated/base-types/EIP712Domain) data from a hash to verify type compliance.

## Parameters

- `$input` : [EIP712Domain](/generated/base-types/EIP712Domain) : The `EIP712Domain` data to encode.

## Returns

- `$typeHash` : `bytes32` : The packet hash of the encoded [EIP712Domain](/generated/base-types/EIP712Domain) data.

## Onchain Implementation

With `getEIP712DomainHash` you can call the function as a `read` and get the encoded data back as a hash. 
        
This is helpful in times when you need to build a message hash without tracking down all the types as well as when you need to verify a signed message hash containing a `EIP712Domain` data type.

::: code-group

``` solidity [Types.sol:getEIP712DomainHash]
function getEIP712DomainHash(
	TypesLib.EIP712Domain memory $input
) public pure virtual returns (bytes32 $typeHash) {
	$typeHash = keccak256(abi.encode(
		EIP712_DOMAIN_TYPEHASH,
		keccak256(bytes($input.name)),
	keccak256(bytes($input.version)),
	$input.chainId,
	$input.verifyingContract
	));
}
``` 

:::