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.
I added
EnsResolver.getName()
. At a glance, it looks like a lot ofEnsResolver
could be simplified with the latest CCIP-Read stuff in v6.I used that to re-implement
AbstractResolver.lookupAddress()
. I made this process more strict, as I don't think it's correct to returnnull
for some of those cases. If that is too big of a change, possibly, we could add a separate function, which is strict, and the old function could just squelch those errors like the original implementation.I unearthed an unused error type
ValueMismatchError
and used that for the mismatch case where the addresses don't match. Not sure if that fits your use-case. Additionally, maybe this function should get a second argument, which only does the one-sided request, as that it also useful in certain circumstances, although the new error would expose both addresses.I'm not exactly sure how your testing stuff works. I added the start of a test but commented it. I ran
build-dist
and then tested it with a different project.For testing, I configured a simple CCIP-Read reverse name on goerli that round-trips correctly and then called the new lookup function.
This corresponds to
raffyraffy.eth
which as the image shows, correctly round trips.And the reverse record
b404af9a235be881335d8898b5b487dc9cd5ed9d.addr.reverse
is both wildcard and offchain.For reference, this was my initial implementation using ethers v6.