Skip to content

Commit

Permalink
fix: validate resolver address before setting snapshot text record
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Dec 20, 2024
1 parent 9cb71d0 commit d079c10
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion apps/ui/src/helpers/ens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,17 @@ export async function setEnsTextRecord(

const ensHash = namehash(ensNormalize(ens));

const resolverAddress = await call(
getProvider(chainId),
ENS_CONTRACTS.registryAbi,
[ENS_CONTRACTS.registry, 'resolver', [ensHash]]
);

if (!resolvers.includes(resolverAddress))
throw new Error('Unsupported resolver');

const contract = new Contract(
resolvers[0],
resolverAddress,
ENS_CONTRACTS.resolverAbi,
signer
);
Expand Down

0 comments on commit d079c10

Please sign in to comment.