Add ENS resolve support
This does work to resolve common ENS names to a given address (I'm using it), with the caveat that the name normalization isn't to spec... so it will not work with some edge case names.
Opening this PR per request.
Codecov Report
Merging #150 (e11c27e) into main (6e1a491) will increase coverage by
0.00%. The diff coverage is100.00%.
:exclamation: Current head e11c27e differs from pull request most recent head 7baf4a5. Consider uploading reports for the commit 7baf4a5 to get more accurate results
@@ Coverage Diff @@
## main #150 +/- ##
========================================
Coverage 99.74% 99.75%
========================================
Files 67 70 +3
Lines 3899 4028 +129
========================================
+ Hits 3889 4018 +129
Misses 10 10
| Impacted Files | Coverage Δ | |
|---|---|---|
| lib/eth.rb | 100.00% <100.00%> (ø) |
|
| lib/eth/ens/resolver.rb | 100.00% <100.00%> (ø) |
|
| spec/eth/ens/resolver_spec.rb | 100.00% <100.00%> (ø) |
|
| lib/eth/chain.rb | 100.00% <0.00%> (ø) |
|
| lib/eth/client.rb | 100.00% <0.00%> (ø) |
|
| spec/eth/tx_spec.rb | 100.00% <0.00%> (ø) |
|
| lib/eth/signature.rb | 100.00% <0.00%> (ø) |
|
| spec/eth/chain_spec.rb | 100.00% <0.00%> (ø) |
|
| spec/eth/client_spec.rb | 100.00% <0.00%> (ø) |
|
| spec/eth/signature_spec.rb | 100.00% <0.00%> (ø) |
|
| ... and 4 more |
:mega: We’re building smart automated test selection to slash your CI/CD build times. Learn more
Had a few general Ruby comments, but really glad you did this. I let myself get stuck on the encoding, and you made the wise decision to get this out there even though it may not work in all use cases. Good call and thank you!
Yeah, I had to fight myself with the encoding piece. Perfect is the enemy of good.
I'll adjust some things based on feedback @mculp tomorrow.
@q9f I was able to make CI happy, two of the tests I had to mark as pending due to: 1) Lack of a library to handle the full extent of text processing required for ENS, and 2) No existing way to test live chains, or to do a full deploy of ENS contracts locally, write to them, etc. If there is an infura/alchemy key in CI secrets, then resolving a known ENS address on mainnet would work... with the small caveat that when that changes the test will need to be updated.
Thank you. I can add an infura key to the pipelines in future.