diff --git a/packages/ens-utils/src/ethregistrar.ts b/packages/ens-utils/src/ethregistrar.ts index 0cb96660b..6a63b66c8 100644 --- a/packages/ens-utils/src/ethregistrar.ts +++ b/packages/ens-utils/src/ethregistrar.ts @@ -1,9 +1,9 @@ import { ENSName, - MIN_ETH_REGISTRABLE_LABEL_LENGTH, ETH_TLD, charCount, getDomainLabelFromENSName, + MIN_ETH_REGISTRABLE_LABEL_LENGTH, } from "./ensname"; import { NFTRef, TokenId, buildNFTRef, buildTokenId } from "./nft"; import { namehash, labelhash } from "viem/ens"; @@ -301,13 +301,16 @@ export const premiumPeriodEndsIn = ( if (!isExpired || !wasRecentlyReleased) return null; /* - This conditional should always be true because expiryTimestamp will only be null when + This conditional should always be true because expirationTimestamp will only be null when the domain was never registered before. Considering that the domain is Expired, it means that it was registered before. It is just a type safety check. */ - if (!registration.expiryTimestamp) return null; + if (!registration.expirationTimestamp) return null; - const releasedEpoch = addSeconds(registration.expiryTimestamp, GRACE_PERIOD); + const releasedEpoch = addSeconds( + registration.expirationTimestamp, + GRACE_PERIOD, + ); const temporaryPremiumEndTimestamp = addSeconds( releasedEpoch, TEMPORARY_PREMIUM_PERIOD, @@ -492,7 +495,6 @@ export type Registration = { // Below timestamps are counted in seconds registrationTimestamp: Timestamp | null; expirationTimestamp: Timestamp | null; - expiryTimestamp: Timestamp | null; primaryStatus: PrimaryRegistrationStatus; secondaryStatus: SecondaryRegistrationStatus | null; @@ -502,56 +504,54 @@ export const getDomainRegistration = ( /* When null, a domain is considered to be not registered. */ - expiryTimestamp: Timestamp | null, + expirationTimestamp: Timestamp | null, ): Registration => { - if (!expiryTimestamp) { + if (!expirationTimestamp) { return { - primaryStatus: PrimaryRegistrationStatus.NeverRegistered, secondaryStatus: null, - registrationTimestamp: null, expirationTimestamp: null, - expiryTimestamp: null, + registrationTimestamp: null, + primaryStatus: PrimaryRegistrationStatus.NeverRegistered, }; } - const primaryStatus = getPrimaryRegistrationStatus(expiryTimestamp); - const secondaryStatus = getSecondaryRegistrationStatus(expiryTimestamp); + const primaryStatus = getPrimaryRegistrationStatus(expirationTimestamp); + const secondaryStatus = getSecondaryRegistrationStatus(expirationTimestamp); return { - expiryTimestamp, primaryStatus, secondaryStatus, + expirationTimestamp, registrationTimestamp: null, - expirationTimestamp: expiryTimestamp, }; }; const getPrimaryRegistrationStatus = ( - expiryTimestamp: Timestamp, + expirationTimestamp: Timestamp, ): PrimaryRegistrationStatus => { const nowTime = now(); - return nowTime.time < expiryTimestamp.time + return nowTime.time < expirationTimestamp.time ? PrimaryRegistrationStatus.Active : PrimaryRegistrationStatus.Expired; }; const getSecondaryRegistrationStatus = ( - expiryTimestamp: Timestamp, + expirationTimestamp: Timestamp, ): SecondaryRegistrationStatus | null => { const nowTime = now(); - if (nowTime.time < expiryTimestamp.time) { - return nowTime.time > expiryTimestamp.time - GRACE_PERIOD.seconds + if (nowTime.time < expirationTimestamp.time) { + return nowTime.time > expirationTimestamp.time - GRACE_PERIOD.seconds ? SecondaryRegistrationStatus.ExpiringSoon : null; } else { if ( - expiryTimestamp.time + + expirationTimestamp.time + GRACE_PERIOD.seconds + TEMPORARY_PREMIUM_PERIOD.seconds < nowTime.time ) return SecondaryRegistrationStatus.FullyReleased; - else if (expiryTimestamp.time + GRACE_PERIOD.seconds > nowTime.time) + else if (expirationTimestamp.time + GRACE_PERIOD.seconds > nowTime.time) return SecondaryRegistrationStatus.GracePeriod; else return SecondaryRegistrationStatus.RecentlyReleased; } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 63558318d..9e6e56cd7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -142,7 +142,7 @@ importers: devDependencies: '@types/node': specifier: latest - version: 22.0.0 + version: 22.1.0 '@types/react': specifier: latest version: 18.3.3 @@ -151,7 +151,7 @@ importers: version: 18.3.0 autoprefixer: specifier: latest - version: 10.4.19(postcss@8.4.40) + version: 10.4.19(postcss@8.4.41) eslint: specifier: ^8.56.0 version: 8.56.0 @@ -160,7 +160,7 @@ importers: version: 14.2.3(eslint@8.56.0)(typescript@5.5.4) postcss: specifier: latest - version: 8.4.40 + version: 8.4.41 tailwind-scrollbar-hide: specifier: 1.1.7 version: 1.1.7 @@ -5231,6 +5231,12 @@ packages: undici-types: 6.11.1 dev: true + /@types/node@22.1.0: + resolution: {integrity: sha512-AOmuRF0R2/5j1knA3c6G3HOk523Ga+l+ZXltX8SF1+5oqcXijjfTd8fY3XRZqSihEu9XhtQnKYLmkFaoxgsJHw==} + dependencies: + undici-types: 6.13.0 + dev: true + /@types/normalize-package-data@2.4.4: resolution: {integrity: sha512-37i+OaWTh9qeK4LSHPsyRC7NahnGotNuZvjLSgcPzblpHB3rrCJxAOgI5gCdKm7coonsaX1Of0ILiTcnZjbfxA==} dev: true @@ -6004,7 +6010,7 @@ packages: postcss-value-parser: 4.2.0 dev: true - /autoprefixer@10.4.19(postcss@8.4.40): + /autoprefixer@10.4.19(postcss@8.4.41): resolution: {integrity: sha512-BaENR2+zBZ8xXhM4pUaKUxlVdxZ0EZhjvbopwnXmxRUfqDmwSpC2lAi/QXvx7NRdPCo1WKEcEF6mV64si1z4Ew==} engines: {node: ^10 || ^12 || >=14} hasBin: true @@ -6016,7 +6022,7 @@ packages: fraction.js: 4.3.7 normalize-range: 0.1.2 picocolors: 1.0.1 - postcss: 8.4.40 + postcss: 8.4.41 postcss-value-parser: 4.2.0 dev: true @@ -8259,6 +8265,7 @@ packages: /glob@7.2.3: resolution: {integrity: sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==} + deprecated: Glob versions prior to v9 are no longer supported dependencies: fs.realpath: 1.0.0 inflight: 1.0.6 @@ -10080,13 +10087,13 @@ packages: resolve: 1.22.8 dev: true - /postcss-import@15.1.0(postcss@8.4.40): + /postcss-import@15.1.0(postcss@8.4.41): resolution: {integrity: sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==} engines: {node: '>=14.0.0'} peerDependencies: postcss: ^8.0.0 dependencies: - postcss: 8.4.40 + postcss: 8.4.41 postcss-value-parser: 4.2.0 read-cache: 1.0.0 resolve: 1.22.8 @@ -10101,14 +10108,14 @@ packages: postcss: 8.4.39 dev: true - /postcss-js@4.0.1(postcss@8.4.40): + /postcss-js@4.0.1(postcss@8.4.41): resolution: {integrity: sha512-dDLF8pEO191hJMtlHFPRa8xsizHaM82MLfNkUHdUtVEV3tgTp5oj+8qbEqYM57SLfc74KSbw//4SeJma2LRVIw==} engines: {node: ^12 || ^14 || >= 16} peerDependencies: postcss: ^8.4.21 dependencies: camelcase-css: 2.0.1 - postcss: 8.4.40 + postcss: 8.4.41 /postcss-load-config@4.0.2(postcss@8.4.38): resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} @@ -10144,7 +10151,7 @@ packages: yaml: 2.4.2 dev: true - /postcss-load-config@4.0.2(postcss@8.4.40): + /postcss-load-config@4.0.2(postcss@8.4.41): resolution: {integrity: sha512-bSVhyJGL00wMVoPUzAVAnbEoWyqRxkjv64tUl427SKnPrENtq6hJwUojroMz2VB+Q1edmi4IfrAPpami5VVgMQ==} engines: {node: '>= 14'} peerDependencies: @@ -10157,7 +10164,7 @@ packages: optional: true dependencies: lilconfig: 3.1.1 - postcss: 8.4.40 + postcss: 8.4.41 yaml: 2.4.2 /postcss-nested@6.0.1(postcss@8.4.39): @@ -10170,13 +10177,13 @@ packages: postcss-selector-parser: 6.0.16 dev: true - /postcss-nested@6.0.1(postcss@8.4.40): + /postcss-nested@6.0.1(postcss@8.4.41): resolution: {integrity: sha512-mEp4xPMi5bSWiMbsgoPfcP74lsWLHkQbZc3sY+jWYd65CUwXrUaTp0fmNpa01ZcETKlIgUdFN/MpS2xZtqL9dQ==} engines: {node: '>=12.0'} peerDependencies: postcss: ^8.2.14 dependencies: - postcss: 8.4.40 + postcss: 8.4.41 postcss-selector-parser: 6.0.16 /postcss-selector-parser@6.0.16: @@ -10222,6 +10229,15 @@ packages: nanoid: 3.3.7 picocolors: 1.0.1 source-map-js: 1.2.0 + dev: true + + /postcss@8.4.41: + resolution: {integrity: sha512-TesUflQ0WKZqAvg52PWL6kHgLKP6xB6heTOdoYM0Wt2UHyxNa4K25EZZMgKns3BH1RLVbZCREPpLY0rhnNoHVQ==} + engines: {node: ^10 || ^12 || >=14} + dependencies: + nanoid: 3.3.7 + picocolors: 1.0.1 + source-map-js: 1.2.0 /preferred-pm@3.1.3: resolution: {integrity: sha512-MkXsENfftWSRpzCzImcp4FRsCc3y1opwB73CfCNWyzMqArju2CrlMHlqB7VexKiPEOjGMbttv1r9fSCn5S610w==} @@ -11471,11 +11487,11 @@ packages: normalize-path: 3.0.0 object-hash: 3.0.0 picocolors: 1.0.1 - postcss: 8.4.40 - postcss-import: 15.1.0(postcss@8.4.40) - postcss-js: 4.0.1(postcss@8.4.40) - postcss-load-config: 4.0.2(postcss@8.4.40) - postcss-nested: 6.0.1(postcss@8.4.40) + postcss: 8.4.41 + postcss-import: 15.1.0(postcss@8.4.41) + postcss-js: 4.0.1(postcss@8.4.41) + postcss-load-config: 4.0.2(postcss@8.4.41) + postcss-nested: 6.0.1(postcss@8.4.41) postcss-selector-parser: 6.0.16 resolve: 1.22.8 sucrase: 3.35.0 @@ -12062,6 +12078,10 @@ packages: resolution: {integrity: sha512-mIDEX2ek50x0OlRgxryxsenE5XaQD4on5U2inY7RApK3SOJpofyw7uW2AyfMKkhAxXIceo2DeWGVGwyvng1GNQ==} dev: true + /undici-types@6.13.0: + resolution: {integrity: sha512-xtFJHudx8S2DSoujjMd1WeWvn7KKWFRESZTMeL1RptAYERu29D6jphMjjY+vn96jvN3kVPDNxU/E13VTaXj6jg==} + dev: true + /unicode-canonical-property-names-ecmascript@2.0.0: resolution: {integrity: sha512-yY5PpDlfVIU5+y/BSCxAJRBIS1Zc2dDG3Ujq+sR0U+JjUevW2JhocOF+soROYDSaAezOzOKuyyixhD6mBknSmQ==} engines: {node: '>=4'} @@ -12399,7 +12419,7 @@ packages: dependencies: '@types/node': 20.12.12 esbuild: 0.19.12 - postcss: 8.4.40 + postcss: 8.4.41 rollup: 4.17.2 optionalDependencies: fsevents: 2.3.3 @@ -12435,7 +12455,7 @@ packages: dependencies: '@types/node': 20.12.7 esbuild: 0.19.12 - postcss: 8.4.40 + postcss: 8.4.41 rollup: 4.17.2 optionalDependencies: fsevents: 2.3.3