Skip to content

Commit

Permalink
fix: Ignore expired ENS domains on space creation (#4424)
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR authored Dec 2, 2023
1 parent 1037eff commit c6fe465
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/composables/useEns.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,12 @@ export function useEns() {

const domains = response.account?.domains || [];
const wrappedDomains = response.account?.wrappedDomains || [];
const allDomains = [...domains, ...wrappedDomains];

let allDomains = [...domains, ...wrappedDomains];
// Filter out expired domains
const now = (Date.now() / 1000).toFixed(0);
allDomains = allDomains.filter(
domain => !domain.expiryDate || domain.expiryDate > now
);
ownedEnsDomains.value = await fetchAllDomainData(allDomains);
};

Expand Down
2 changes: 2 additions & 0 deletions src/helpers/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,11 @@ export const ENS_DOMAINS_BY_ACCOUNT_QUERY = gql`
account(id: $id) {
domains {
name
expiryDate
}
wrappedDomains {
name
expiryDate
}
}
}
Expand Down

1 comment on commit c6fe465

@vercel
Copy link

@vercel vercel bot commented on c6fe465 Dec 2, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.