fix(ensjs): getName should enforce normalization - #345
Merged
v1rtl merged 1 commit intoJun 24, 2026
Conversation
getName previously coerced the reverse-resolved name via normalise(), silently returning a different name than what was resolved. It now uses viem's normalize() to verify the name is already normalised and returns null otherwise, matching viem's getEnsName (wevm/viem#4756) and v5. Applies to both the match and allowMismatch paths. Preserves the encode/decode batching API and the existing return body. Closes WEB-533
svemat01
approved these changes
Jun 24, 2026
v1rtl
deleted the
feature/web-533-ensjs-v4-getname-should-enforce-normalization
branch
June 24, 2026 17:42
|
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Summary
ENSjs v4
getNamepreviously coerced the reverse-resolved name withnormalise(), silently returning a name that differs from what reverse resolution actually returned. It now enforces normalization the same way viem'sgetEnsNamedoes (wevm/viem#4756) and the same way ENSjs v5 already does: the name is returned only if it is already normalised, otherwisegetNamereturnsnull.Uses viem's
normalize(viem/ens) under the hood for the check.Closes WEB-533.
Changes
getName.ts:isNormalisedhelper using viem'snormalize(returnsfalseifnormalizethrows).null).ReverseAddressMismatch(allowMismatch: true) path.getName.test.ts: add unit tests for both paths (unnormalised ->null, normalised -> unchanged).Notes / design
encode/decode(generateFunction) architecture sogetName.batch()and ENSjs's on-chainbatch()multicall continue to work, and the return body ({ name, match, reverseResolverAddress, resolverAddress }) is unchanged.getEnsNameitself was not used directly because it returns onlystring | nulland is a monolithic action (noencode/decode), which would drop thematch/resolver-address fields and break batching.