Skip to content
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

feat: add domain api to return custom domain associated to an offchain space #302

Merged
merged 1 commit into from
Sep 12, 2024

Conversation

wa0x6e
Copy link
Contributor

@wa0x6e wa0x6e commented Sep 12, 2024

Working towards https://github.com/snapshot-labs/workflow/issues/142

See also https://discord.com/channels/955773041898573854/1282876175642918964/1283367668648382587

This PR will add a new /api/domain endpoint to return a custom domain associated to an offchain space.

Domains list will be pulled from the snapshot-spaces repo, be cached in memory, and refreshed every 5 minutes.

Test

  • yarn dev
  • monitor console to confirm that the domain list has been loaded
  • curl http://localhost:3005/api/domains/vote.lends.so
  • it should return {"domain":"vote.lends.so","space_id":"s:lendsdao.eth"}
  • curl http://localhost:3005/api/domains/random
  • it should return {"domain":"vote.lends.so","space_id":null}

@wa0x6e wa0x6e marked this pull request as ready for review September 12, 2024 04:02
Copy link
Member

@ChaituVR ChaituVR left a comment

Choose a reason for hiding this comment

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

tAck


const body: Record<string, string> = await response.json();

data = new Map(Object.entries(body).map(([domain, spaceId]) => [domain, `s:${spaceId}`]));
Copy link
Member

Choose a reason for hiding this comment

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

Do we want to store sx spaces on snapshot-spaces?

then maybe it is better to add s: on that repo

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this repo will be deprecated soon.

Sidekick is aggregating v2 spaces from the repo, sx spaces will have another source I believe

@wa0x6e wa0x6e merged commit d34563c into main Sep 12, 2024
4 checks passed
@wa0x6e wa0x6e deleted the feat-new-domain-api branch September 12, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants