[lib] Introduce ENSCache with getNameForAddress function
Summary:
This is the beginning of addressing this Linear task: ENG-2588
We'll also need a way to query for forward resolution, but that will come in a separate diff.
Depends on D6263
Test Plan:
ALCHEMY_API_KEY=alchemykeygoeshere yarn test utils/ens-cache.test.js
Two notes on the test plan:
- I originally wanted test cases for an ETH name that wasn't normalized and for a reverse resolution that didn't have a matching forward resolution, but I couldn't find anything in the wild. I found non-normalized ETH names but none of them had a reverse resolution set, and I didn't find any reverse resolutions without matching forward resolutions. I could construct these myself but it would probably require hitting some APIs directly or something, since I'm guessing ENS doesn't want you doing these things. Probably not worth it.
- The tests require ALCHEMY_API_KEY, otherwise they are silently ignored. This diff adds that environmental to GitHub Actions, but the tests will get ignored when run in precommit hooks and in Buildkite. Discussing with Atul about potentially making it work on Buildkite, but my impression is that it might not be worth the time.
Reviewers: atul
Reviewed By: atul
Subscribers: tomek
Differential Revision: https://phab.comm.dev/D6264