-
Notifications
You must be signed in to change notification settings - Fork 582
feat: offchain validate name owner #1134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
ef1365b
feat: offchain validate name owner fron DNS
wa0x6e 5ed96ae
feat: return resolved address as owner for subdomain using offchain r…
wa0x6e 0d39897
fix: use offchain resolver for offchain subdomain
wa0x6e b55dafc
fix: getEnsOwner always return an address
wa0x6e b3ddc1a
fix: ensure returned value is always an address
wa0x6e 0374415
fix: fix results for tld
wa0x6e d994a8b
fix: add link to error code documentation
wa0x6e 1ed6d37
fix: mute error when coinbase subdomain does not exist
wa0x6e 475c9c6
fix: throw error when on unsupported network
wa0x6e df83027
test: add tests for offchain subdomain resolver
wa0x6e bdc764c
fix: ignore missing offchain resolver error on sepolia
wa0x6e 58a1b1c
fix: check DNS owner only on imported domains
wa0x6e 6c555fa
test: move online tests to E2E
wa0x6e 86ea941
Merge branch 'master' into feat-check-offchain-dns-owner
wa0x6e 062391a
Merge branch 'master' into feat-check-offchain-dns-owner
ChaituVR 1edbdcb
fix: simplify errors handling
wa0x6e 394aa92
Update src/utils.ts
wa0x6e 4f250e5
Update src/utils.ts
wa0x6e e5f09a9
v0.12.56
ChaituVR File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import { describe, test, expect } from 'vitest'; | ||
import { getEnsOwner } from '../../src/utils'; | ||
|
||
const EMPTY_ADDRESS = '0x0000000000000000000000000000000000000000'; | ||
|
||
describe('utils', () => { | ||
describe('getEnsOwner', () => { | ||
describe('onchain resolver', () => { | ||
test('return an address for mainnet', () => { | ||
expect(getEnsOwner('shot.eth', '1')).resolves.toBe( | ||
'0x8C28Cf33d9Fd3D0293f963b1cd27e3FF422B425c' | ||
); | ||
}); | ||
|
||
test('return an address for sepolia', () => { | ||
expect(getEnsOwner('snapshot.eth', '11155111')).resolves.toBe( | ||
'0x8C28Cf33d9Fd3D0293f963b1cd27e3FF422B425c' | ||
); | ||
}); | ||
|
||
test('return an address for subdomain', () => { | ||
expect(getEnsOwner('2.snapspace.eth')).resolves.toBe( | ||
'0x24F15402C6Bb870554489b2fd2049A85d75B982f' | ||
); | ||
}); | ||
|
||
test('return an address for other TLD', () => { | ||
expect(getEnsOwner('worldlibertyfinancial.com')).resolves.toBe( | ||
'0x407F66Afb4f9876637AcCC3246099a2f9705c178' | ||
); | ||
}); | ||
|
||
test('return an empty address for non-existent subdomain', () => { | ||
expect(getEnsOwner('2arst.snapspace.eth')).resolves.toBe(EMPTY_ADDRESS); | ||
}); | ||
}); | ||
|
||
describe('offchain resolver', () => { | ||
test('return an address for coinbase resolver', () => { | ||
expect(getEnsOwner('lucemans.cb.id')).resolves.toBe( | ||
'0x4e7abb71BEe38011c54c30D0130c0c71Da09222b' | ||
); | ||
}); | ||
|
||
test('return an address for uniswap resolver', () => { | ||
expect(getEnsOwner('lucemans.uni.eth')).resolves.toBe( | ||
'0x225f137127d9067788314bc7fcc1f36746a3c3B5' | ||
); | ||
}); | ||
|
||
test('return an empty address when no result from resolver on mainnet', () => { | ||
expect(getEnsOwner('notfounddomain.uni.eth')).resolves.toBe( | ||
EMPTY_ADDRESS | ||
); | ||
}); | ||
|
||
test('return an empty address when no result from resolver on testnet', () => { | ||
expect(getEnsOwner('notfounddomain.uni.eth', '11155111')).resolves.toBe( | ||
EMPTY_ADDRESS | ||
); | ||
}); | ||
}); | ||
|
||
describe('offchain DNS resolver', () => { | ||
test('return an address for claimed domain', () => { | ||
expect(getEnsOwner('defi.app')).resolves.toBe( | ||
'0x7aeB96261e9dC2C9f01BaE6A516Df80a5a98c7eB' | ||
); | ||
}); | ||
|
||
test('return an empty address for unclaimed domain', () => { | ||
expect(getEnsOwner('google.com')).resolves.toBe(EMPTY_ADDRESS); | ||
}); | ||
}); | ||
}); | ||
}); |
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.
Uh oh!
There was an error while loading. Please reload this page.