diff --git a/clk-gateway/src/helpers.ts b/clk-gateway/src/helpers.ts index f543071..104ea1d 100644 --- a/clk-gateway/src/helpers.ts +++ b/clk-gateway/src/helpers.ts @@ -377,7 +377,17 @@ export function buildTypedData( chainId: Number(process.env.L2_CHAIN_ID!), }; - return { types, domain, value }; + const domainTypes = { + EIP712Domain: [ + { name: "name", type: "string" }, + { name: "version", type: "string" }, + { name: "chainId", type: "uint256" }, + ], + }; + + const primaryType = Object.keys(types)?.[0] || "Transaction"; + + return { types: { ...domainTypes, ...types }, domain, value, primaryType }; } /** diff --git a/clk-gateway/src/routes/names.ts b/clk-gateway/src/routes/names.ts index c4e1335..c7b3e73 100644 --- a/clk-gateway/src/routes/names.ts +++ b/clk-gateway/src/routes/names.ts @@ -97,12 +97,12 @@ router.post( ); } const data = matchedData(req); - const [name, sub] = data.name.split("."); + const [name, sub, tld] = data.name.split("."); const owner = getAddress(data.owner); const typedData = buildTypedData({ name: data.name, - email: data.email, + email: data.email || "example@not-valid.com", }); const isValidSignature = validateSignature({ @@ -140,6 +140,7 @@ router.post( .setCustomUserClaims(decodedToken.uid, { subDomain: sub }); */ res.status(200).send({ txHash: receipt.hash, + name: `${name}.${sub}.${tld}`, }); }) ); @@ -278,6 +279,8 @@ router.post( res.status(200).send({ txHash: receipt.hash, + key: data.key, + value: data.value, }); }) ); @@ -425,7 +428,7 @@ router.post( const typedData = buildTypedData({ name: data.name, - email: data.email, + email: data.email || "example@not-valid.com", }); res.status(200).send({