getEip712Domain
Reads the EIP-712 domain from a contract, based on the ERC-5267 specification.
Usage
example.ts
import { publicClient } from './client'
const { domain, extensions, fields } = await publicClient.getEip712Domain({
address: '0x57ba3ec8df619d4d243ce439551cce713bb17411',
})
Counterfactual Call
It is possible to read the EIP-712 domain on a contract that has not been deployed by providing deployment factory (factory
+ factoryData
) parameters:
example.ts
import { factory, publicClient } from './config'
const { domain, extensions, fields } = await publicClient.getEip712Domain({
address: '0x57ba3ec8df619d4d243ce439551cce713bb17411',
factory: factory.address,
factoryData: encodeFunctionData({
abi: factory.abi,
functionName: 'createAccount',
args: ['0x0000000000000000000000000000000000000000', 0n]
}),
})
Returns
GetEip712DomainReturnType
The EIP-712 domain (domain
) for the contract, with fields
and extensions
, as per ERC-5267.
Parameters
address
- Type:
string
The address of the contract to read the EIP-712 domain from.
const result = await publicClient.getEip712Domain({
address: '0x57ba3ec8df619d4d243ce439551cce713bb17411',
})
factory (optional)
- Type:
Contract deployment factory address (ie. Create2 factory, Smart Account factory, etc).
const result = await publicClient.getEip712Domain({
address: '0x57ba3ec8df619d4d243ce439551cce713bb17411',
factory: '0xE8Df82fA4E10e6A12a9Dab552bceA2acd26De9bb',
factoryData: '0xdeadbeef',
})
factoryData (optional)
- Type:
Calldata to execute on the factory to deploy the contract.
const result = await publicClient.getEip712Domain({
address: '0x57ba3ec8df619d4d243ce439551cce713bb17411',
factory: '0xE8Df82fA4E10e6A12a9Dab552bceA2acd26De9bb',
factoryData: '0xdeadbeef',
})