viem
Version:
55 lines • 1.84 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.getEip712Domain = getEip712Domain;
const eip712_js_1 = require("../../errors/eip712.js");
const getAction_js_1 = require("../../utils/getAction.js");
const readContract_js_1 = require("./readContract.js");
async function getEip712Domain(client, parameters) {
const { address, factory, factoryData } = parameters;
try {
const [fields, name, version, chainId, verifyingContract, salt, extensions,] = await (0, getAction_js_1.getAction)(client, readContract_js_1.readContract, 'readContract')({
abi,
address,
functionName: 'eip712Domain',
factory,
factoryData,
});
return {
domain: {
name,
version,
chainId: Number(chainId),
verifyingContract,
salt,
},
extensions,
fields,
};
}
catch (e) {
const error = e;
if (error.name === 'ContractFunctionExecutionError' &&
error.cause.name === 'ContractFunctionZeroDataError') {
throw new eip712_js_1.Eip712DomainNotFoundError({ address });
}
throw error;
}
}
const abi = [
{
inputs: [],
name: 'eip712Domain',
outputs: [
{ name: 'fields', type: 'bytes1' },
{ name: 'name', type: 'string' },
{ name: 'version', type: 'string' },
{ name: 'chainId', type: 'uint256' },
{ name: 'verifyingContract', type: 'address' },
{ name: 'salt', type: 'bytes32' },
{ name: 'extensions', type: 'uint256[]' },
],
stateMutability: 'view',
type: 'function',
},
];
//# sourceMappingURL=getEip712Domain.js.map
;