From 33fef658071d6b2b2ccc498c28d1c3e52bd73410 Mon Sep 17 00:00:00 2001 From: Sergii Iurevych Date: Thu, 14 Nov 2024 18:13:00 +0200 Subject: [PATCH] Remove .luxy and .kred from ENS resolution --- CHANGELOG.md | 1 + src/Ens.ts | 2 +- src/Resolution.ts | 4 ++-- src/Uns.ts | 5 +---- src/UnsInternal.ts | 5 +---- src/tests/Ens.test.ts | 34 ---------------------------------- src/utils/index.ts | 2 +- 7 files changed, 7 insertions(+), 46 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 87c13fac..93a211fa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ ## 9.3.1 - Resolve .xyz TLD as UNS domains +- Remove .kred and .luxe from ENS resolution ## 9.3.0 diff --git a/src/Ens.ts b/src/Ens.ts index b008f5c1..0d9be63c 100644 --- a/src/Ens.ts +++ b/src/Ens.ts @@ -513,7 +513,7 @@ export default class Ens extends NamingService { private checkSupportedDomain(domain: string): boolean { return ( domain === 'eth' || - /^([^\s\\.]+\.)+(eth|luxe|kred)+$/.test(domain) || + /^([^\s\\.]+\.)+(eth)+$/.test(domain) || /^([^\s\\.]+\.)(addr\.)(reverse)$/.test(domain) ); } diff --git a/src/Resolution.ts b/src/Resolution.ts index 2344667a..3559e6de 100644 --- a/src/Resolution.ts +++ b/src/Resolution.ts @@ -968,10 +968,10 @@ export default class Resolution { async locations(domains: string[]): Promise { const zilDomains = domains.filter((domain) => domain.endsWith('.zil')); const ensDomains = domains.filter((domain) => - domain.match(/^([^\s\\.]+\.)+(eth|luxe|kred)+$/), + domain.match(/^([^\s\\.]+\.)+(eth)+$/), ); const nonEnsDomains = domains.filter( - (domain) => !domain.match(/^([^\s\\.]+\.)+(eth|luxe|kred)+$/), + (domain) => !domain.match(/^([^\s\\.]+\.)+(eth)+$/), ); // Here, we call both UNS and ZNS methods and merge the results. // If any of the calls fails, this method will fail as well as we aren't interested in partial results. diff --git a/src/Uns.ts b/src/Uns.ts index 47bcd1c8..ddad785f 100644 --- a/src/Uns.ts +++ b/src/Uns.ts @@ -534,10 +534,7 @@ export default class Uns extends NamingService { const tokens = domain.split('.'); return ( !!tokens.length && - !( - domain === 'eth' || - /^[^-]*[^-]*\.(eth|luxe|kred|addr\.reverse)$/.test(domain) - ) && + !(domain === 'eth' || /^[^-]*[^-]*\.(eth|addr\.reverse)$/.test(domain)) && tokens.every((v) => !!v.length) ); } diff --git a/src/UnsInternal.ts b/src/UnsInternal.ts index eae1308f..4dc012b0 100644 --- a/src/UnsInternal.ts +++ b/src/UnsInternal.ts @@ -163,10 +163,7 @@ export default class UnsInternal { const tokens = domain.split('.'); return ( !!tokens.length && - !( - domain === 'eth' || - /^[^-]*[^-]*\.(eth|luxe|kred|addr\.reverse)$/.test(domain) - ) && + !(domain === 'eth' || /^[^-]*[^-]*\.(eth|addr\.reverse)$/.test(domain)) && tokens.every((v) => !!v.length) ); } diff --git a/src/tests/Ens.test.ts b/src/tests/Ens.test.ts index 921c3707..eaf3e833 100644 --- a/src/tests/Ens.test.ts +++ b/src/tests/Ens.test.ts @@ -93,40 +93,6 @@ describe('ENS', () => { expect(result).toEqual(null); }); - it('resolves .luxe name using ENS blockchain', async () => { - const eyes = mockAsyncMethods(ens, { - resolver: '0xBD5F5ec7ed5f19b53726344540296C02584A5237', - fetchAddress: '0xf3dE750A73C11a6a2863761E930BF5fE979d5663', - }); - - const result = await resolution.addr('john.luxe', 'ETH'); - expectSpyToBeCalled(eyes); - expect(result).toEqual('0xf3dE750A73C11a6a2863761E930BF5fE979d5663'); - }); - - it('resolves .kred name using ENS blockchain', async () => { - const eyes = mockAsyncMethods(ens, { - resolver: '0x96184444629F3489c4dE199871E6F99568229d8f', - fetchAddress: '0x96184444629F3489c4dE199871E6F99568229d8f', - }); - const result = await resolution.addr('brantly.kred', 'ETH'); - expectSpyToBeCalled(eyes); - expect(result).toEqual('0x96184444629F3489c4dE199871E6F99568229d8f'); - }); - - it('resolves .luxe name using ENS blockchain with thrown error', async () => { - const spies = mockAsyncMethods(ens, { - resolver: undefined, - owner: undefined, - }); - - await expectResolutionErrorCode( - resolution.addr('something.luxe', 'ETH'), - ResolutionErrorCode.UnregisteredDomain, - ); - expectSpyToBeCalled(spies); - }); - it('resolves name with resolver but without an owner', async () => { const eyes = mockAsyncMethods(ens, { resolver: '0x226159d592E2b063810a10Ebf6dcbADA94Ed68b8', diff --git a/src/utils/index.ts b/src/utils/index.ts index 965074c5..2d091b15 100644 --- a/src/utils/index.ts +++ b/src/utils/index.ts @@ -86,7 +86,7 @@ export function constructRecords( return records; } -const EnsTlds = ['eth', 'luxe', 'kred', 'reverse']; +const EnsTlds = ['eth', 'reverse']; export const findNamingServiceName = async ( domain: string,