diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index c6a515238..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,4 +0,0 @@ -.github/ @gskril -app/ @gskril -docs/ @gskril -docs/ensip/ @arachnid diff --git a/.github/PULL_REQUEST_TEMPLATE/code_update.md b/.github/PULL_REQUEST_TEMPLATE/code_update.md deleted file mode 100644 index 7dbcfc865..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/code_update.md +++ /dev/null @@ -1 +0,0 @@ -> This PR alters code / functionality diff --git a/.github/PULL_REQUEST_TEMPLATE/documentation_update.md b/.github/PULL_REQUEST_TEMPLATE/documentation_update.md deleted file mode 100644 index 3a4d0613b..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/documentation_update.md +++ /dev/null @@ -1 +0,0 @@ -> This PR alters content of the Documentation diff --git a/.github/PULL_REQUEST_TEMPLATE/ensip_proposal.md b/.github/PULL_REQUEST_TEMPLATE/ensip_proposal.md deleted file mode 100644 index b76c314d9..000000000 --- a/.github/PULL_REQUEST_TEMPLATE/ensip_proposal.md +++ /dev/null @@ -1 +0,0 @@ -> This PR has to do with ENSIP / Proposes an ENSIP diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml deleted file mode 100644 index 4c083ddfd..000000000 --- a/.github/actions/install/action.yml +++ /dev/null @@ -1,24 +0,0 @@ -name: Install Tools & Dependencies -description: Installs pnpm, Node.js & package dependencies - -runs: - using: composite - steps: - - name: Setup PNPM - uses: pnpm/action-setup@v4 - with: - run_install: false - standalone: true - package_json_file: app/package.json - version: 9 - - - name: Setup Node - uses: actions/setup-node@v4 - with: - node-version: 19 - cache: pnpm - cache-dependency-path: 'app' - - - name: Install dependencies - run: cd app && pnpm install - shell: bash diff --git a/.github/development.md b/.github/development.md deleted file mode 100644 index 458a63fe1..000000000 --- a/.github/development.md +++ /dev/null @@ -1,25 +0,0 @@ -# Development Guide - -## 🏠 Use node version - -Ensure you are on the right version of NodeJS. To see the active version, check [the .nvmrc file](../app/.nvmrc). - -```sh -nvm use -``` - -## 🏃 Running the project - -To run the project, run: - -```sh -pnpm dev -``` - -## 🏗️ Building the project - -To build the project, run: - -```sh -pnpm build -``` diff --git a/.github/readme.png b/.github/readme.png deleted file mode 100644 index dd6016802..000000000 Binary files a/.github/readme.png and /dev/null differ diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 99924416b..000000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,65 +0,0 @@ -name: 🔎 - -on: - push: - branches: [master, main] - merge_group: - pull_request: - branches: [master, main] - -# Automatically cancel in-progress actions on the same branch -concurrency: - group: ${{ github.workflow }}-${{ github.event_name == 'pull_request_target' && github.head_ref || github.ref }} - cancel-in-progress: true - -env: - NODE_OPTIONS: '--max_old_space_size=8192' - -jobs: - typecheck: - name: 🟦 Typescript - runs-on: ubuntu-latest - env: - FORCE_COLOR: true - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Run typecheck - working-directory: ./app - run: pnpm run typecheck - eslint: - name: 👕 Linting - runs-on: ubuntu-latest - env: - FORCE_COLOR: true - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Run eslint - working-directory: ./app - run: pnpm run lint - build: - name: 🛠️ Build - runs-on: ubuntu-latest - env: - FORCE_COLOR: true - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Build - working-directory: ./app - run: pnpm run build diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 0ce1b823c..000000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,59 +0,0 @@ -name: 🚚 Deploy - -on: - push: - branches: - - master - -env: - NODE_OPTIONS: "--max_old_space_size=8192" - -jobs: - deploy: - runs-on: ubuntu-20.04 - permissions: - contents: write - concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - steps: - - name: Checkout - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Install Tools & Dependencies - uses: ./.github/actions/install - - - name: Build - working-directory: ./app - run: pnpm run build - env: - TALLY_API_KEY: ${{ secrets.TALLY_API_KEY }} - - - name: Cloudflare Pages Upload - uses: cloudflare/pages-action@v1 - with: - apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }} - accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} - projectName: ens-docs - branch: master - directory: app/out - # gitHubToken: ${{ secrets.GITHUB_TOKEN }} - wranglerVersion: '3' - - - uses: oven-sh/setup-bun@v1 - - - name: Install dependencies - run: bun install - working-directory: app/scripts - shell: bash - - - name: Build search.json - run: bun run build-search - working-directory: app/scripts - shell: bash - - - name: Index search.json - shell: bash - run: | - curl --silent -X POST -H "Content-Type: application/json" -H "Authorization: Bearer ${{secrets.SEARCH_TOKEN}}" -d @app/out/search.json https://search.v3x.systems/indexes/ens-docs/documents?primaryKey=id diff --git a/.gitignore b/.gitignore index 3c3629e64..3bc59c2c7 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,18 @@ +.env +.env*.local +*.DS_Store node_modules +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.pnpm-debug.log* +vocs.config.ts.timestamp-* +src/dist + +# Generated plugin files +src/pages/deployments.md +src/pages/ensip/* +!src/pages/ensip/index.mdx +src/data/generated/* +!src/data/generated/.keep + diff --git a/.nvmrc b/.nvmrc new file mode 100644 index 000000000..92f279e3e --- /dev/null +++ b/.nvmrc @@ -0,0 +1 @@ +v22 \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 000000000..f5ee2600a --- /dev/null +++ b/.prettierrc @@ -0,0 +1,15 @@ +{ + "semi": false, + "tabWidth": 2, + "printWidth": 80, + "useTabs": false, + "singleQuote": true, + "trailingComma": "es5", + "plugins": [ + "@trivago/prettier-plugin-sort-imports", + "prettier-plugin-tailwindcss" + ], + "importOrder": ["", "^@/", "^[./]"], + "importOrderSeparation": true, + "importOrderSortSpecifiers": true +} diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4fac54fe5..66c884955 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -12,25 +12,27 @@ This guide will walk you through the process of contributing to the ENS docs. If #### Create a new issue -If you spot a problem with the docs, [search if an issue already exists](https://github.com/ensdomains/docs/issues). If a related issue doesn't exist, you can open a new issue using a relevant [issue form](https://github.com/ensdomains/docs/issues/new). +If you spot a problem with the docs, [search if an issue already exists](https://github.com/ensdomains/docs/issues). If a related issue doesn't exist, you can [open a new issue](https://github.com/ensdomains/docs/issues/new). #### Solve an issue -Scan through our [existing issues](https://github.com/ensdomains/docs/issues) to find one that interests you. You can narrow down the search using `labels` as filters. As a general rule, we don't assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix. +Scan through our [existing issues](https://github.com/ensdomains/docs/issues) to find one that interests you. As a general rule, we don't assign issues to anyone. If you find an issue to work on, you are welcome to open a PR with a fix. ### Make Changes #### Make changes in the UI -Click **Make a contribution** at the bottom of any docs page to make small changes such as a typo, sentence fix, or a broken link. This takes you to the `.md` file where you can make your changes and [create a pull request](#pull-request) for a review. +Click **Make a contribution** at the bottom of any docs page to make small changes such as a typo, sentence fix, or a broken link. This takes you to the `.mdx` file where you can make your changes and [create a pull request](#pull-request) for a review. #### Make changes locally -1. Fork the repository. +> [!NOTE] +> Node.js version 20 or higher is required to build the docs. -2. (Optional) If you are making any code changes. Install or update to **Node.js**, or run `nvm use` if using [Node Version Manager](https://nvm.sh). For more information, see [the development guide](.github/development.md). - -3. Create a working branch and start with your changes! +1. Fork the repository via the GitHub UI. +2. Clone your forked repository to your local machine. +3. Create a working branch and make your changes! +4. Build the docs locally with `pnpm run build` to ensure your changes are valid. ### Commit your update @@ -39,10 +41,9 @@ Commit the changes once you are happy with them. Upon creating a Pull Request yo ### Pull Request When you're finished with the changes, create a pull request, also known as a PR. -- Fill the "Ready for review" template so that we can review your PR. This template helps reviewers understand your changes as well as the purpose of your pull request. -- Don't forget to [link PR to issue](https://docs.github.com/en/issues/tracking-your-work-with-issues/linking-a-pull-request-to-an-issue) if you are solving one. + - Enable the checkbox to [allow maintainer edits](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/allowing-changes-to-a-pull-request-branch-created-from-a-fork) so the branch can be updated for a merge. -Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information. + Once you submit your PR, a Docs team member will review your proposal. We may ask questions or request additional information. - We may ask for changes to be made before a PR can be merged, either using [suggested changes](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/incorporating-feedback-in-your-pull-request) or pull request comments. You can apply suggested changes directly through the UI. You can make any other changes in your fork, then commit them to your branch. - As you update your PR and apply changes, mark each conversation as [resolved](https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/commenting-on-a-pull-request#resolving-conversations). - If you run into any merge issues, checkout this [git tutorial](https://github.com/skills/resolve-merge-conflicts) to help you resolve merge conflicts and other issues. diff --git a/README.md b/README.md index 032f66214..c7fb1e582 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,14 @@ -[![readme](./.github/readme.png)](https://docs.ens.domains/?ref=github-banner) +# ENS Documentation -The Ethereum Name Service (ENS) is a distributed, open, and extensible naming system based on the Ethereum blockchain, but available to the entire internet. +This repository contains the source code for [docs.ens.domains](https://docs.ens.domains/?ref=ens-docs-github), as well as the markdown files that make up its contents. It's built with [Vocs](https://vocs.dev/) and deployed to [Cloudflare Pages](https://pages.cloudflare.com/). -## 🗒️ Documentation +Some content is generated at build time from external sources, such as [ENSIPs](https://github.com/ensdomains/ensips) and [smart contract deployments](https://github.com/ensdomains/ens-contracts). Markdown generation is handled by Vite plugins located in the `src/plugins` directory. -The ENS documentation is available at [docs.ens.domains](https://docs.ens.domains/?ref=ens-docs-github). This repository contains the source code for the documentation, as well as the markdown files that make up its contents. +Cloudflare [Pages Functions](https://developers.cloudflare.com/pages/functions/) are used to dynamically generate opengraph images for each page. ## 📖 Contributing -We welcome contributions to the ENS documentation. If you would like to contribute, please read the [contributing guidelines](./CONTRIBUTING.md). All content is written in mdx, and [markdown files can be found here](./docs). +We welcome contributions to the ENS documentation. If you would like to contribute, please read the [contributing guidelines](./CONTRIBUTING.md). All content is written in mdx, and [markdown files can be found here](./src/pages/). ## 📄 License diff --git a/app/.eslintrc.json b/app/.eslintrc.json deleted file mode 100644 index d72b3caeb..000000000 --- a/app/.eslintrc.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "root": true, - "extends": ["plugin:v3xlabs/recommended", "plugin:tailwindcss/recommended"], - "parser": "@typescript-eslint/parser", - "parserOptions": { - "ecmaVersion": 2021 - }, - "ignorePatterns": ["!**/*"], - "plugins": ["v3xlabs", "tailwindcss"], - "env": { - "node": true, - "browser": true - }, - "rules": { - "sonarjs/cognitive-complexity": ["warn", 20], - "tailwindcss/no-custom-classname": "off" - }, - "settings": { - "tailwindcss": { - "config": "./tailwind.config.js" - } - } -} diff --git a/app/.gitignore b/app/.gitignore deleted file mode 100644 index e051a5bea..000000000 --- a/app/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -.env -node_modules -.next/ -out/ -*.DS_Store -*.pem -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.pnpm-debug.log* -.env*.local -.env diff --git a/app/.nvmrc b/app/.nvmrc deleted file mode 100644 index 62ccda57f..000000000 --- a/app/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -v19 diff --git a/app/.prettierrc b/app/.prettierrc deleted file mode 100644 index d681759c4..000000000 --- a/app/.prettierrc +++ /dev/null @@ -1,6 +0,0 @@ -{ - "tabWidth": 4, - "useTabs": false, - "singleQuote": true, - "trailingComma": "es5" -} diff --git a/app/app/[...slug]/page.tsx b/app/app/[...slug]/page.tsx deleted file mode 100644 index c430e7b92..000000000 --- a/app/app/[...slug]/page.tsx +++ /dev/null @@ -1,81 +0,0 @@ -import { getPageBySlug } from 'data/get_page'; -import { getAllPageSlugs } from 'data/get_pages'; -import { ResolvingMetadata } from 'next'; - -import { ClientOnly } from '@/ClientOnly'; -import { Layout } from '@/layout/PageLayout'; -import { redirectToIndex } from '@/layout/RouteCheck'; -import { createMetadata } from '@/lib/metadata'; -import { getLinkHref } from '@/utils/contributorHelper'; - -type PageProperties = { - params: { slug: string[] }; -}; - -export const generateMetadata = async ( - { params }: PageProperties, - parent: ResolvingMetadata -) => { - const { - pageProperties: { meta }, - } = await getPageBySlug(params.slug.join('/')); - const parentMetadata = await parent; - - return createMetadata( - { - title: `${meta.title} | ENS Docs`, - description: meta.description, - path: params.slug.join('/'), - }, - parentMetadata, - { - openGraph: { - type: 'article', - title: meta.title, - description: meta.description, - images: `/opengraph/${params.slug.join('/')}.png`, - tags: ['ENS', 'Ethereum Name Service', '.eth'], - authors: meta.contributors?.map((contributor) => - getLinkHref(contributor) - ), - }, - twitter: { - card: 'summary_large_image', - }, - authors: meta.contributors?.map((contributor) => ({ - name: contributor, - url: getLinkHref(contributor), - })), - } - ); -}; - -// eslint-disable-next-line unicorn/prevent-abbreviations -export async function generateStaticParams() { - const pages = await getAllPageSlugs(); - - return pages.map((slug) => ({ - slug: slug.split('/'), - })); -} - -const Page = async ({ params }: PageProperties) => { - console.log('🖥️ -> ' + params.slug.join('/')); - - if (params.slug.length == 1 && params.slug[0] == 'index') { - return ; - } - - const { Page, pageProperties } = await getPageBySlug(params.slug.join('/')); - - return ( - - - - ); -}; - -export default Page; diff --git a/app/app/content-metadata.json/route.ts b/app/app/content-metadata.json/route.ts deleted file mode 100644 index 5c633b286..000000000 --- a/app/app/content-metadata.json/route.ts +++ /dev/null @@ -1,44 +0,0 @@ -import { getPageBySlug } from 'data/get_page'; -import { getAllPageSlugs } from 'data/get_pages'; -import { NextResponse } from 'next/server'; - -import { navigation } from '../../local/config/navigation'; - -const { protocol } = navigation; - -export async function GET() { - if (process.env.NODE_ENV !== 'production') return NextResponse.json([]); - - console.log('🔍 Generating Search Index'); - - const slugs = await getAllPageSlugs(); - - const posts = await Promise.all( - slugs.map(async (slug) => { - const tag = - protocol.find((section) => { - if (slug == 'index' && section.name == 'Intro') return true; - - if (slug == 'dissapeared') return false; - - return section.activePattern.test(`/${slug}`); - })?.name || ''; - const { pageProperties } = await getPageBySlug(slug); - - return { - pageProperties, - slug, - tag, - }; - }) - ); - - const data = posts.map((post) => ({ - ...post.pageProperties.meta, - id: post.slug.replace('/', '--').replace(/[^\w-]/g, ''), - slug: post.slug, - tag: post.tag, - })); - - return NextResponse.json(data); -} diff --git a/app/app/globals.css b/app/app/globals.css deleted file mode 100644 index 431e6eebc..000000000 --- a/app/app/globals.css +++ /dev/null @@ -1,416 +0,0 @@ -:root.dark { - --shiki-foreground: theme('colors.ens.dark.text.primary'); - --shiki-background: theme('colors.ens.dark.background.primary'); - --shiki-token-constant: theme('colors.ens.dark.blue.primary'); - --shiki-token-string: theme('colors.ens.dark.green.primary'); - --shiki-token-comment: theme('colors.ens.dark.text.secondary'); - --shiki-token-keyword: theme('colors.ens.dark.blue.primary'); - --shiki-token-parameter: theme('colors.ens.dark.pink.light'); - --shiki-token-function: theme('colors.ens.dark.orange.primary'); - --shiki-token-string-expression: theme('colors.ens.dark.pink.primary'); - --shiki-token-punctuation: theme('colors.ens.dark.text.disabled'); -} - -:root { - --shiki-foreground: #0969da; - --shiki-background: #afb8c133; - --shiki-token-constant: #0044ff; - --shiki-token-string: #0a3069; - --shiki-token-comment: #6e7781; - --shiki-token-keyword: #cf222e; - --shiki-token-parameter: #0a3069; - --shiki-token-function: #6639ba; - --shiki-token-string-expression: #0a3069; - --shiki-token-punctuation: #6e7781; - --shiki-token-link: #0969da; -} - -@font-face { - font-family: 'Satoshi'; - font-style: normal; - font-weight: normal; - font-display: swap; - src: url('/fonts/sans-serif/Satoshi-Medium.otf') format('opentype'); -} -@font-face { - font-family: 'Satoshi'; - font-style: normal; - font-weight: bold; - font-display: swap; - src: url('/fonts/sans-serif/Satoshi-Bold.otf') format('opentype'); -} -@font-face { - font-family: 'Satoshi'; - font-display: swap; - src: url('/fonts/sans-serif/Satoshi-Variable.ttf') format('truetype'); -} - -@font-face { - font-family: 'Inter'; - font-display: swap; - src: url('/fonts/sans-serif/inter/Inter-VariableFont_slnt,wght.ttf') - format('truetype'); -} - -@media (min-width: 768px) { - :root { - font-size: 16px; - } -} - -@tailwind base; -@tailwind components; -@tailwind utilities; - -.card { - @apply overflow-hidden rounded-lg bg-ens-light-grey-surface dark:bg-ens-dark-grey-surface shadow-sm dark:shadow-md ring-1 ring-black/10 dark:ring-white/10; -} - -.card1 { - @apply rounded-2xl bg-ens-light-background-primary dark:bg-ens-dark-background-primary border border-ens-light-border dark:border-ens-dark-border; -} -.card2 { - @apply rounded-2xl bg-ens-light-background-secondary dark:bg-ens-dark-background-secondary border border-ens-light-border dark:border-ens-dark-border; -} - -.card:not(.no-margin) { - @apply my-6; -} - -html body { - font-family: 'Inter', 'Satoshi', sans-serif; -} - -h1, h2, h3, h4 { - font-family: 'Satoshi', sans-serif; -} - -.font-satoshi { - font-family: 'Satoshi', sans-serif; -} - -.prose { - /* max-width: 720px; */ - /* width: 720px; */ -} - -/* @media (max-width: 1400px) { - .prose > * { - margin-left: 0; - } -} */ - -.prose > p + p { - /* @apply !mt-0 mb-0; */ -} - -.prose { - @apply text-ens-light-text-primary dark:text-ens-dark-text-primary; -} - -.prose h1, -.prose h2, -.prose h3, -.prose h4 { - @apply text-ens-light-text-primary dark:text-ens-dark-text-primary; -} - -html.dark { - color-scheme: dark; -} - -.scrollbar { - scrollbar-gutter: stable; -} - -.scrollbar::-webkit-scrollbar { - @apply bg-transparent w-2; -} - -.scrollbar::-webkit-scrollbar-track { - background: transparent; -} - -.scrollbar:hover::-webkit-scrollbar-thumb { - @apply bg-zinc-900/10 rounded-full dark:bg-zinc-200/10; -} - -pre { - @apply bg-ens-light-background-secondary/20 dark:bg-ens-dark-background-secondary/20; - @apply text-ens-light-text-primary dark:text-ens-dark-text-primary overflow-x-auto p-4 text-xs; -} - -pre > code { - counter-reset: line; -} -pre > code > span:not(:last-child)::before { - content: counter(line); - counter-increment: line; - user-select: none; - - @apply inline-block text-right w-8; - @apply text-ens-light-text-secondary dark:text-ens-dark-text-secondary; - - padding-right: 0.5em; - margin-right: 1em; -} - -.mermaid { - @apply flex items-center justify-center; -} - -svg[role~='graphics-document'] { - @apply w-full border block; -} - -.focus-code { - @apply w-full; -} - -.focus-code::before { - content: ''; - @apply absolute left-0 right-0 h-[24px] bg-ens-light-blue-400/5; -} - -/* @media (min-width: 1650px) { - .pagedetails_wrapper { - @apply inset-x-0 top-16 w-full absolute; - } - .pagedetails { - margin-left: calc(50% - min(50%, 33rem)); - margin-right: calc(50% - min(50%, 33rem)); - } - .pagedetails_inner { - @apply absolute left-full px-4 h-[100px] !w-72; - } -} - -.pagedetails_wrapper { -} - -.pagedetails { - @apply relative w-full max-w-[900px]; - @apply mt-4; -} - -.pagedetails_inner { - @apply w-full h-fit space-y-4; -} */ - -.hlem em { - @apply bg-neutral-300/25 underline; -} - -.hlem:last-child { - @apply rounded-b-2xl; -} - -.hidable-code + * { - display: none; -} - -.hidable-code.hidden ~ * { - display: block; -} -.hidable-code.hidden ~ *.hidden { - display: none; -} -.ReactModal__Content { - opacity: 0; - transform: translateY(32px); - scale: 0.9; - transition: all 200ms ease-in-out; -} - -.ReactModal__Content--after-open { - opacity: 1; - scale: 1; - transform: translateY(0px); -} - -.ReactModal__Content--before-close { - opacity: 0; - scale: 0.95; - transform: translateY(32px); -} - -.breadcrumb { -} - -.breadcrumb ul { - display: flex; - flex-wrap: wrap; - list-style: none; - margin: 0; - padding: 0; -} - -.breadcrumb li:first-child { - padding-left: 0; -} - -.breadcrumb li:not(:last-child)::after { - display: inline-block; - padding-left: 0.5rem; - content: '/'; -} - -table { - border-collapse: separate; - border-width: 0; - border-spacing: 0; - @apply rounded-lg overflow-hidden border border-ens-light-border dark:border-ens-dark-border; -} - -thead { - @apply bg-ens-light-background-secondary dark:bg-ens-dark-background-secondary; - - display: table-header-group; - vertical-align: middle; -} - -thead tr { - display: table-row; - vertical-align: inherit; - @apply rounded-t-xl border overflow-hidden border-ens-light-border dark:border-ens-dark-border; -} - -thead th { - @apply p-4 last:border-r-0 border-b border-r text-ens-light-text-primary dark:text-ens-dark-text-primary border-ens-light-border dark:border-ens-dark-border; -} - -tbody { - @apply bg-ens-light-background-secondary/20 dark:bg-ens-dark-background-secondary/20; -} - -tbody tr { -} - -tbody td { - @apply p-4 border-b border-ens-light-border dark:border-ens-dark-border; -} - -tbody tr:last-child td { - @apply border-b-0; -} - -.btn { - @apply inline-flex justify-center gap-0.5 overflow-hidden text-sm font-medium transition; - @apply hover:-translate-y-[1px]; - @apply active:translate-y-0; -} - -.btn-blue-primary { - @apply bg-ens-light-blue-primary dark:bg-ens-dark-blue-primary; - @apply text-ens-light-text-accent dark:text-ens-dark-text-accent; - @apply hover:bg-ens-light-blue-bright dark:hover:bg-ens-dark-blue-bright hover:text-ens-light-text-accent hover:dark:text-ens-dark-text-accent; - @apply active:bg-ens-light-blue-bright dark:active:bg-ens-dark-blue-bright; /* */ - @apply focus:ring focus:ring-offset-2 focus:ring-ens-light-blue-bright dark:focus:ring-ens-dark-blue-bright focus:outline-none; /* */ - @apply rounded-lg py-2.5 px-5; -} - -.btn-blue-surface { - @apply bg-ens-light-blue-surface dark:bg-ens-dark-blue-surface; - @apply text-ens-light-blue-dim dark:text-ens-dark-blue-dim; - @apply hover:bg-ens-light-blue-light dark:hover:bg-ens-dark-blue-light; - @apply active:bg-ens-light-blue-bright dark:active:bg-ens-dark-blue-bright; /* */ - @apply focus:ring focus:ring-offset-2 focus:ring-ens-light-blue-bright dark:focus:ring-ens-dark-blue-bright focus:outline-none; /* */ - @apply rounded-lg py-2.5 px-5; -} - -.btn-red-primary { - @apply bg-ens-light-red-primary dark:bg-ens-dark-red-primary; - @apply text-ens-light-text-accent dark:text-ens-dark-text-accent; - @apply hover:bg-ens-light-red-bright dark:hover:bg-ens-dark-red-bright hover:text-ens-light-text-accent hover:dark:text-ens-dark-text-accent; - @apply active:bg-ens-light-red-bright dark:active:bg-ens-dark-red-bright; /* */ - @apply focus:ring focus:ring-offset-2 focus:ring-ens-light-red-bright dark:focus:ring-ens-dark-red-bright focus:outline-none; /* */ - @apply rounded-lg py-2.5 px-5; -} - -.btn-disabled { - @apply bg-ens-light-background-disabled dark:bg-ens-dark-background-disabled; - @apply text-ens-light-text-disabled dark:text-ens-dark-text-disabled; - @apply rounded-lg py-2.5 px-5; -} - -.btn-subtle { - @apply bg-ens-light-background-primary dark:bg-ens-dark-background-primary; - @apply text-ens-light-text-secondary dark:text-ens-dark-text-secondary; - @apply hover:bg-ens-light-background-secondary dark:hover:bg-ens-dark-background-secondary hover:text-ens-light-text-secondary hover:dark:text-ens-dark-text-secondary; - @apply active:bg-ens-light-blue-bright dark:active:bg-ens-dark-blue-bright; /* */ - @apply focus:ring focus:ring-offset-2 focus:ring-ens-light-border dark:focus:ring-ens-dark-border focus:outline-none; /* */ - @apply border border-ens-light-border dark:border-ens-dark-border; - @apply rounded-lg py-2.5 px-5; - @apply font-bold; -} - -.input { - @apply block w-full border border-ens-light-border dark:border-ens-dark-border; - @apply outline-none; - @apply focus:ring focus:ring-offset-2 focus:ring-ens-light-blue-bright dark:focus:ring-ens-dark-blue-bright focus:outline-none; /* */ - @apply rounded-lg py-2 px-5; -} - -.helper-green { - @apply flex items-center gap-2 text-ens-light-text-primary dark:text-ens-dark-text-primary rounded-lg p-4 bg-ens-light-green-surface dark:bg-ens-dark-green-surface border border-ens-light-green-primary dark:border-ens-dark-green-primary; -} - -.helper-green svg { - @apply text-ens-light-green-primary dark:text-ens-dark-green-primary text-2xl; -} - -.tag { - @apply inline-flex items-center justify-center gap-1 rounded-2xl px-3 py-0.5 w-fit text-sm h-fit; -} - -.tag-blue { - @apply text-ens-light-blue-primary dark:text-ens-dark-blue-primary bg-ens-light-blue-surface dark:bg-ens-dark-blue-surface; -} - -.tag-yellow { - @apply text-ens-light-yellow-active dark:text-ens-dark-yellow-active bg-ens-light-yellow-surface dark:bg-ens-dark-yellow-surface; -} - -.tag-grey { - @apply text-ens-light-text-secondary dark:text-ens-dark-text-secondary bg-ens-light-grey-surface dark:bg-ens-dark-grey-surface; -} - -.tag-purple { - @apply text-ens-light-purple-active dark:text-ens-dark-purple-active bg-ens-light-purple-surface dark:bg-ens-dark-purple-surface; -} - -.gh-repo { - @apply mt-0 mb-0; -} - -.ReactModal__Overlay { - @apply bg-ens-light-grey-active/20 dark:bg-ens-dark-grey-active/20; -} - -label.label { - @apply text-ens-light-text-secondary px-2 font-bold; -} - -.card1.card-green { - @apply rounded-2xl bg-ens-light-green-surface dark:bg-ens-dark-green-surface border border-ens-light-green-primary dark:border-ens-dark-green-primary text-ens-light-green-primary dark:text-ens-dark-green-primary; -} -.card1.card-red { - @apply rounded-2xl bg-ens-light-red-surface dark:bg-ens-dark-red-surface border border-ens-light-red-primary dark:border-ens-dark-red-primary text-ens-light-red-primary dark:text-ens-dark-red-primary; -} - -.card1::scrollbar { - @apply rounded-tr-xl overflow-hidden; -} - -.load-width { - animation: load-width 1s ease-out forwards; -} - -@keyframes load-width { - 0% { - width: 0; - } - 100% { - width: 90%; - } -} diff --git a/app/app/layout.tsx b/app/app/layout.tsx deleted file mode 100644 index 78da66ce3..000000000 --- a/app/app/layout.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import './globals.css'; -import 'focus-visible'; -import '@ens-tools/thorin-core/style.css'; - -import { - PropertyValueSpecification, - SearchAction, - WebSite, - WithContext, -} from 'schema-dts'; - -import { Theme } from './theme'; - -export const metadata = { - title: 'ENS Documentation', - description: 'Documentation for the ENS protocol.', -}; - -type CustomSearchAction = SearchAction & { - 'query-input': PropertyValueSpecification | String; -}; - -const searchAction: CustomSearchAction = { - '@type': 'SearchAction', - target: 'https://docs.ens.domains?q={search_term_string}', - 'query-input': 'required name=search_term_string', -}; - -const jsonLD: WithContext = { - '@context': 'https://schema.org', - '@type': 'WebSite', - url: 'https://docs.ens.domains', - name: metadata.title, - description: metadata.description, - potentialAction: searchAction, -}; - -export default function RootLayout(properties) { - const { children } = properties; - - return ( - - - - - - - - ); -} diff --git a/app/app/not-found.tsx b/app/app/not-found.tsx deleted file mode 100644 index f3bb08fc1..000000000 --- a/app/app/not-found.tsx +++ /dev/null @@ -1,33 +0,0 @@ -import Image from 'next/image'; - -import { Button } from '@/components/Button'; -import { Layout } from '@/layout/PageLayout'; - -export default function NotFound() { - return ( - -
- Shrug -

Article Not Found

-

It doesn't look like this page exists...

- -
-
- ); -} diff --git a/app/app/opengraph/[...slug]/route.tsx b/app/app/opengraph/[...slug]/route.tsx deleted file mode 100644 index b5384ba1c..000000000 --- a/app/app/opengraph/[...slug]/route.tsx +++ /dev/null @@ -1,210 +0,0 @@ -import { getPageBySlug } from 'data/get_page'; -import { getAllPageSlugs } from 'data/get_pages'; -import { ImageResponse } from 'next/og'; -import { NextRequest } from 'next/server'; -import { readFile } from 'node:fs/promises'; - -import { navigation } from '#/config/navigation'; - -// eslint-disable-next-line unicorn/prevent-abbreviations -export async function generateStaticParams() { - if (process.env.NODE_ENV !== 'production') return []; - - const pages = await getAllPageSlugs(); - - // return []; - - // TODO: Uncomment - return pages.map((slug) => ({ - slug: (slug + '.png').split('/'), - })); -} - -const fontScale = (length: number) => { - // Max font size: 128 - const max = 100; - // Min font size: 32 - const min = 32; - - // Max length: 30 - // Min length: 3 - - return Math.max( - min, - Math.min(max, Math.round(max - (max - min) * (length / 40))) - ); -}; - -const satoshiBoldFont = readFile('public/fonts/sans-serif/Satoshi-Bold.otf'); -const satoshiMediumFont = readFile( - 'public/fonts/sans-serif/Satoshi-Medium.otf' -); - -// const satoshiFont = fetch( -// new URL(, import.meta.url) -// ).then((response) => response.arrayBuffer()); - -// Image generation -export async function GET(request: NextRequest) { - // ex: /opengraph/web/siwe.png - const { pathname } = request.nextUrl; - - console.log('🖼️ -> ' + pathname); - - // ex web/siwe (remove final .png, and remove /opengraph/) - const slug = pathname.slice(11, -4); - - const section = navigation.protocol.find((section) => - section.activePattern?.test('/' + slug) - )?.name; - - const page = await getPageBySlug(slug); - - return new ImageResponse( - ( - // ImageResponse JSX element -
-
-
- - - - - - - - - - -
-
-
- {page.pageProperties.meta.title} -
- {!!section && ( -
- {section} -
- )} -
-
- Docs -
-
-
- ), - // ImageResponse options - { - // ...size, - width: 1200, - height: 630, - emoji: 'twemoji', - fonts: [ - { - name: 'Satoshi', - data: await satoshiMediumFont, - style: 'normal', - weight: 500, - }, - { - name: 'Satoshi', - data: await satoshiBoldFont, - style: 'normal', - weight: 700, - }, - ], - } - ); -} diff --git a/app/app/page.tsx b/app/app/page.tsx deleted file mode 100644 index ff6f79caa..000000000 --- a/app/app/page.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { getPageBySlug } from 'data/get_page'; -import { ResolvingMetadata } from 'next'; - -import { Layout } from '@/layout/PageLayout'; -import { createMetadata } from '@/lib/metadata'; - -export const generateMetadata = async (_x: any, parent: ResolvingMetadata) => { - const { - pageProperties: { meta }, - } = await getPageBySlug('index'); - const parentMetadata = await parent; - - return createMetadata( - { - title: 'ENS Documentation', - description: meta.description, - path: '/', - }, - parentMetadata, - { - twitter: { - card: 'summary_large_image', - }, - openGraph: { - type: 'article', - images: '/opengraph.png', - }, - } - ); -}; - -export default async function Page() { - const { Page, pageProperties } = await getPageBySlug('index'); - - return ( - - - - ); -} diff --git a/app/app/sitemap.ts b/app/app/sitemap.ts deleted file mode 100644 index 3d4bd5b1e..000000000 --- a/app/app/sitemap.ts +++ /dev/null @@ -1,45 +0,0 @@ -import { glob } from 'glob'; -import { MetadataRoute } from 'next'; -import { join } from 'node:path'; -import simpleGit from 'simple-git'; - -const SLUG_IGNORE = new Set(['dissapeared']); - -const processSlugs = (slug: string) => { - return slug.replace('index', ''); -}; - -const getGitLastUpdatedTimeStamp = async (slug: string) => { - const git = simpleGit({ - baseDir: process.cwd().replace(/\/app$/, ''), - }); - const lastUpdatedTimeStamp = await git.log({ - file: process.cwd().replace(/\/app$/, '') + `/docs/${slug}`, - }); - - return new Date(lastUpdatedTimeStamp.latest.date); -}; - -export default async function sitemap(): Promise { - const files = await glob('**/*.mdx', { - cwd: join(process.cwd(), '../docs'), - }); - - const routes = await Promise.all( - files.map(async (file) => { - const slug = file.replace(/(\/index)?\.mdx$/, ''); - const lastUpdated = await getGitLastUpdatedTimeStamp(file); - - if (SLUG_IGNORE.has(slug)) { - return; - } - - return { - url: 'https://docs.ens.domains/' + processSlugs(slug), - lastModified: lastUpdated, - }; - }) - ); - - return routes.filter(Boolean); -} diff --git a/app/app/theme.tsx b/app/app/theme.tsx deleted file mode 100644 index 4dd982ee3..000000000 --- a/app/app/theme.tsx +++ /dev/null @@ -1,74 +0,0 @@ -'use client'; - -import { QueryClient, QueryClientProvider } from '@tanstack/react-query'; -import { ThemeProvider } from 'next-themes'; -import { useEffect } from 'react'; -import { holesky, mainnet, sepolia } from 'viem/chains'; -import { - createConfig, - http, - useAccount, - useConfig, - WagmiProvider, -} from 'wagmi'; -import { injected, walletConnect } from 'wagmi/connectors'; - -const config = createConfig({ - chains: [mainnet, sepolia, holesky], - connectors: [ - injected({}), - walletConnect({ - projectId: '3b205429cec06896f1d18c3b46dc5a68', - metadata: { - name: 'ENS Documentation', - description: 'Ethereum Name Service Documentation', - icons: ['https://docs.ens.domains/favicon.ico'], - url: 'https://docs.ens.domains', - }, - showQrModal: false, - }), - ], - transports: { - [mainnet.id]: http('https://eth.drpc.org'), - [sepolia.id]: http('https://sepolia.drpc.org'), - [holesky.id]: http('https://holesky.drpc.org'), - }, -}); - -declare module 'wagmi' { - // @ts-ignore - // eslint-disable-next-line unused-imports/no-unused-vars - interface Register { - config: typeof config; - } -} - -const queryClient = new QueryClient(); - -export const Theme = ({ children }) => { - return ( - - - - {children} - - - - - ); -}; - -export const WagmiChild = () => { - const state = useConfig(); - const { address, connector } = useAccount(); - - useEffect(() => { - (async () => { - const { setupConfig } = await import('@ens-tools/thorin-core'); - - setupConfig(() => state || config); - })(); - }, [state, address, connector]); - - return <>; -}; diff --git a/app/data/get_page.tsx b/app/data/get_page.tsx deleted file mode 100644 index 3c3774402..000000000 --- a/app/data/get_page.tsx +++ /dev/null @@ -1,59 +0,0 @@ -import { MDXProps } from 'mdx/types'; -import { notFound } from 'next/navigation'; -import { existsSync } from 'node:fs'; -import { join } from 'node:path'; -import { cache, ReactNode } from 'react'; - -import { - MdxPageProps as MdxPageProperties, - mdxPagePropsSchema as mdxPagePropertiesSchema, -} from '../src/lib/mdxPageProps'; - -const contentDirectory = join(process.cwd(), '../docs'); - -const _getPageBySlug = async ( - // ex 'index' or 'web' or 'web/quickstart' - slug: string -): Promise<{ - Page: (_properties: MDXProps) => ReactNode; - pageProperties: MdxPageProperties; -}> => { - console.log('🔍 -> ' + slug); - - const potentialPaths = [slug, slug + '/index']; - let foundPath: string | undefined; - - for (const path of potentialPaths) { - const exists = existsSync(join(contentDirectory, path + '.mdx')); - - if (exists) { - foundPath = path; - break; - } - } - - if (!foundPath) { - console.warn('Tried to find page by slug but couldnt find:', slug); - - return notFound(); - } - - const file = await import('../../docs/' + foundPath + '.mdx'); - - const { default: Page, ...rawPageProperties } = - file as MdxPageProperties & { - default: (_properties: MDXProps) => ReactNode; - }; - - const pageProperties = mdxPagePropertiesSchema.parse(rawPageProperties); - - if (!pageProperties.meta.title || pageProperties.meta.title == '') - pageProperties.meta.title = pageProperties.title; - - return { - pageProperties, - Page, - }; -}; - -export const getPageBySlug = cache(_getPageBySlug); diff --git a/app/data/get_pages.ts b/app/data/get_pages.ts deleted file mode 100644 index 731986931..000000000 --- a/app/data/get_pages.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { glob } from 'glob'; -import { join } from 'node:path'; -import { cache } from 'react'; - -const contentDirectory = join(process.cwd(), '../docs'); - -const _getAllPageSlugs = async () => { - console.log('🧹 GLOBBING DA FILES'); - - const files = await glob('**/*.mdx', { cwd: contentDirectory }); - - return files.map((file) => file.replace(/(\/index)?\.mdx$/, '')); -}; - -export const getAllPageSlugs = cache(_getAllPageSlugs); diff --git a/app/jsconfig.json b/app/jsconfig.json deleted file mode 100644 index 2c8ee2bb0..000000000 --- a/app/jsconfig.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "compilerOptions": { - "baseUrl": ".", - "paths": { - "@/*": ["src/*"] - } - } -} diff --git a/app/local/config/languages.ts b/app/local/config/languages.ts deleted file mode 100644 index adc343582..000000000 --- a/app/local/config/languages.ts +++ /dev/null @@ -1,114 +0,0 @@ -import { configureLanguages } from '#/content/prose/code/types/language'; - -export const LanguagePresets = configureLanguages({ - typescript: { - icon: '/icons/libraries/typescript.png', - name: 'Typescript', - language: 'typescript', - fallback: ['javascript'], - }, - javascript: { - icon: '/icons/libraries/javascript.png', - name: 'Javascript', - language: 'javascript', - fallback: [], - }, - 'ethers-v5': { - icon: '/icons/libraries/ethers.svg', - language: 'typescript', - name: 'Ethers.js v5', - fallback: ['typescript', 'javascript'], - }, - viem: { - icon: '/icons/libraries/viem.svg', - language: 'typescript', - name: 'Viem', - fallback: ['typescript', 'javascript'], - }, - 'ethers-rs': { - icon: '/icons/libraries/rust.svg', - name: 'Ethers.rs', - language: 'rust', - }, - 'go-ens': { - icon: '/icons/libraries/go.svg', - name: 'Go', - language: 'go', - }, - 'alchemy-sdk': { - icon: '/icons/libraries/alchemy.svg', - name: 'Alchemy SDK', - language: 'typescript', - fallback: ['typescript', 'javascript'], - }, - react: { - icon: '/icons/libraries/react.svg', - name: 'React', - language: 'typescript', - fallback: ['typescript'], - }, - wagmi: { - icon: '/icons/libraries/wagmi.svg', - name: 'Wagmi', - language: 'typescript', - fallback: ['enstools', 'react', 'viem', 'typescript', 'javascript'], - }, - ensjs: { - icon: '/icons/libraries/ensjs.svg', - name: 'ENSjs v3', - language: 'typescript', - fallback: ['wagmi', 'react', 'viem', 'typescript', 'javascript'], - }, - rainbowkit: { - icon: '/icons/libraries/rainbow.svg', - name: 'Rainbowkit', - language: 'typescript', - fallback: [ - 'enstools', - 'wagmi', - 'react', - 'viem', - 'typescript', - 'javascript', - ], - }, - connectkit: { - icon: '/icons/libraries/family.svg', - name: 'Connectkit', - language: 'typescript', - fallback: [ - 'enstools', - 'wagmi', - 'react', - 'viem', - 'typescript', - 'javascript', - ], - }, - enstools: { - icon: '/icons/libraries/family.svg', - name: 'ENS Tools', - language: 'typescript', - fallback: ['wagmi', 'react', 'viem', 'typescript', 'javascript'], - }, - web3py: { - icon: '', - name: 'web3.py', - language: 'python', - fallback: [], - }, - solidity: { - icon: '/icons/libraries/solidity.svg', - name: 'Solidity', - language: 'solidity', - fallback: [], - }, - nethereum: { - icon: '/icons/libraries/nethereum.svg', - name: 'Nethereum', - language: 'csharp', - fallback: [], - }, -}); - -export type languages = keyof typeof LanguagePresets; diff --git a/app/local/config/navigation.ts b/app/local/config/navigation.ts deleted file mode 100644 index 4b55581cc..000000000 --- a/app/local/config/navigation.ts +++ /dev/null @@ -1,43 +0,0 @@ -import { ReactNode } from 'react'; - -import { navigation as protocolNavigation } from './navigation/protocol'; - -export type SectionData = { - name: string; - href: string; - icon: ReactNode; - activePattern?: RegExp; - links: routeGroup[]; - expanded?: boolean; -}; - -export const isSectionData = (element: any): element is SectionData => { - return (element as SectionData).name !== undefined; -}; - -export type routeLink = { - title: string; - href: string; - icon?: string; - external?: boolean; - wip?: number | boolean; - design_wip?: boolean; -}; - -export type routeGroup = { - title: string; - icon?: string; - links: routeElement[]; -}; - -export type routeElement = routeGroup | routeLink; -export const isRouteLink = (element: routeElement): element is routeLink => { - return (element as routeLink).href !== undefined; -}; -export const isRouteGroup = (element: routeElement): element is routeGroup => { - return (element as routeGroup).links !== undefined; -}; - -export const navigation = { - protocol: protocolNavigation, -}; diff --git a/app/local/config/navigation/protocol.ts b/app/local/config/navigation/protocol.ts deleted file mode 100644 index c98eca138..000000000 --- a/app/local/config/navigation/protocol.ts +++ /dev/null @@ -1,869 +0,0 @@ -/* eslint-disable sonarjs/no-duplicate-string */ -import { SectionData } from '../navigation'; - -export const showWIP = false; - -export const navigation: SectionData[] = [ - { - name: 'Intro', - href: '/learn/protocol', - icon: '🏠', - activePattern: /^\/((learn|terminology|changelog|bugs|faq)(\/.*)?)?$/, - links: [ - { - title: 'Learn', - icon: '🧑‍🎓', - links: [ - { - title: 'The Protocol', - href: '/learn/protocol', - icon: '📖', - }, - { - title: 'Deployments', - href: '/learn/deployments', - icon: '📰', - }, - { - title: 'Resolution', - href: '/learn/resolution', - icon: '🔍', - }, - { title: 'DNS Names', href: '/learn/dns', icon: '🌐' }, - { - title: 'Layer 2 & Offchain', - icon: '🔗', - href: '/learn/ccip-read', - }, - ], - }, - { - title: 'Other', - icon: '📰', - links: [ - { - title: 'Frequently Asked Questions', - href: '/faq', - icon: '📓', - }, - { - title: 'Terminology', - href: '/terminology', - icon: '📓', - }, - { - title: 'Bug Bounties', - href: '/bugs', - icon: '🪲', - }, - { - title: 'Changelog', - href: '/changelog', - icon: '📝', - }, - ], - }, - ], - }, - { - name: 'Using ENS', - href: '/web', - icon: '📖', - activePattern: /^\/d?web(\/.*)?/, - links: [ - { - title: '', - links: [ - { - title: 'Quickstart', - href: '/web/quickstart', - icon: '⚡', - }, - { - title: 'Getting Started', - href: '/web', - icon: '👋', - }, - { - title: 'Tools and Libraries', - href: '/web/libraries', - icon: '🛠️', - }, - ], - }, - { - title: 'Web & Querying', - icon: '🌐', - links: [ - { - title: 'Addresses', - href: '/web/resolution', - icon: '🔍', - }, - { - title: 'Text Records', - href: '/web/records', - icon: '🔍', - }, - { title: 'Avatars', href: '/web/avatars', icon: '🔍' }, - { - title: 'Primary Names', - href: '/web/reverse', - icon: '🔍', - }, - { - title: 'Listing Names', - href: '/web/enumerate', - icon: '🔍', - }, - ], - }, - { - title: 'Advanced', - icon: '⚙️', - links: [ - { - title: 'Decentralized Web', - href: '/dweb/intro', - }, - { - title: 'Issuing Subdomains', - href: '/web/subdomains', - }, - { - title: 'Naming Smart-contracts', - href: '/web/naming-contracts', - }, - { - // eslint-disable-next-line quotes - title: "Layer 2's & Multichain", - href: '/web/multichain', - icon: '⛓️', - }, - { - title: 'Subgraph', - href: '/web/subgraph', - }, - // { - // title: 'Sign In With Ethereum (SIWE)', - // href: '/web/siwe', - // wip: 80, - // icon: '✍️', - // }, - ], - }, - { - title: 'Design', - icon: '🖼️', - links: [ - // { - // title: 'Guidelines', - // href: '/web/design', - // }, - { - title: 'Thorin', - href: 'https://thorin.ens.domains/', - external: true, - }, - { - title: 'Brand', - href: 'https://ens.domains/brand', - external: true, - }, - ], - }, - ], - }, - { - name: 'Smart Contracts', - href: '/contracts', - icon: '⚙️', - activePattern: - /^\/(resolvers|contracts|wrapper|registry|resolution|dns)(\/.*)?/, - links: [ - { - title: '', - links: [ - { - title: 'Overview', - href: '/contracts', - icon: '👋', - }, - ], - }, - { - title: 'Resolution', - icon: '🌐', - links: [ - { - title: 'Resolution Process', - href: '/resolution', - wip: true, - icon: '✨', - }, - { - title: 'Name Processing', - href: '/resolution/names', - icon: '⚙️', - }, - ], - }, - { - title: 'Resolvers', - icon: '🗺️', - links: [ - { - title: 'Start Here', - href: '/resolvers/quickstart', - icon: '✨', - }, - { - title: 'Public Resolver', - href: '/resolvers/public', - wip: 55, - icon: '🏛️', - }, - { - title: 'Interacting with a resolver', - href: '/resolvers/interacting', - wip: 55, - icon: '👉', - }, - { - title: 'Writing your own resolver', - href: '/resolvers/writing', - wip: 45, - icon: '✍️', - }, - { - title: 'Cross Chain Resolvers', - href: '/resolvers/ccip-read', - icon: '⛓️', - }, - { - title: 'Universal Resolver', - href: '/resolvers/universal', - wip: 70, - icon: '✍️', - }, - { - title: 'Interface Reference', - href: '/resolvers/interfaces', - wip: 70, - icon: '✍️', - }, - ], - }, - { - title: 'Registries', - icon: '🏛️', - links: [ - { - title: 'The Registry', - href: '/registry/ens', - icon: '🗒️', - }, - { - title: 'ETH Registrar', - href: '/registry/eth', - icon: '🗒️', - }, - { - title: 'DNS Registrar', - href: '/registry/dns', - icon: '🗒️', - }, - { - title: 'TLDs List', - href: '/dns/tlds', - }, - // { - // title: 'Test Registrar', - // href: '/registry/test', - // wip: true, - // icon: '🗒️', - // }, - { - title: 'Reverse Registrar', - href: '/registry/reverse', - icon: '🗒️', - }, - // { - // title: 'Authoring a registry', - // wip: true, - // href: '/registry/writing', - // icon: '✍️', - // }, - ], - }, - { - title: 'Namewrapper', - icon: '🎁', - links: [ - { - title: 'Overview', - href: '/wrapper/overview', - icon: '📰', - }, - { - title: 'Wrapped States', - href: '/wrapper/states', - icon: '🗒️', - }, - { - title: 'Fuses', - href: '/wrapper/fuses', - icon: '🧨', - }, - { - title: 'Expiry', - href: '/wrapper/expiry', - icon: '🕰️', - }, - { - title: 'Contract Details', - href: '/wrapper/contracts', - icon: '🔍', - }, - { - title: 'Use-Cases', - href: '/wrapper/usecases', - icon: '✨', - }, - { - title: 'Creating a Subname Registrar', - href: '/wrapper/creating-subname-registrar', - icon: '🕹️', - }, - ], - }, - ], - }, - { - name: 'Governance', - href: '/dao', - icon: '🏛️', - activePattern: /^\/(dao|governance)(\/.*)?/, - links: [ - { - title: '', - links: [{ title: 'Welcome', href: '/dao' }], - }, - { - title: 'The interesting bits', - links: [ - { - title: 'Constitution', - href: '/dao/constitution', - }, - { title: 'Foundation', href: '/dao/foundation' }, - { title: 'Token & Airdrop', href: '/dao/token' }, - ], - }, - { - title: 'Good to know', - links: [ - { - title: 'Submit Proposal', - href: '/dao/proposals/submit', - }, - { - title: 'DAO Stewards', - href: '/dao/stewards', - }, - { - title: 'Working Group Rules', - href: '/dao/wg/rules', - }, - ], - }, - { - title: 'Links', - links: [ - { - title: 'Discourse', - href: 'https://discuss.ens.domains', - external: true, - }, - { - title: 'Snapshot', - href: 'https://snapshot.org/#/ens.eth', - external: true, - }, - { - title: 'Tally', - href: 'https://www.withtally.com/governance/ens', - external: true, - }, - { - title: 'Sybil', - href: 'https://sybil.org/#/delegates/ens', - external: true, - }, - ], - }, - { - title: 'Proposals Term 6', - links: [ - { - title: '6.3 - [Social] Renew Service Provider Budget', - href: '/dao/proposals/6.3', - }, - { - title: '6.2 - [Executable] Endowment expansion (3rd tranche)', - href: '/dao/proposals/6.2', - }, - { - title: '6.1 - [Executable] Convert 6,000 ETH to USDC for DAO Operating Expenses', - href: '/dao/proposals/6.1', - }, - ], - }, - { - title: 'Proposals Term 5', - links: [ - { - title: '5.29 - [Executable] Funding request for Unruggable to build and operate a network of gateways', - href: '/dao/proposals/5.29', - }, - { - // eslint-disable-next-line quotes - title: "5.28 - [Executable] Reimbursement of eth.limo's ongoing legal fees", - href: '/dao/proposals/5.28', - }, - { - title: '5.27 - [Executable] Revoke the DAO’s ability to upgrade the name wrapper', - href: '/dao/proposals/5.27', - }, - { - title: '5.26 - [Executable] Implementation of [EP 5.19]’s ENS Governance Distribution Pilot Program', - href: '/dao/proposals/5.26', - }, - { - title: '5.25 - [Executable] Collective Working Group Funding Request (Oct 2024) - Resubmission', - href: '/dao/proposals/5.25', - }, - { - title: '5.24 - [Executable] Term 5 Q4, Collective Working Group Funding Proposal', - href: '/dao/proposals/5.24', - }, - { - // eslint-disable-next-line quotes - title: "5.23 - [Executable] blockful's governance security bounty", - href: '/dao/proposals/5.23', - }, - { - title: '5.22 - [Executable] ENSv2 Development Funding', - href: '/dao/proposals/5.22', - }, - { - title: '5.21 - [Social] Governance Security Bounty', - href: '/dao/proposals/5.21', - }, - { - title: '5.20 - [Social] ENS Endowment Investment Policy Statement ', - href: '/dao/proposals/5.20', - }, - { - title: '5.19 - [Social] Governance Distribution Pilot Program', - href: '/dao/proposals/5.19', - }, - { - title: '5.18 - [Social] ENS DAO Steward Compensation Structure - Term 6', - href: '/dao/proposals/5.18', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.17.3 - [Social] Funding Request: ENS Public Goods Working Group', - href: '/dao/proposals/5.17.3', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.17.2 - [Social] Funding Request: ENS Ecosystem Working Group', - href: '/dao/proposals/5.17.2', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.17.1 - [Social] Funding Request: ENS Meta-Governance Working Group', - href: '/dao/proposals/5.17.1', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.16 - [Executable] Reimbursement of ENS Labs’ legal fees in eth.link litigation', - href: '/dao/proposals/5.16', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.15 - [Social] ENS Governor Improvement Proposal: ProposalBond', - href: '/dao/proposals/5.15', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.14 - [Executable] Endowment permissions to karpatkey - Update #4', - href: '/dao/proposals/5.14', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.13 - [Executable] Security Council', - href: '/dao/proposals/5.13', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.12 - [Executable] Roles Modifier V2 Migration & Updates to Endowment Permissions', - href: '/dao/proposals/5.12', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.11 - [Executable] Fund the Meta-Governance Working Group (Term 5)', - href: '/dao/proposals/5.11', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.10 - [Social] Confirming the ENS DAO Security Council Members', - href: '/dao/proposals/5.10', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.9 - [Social] Funding Request: ENS Meta-Governance Working Group Term 5 (Q1/Q2)', - href: '/dao/proposals/5.9', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.8 - [Social] ENS Steward Vesting Proposal', - href: '/dao/proposals/5.8', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.7 - [Social] Security Council', - href: '/dao/proposals/5.7', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.6 - [Executable] Enable Self-Funding for the Endowment', - href: '/dao/proposals/5.6', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.5 - [Executable] Funding Request: ENS Public Goods Working Group Term 5 (Q1/Q2)', - href: '/dao/proposals/5.5', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.4.2 - [Social] Funding Request: ENS Meta-Governance Working Group Term 5 (Q1/Q2)', - href: '/dao/proposals/5.4.2', - }, - { - // eslint-disable-next-line prettier/prettier - title: '5.4.1 - [Social] Funding Request: ENS Meta-Governance Working Group Term 5 (Q1/Q2)', - href: '/dao/proposals/5.4.1', - }, - { - // eslint-disable-next-line quotes - title: "5.3 - [Social] Determine ENS Labs' next steps in eth.link litigation", - href: '/dao/proposals/5.3', - }, - { - title: '5.2 - [Executable] Commence Streams for Service Providers', - href: '/dao/proposals/5.2', - }, - { - title: '5.1 - [Executable] Upgrade DNSSEC support', - href: '/dao/proposals/5.1', - }, - ], - }, - { - title: 'Proposals Term 4', - links: [ - { - title: '4.10 - [Social] Transfer ENS Root Key Ownership to the ENS DAO', - href: '/dao/proposals/4.10', - }, - { - title: '4.9 - [Social] Select providers for EP4.7 streams', - href: '/dao/proposals/4.9', - }, - { - title: '4.8 - [Social] Amend working groups rules to extend to a full year', - href: '/dao/proposals/4.8', - }, - { - title: '4.7 - [Social] Create Service Provider Streams', - href: '/dao/proposals/4.7', - }, - { - title: '4.6 - [Executable] October 2023 Working Group Funding', - href: '/dao/proposals/4.6', - }, - { - title: '4.5 - [Executable] Endowment permissions to karpatkey - Update #3', - href: '/dao/proposals/4.5', - }, - { - title: '4.4.3 - [Social] Funding Request: Public Goods Working Group', - href: '/dao/proposals/4.4.3', - }, - { - title: '4.4.2 - [Social] Funding Request: ENS Meta-Goverance Working Group', - href: '/dao/proposals/4.4.2', - }, - { - title: '4.4.1 - [Social] Funding Request: ENS Ecosystem Working Group', - href: '/dao/proposals/4.4.1', - }, - { - title: '4.3 - [Executable] Refund Invalid .eth Names', - href: '/dao/proposals/4.3', - }, - { - title: '4.2 - [Executable] Fund the Endowment (second tranche)', - href: '/dao/proposals/4.2', - }, - { - title: '4.1 - [Executable] Approve further actions and strategies for the Endowment', - href: '/dao/proposals/4.1', - }, - ], - }, - { - title: 'Proposals Term 3', - links: [ - { - title: '3.7 - [Social] Approval of ENS Name Normalization Standard (ENSIP-15)', - href: '/dao/proposals/3.7', - }, - { - title: '3.6 - [Social] Election of new ENS Foundation director', - href: '/dao/proposals/3.6', - }, - { - title: '3.5 - [Executable] Activate new .eth Controller and Reverse Registrar', - href: '/dao/proposals/3.5', - }, - { - title: '3.4 - [Executable] Fund the Endowment (first tranche)', - href: '/dao/proposals/3.4', - }, - { - title: '3.3 - [Executable] Sell ETH to USDC', - href: '/dao/proposals/3.3', - }, - { - title: '3.2 - [Executable] Q1/Q2 2023 Working Group Funding', - href: '/dao/proposals/3.2', - }, - { - title: '3.1.3 - [Social] Q1/Q2 2023 Funding Request: Public Goods Working Group', - href: '/dao/proposals/3.1.3', - }, - { - title: '3.1.2- [Social] Q1/Q2 2023 Funding Request: Meta-Governance Working Group', - href: '/dao/proposals/3.1.2', - }, - { - title: '3.1.1 - [Social] Q1/Q2 2023 Funding Request: ENS Ecosystem Working Group', - href: '/dao/proposals/3.1.1', - }, - ], - }, - { - title: 'Proposals Term 2', - links: [ - { - title: '2.2.5 - [Social] Selection of an ENS endowment fund manager', - href: '/dao/proposals/2.2.5', - }, - { - title: '2.2.4 - [Social] ENS Endaoment RFP', - href: '/dao/proposals/2.2.4', - }, - { - title: '2.2.3 - [Executable] Q3 & Q4 2022 Public Goods WG Budget', - href: '/dao/proposals/2.2.3', - }, - { - title: '2.2.2 - [Executable] Q3 & Q4 2022 Ecosystem WG Budget', - href: '/dao/proposals/2.2.2', - }, - { - title: '2.2.1 - [Executable] Q3 & Q4 2022 Meta-Governance WG Budget', - href: '/dao/proposals/2.2.1', - }, - { - title: '2.1 - [Executable] Funding True Names Ltd', - href: '/dao/proposals/2.1', - }, - ], - }, - { - title: 'Proposals Term 1', - links: [ - { - title: '1.9 - [Executable] Fund the Protocol Guild pilot with 200,000 $ENS', - href: '/dao/proposals/1.9', - }, - { - title: '1.8 - [Social] Working Group Rules', - href: '/dao/proposals/1.8', - }, - { - title: '1.7 - [Executable] End the $ENS and EP2 airdrops', - href: '/dao/proposals/1.7', - }, - { - title: '1.6 - [Executable] A DAO-Governed Identity Server', - href: '/dao/proposals/1.6', - }, - { - title: '1.5 - [Executable] Change to Exponential Premium Price Oracle', - href: '/dao/proposals/1.5', - }, - { - title: '1.4 - [Executable] Reimburse True Names for expenses and tax obligations incurred for the DAO', - href: '/dao/proposals/1.4', - }, - { - title: '1.3.4 - [Executable] Q1 & Q2 2022 Public Goods WG Budget', - href: '/dao/proposals/1.3.4', - }, - { - title: '1.3.3 - [Executable] Q1 & Q2 2022 Community WG Budget', - href: '/dao/proposals/1.3.3', - }, - { - title: '1.3.2 - [Executable] Q1 & Q2 2022 ENS Ecosystem WG Budget', - href: '/dao/proposals/1.3.2', - }, - { - title: '1.3.1 - [Executable] Q1 & Q2 2022 Meta-Governance WG Budget', - href: '/dao/proposals/1.3.1', - }, - { - title: '1.2.2 - [Social] Election of a new Director of The ENS Foundation', - href: '/dao/proposals/1.2.2', - }, - { - title: '1.2.1 - [Social] Removal of Brantly Millegan as Director of the ENS Foundation', - href: '/dao/proposals/1.2.1', - }, - { - title: '1.1 - [Executable] Set the temporary premium start price to $100,000', - href: '/dao/proposals/1.1', - }, - ], - }, - { - title: 'Proposals Term 0', - links: [ - { - title: '0.4 - [Social] Proposal: Creation of Foundational Working Groups and Working Group Rules', - href: '/dao/proposals/0.4', - }, - { - title: '0.3 - [Social] Amend airdrop proposal to include accidentally returned funds', - href: '/dao/proposals/0.3', - }, - { - // eslint-disable-next-line quotes - title: "0.2 - [Executable] Retrospective airdrop for accounts that owned another account's primary ENS 1", - href: '/dao/proposals/0.2', - }, - { - title: '0.1 - [Social] Proposal: Transfer ENS Treasury and Contract Ownership', - href: '/dao/proposals/0.1', - }, - ], - }, - ], - }, - { - name: 'Improvement Proposals', - href: '/ensip', - icon: '📜', - activePattern: /^\/(standards|ensip)(\/.*)?/, - links: [ - { - title: '', - links: [ - { title: 'What is an ENSIP?', href: '/ensip', icon: '👋' }, - ], - }, - { - title: 'Proposals', - icon: '📖', - links: [ - { title: '1 - ENS', href: '/ensip/1' }, - { title: '2 - Hash Registrar', href: '/ensip/2' }, - { - title: '3 - Reverse Resolution', - href: '/ensip/3', - }, - { title: '4 - Contract ABIs', href: '/ensip/4' }, - { title: '5 - Text Records', href: '/ensip/5' }, - { title: '6 - DNS-in-ENS', href: '/ensip/6' }, - { title: '7 - Contenthash', href: '/ensip/7' }, - { - title: '8 - Interface Discovery', - href: '/ensip/8', - }, - { - title: '9 - Multichain Addresses', - href: '/ensip/9', - }, - { - title: '10 - Wildcard Resolution', - href: '/ensip/10', - }, - { - title: '11 - EVM Compatible Chain Address', - href: '/ensip/11', - }, - { - title: '12 - Avatar Text Records', - href: '/ensip/12', - }, - { - title: '13 - SAFE Authentication', - href: '/ensip/13', - }, - { - title: '14 - On-chain Source Parameter', - href: '/ensip/14', - }, - { - title: '15 - ENS Name Normalization Standard', - href: '/ensip/15', - }, - { - title: '16 - Offchain Metadata', - href: '/ensip/16', - }, - { - title: '17 - Gasless DNS Resolution', - href: '/ensip/17', - }, - { - title: '18 - Profile Text Records', - href: '/ensip/18', - }, - { - title: '19 - EVM-chain Reverse Resolution', // '19 - Multichain Primary Names', - href: '/ensip/19', - }, - { - title: '20 - Wildcard Writing', - href: '/ensip/20', - }, - ], - }, - ], - }, - // TODO: Uncomment this - // { - // name: 'Learn', - // href: '/learn/protocol', - // icon: '🎓', - // activePattern: /^\/learn(\/.*)?/, - // links: [], - // }, -]; diff --git a/app/local/content/demos/LiveDemo.tsx b/app/local/content/demos/LiveDemo.tsx deleted file mode 100644 index b95802eae..000000000 --- a/app/local/content/demos/LiveDemo.tsx +++ /dev/null @@ -1,80 +0,0 @@ -import { FC } from 'react'; -import { holesky, mainnet, sepolia } from 'viem/chains'; - -import { DemoBorder } from './border/Border'; -import { ETHRegistryDemo } from './ethregistry/ETHRegistryDemo'; -import { ETHRegistryRenewDemo } from './ethregistryrenew/ETHRegistryRenewDemo'; -import { ListNamesDemo } from './listnames/ListNamesDemo'; -import { NameLookupDemo } from './namelookup/NameLookup'; -import { ResolverPlaygroundDemo } from './resolverplayground'; -import { ResolverTestDemo } from './resolvertest'; -import { ReverseSetNameForDemo } from './reverse-set-name-for/ReverseSetNameForDemo'; -import { SendTransactionDemo } from './send-transaction/SendTransaction'; -import { SiweDemo } from './siwe/SiweDemo'; - -const demos = { - ethregistry: { - title: 'Register a name', - wallet: true, - chains: new Set([mainnet.id, sepolia.id]), - component: ETHRegistryDemo, - }, - ethregistry_renew: { - title: 'Renew a name', - wallet: true, - chains: new Set([mainnet.id, sepolia.id]), - component: ETHRegistryRenewDemo, - }, - name_lookup: { - title: 'Name Lookup', - wallet: false, - component: NameLookupDemo, - }, - siwe: { - title: 'SIWE', - wallet: true, - component: SiweDemo, - }, - resolver_test: { - title: 'Resolver Test', - wallet: true, - component: ResolverTestDemo, - }, - send_transaction: { - title: 'Send Transaction', - wallet: true, - component: SendTransactionDemo, - }, - reversesetnamefordemo: { - title: 'Reverse Set Name For', - wallet: true, - chains: new Set([mainnet.id]), - component: ReverseSetNameForDemo, - }, - listnamesdemo: { - title: 'List Names', - wallet: true, - chains: new Set([mainnet.id, sepolia.id, holesky.id]), - component: ListNamesDemo, - }, - resolverdemo: { - title: 'Resolver Playground', - wallet: true, - chains: new Set([mainnet.id, sepolia.id, holesky.id]), - component: ResolverPlaygroundDemo, - }, -}; - -export const LiveDemo: FC<{ id?: string }> = ({ id }) => { - const demo = demos[id]; - - return ( - - {demo.component && } - - ); -}; diff --git a/app/local/content/demos/border/Border.tsx b/app/local/content/demos/border/Border.tsx deleted file mode 100644 index 53e636958..000000000 --- a/app/local/content/demos/border/Border.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { FC, PropsWithChildren } from 'react'; - -import { BorderConnection } from './BorderConnection'; - -export const DemoBorder: FC< - PropsWithChildren<{ - showConnect: boolean; - title: string; - chains?: Set; - }> -> = ({ children, showConnect, title, chains }) => { - return ( -
-
-
{title}
-
{showConnect && }
-
-
- {children} -
-
- ); -}; diff --git a/app/local/content/demos/border/BorderConnection.tsx b/app/local/content/demos/border/BorderConnection.tsx deleted file mode 100644 index 8e1fdd38c..000000000 --- a/app/local/content/demos/border/BorderConnection.tsx +++ /dev/null @@ -1,65 +0,0 @@ -'use client'; - -import { formatAddress } from 'ens-tools'; -import { FC, useLayoutEffect, useRef, useState } from 'react'; -import { FaWallet } from 'react-icons/fa6'; -import { useAccount, useEnsAvatar, useEnsName } from 'wagmi'; - -import { Button } from '@/components/Button'; - -import { ChainSwitcher } from './ChainSwitcher'; - -export const BorderConnection: FC<{ chains?: Set }> = ({ chains }) => { - const { isConnected, address, connector } = useAccount(); - const { data: name } = useEnsName({ address }); - const { data: avatar } = useEnsAvatar({ name }); - const [isOpen, setIsOpen] = useState(false); - const connectModalReference = useRef(null); - - useLayoutEffect(() => { - connectModalReference?.current?.addEventListener('onClose', () => { - setIsOpen(false); - }); - }, [connectModalReference]); - - return ( -
- {/* setIsOpen(false)} /> */} - {!isConnected && ( - - )} - {/* @ts-ignore */} - - {/* @ts-ignore */} - - - {isConnected && ( -
- - -
- )} -
- ); -}; diff --git a/app/local/content/demos/border/ChainSwitcher.tsx b/app/local/content/demos/border/ChainSwitcher.tsx deleted file mode 100644 index e57c6cff1..000000000 --- a/app/local/content/demos/border/ChainSwitcher.tsx +++ /dev/null @@ -1,69 +0,0 @@ -/* eslint-disable unicorn/no-nested-ternary */ -import { FC } from 'react'; -import { holesky, mainnet, sepolia } from 'viem/chains'; -import { useChainId, useSwitchChain } from 'wagmi'; - -export const ChainSwitcher: FC<{ available?: Set }> = ({ - available = new Set([5]), -}) => { - const { chains, error, switchChainAsync } = useSwitchChain(); - const chainId = useChainId(); - // const { isConnected, address, connector } = useAccount(); - // const { connect, connectors } = useConnect(); - // const { disconnectAsync } = useDisconnect(); - - const illegalChain = chainId && !available.has(chainId); - - return ( -
- {illegalChain && ( -
-
Chain not available
-
- )} - -
- ); -}; diff --git a/app/local/content/demos/call/EthCall.tsx b/app/local/content/demos/call/EthCall.tsx deleted file mode 100644 index e14efb12a..000000000 --- a/app/local/content/demos/call/EthCall.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import clsx from 'clsx'; -import { FC, PropsWithChildren, ReactNode } from 'react'; - -type AllProperties = { - call: ReactNode; - description?: string; -}; - -type EthCallProperties = { - type?: 'call'; -}; - -type EthTransactionProperties = { - type?: 'transaction'; - gas: string; -}; - -export const EthCall: FC< - PropsWithChildren< - AllProperties & (EthCallProperties | EthTransactionProperties) - > -> = ({ type = 'call', call, children, description }) => { - const is_transaction = type == 'transaction'; - - return ( -
-
-
-
- {is_transaction ? 'Transaction' : 'ETH Call'} -
-
-
- {description} -
-
- {call} -
- {children} -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/DemoSection.tsx b/app/local/content/demos/ethregistry/DemoSection.tsx deleted file mode 100644 index 3f0dd1446..000000000 --- a/app/local/content/demos/ethregistry/DemoSection.tsx +++ /dev/null @@ -1,20 +0,0 @@ -import { FC, PropsWithChildren } from 'react'; - -export const DemoSection: FC> = ({ - name, - children, -}) => { - return ( -
-
- {/* - ETHRegistrarController - */} - - {name} - -
-
{children}
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/ETHRegistryABI.ts b/app/local/content/demos/ethregistry/ETHRegistryABI.ts deleted file mode 100644 index ebea97318..000000000 --- a/app/local/content/demos/ethregistry/ETHRegistryABI.ts +++ /dev/null @@ -1,382 +0,0 @@ -export const ETHRegistrarABI = [ - { - inputs: [ - { - internalType: 'contract BaseRegistrarImplementation', - name: '_base', - type: 'address', - }, - { - internalType: 'contract IPriceOracle', - name: '_prices', - type: 'address', - }, - { - internalType: 'uint256', - name: '_minCommitmentAge', - type: 'uint256', - }, - { - internalType: 'uint256', - name: '_maxCommitmentAge', - type: 'uint256', - }, - { - internalType: 'contract ReverseRegistrar', - name: '_reverseRegistrar', - type: 'address', - }, - { - internalType: 'contract INameWrapper', - name: '_nameWrapper', - type: 'address', - }, - ], - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'commitment', type: 'bytes32' }, - ], - name: 'CommitmentTooNew', - type: 'error', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'commitment', type: 'bytes32' }, - ], - name: 'CommitmentTooOld', - type: 'error', - }, - { - inputs: [ - { internalType: 'uint256', name: 'duration', type: 'uint256' }, - ], - name: 'DurationTooShort', - type: 'error', - }, - { inputs: [], name: 'InsufficientValue', type: 'error' }, - { inputs: [], name: 'MaxCommitmentAgeTooHigh', type: 'error' }, - { inputs: [], name: 'MaxCommitmentAgeTooLow', type: 'error' }, - { - inputs: [{ internalType: 'string', name: 'name', type: 'string' }], - name: 'NameNotAvailable', - type: 'error', - }, - { inputs: [], name: 'ResolverRequiredWhenDataSupplied', type: 'error' }, - { - inputs: [ - { internalType: 'bytes32', name: 'commitment', type: 'bytes32' }, - ], - name: 'UnexpiredCommitmentExists', - type: 'error', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'name', - type: 'string', - }, - { - indexed: true, - internalType: 'bytes32', - name: 'label', - type: 'bytes32', - }, - { - indexed: true, - internalType: 'address', - name: 'owner', - type: 'address', - }, - { - indexed: false, - internalType: 'uint256', - name: 'baseCost', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'premium', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'expires', - type: 'uint256', - }, - ], - name: 'NameRegistered', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: false, - internalType: 'string', - name: 'name', - type: 'string', - }, - { - indexed: true, - internalType: 'bytes32', - name: 'label', - type: 'bytes32', - }, - { - indexed: false, - internalType: 'uint256', - name: 'cost', - type: 'uint256', - }, - { - indexed: false, - internalType: 'uint256', - name: 'expires', - type: 'uint256', - }, - ], - name: 'NameRenewed', - type: 'event', - }, - { - anonymous: false, - inputs: [ - { - indexed: true, - internalType: 'address', - name: 'previousOwner', - type: 'address', - }, - { - indexed: true, - internalType: 'address', - name: 'newOwner', - type: 'address', - }, - ], - name: 'OwnershipTransferred', - type: 'event', - }, - { - inputs: [], - name: 'MIN_REGISTRATION_DURATION', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [{ internalType: 'string', name: 'name', type: 'string' }], - name: 'available', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes32', name: 'commitment', type: 'bytes32' }, - ], - name: 'commit', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - name: 'commitments', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'string', name: 'name', type: 'string' }, - { internalType: 'address', name: 'owner', type: 'address' }, - { internalType: 'uint256', name: 'duration', type: 'uint256' }, - { internalType: 'bytes32', name: 'secret', type: 'bytes32' }, - { internalType: 'address', name: 'resolver', type: 'address' }, - { internalType: 'bytes[]', name: 'data', type: 'bytes[]' }, - { internalType: 'bool', name: 'reverseRecord', type: 'bool' }, - { - internalType: 'uint16', - name: 'ownerControlledFuses', - type: 'uint16', - }, - ], - name: 'makeCommitment', - outputs: [{ internalType: 'bytes32', name: '', type: 'bytes32' }], - stateMutability: 'pure', - type: 'function', - }, - { - inputs: [], - name: 'maxCommitmentAge', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'minCommitmentAge', - outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'nameWrapper', - outputs: [ - { - internalType: 'contract INameWrapper', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'owner', - outputs: [{ internalType: 'address', name: '', type: 'address' }], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'prices', - outputs: [ - { - internalType: 'contract IPriceOracle', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'address', name: '_token', type: 'address' }, - { internalType: 'address', name: '_to', type: 'address' }, - { internalType: 'uint256', name: '_amount', type: 'uint256' }, - ], - name: 'recoverFunds', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'string', name: 'name', type: 'string' }, - { internalType: 'address', name: 'owner', type: 'address' }, - { internalType: 'uint256', name: 'duration', type: 'uint256' }, - { internalType: 'bytes32', name: 'secret', type: 'bytes32' }, - { internalType: 'address', name: 'resolver', type: 'address' }, - { internalType: 'bytes[]', name: 'data', type: 'bytes[]' }, - { internalType: 'bool', name: 'reverseRecord', type: 'bool' }, - { - internalType: 'uint16', - name: 'ownerControlledFuses', - type: 'uint16', - }, - ], - name: 'register', - outputs: [], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [ - { internalType: 'string', name: 'name', type: 'string' }, - { internalType: 'uint256', name: 'duration', type: 'uint256' }, - ], - name: 'renew', - outputs: [], - stateMutability: 'payable', - type: 'function', - }, - { - inputs: [], - name: 'renounceOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [ - { internalType: 'string', name: 'name', type: 'string' }, - { internalType: 'uint256', name: 'duration', type: 'uint256' }, - ], - name: 'rentPrice', - outputs: [ - { - components: [ - { internalType: 'uint256', name: 'base', type: 'uint256' }, - { - internalType: 'uint256', - name: 'premium', - type: 'uint256', - }, - ], - internalType: 'struct IPriceOracle.Price', - name: 'price', - type: 'tuple', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [], - name: 'reverseRegistrar', - outputs: [ - { - internalType: 'contract ReverseRegistrar', - name: '', - type: 'address', - }, - ], - stateMutability: 'view', - type: 'function', - }, - { - inputs: [ - { internalType: 'bytes4', name: 'interfaceID', type: 'bytes4' }, - ], - name: 'supportsInterface', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'pure', - type: 'function', - }, - { - inputs: [ - { internalType: 'address', name: 'newOwner', type: 'address' }, - ], - name: 'transferOwnership', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, - { - inputs: [{ internalType: 'string', name: 'name', type: 'string' }], - name: 'valid', - outputs: [{ internalType: 'bool', name: '', type: 'bool' }], - stateMutability: 'pure', - type: 'function', - }, - { - inputs: [], - name: 'withdraw', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, -]; diff --git a/app/local/content/demos/ethregistry/ETHRegistryDemo.tsx b/app/local/content/demos/ethregistry/ETHRegistryDemo.tsx deleted file mode 100644 index 3937e3ae1..000000000 --- a/app/local/content/demos/ethregistry/ETHRegistryDemo.tsx +++ /dev/null @@ -1,106 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import { FiClock } from 'react-icons/fi'; -import { useAccount, useChainId } from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; - -import { DemoSection } from './DemoSection'; -import { DurationField } from './inputs/DurationField'; -import { GenerateSecret } from './inputs/GenerateSecret'; -import { LabelField } from './inputs/LabelField'; -import { OwnerField } from './inputs/OwnerField'; -import { ResolverField } from './inputs/ResolverField'; -import { AvailabilityCheck } from './stage/AvailabilityCheck'; -import { CommitmentCheck } from './stage/CommitmentCheck'; -import { RentPriceCheck } from './stage/RentPriceCheck'; -import { MakeCommit } from './transactions/MakeCommit'; -import { RegisterName } from './transactions/RegisterName'; - -const title = 'Register a Name (Live Demo)'; - -const Demo = () => { - const { address } = useAccount(); - const chainId = useChainId(); - - /* User Configurable Values */ - const [label, setLabel] = useState('testname123456'); - const [owner, setOwner] = useState( - '0x225f137127d9067788314bc7fcc1f36746a3c3B5' - ); - const [resolver, setResolver] = useState( - '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63' - ); - const [duration, setDuration] = useState(60 * 60 * 24 * 365); - const [secret, setSecret] = useState( - '0x0000000000000000000000000000000000000000000000000000000000000000' - ); - - /* State Values */ - const [available, setAvailable] = useState(false); - const [commithash, setCommithash] = useState(''); - // eslint-disable-next-line unicorn/no-useless-undefined - const [rentPrice, setRentPrice] = useState(undefined); - - const { isConnected } = useAccount(); - - return ( -
-
- {!isConnected &&
Please Connect Wallet
} - - - - - - - - - - - - -
- - Wait 60 seconds. -
- - - - -
-
- ); -}; - -export const ETHRegistryDemo = () => { - return } />; -}; diff --git a/app/local/content/demos/ethregistry/hooks/isAvailable.ts b/app/local/content/demos/ethregistry/hooks/isAvailable.ts deleted file mode 100644 index deb467892..000000000 --- a/app/local/content/demos/ethregistry/hooks/isAvailable.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { mainnet, sepolia } from 'viem/chains'; -import { useChainId, useReadContract } from 'wagmi'; - -import { ETHRegistrarABI } from '../ETHRegistryABI'; - -const deployments = { - [mainnet.id]: '0x253553366Da8546fC250F225fe3d25d0C782303b', - [sepolia.id]: '0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72', -}; - -export const useIsAvailable = (name: string) => { - const chainId = useChainId(); - - const { data, isLoading } = useReadContract({ - address: deployments[chainId] as `0x${string}`, - abi: ETHRegistrarABI, - functionName: 'available', - args: [name], - // enabled: !!name && name.length >= 3, - chainId, - }); - - return { - isAvailable: data as boolean, - isLoadingAvailability: isLoading, - }; -}; diff --git a/app/local/content/demos/ethregistry/hooks/useCommitment.ts b/app/local/content/demos/ethregistry/hooks/useCommitment.ts deleted file mode 100644 index 2757170d5..000000000 --- a/app/local/content/demos/ethregistry/hooks/useCommitment.ts +++ /dev/null @@ -1,40 +0,0 @@ -import { mainnet, sepolia } from 'viem/chains'; -import { useChainId, useReadContract } from 'wagmi'; - -import { ETHRegistrarABI } from '../ETHRegistryABI'; - -const deployments = { - [mainnet.id]: '0x253553366Da8546fC250F225fe3d25d0C782303b', - [sepolia.id]: '0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72', -}; - -export const useCommitment = ( - name: string, - owner: string, - duration: number, - secret: string, - resolver: string -) => { - const chainId = useChainId(); - - const { data, isLoading } = useReadContract({ - address: deployments[chainId] as `0x${string}`, - abi: ETHRegistrarABI, - functionName: 'makeCommitment', - args: [name, owner, duration, secret, resolver, [], false, 0], - // enabled: - // !!name && - // name.length >= 3 && - // !!owner && - // !!duration && - // duration > 0 && - // !!secret && - // !!resolver, - chainId, - }); - - return { - commithash: data as string, - isLoadingCommithash: isLoading, - }; -}; diff --git a/app/local/content/demos/ethregistry/hooks/useRentPrice.ts b/app/local/content/demos/ethregistry/hooks/useRentPrice.ts deleted file mode 100644 index 3c6b6335b..000000000 --- a/app/local/content/demos/ethregistry/hooks/useRentPrice.ts +++ /dev/null @@ -1,27 +0,0 @@ -import { mainnet, sepolia } from 'viem/chains'; -import { useChainId, useReadContract } from 'wagmi'; - -import { ETHRegistrarABI } from '../ETHRegistryABI'; - -const deployments = { - [mainnet.id]: '0x253553366Da8546fC250F225fe3d25d0C782303b', - [sepolia.id]: '0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72', -}; - -export const useRentPrice = (name: string, duration: number) => { - const chainId = useChainId(); - - const { data, isLoading } = useReadContract({ - address: deployments[chainId] as `0x${string}`, - abi: ETHRegistrarABI, - functionName: 'rentPrice', - args: [name, duration], - // enabled: !!name && name.length >= 3 && !!duration && duration > 0, - chainId, - }); - - return { - rentPrice: data as { base: bigint; premium: bigint }, - isLoadingRentPrice: isLoading, - }; -}; diff --git a/app/local/content/demos/ethregistry/inputs/ChainField.tsx b/app/local/content/demos/ethregistry/inputs/ChainField.tsx deleted file mode 100644 index fbfae7a87..000000000 --- a/app/local/content/demos/ethregistry/inputs/ChainField.tsx +++ /dev/null @@ -1,64 +0,0 @@ -/* eslint-disable unicorn/no-nested-ternary */ -import { FC } from 'react'; -import { holesky, mainnet, sepolia } from 'viem/chains'; -import { - useAccount, - useChainId, - useConnect, - useDisconnect, - useSwitchChain, -} from 'wagmi'; - -import { Button } from '@/components/Button'; - -export const ChainField: FC<{ available?: Set }> = ({ - available = new Set([5]), -}) => { - const { chains, error, switchChain } = useSwitchChain(); - const chainId = useChainId(); - const { isConnected, address, connector } = useAccount(); - const { connect, connectors } = useConnect(); - const { disconnectAsync } = useDisconnect(); - - return ( -
- Chain (currently {chainId}) -
- {( - [ - [mainnet.id, 'Mainnet'], - [sepolia.id, 'Sepolia'], - [holesky.id, 'Holesky'], - ] as [number, string][] - ).map(([id, name]) => { - const is_active = id === chainId; - const is_available = available.has(id); - const variant = is_active - ? 'primary' - : is_available - ? 'secondary' - : 'disabled'; - - return ( - - ); - })} -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/inputs/DurationField.tsx b/app/local/content/demos/ethregistry/inputs/DurationField.tsx deleted file mode 100644 index f15b43430..000000000 --- a/app/local/content/demos/ethregistry/inputs/DurationField.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { FC } from 'react'; - -import { Button } from '@/components/Button'; - -export const DurationField: FC<{ - duration: number; - setDuration: (_duration: number) => void; -}> = ({ duration, setDuration }) => { - const id = 'duration'; - - return ( -
- -
- {( - [ - [60 * 60 * 24 * 30, '1 month'], - [60 * 60 * 24 * 365, '1 year'], - [60 * 60 * 24 * 365 * 2, '2 years'], - ] as [number, string][] - ).map(([time, name]) => ( - - ))} - { - try { - setDuration(Number(event.target.value)); - } catch (error) { - event.preventDefault(); - console.log(error); - } - }} - id={id + 'duration'} - className="input max-w-sm" - placeholder="31536000" - /> -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/inputs/GenerateSecret.tsx b/app/local/content/demos/ethregistry/inputs/GenerateSecret.tsx deleted file mode 100644 index b8dba8c7f..000000000 --- a/app/local/content/demos/ethregistry/inputs/GenerateSecret.tsx +++ /dev/null @@ -1,40 +0,0 @@ -// eslint-disable-next-line unicorn/prefer-node-protocol -import { randomBytes } from 'crypto'; -import { FC } from 'react'; -import { FiRefreshCcw } from 'react-icons/fi'; - -import { Button } from '@/components/Button'; - -export const GenerateSecret: FC<{ - secret: string; - setSecret: (secret: string) => void; -}> = ({ secret, setSecret }) => { - return ( -
- -
- setSecret(event.target.value)} - className="input" - id="secret" - placeholder="0x0000000000000000000000000000000000000000000000000000000000000000" - /> - -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/inputs/LabelField.tsx b/app/local/content/demos/ethregistry/inputs/LabelField.tsx deleted file mode 100644 index d41f8e83e..000000000 --- a/app/local/content/demos/ethregistry/inputs/LabelField.tsx +++ /dev/null @@ -1,30 +0,0 @@ -import { FC } from 'react'; - -export const LabelField: FC<{ - label: string; - setLabel: (_label: string) => void; -}> = ({ label, setLabel }) => { - const id = 'label'; // TODO: - - return ( -
- -
- setLabel(event.target.value)} - className="input" - placeholder="test123" - id={id + 'label'} - name="label" - /> -
.eth
-
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/inputs/OwnerField.tsx b/app/local/content/demos/ethregistry/inputs/OwnerField.tsx deleted file mode 100644 index 2f1ac0b0e..000000000 --- a/app/local/content/demos/ethregistry/inputs/OwnerField.tsx +++ /dev/null @@ -1,38 +0,0 @@ -import { FC } from 'react'; -import { useAccount } from 'wagmi'; - -import { Button } from '@/components/Button'; - -export const OwnerField: FC<{ - owner: string; - setOwner: (_owner: string) => void; -}> = ({ owner, setOwner }) => { - const { address } = useAccount(); - - return ( -
- -
- setOwner(event.target.value)} - className="input" - id="owner" - placeholder="0x225f137127d9067788314bc7fcc1f36746a3c3B5" - /> - {address && ( - - )} -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/inputs/ResolverField.tsx b/app/local/content/demos/ethregistry/inputs/ResolverField.tsx deleted file mode 100644 index 38b7650d0..000000000 --- a/app/local/content/demos/ethregistry/inputs/ResolverField.tsx +++ /dev/null @@ -1,23 +0,0 @@ -import { FC } from 'react'; - -export const ResolverField: FC<{ - resolver: string; - setResolver: (owner: string) => void; -}> = ({ resolver: owner, setResolver: setOwner }) => { - return ( -
- -
- setOwner(event.target.value)} - className="input" - id="resolver" - placeholder="0x225f137127d9067788314bc7fcc1f36746a3c3B5" - /> -
-
- ); -}; diff --git a/app/local/content/demos/ethregistry/stage/AvailabilityCheck.tsx b/app/local/content/demos/ethregistry/stage/AvailabilityCheck.tsx deleted file mode 100644 index d39157afc..000000000 --- a/app/local/content/demos/ethregistry/stage/AvailabilityCheck.tsx +++ /dev/null @@ -1,56 +0,0 @@ -import { FC, useEffect } from 'react'; -import { FiCheck, FiX } from 'react-icons/fi'; - -import { EthCall } from '../../call/EthCall'; -import { useIsAvailable } from '../hooks/isAvailable'; - -export const AvailabilityCheck: FC<{ - name: string; - setAvailable?: (_available: boolean) => void; -}> = ({ name, setAvailable }) => { - const { isAvailable, isLoadingAvailability } = useIsAvailable(name); - - useEffect(() => { - setAvailable(isAvailable); - }, [isAvailable]); - - return ( -
- - - ETHRegistrarController - - .available( - - "{name}" - - ) -
- } - > - {isLoadingAvailability ? ( -
- Loading... -
- ) : ( -
- {isAvailable ? ( -
- - Name is Available -
- ) : ( -
- - Name Taken -
- )} -
- )} - - - ); -}; diff --git a/app/local/content/demos/ethregistry/stage/CommitmentCheck.tsx b/app/local/content/demos/ethregistry/stage/CommitmentCheck.tsx deleted file mode 100644 index 9718a7f7e..000000000 --- a/app/local/content/demos/ethregistry/stage/CommitmentCheck.tsx +++ /dev/null @@ -1,97 +0,0 @@ -import { FC, useEffect } from 'react'; -import { FiCheck, FiX } from 'react-icons/fi'; - -import { EthCall } from '../../call/EthCall'; -import { useCommitment } from '../hooks/useCommitment'; - -export const CommitmentCheck: FC<{ - name: string; - duration: number; - owner: string; - secret: string; - resolver: string; - setCommithash?: (_commithash: string) => void; -}> = ({ name, duration, owner, secret, resolver, setCommithash }) => { - const { commithash, isLoadingCommithash } = useCommitment( - name, - owner, - duration, - secret, - resolver - ); - - const isReady = - name && duration && owner && secret && resolver && !isLoadingCommithash; - - useEffect(() => { - if (isReady) { - setCommithash(commithash); - } else { - setCommithash(''); - } - }, [commithash, isReady, isLoadingCommithash]); - - return ( -
- - - ETHRegistrarController - - .makeCommitment( - - "{name}" - - ,{' '} - - {owner} - - , - - {duration} - - , - - {secret} - - , - - {resolver} - - , [], false, 0 ) -
- } - > - {isLoadingCommithash ? ( -
- Loading... -
- ) : ( -
- {commithash ? ( -
-
- -
-
- CommitHash: {commithash} -
-
- ) : ( -
-
- -
-
- Problem -
-
- )} -
- )} - - - ); -}; diff --git a/app/local/content/demos/ethregistry/stage/RentPriceCheck.tsx b/app/local/content/demos/ethregistry/stage/RentPriceCheck.tsx deleted file mode 100644 index bd9394649..000000000 --- a/app/local/content/demos/ethregistry/stage/RentPriceCheck.tsx +++ /dev/null @@ -1,62 +0,0 @@ -import { FC, useEffect } from 'react'; -import { FiCheck, FiX } from 'react-icons/fi'; - -import { EthCall } from '../../call/EthCall'; -import { useRentPrice } from '../hooks/useRentPrice'; - -export const RentPriceCheck: FC<{ - name: string; - duration: number; - setRentPrice?: (_price: bigint | null) => void; -}> = ({ name, duration, setRentPrice }) => { - const { rentPrice, isLoadingRentPrice } = useRentPrice(name, duration); - - useEffect(() => { - if (isLoadingRentPrice || !rentPrice) { - // eslint-disable-next-line unicorn/no-null - setRentPrice?.(null); - } else { - setRentPrice?.((rentPrice?.base + rentPrice?.premium) as bigint); - } - }, [isLoadingRentPrice, rentPrice]); - - return ( -
- - - ETHRegistrarController - - .rentPrice( - - "{name}" - - ,{' '} - - {duration} - - ) -
- } - > -
- {rentPrice ? ( -
- - Rent Price: (Base:{' '} - {rentPrice?.base.toLocaleString()}, Premium:{' '} - {rentPrice?.premium.toLocaleString()}) -
- ) : ( -
- - Problem -
- )} -
- - - ); -}; diff --git a/app/local/content/demos/ethregistry/transactions/MakeCommit.tsx b/app/local/content/demos/ethregistry/transactions/MakeCommit.tsx deleted file mode 100644 index 67eae71cf..000000000 --- a/app/local/content/demos/ethregistry/transactions/MakeCommit.tsx +++ /dev/null @@ -1,66 +0,0 @@ -'use client'; - -import { FC } from 'react'; -import { FiX } from 'react-icons/fi'; -import { useEstimateGas, useWriteContract } from 'wagmi'; - -import { Button } from '@/components/Button'; - -import { EthCall } from '../../call/EthCall'; -import { ETHRegistrarABI } from '../ETHRegistryABI'; - -export const MakeCommit: FC<{ commithash: string }> = ({ commithash }) => { - const config = { - abi: ETHRegistrarABI, - to: '0xcc5e7db10e65eed1bbd105359e7268aa660f6734', - functionName: 'commit', - args: [commithash], - enabled: !!commithash, - }; - - const { data: gas, isError } = useEstimateGas(config); - - const { writeContract } = useWriteContract({}); - - return ( -
- - - ETHRegistrarController - - .commit( - - "{commithash}" - - ) -
- } - > -
-
{gas?.toString()} gas
- -
- {isError && ( -
- - Problem -
- )} - - - ); -}; diff --git a/app/local/content/demos/ethregistry/transactions/RegisterName.tsx b/app/local/content/demos/ethregistry/transactions/RegisterName.tsx deleted file mode 100644 index e9d2ff5a1..000000000 --- a/app/local/content/demos/ethregistry/transactions/RegisterName.tsx +++ /dev/null @@ -1,101 +0,0 @@ -import { FC } from 'react'; -import { FiX } from 'react-icons/fi'; -import { formatEther } from 'viem'; -import { useEstimateGas, useSimulateContract, useWriteContract } from 'wagmi'; - -import { Button } from '@/components/Button'; - -import { EthCall } from '../../call/EthCall'; -import { ETHRegistrarABI } from '../ETHRegistryABI'; - -export const RegisterName: FC<{ - name: string; - duration: number; - owner: string; - secret: string; - resolver: string; - rentPrice: bigint; -}> = ({ name, duration, owner, secret, resolver, rentPrice }) => { - const isReady = - name && duration && owner && secret && resolver && rentPrice > 0; - - const config = { - abi: ETHRegistrarABI, - to: '0xcc5e7db10e65eed1bbd105359e7268aa660f6734', - functionName: 'register', - args: [name, owner, duration, secret, resolver, [], false, 0], - value: rentPrice, - enabled: isReady, - }; - - const { data: registerCallResult, writeContract } = useWriteContract({}); - const { data, isError } = useSimulateContract(config); - const { data: gas } = useEstimateGas(config); - - const rentPriceFormatted = formatEther(rentPrice || BigInt(0)); - - return ( -
- - - ETHRegistrarController - - .register( - - "{name}" - - ,{' '} - - {owner} - - , - - {duration} - - , - - {secret} - - , - - {resolver} - - , [], false, 0 ) -
- } - gas={gas?.toString()} - > -
-
{gas?.toString()} gas
-
{rentPriceFormatted} eth
- -
- {!isReady && ( -
- - Not Ready -
- )} - {isError && ( -
- - Problem -
- )} - - - ); -}; diff --git a/app/local/content/demos/ethregistryrenew/ETHRegistryRenewDemo.tsx b/app/local/content/demos/ethregistryrenew/ETHRegistryRenewDemo.tsx deleted file mode 100644 index 60e2aaa5a..000000000 --- a/app/local/content/demos/ethregistryrenew/ETHRegistryRenewDemo.tsx +++ /dev/null @@ -1,60 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import { useAccount, useChainId } from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; - -import { DurationField } from '../ethregistry/inputs/DurationField'; -import { LabelField } from '../ethregistry/inputs/LabelField'; -import { RentPriceCheck } from '../ethregistry/stage/RentPriceCheck'; -import { RenewName } from './transactions/RenewName'; - -const Demo = () => { - const { address } = useAccount(); - const chainId = useChainId(); - - /* User Configurable Values */ - const [label, setLabel] = useState('testname123456'); - const [owner, setOwner] = useState( - '0x225f137127d9067788314bc7fcc1f36746a3c3B5' - ); - const [resolver, setResolver] = useState( - '0x225f137127d9067788314bc7fcc1f36746a3c3B5' - ); - const [duration, setDuration] = useState(60 * 60 * 24 * 365); - const [secret, setSecret] = useState( - '0x0000000000000000000000000000000000000000000000000000000000000000' - ); - - /* State Values */ - const [available, setAvailable] = useState(false); - const [commithash, setCommithash] = useState(''); - // eslint-disable-next-line unicorn/no-useless-undefined - const [rentPrice, setRentPrice] = useState(undefined); - - const { isConnected } = useAccount(); - - return ( -
-
- - - - -
-
- ); -}; - -export const ETHRegistryRenewDemo = () => { - return } />; -}; diff --git a/app/local/content/demos/ethregistryrenew/transactions/RenewName.tsx b/app/local/content/demos/ethregistryrenew/transactions/RenewName.tsx deleted file mode 100644 index 6f25d8b3e..000000000 --- a/app/local/content/demos/ethregistryrenew/transactions/RenewName.tsx +++ /dev/null @@ -1,94 +0,0 @@ -import { FC } from 'react'; -import { FiX } from 'react-icons/fi'; -import { formatEther } from 'viem'; -import { - useAccount, - useEstimateGas, - useSimulateContract, - useWriteContract, -} from 'wagmi'; - -import { Button } from '@/components/Button'; - -import { EthCall } from '../../call/EthCall'; -import { ETHRegistrarABI } from '../../ethregistry/ETHRegistryABI'; - -export const RenewName: FC<{ - name: string; - duration: number; - rentPrice: bigint; -}> = ({ name, duration, rentPrice }) => { - const isReady = name && duration && rentPrice > 0; - - const { address } = useAccount(); - - const { writeContract, isError: _isUserDecline } = useWriteContract(); - - const config = { - abi: ETHRegistrarABI, - from: address, - to: '0xcc5e7db10e65eed1bbd105359e7268aa660f6734', - functionName: 'renew', - args: [name, duration], - value: rentPrice, - enabled: isReady, - }; - - const { data: gas2, isError } = useSimulateContract(config); - const { data: gas } = useEstimateGas(config); - - console.log({ gas, gas2 }); - - const rentPriceFormatted = formatEther(rentPrice || BigInt(0)); - - return ( -
- - - ETHRegistrarController - - .renew( - - "{name}" - - ,{' '} - - {duration} - - ) -
- } - > -
-
{gas?.toString()} gas
-
{rentPriceFormatted} eth
- -
- {!isReady && ( -
- - Not Ready -
- )} - {isError && ( -
- - Problem -
- )} - - - ); -}; diff --git a/app/local/content/demos/index.ts b/app/local/content/demos/index.ts deleted file mode 100644 index b5ee02c47..000000000 --- a/app/local/content/demos/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { LiveDemo } from './LiveDemo'; - -export const demos = { - LiveDemo, -}; diff --git a/app/local/content/demos/listnames/ListNamesDemo.tsx b/app/local/content/demos/listnames/ListNamesDemo.tsx deleted file mode 100644 index 53dcee70d..000000000 --- a/app/local/content/demos/listnames/ListNamesDemo.tsx +++ /dev/null @@ -1,136 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import useSWR from 'swr'; -import { holesky, mainnet, sepolia } from 'viem/chains'; -import { useAccount } from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; -import { Button } from '@/components/Button'; -import { ProfileAvatar } from '#/content/prose/profile/ProfileAvatar'; - -import { OwnerField } from '../ethregistry/inputs/OwnerField'; - -const ENS_SUBGRAPH_API_KEY = '13ef776c0372f7c14eb7c019a0f80272'; - -const GRAPH_QL_URL = { - [mainnet.id]: `https://gateway.thegraph.com/api/${ENS_SUBGRAPH_API_KEY}/subgraphs/id/5XqPmWe6gjyrJtFn9cLy237i4cWw2j9HcUJEXsP5qGtH`, - [sepolia.id]: - 'https://api.studio.thegraph.com/proxy/49574/enssepolia/version/latest', - [holesky.id]: - 'https://api.studio.thegraph.com/proxy/49574/ensholesky/version/latest', -}; - -type SubgraphResponse = { - data: { - domains: { - name: string; - expiryDate?: string; - registration?: { expiryDate: string; registrationDate: string }; - }[]; - }; -}; - -const fetcher = async ([address, chainId]: [string, number]) => { - const url = GRAPH_QL_URL[chainId]; - - if (!url) throw new Error('Unsupported chain id'); - - const request = await fetch(url, { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - body: JSON.stringify({ - query: ` - query { - domains(where: {and: [{or: [{owner: "${address}"},{registrant:"${address}"},{wrappedOwner: "${address}"}]},{parent_not: "0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2"},{or:[{expiryDate_gt: "1723472244"},{expiryDate: null}]},{or: [{owner_not: "0x0000000000000000000000000000000000000000"},{resolver_not: null},{and: [{registrant_not: "0x0000000000000000000000000000000000000000"},{registrant_not: null}]}]}]}) { - name - expiryDate - registration { - expiryDate - registrationDate - } - } - } - `, - }), - }).then((result) => result.json() as Promise); - - return request.data.domains.sort((a, b) => { - // Sort by expiry date - if (a.expiryDate && b.expiryDate) { - return ( - Number.parseInt(b.expiryDate) - Number.parseInt(a.expiryDate) - ); - } - - return 0; - }); -}; - -const Demo = () => { - const { address, chainId } = useAccount(); - const [targetAddress, setAddress] = useState(address as string); - const { data, isLoading } = useSWR( - [targetAddress?.toLowerCase(), chainId], - fetcher - ); - - return ( -
- -
- -
- - -
-
-
- -
- {data?.length > 0 ? ( -
- {data.map((domain) => ( -
-
- - {domain.name} - -
-
- -
-
- ))} -
- ) : ( -
- {isLoading ? ( -
Loading...
- ) : ( -
No names found
- )} -
- )} -
-
-
- ); -}; - -export const ListNamesDemo = () => { - return } />; -}; diff --git a/app/local/content/demos/namelookup/NameLookup.tsx b/app/local/content/demos/namelookup/NameLookup.tsx deleted file mode 100644 index a1a5f253a..000000000 --- a/app/local/content/demos/namelookup/NameLookup.tsx +++ /dev/null @@ -1,103 +0,0 @@ -'use client'; - -import { formatAddress } from '@ens-tools/format'; -import clsx from 'clsx'; -import { FC, useState } from 'react'; -import { useDebounce } from 'use-debounce'; - -import { Button } from '@/components/Button'; - -import { useProfile } from './logic/useProfile'; -import { Chains } from './parts/chains'; -import { Records } from './parts/records'; - -export const NameLookupDemo: FC = () => { - const [temporaryName, setTemporaryName] = useState('luc.eth'); - const [name] = useDebounce(temporaryName, 120); - - const { data, isLoading, error } = useProfile({ name }); - - const isValidName = !isLoading && data && data['status'] === undefined; - const isUnknownName = - !isLoading && ((data && data['status'] == 404) || !data); - const isOtherError = !isLoading && error && data['status'] !== 404; - - return ( -
-
- setTemporaryName(event.target.value)} - value={temporaryName} - /> -
-
- {isLoading && ( -
-
-
- )} - <> - {isOtherError &&
Error {JSON.stringify(error)}
} - {isUnknownName && ( -
-
Unknown Name 🤷‍♀️
-
- Try{' '} -
    - {['luc.eth', 'irc.eth', 'domico.eth'].map( - (name) => ( -
  • - -
  • - ) - )} -
-
-
- )} - {isValidName && ( - <> -
-
- {data?.avatar && ( - Avatar - )} -
-
-
- {data.name} -
- -
- {data?.address && - formatAddress(data.address)} -
-
-
- - - - )} - -
-
- ); -}; diff --git a/app/local/content/demos/namelookup/logic/fetch.ts b/app/local/content/demos/namelookup/logic/fetch.ts deleted file mode 100644 index 05373422c..000000000 --- a/app/local/content/demos/namelookup/logic/fetch.ts +++ /dev/null @@ -1,17 +0,0 @@ -import { ENStateProfile } from './profile'; - -const ENSTATE_PUBLIC_INSTANCE = 'https://enstate.rs'; - -export const rawFetchEnstateProfile = async ( - name: string, - instance: string = ENSTATE_PUBLIC_INSTANCE -): Promise => { - const request = await fetch(instance + '/u/' + name); - - return request.json() as Promise; -}; - -export const swrFetchEnstateProfile = (instance?: string) => { - return async ([_enstate, name]: ['enstate', string]) => - rawFetchEnstateProfile(name, instance); -}; diff --git a/app/local/content/demos/namelookup/logic/profile.ts b/app/local/content/demos/namelookup/logic/profile.ts deleted file mode 100644 index c5566d02a..000000000 --- a/app/local/content/demos/namelookup/logic/profile.ts +++ /dev/null @@ -1,36 +0,0 @@ -export type SuggestedRecords = - | 'url' - | 'mail' - | 'name' - | 'email' - | 'header' - | 'avatar' - | 'location' - | 'timezone' - | 'language' - | 'pronouns' - | 'org.matrix' - | 'io.keybase' - | 'com.twitter' - | 'description' - | 'com.discord' - | 'org.telegram' - | 'com.linkedin' - | 'social.bluesky' - | 'social.mastadon' - | 'network.dm3.profile' - | 'network.dm3.deliveryService'; - -export type RecordType = SuggestedRecords | (string & {}); - -export type ENStateProfile = { - name: string; - address: string; // address - avatar: string; // url - display: string; // ens name - records: Record; - chains: Record; - fresh: number; // timestamp - resolver: string; // address of resolver - errors: Record; -}; diff --git a/app/local/content/demos/namelookup/logic/useProfile.ts b/app/local/content/demos/namelookup/logic/useProfile.ts deleted file mode 100644 index 07eeea3cc..000000000 --- a/app/local/content/demos/namelookup/logic/useProfile.ts +++ /dev/null @@ -1,39 +0,0 @@ -import useSWR from 'swr'; - -import { swrFetchEnstateProfile } from './fetch'; - -export type UseProfileParameters = { - /** - * The name of the profile to fetch. - * @example 'luc.eth' - */ - name: string; - /** - * URL of the enstate instance to use. - * WARNING, the default instance is provided as is, please use it respectfully. - * @default https://enstate.rs - */ - instance?: string; -}; - -// TODO: Naive approach, doesn't support extended character set -const isValidDomain = /^([\da-z-]{1,63}\.)+[\da-z-]{1,63}$/i; - -const isValidAddress = /^0x[\da-f]{40}$/i; - -export const useProfile = ({ name, instance }: UseProfileParameters) => { - const { data, error, isLoading, isValidating, mutate } = useSWR( - isValidDomain.test(name) || isValidAddress.test(name) - ? ['enstate', name] - : undefined, - swrFetchEnstateProfile(instance) - ); - - return { - data, - error, - isLoading, - isValidating, - mutate, - }; -}; diff --git a/app/local/content/demos/namelookup/parts/chains.tsx b/app/local/content/demos/namelookup/parts/chains.tsx deleted file mode 100644 index 84682a15c..000000000 --- a/app/local/content/demos/namelookup/parts/chains.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import { formatAddress } from '@ens-tools/format'; -import { FC, Fragment } from 'react'; - -const multicoinIcons = { - btc: '/icons/multicoin/bitcoin.svg', - eth: '/icons/multicoin/ethereum.svg', -} as const; - -export const Chains: FC<{ chains?: Record }> = ({ chains }) => { - if (!chains) return <>; - - if (Object.keys(chains).length === 0) return <>; - - return ( -
- {Object.keys(chains) - .sort((a, b) => b.length - a.length) - .map((chain) => ( - -
- {multicoinIcons[chain] ? ( -
-
- {chain} -
-
- {chain} -
-
- ) : ( -
- {chain} -
- )} -
-
- {chain == 'eth' - ? formatAddress(chains[chain]) - : chains[chain]} -
-
- ))} -
- ); -}; diff --git a/app/local/content/demos/namelookup/parts/records.tsx b/app/local/content/demos/namelookup/parts/records.tsx deleted file mode 100644 index 2d1e9d7a6..000000000 --- a/app/local/content/demos/namelookup/parts/records.tsx +++ /dev/null @@ -1,69 +0,0 @@ -import { FC, Fragment } from 'react'; -import { - FaClock, - FaDiscord, - FaGithub, - FaGlobe, - FaTelegram, - FaTwitter, -} from 'react-icons/fa'; - -import { RecordType } from '../logic/profile'; -const recordIcons = { - 'com.discord': , - 'com.github': , - 'com.twitter': , - 'org.telegram': , - url: , - timezone: , -} as const; - -export const Records: FC<{ records?: Record }> = ({ - records, -}) => { - if (!records) return <>; - - if (Object.keys(records).length === 0) return <>; - - return ( -
- {Object.keys(records) - .sort((a, b) => b.length - a.length) - .map((record) => ( - -
- {recordIcons[record] ? ( -
-
- {typeof recordIcons[record] === - 'string' ? ( - {record} - ) : ( - recordIcons[record] - )} -
-
- {record} -
-
- ) : ( -
- {record} -
- )} -
-
- {records[record]} -
-
- ))} -
- ); -}; diff --git a/app/local/content/demos/resolverplayground/index.tsx b/app/local/content/demos/resolverplayground/index.tsx deleted file mode 100644 index 65efdccb7..000000000 --- a/app/local/content/demos/resolverplayground/index.tsx +++ /dev/null @@ -1,178 +0,0 @@ -'use client'; - -import clsx from 'clsx'; -import { useEffect, useState } from 'react'; -import { encodeAbiParameters, zeroAddress } from 'viem'; -import { namehash, normalize } from 'viem/ens'; -import { - useAccount, - useCall, - useChainId, - useConnect, - useReadContract, -} from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; -import { Button } from '@/components/Button'; - -import { supportsInterfaceABI } from './supportsInterfaceABI'; - -const RESOLVER_REGEX = /^0x[\dA-Fa-f]{40}$/; -const NAME_REGEX = /^[\w-]+$/; -const ALLOWED_METHODS = ['addr', 'text', 'contenthash', 'ttl']; - -// 0x9061b923000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000009036c7563036574680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044f1cb7e06e1e7bcf2ca33c28a806ee265cfedf02fedf1b124ca73b2203ca80cc7c91a02ad000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000 - -const Demo = () => { - const [resolver, setResolver] = useState( - '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63' - ); - const [name, setName] = useState('luc.eth'); - const [shouldWildcard, setShouldWildcard] = useState(false); - - const [method, setMethod] = useState('addr'); - const chainId = useChainId(); - - const { connect } = useConnect(); - - const { isConnected } = useAccount(); - - // resolver supports wildcard - const { data: supportsWildcard, error } = useCall({ - to: resolver, - account: zeroAddress, - data: - '0x01ffc9a7' + - '9061b92300000000000000000000000000000000000000000000000000000000', - }); - - const { data: supportsWildcard2, error: error2 } = useReadContract({ - chainId, - abi: supportsInterfaceABI, - address: resolver as any, - functionName: 'supportsInterface', - args: ['0x9061b923'], - }); - - useEffect(() => { - if (supportsWildcard == undefined) return; - - if (Number(supportsWildcard) == 0) { - setShouldWildcard(false); - } - }, [supportsWildcard]); - - console.log({ supportsWildcard, error }); - - const a1 = namehash(normalize('luc.eth')); - const a2 = - '0x3b3b57de' + - encodeAbiParameters( - [{ name: 'name', type: 'bytes32' }], - [namehash(normalize(name))] - ).replace('0x', ''); - - console.log({ a1, a2 }); - - console.log({ supportsWildcard2 }); - - // const { data, refetch } = useCall({ - // to: resolver, - // data: '0x3b3b57de' + a1.replace('0x', ''), - // }); - - // const { data, refetch } = useReadContract({ - // chainId, - // address: resolver as `0x${string}`, - // abi: [ - // { - // type: 'function', - // inputs: [ - // { - // name: 'name', - // type: 'bytes', - // }, - // { - // name: 'data', - // type: 'bytes', - // }, - // ], - // name: 'resolve', - // outputs: [{ name: 'result', type: 'bytes' }], - // stateMutability: 'view', - // }, - // ], - // functionName: 'resolve', - // args: [a1, a2 as any], - // }); - - return ( -
- {/* {data && JSON.stringify(data)} */} -
-
-
Resolver
- setResolver(event.target.value)} - className="input" - /> -
-
- {[ - ['Direct', false], - ['Wildcard', true], - ].map(([name, value]) => ( - - ))} -
- setName(event.target.value)} - className="input" - /> -
-
- -
-
- ); -}; - -export const ResolverPlaygroundDemo = () => { - return ( - ( -
- - {/* This demo is in under construction */} -
- )} - /> - ); -}; diff --git a/app/local/content/demos/resolverplayground/supportsInterfaceABI.ts b/app/local/content/demos/resolverplayground/supportsInterfaceABI.ts deleted file mode 100644 index aa4a08822..000000000 --- a/app/local/content/demos/resolverplayground/supportsInterfaceABI.ts +++ /dev/null @@ -1,29 +0,0 @@ -export const supportsInterfaceABI = [ - { - inputs: [], - payable: false, - stateMutability: 'nonpayable', - type: 'constructor', - }, - { - constant: true, - inputs: [ - { - internalType: 'bytes4', - name: 'interfaceId', - type: 'bytes4', - }, - ], - name: 'supportsInterface', - outputs: [ - { - internalType: 'bool', - name: '', - type: 'bool', - }, - ], - payable: false, - stateMutability: 'view', - type: 'function', - }, -] as const; diff --git a/app/local/content/demos/resolvertest/index.tsx b/app/local/content/demos/resolvertest/index.tsx deleted file mode 100644 index fccf75996..000000000 --- a/app/local/content/demos/resolvertest/index.tsx +++ /dev/null @@ -1,120 +0,0 @@ -'use client'; - -import { useState } from 'react'; -import { encodeAbiParameters, labelhash } from 'viem'; -import { namehash, normalize } from 'viem/ens'; -import { useAccount, useChainId, useConnect, useReadContract } from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; -import { Button } from '@/components/Button'; - -const RESOLVER_REGEX = /^0x[\dA-Fa-f]{40}$/; -const NAME_REGEX = /^[\w-]+$/; -const ALLOWED_METHODS = ['addr', 'text', 'contenthash', 'ttl']; - -// 0x9061b923000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000009036c7563036574680000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044f1cb7e06e1e7bcf2ca33c28a806ee265cfedf02fedf1b124ca73b2203ca80cc7c91a02ad000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000 - -const Demo = () => { - const [resolver, setResolver] = useState( - '0xdCcB68ac05BB2Ee83F0873DCd0BF5F57E2968344' - ); - const [name, setName] = useState('luc.willbreak.eth'); - - const [method, setMethod] = useState('addr'); - const chainId = useChainId(); - - const { connect } = useConnect(); - - const { isConnected } = useAccount(); - - const a1 = labelhash(normalize(name)); - const a2 = - '0x3b3b57de' + - encodeAbiParameters( - [{ name: 'name', type: 'bytes32' }], - [namehash(normalize(name))] - ).replace('0x', ''); - - console.log({ a1, a2 }); - - const { data, refetch } = useReadContract({ - chainId, - address: resolver as `0x${string}`, - abi: [ - { - type: 'function', - inputs: [ - { - name: 'name', - type: 'bytes', - }, - { - name: 'data', - type: 'bytes', - }, - ], - name: 'resolve', - outputs: [{ name: 'result', type: 'bytes' }], - stateMutability: 'view', - }, - ], - functionName: 'resolve', - args: [a1, a2 as any], - }); - - if (!isConnected) { - return ( -
- -
- ); - } - - return ( -
- {data && JSON.stringify(data)} -
-
{chainId}
- setResolver(event.target.value)} - /> - setName(event.target.value)} - /> -
-
- -
-
- ); -}; - -export const ResolverTestDemo = () => { - return ( - ( -
- {/* */} - This demo is in under construction -
- )} - /> - ); -}; diff --git a/app/local/content/demos/reverse-set-name-for/ReverseSetNameForDemo.tsx b/app/local/content/demos/reverse-set-name-for/ReverseSetNameForDemo.tsx deleted file mode 100644 index 0f9cace11..000000000 --- a/app/local/content/demos/reverse-set-name-for/ReverseSetNameForDemo.tsx +++ /dev/null @@ -1,242 +0,0 @@ -/* eslint-disable unicorn/no-nested-ternary */ -'use client'; - -import clsx from 'clsx'; -import { useState } from 'react'; -import { FiCheck, FiLoader, FiX } from 'react-icons/fi'; -import { mainnet, sepolia } from 'viem/chains'; -import { useAccount, useReadContract } from 'wagmi'; - -import { ALink } from '#/content/prose/link/ALink'; - -import { EthCall } from '../call/EthCall'; - -const REVERSE_REGISTRAR_ADDRESS = { - [mainnet.id]: '0xa58E81fe9b61B5c3fE2AFD33CF304c454AbFc7Cb', - [sepolia.id]: '', -}; - -export const ReverseSetNameForDemo = () => { - const { address: account, isConnected, chainId } = useAccount(); - - const [contractAddress, setContractAddress] = useState(''); - const [name, setName] = useState(''); - const [resolver, setResolver] = useState( - '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63' - ); - const addr = contractAddress; - const owner = account; - - const { - data: ownsContractData, - error: ownsContractError, - isLoading: ownsContractLoading, - } = useReadContract({ - abi: [ - { - inputs: [], - name: 'owner', - outputs: [ - { internalType: 'address', name: '', type: 'address' }, - ], - stateMutability: 'view', - type: 'function', - constant: true, - }, - ] as const, - address: contractAddress as any, - functionName: 'owner', - args: [], - }); - - const ownsContract = ownsContractData === owner; - const supportsOwnable = ownsContractData !== undefined; - - return ( -
-
-
- - { - setContractAddress(event.target.value); - }} - /> -
-
- - { - setName(event.target.value); - }} - /> -
-
- - { - event.preventDefault(); - }} - disabled - /> -
-
- - { - setResolver(event.target.value); - }} - /> -
-
-
-
-
- {ownsContractLoading ? ( - - ) : supportsOwnable ? ( - - ) : ( - - )} - - Supports{' '} - - Ownable - - -
-
-
-
- {ownsContractLoading ? ( - - ) : ownsContract ? ( - - ) : ( - - )} -
-
User is owner of contract
- {ownsContractData && !ownsContract && ( - - Owner is{' '} - - {ownsContractData} - - - )} -
-
-
-
- - - ReverseRegistrar - - .setNameForAddr( - - - - {addr || '
'} - - ,{' '} - - - - {owner || ''} - - ,{' '} - - - - {resolver || ''} - - ,{' '} - - - - {name || ''} - - - - ) -
- } - > - {/*
-
{gas?.toString()} gas
-
{rentPriceFormatted} eth
- -
- {!isReady && ( -
- - Not Ready -
- )} - {isError && ( -
- - Problem -
- )} */} - - - ); -}; diff --git a/app/local/content/demos/send-transaction/SendTransaction.tsx b/app/local/content/demos/send-transaction/SendTransaction.tsx deleted file mode 100644 index e49a2b1a0..000000000 --- a/app/local/content/demos/send-transaction/SendTransaction.tsx +++ /dev/null @@ -1,74 +0,0 @@ -'use client'; - -import { FC, useState } from 'react'; -import { useDebounce } from 'use-debounce'; -import { isAddress } from 'viem'; -import { useEnsAddress, useEnsAvatar } from 'wagmi'; - -import { Button } from '@/components/Button'; - -// TODO: make this look nice, for example https://ens-frontend-template.vercel.app/input -export const SendTransactionDemo: FC = () => { - const [input, setInput] = useState(''); - - const [debouncedInput] = useDebounce(input, 500); - - // Resolve potential ENS names (dot separated strings) - const { data: ensAddress, isLoading: ensAddressIsLoading } = useEnsAddress({ - name: debouncedInput.includes('.') ? debouncedInput : undefined, - chainId: 1, - }); - const { data: ensAvatar, isLoading: ensAvatarIsLoading } = useEnsAvatar({ - name: debouncedInput.includes('.') ? debouncedInput : undefined, - chainId: 1, - }); - - // Set the address (address if provided directly or resolved address from ENS name) - const address = - input !== debouncedInput - ? undefined - : // TODO: fix linting, it's competing with prettier here - // eslint-disable-next-line unicorn/no-nested-ternary - isAddress(debouncedInput) - ? debouncedInput - : ensAddress; - - return ( -
- - setInput(event.target.value)} - /> - - {ensAddress && address && ( -
- {ensAvatar && ( -
- Avatar -
- )} - {address} -
- )} - - -
- ); -}; diff --git a/app/local/content/demos/siwe/SiweDemo.tsx b/app/local/content/demos/siwe/SiweDemo.tsx deleted file mode 100644 index 85c90a8cb..000000000 --- a/app/local/content/demos/siwe/SiweDemo.tsx +++ /dev/null @@ -1,106 +0,0 @@ -'use client'; - -import { formatAddress } from '@ens-tools/format'; -import { useEffect } from 'react'; -import { FaSignature, FaSpinner } from 'react-icons/fa'; -import { ImExit } from 'react-icons/im'; -import { SiweMessage } from 'siwe'; -import { - useAccount, - useConnect, - useDisconnect, - useEnsName, - useSignMessage, -} from 'wagmi'; - -import { ClientOnly } from '@/ClientOnly'; -import { Button } from '@/components/Button'; - -const Demo = () => { - const { address, isConnected } = useAccount(); - const { connect } = useConnect(); - const { disconnect } = useDisconnect(); - const { data: ensName } = useEnsName({ address }); - const { - data: signatureData, - signMessage, - isPending, - reset, - } = useSignMessage({}); - - useEffect(() => { - reset(); - }, [address]); - - return ( -
- {isConnected ? ( - <> - -
- - -
- {signatureData && ( -
- Signature Verified! -
- )} - - ) : ( - - )} -
- ); -}; - -export const SiweDemo = () => } />; diff --git a/app/local/content/extras/deployments/copy.tsx b/app/local/content/extras/deployments/copy.tsx deleted file mode 100644 index 142933cfa..000000000 --- a/app/local/content/extras/deployments/copy.tsx +++ /dev/null @@ -1,20 +0,0 @@ -'use client'; - -import { FC } from 'react'; -import { FiClipboard } from 'react-icons/fi'; - -import { Button } from '@/components/Button'; - -export const CopyButton: FC<{ text: string }> = ({ text }) => { - return ( - - ); -}; diff --git a/app/local/content/extras/deployments/deployment.tsx b/app/local/content/extras/deployments/deployment.tsx deleted file mode 100644 index 8fa1a38b8..000000000 --- a/app/local/content/extras/deployments/deployment.tsx +++ /dev/null @@ -1,165 +0,0 @@ -import Link from 'next/link'; -import { FC } from 'react'; -import { FiExternalLink } from 'react-icons/fi'; - -import { CodeGroup } from '#/content/prose/code/group/CodeGroup'; -import { BLOCKCHAIN_EXPLORERS } from '#/data/blockchain_explorers'; -import { Deployment, DEPLOYMENTS } from '#/data/deployments'; - -import { CopyButton } from './copy'; - -type githubDeploymentReturn = { - address: string; - abi: []; -}; - -export type DeploymentData = { - name: string; - address?: string; - path?: string; - srcPath?: string; - branch?: string; -}; - -export const getGithubDeployment = async ( - branch: string = 'staging', - chain: string = 'mainnet', - path: string = 'ENSRegistry' -) => { - const url = `https://raw.githubusercontent.com/ensdomains/ens-contracts/${branch}/deployments/${chain}/${path}.json`; - - const response = await fetch(url); - - if (!response.ok) { - throw new Error(`Failed to fetch ${url}`); - } - - return (await response.json()) as githubDeploymentReturn; -}; - -const ChainDeployment: FC<{ - identifier?: string; - preset: string; - title: string; - chain: Deployment; -}> = async ({ identifier, preset, chain }) => { - return ( -
- {chain.contracts.map( - withDeploymentData(chain.slug, (deployment, data) => ( -
-
-
- {deployment.name} -
-
- {deployment.path && ( - - - ABI - - )} - - {deployment.srcPath && ( - - - Source - - )} - {data?.address && - BLOCKCHAIN_EXPLORERS[chain.id][0].name && ( - - - { - BLOCKCHAIN_EXPLORERS[ - chain.id - ][0].name - } - - )} -
-
-
-
-                                {deployment.address || data.address}
-                            
- - -
-
- )) - )} -
- ); -}; - -export const ChainDeployments: FC = () => { - return ( - - {DEPLOYMENTS.map((chain) => ( - - ))} - - ); -}; - -const withDeploymentData = ( - chain: string, - callback: (_deployment: DeploymentData, _data: githubDeploymentReturn) => K -) => { - return async (deployment: DeploymentData) => { - const data = deployment.path - ? await getGithubDeployment( - deployment.branch, - chain, - deployment.path - ) - : ({ - address: deployment.address, - abi: [], - } as githubDeploymentReturn); - - return callback(deployment, data); - }; -}; diff --git a/app/local/content/extras/dns/DNSUsageExamples.tsx b/app/local/content/extras/dns/DNSUsageExamples.tsx deleted file mode 100644 index e7b671662..000000000 --- a/app/local/content/extras/dns/DNSUsageExamples.tsx +++ /dev/null @@ -1,82 +0,0 @@ -import { FiChevronRight } from 'react-icons/fi'; - -import { LinkCard } from '../linkcard/LinkCard'; - -export const DNSUsageExamples = () => { - return ( -
- {[ - [ - 'Lens', - 'The Social Layer for Web3', - '.lens.xyz', - 'https://www.lens.xyz/', - '/content/learn/dnssec/lens-logo.svg', - 'rgb(255, 235, 184)', - 'rgb(39, 46, 41)', - ], - [ - 'Coinbase Wallet', - 'Self-custody crypto wallet built by Coinbase', - '.cb.id', - 'https://cb.id/', - '/content/learn/dnssec/coinbase-wallet-logo.svg', - 'rgb(20, 21, 25)', - 'rgb(88, 138, 245)', - ], - [ - 'Argent', - 'zk-sync & starknet powered smart-contract wallet', - '.argent.xyz', - 'https://www.argent.xyz/', - '/content/learn/dnssec/argent-logo.svg', - '#000', - '#FF875B', - ], - ].map( - ( - [title, description, domain, link, logo, bgColor, fgColor], - index - ) => ( - - ) - )} -
-
- And many more... - - See{' '} - - our integrations - - -
- -
- read more -
-
-
-
- ); -}; diff --git a/app/local/content/extras/home/QuickLink.tsx b/app/local/content/extras/home/QuickLink.tsx deleted file mode 100644 index bd74ce319..000000000 --- a/app/local/content/extras/home/QuickLink.tsx +++ /dev/null @@ -1,29 +0,0 @@ -import Link from 'next/link'; -import { FC } from 'react'; - -export const QuickBannerLink: FC<{ - title: string; - description: string; - href: string; - image: string; -}> = ({ title, description, href, image }) => { - return ( - -
- {image && } -
-
-
-
- {title} -
-
{description}
-
-
- - ); -}; diff --git a/app/local/content/extras/icons/NotIcon.tsx b/app/local/content/extras/icons/NotIcon.tsx deleted file mode 100644 index e28b7fb3d..000000000 --- a/app/local/content/extras/icons/NotIcon.tsx +++ /dev/null @@ -1,7 +0,0 @@ -import { FiBookOpen, FiClock, FiHash } from 'react-icons/fi'; - -export const Icons = { - FiHash, - FiClock, - FiBookOpen, -}; diff --git a/app/local/content/extras/index.ts b/app/local/content/extras/index.ts deleted file mode 100644 index 99a126a72..000000000 --- a/app/local/content/extras/index.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { ChainDeployments } from './deployments/deployment'; -import { DNSUsageExamples } from './dns/DNSUsageExamples'; -import { QuickBannerLink } from './home/QuickLink'; -import { Icons } from './icons/NotIcon'; -import { LinkCard } from './linkcard/LinkCard'; -import { SmartContractMap } from './smartcontractmap/SmartContractMap'; -import { DNSGrid } from './tld-list/DNSGrid'; -import { TLDList } from './tld-list/TLDList'; -import { Usertag } from './usertag/Usertag'; -import { VideoGallery } from './videos/VideoGallery'; - -export const extras = { - DNSUsageExamples, - QuickBannerLink, - Usertag, - ChainDeployments, - TLDList, - DNSGrid, - SmartContractMap, - Icons, - LinkCard, - VideoGallery, -}; diff --git a/app/local/content/extras/linkcard/LinkCard.tsx b/app/local/content/extras/linkcard/LinkCard.tsx deleted file mode 100644 index 14b2b96c0..000000000 --- a/app/local/content/extras/linkcard/LinkCard.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { FiChevronRight } from 'react-icons/fi'; - -type Properties = { - title: string; - description: string; - domain?: string; - link: string; - logo: string; - bgColor: string; - fgColor: string; -}; - -export const LinkCard = ({ - title, - description, - domain, - link, - logo, - bgColor, - fgColor, -}: Properties) => { - return ( - -
-
- {title} -
- {domain && ( -
- {domain} -
- )} -
-
{title}
-
{description}
-
-
- read more -
-
-
- ); -}; diff --git a/app/local/content/extras/smartcontractmap/SmartContractMap.tsx b/app/local/content/extras/smartcontractmap/SmartContractMap.tsx deleted file mode 100644 index 7050cd28c..000000000 --- a/app/local/content/extras/smartcontractmap/SmartContractMap.tsx +++ /dev/null @@ -1,122 +0,0 @@ -/* eslint-disable jsx-a11y/no-static-element-interactions */ -'use client'; - -import { useState } from 'react'; - -import { Button } from '@/components/Button'; - -const width = 800; -const height = (9 / 16) * 800; - -export const SmartContractMap = () => { - const [[x, y], setLocation] = useState([0, 0]); - const [[dragX, dragY], setStartLocation] = useState([0, 0]); - const [dragging, setDragging] = useState(false); - - return ( -
{ - setDragging(true); - setStartLocation([event.clientX - x, event.clientY - y]); - }} - onMouseUp={() => setDragging(false)} - onMouseLeave={() => setDragging(false)} - onMouseMove={(event) => { - if (dragging) { - setLocation([ - Math.max(Math.min(event.clientX - dragX, 150), -200), - Math.max(Math.min(event.clientY - dragY, 150), -600), - ]); - } - }} - onScrollCapture={(event) => { - const x = event.detail; - - console.log(x); - }} - > -
- event.preventDefault()} - /> -
-
-
-
addr
-
- .reverse -
-
- -
-
-
-
registrar
-
- .ens.eth -
-
- -
-
-
-
- dnsregistrar -
-
- .ens.eth -
-
- -
-
-
-
root
-
- .ens.eth -
-
- -
-
-
-
- ); -}; diff --git a/app/local/content/extras/tld-list/DNSGrid.tsx b/app/local/content/extras/tld-list/DNSGrid.tsx deleted file mode 100644 index ad7fdb68f..000000000 --- a/app/local/content/extras/tld-list/DNSGrid.tsx +++ /dev/null @@ -1,58 +0,0 @@ -export const DNSGrid = () => { - return ( -
-
- {[ - '.com', - '.xyz', - '.nl', - '.net', - '.org', - '.shop', - '.photos', - '.pizza', - '.cash', - '.money', - '.news', - '.info', - '.gold', - '.domains', - '.social', - '.de', - '.city', - '.lol', - '.rip', - '.company', - '.es', - '.network', - '.me', - '.us', - '.id', - '.fr', - '.space', - '.ninja', - '.tools', - '.wtf', - '.capital', - '.finance', - '.vision', - '.limo', - '.link', - '.uk', - '.world', - '.dev', - '.day', - '.fyi', - '.cool', - ].map((a) => ( - - {a} - - ))} - - and any other DNSSEC-compatible domain... - -
-
- ); -}; diff --git a/app/local/content/extras/tld-list/TLDList.tsx b/app/local/content/extras/tld-list/TLDList.tsx deleted file mode 100644 index 7388d77e4..000000000 --- a/app/local/content/extras/tld-list/TLDList.tsx +++ /dev/null @@ -1,236 +0,0 @@ -import clsx from 'clsx'; -import Link from 'next/link'; -import { FiExternalLink } from 'react-icons/fi'; -import { createPublicClient, http, namehash } from 'viem'; -import { mainnet } from 'viem/chains'; - -import { SmallCopy } from '@/components/SmallCopy'; -import { TLDs } from '#/data/tlds'; - -const ADDRESS_MAP = { - '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85': { - name: 'ETH Registrar', - color: 'text-ens-light-blue-primary dark:text-ens-dark-blue-primary', - surface: - 'bg-ens-light-blue-surface dark:bg-ens-dark-blue-surface border-ens-light-blue-surface dark:border-ens-dark-blue-surface', - }, - '0x58774Bb8acD458A640aF0B88238369A167546ef2': { - name: 'DNS Registrar', - color: 'text-ens-light-green-primary dark:text-ens-dark-green-primary', - surface: - 'bg-ens-light-green-surface dark:bg-ens-dark-green-surface border-ens-light-green-surface dark:border-ens-dark-green-surface', - }, - '0xB32cB5677a7C971689228EC835800432B339bA2B': { - name: 'DNS Registrar (Supports Gasless)', - color: 'text-ens-light-green-primary dark:text-ens-dark-green-primary', - surface: - 'bg-ens-light-green-surface dark:bg-ens-dark-green-surface border-ens-light-green-surface dark:border-ens-dark-green-surface', - }, - '0x828D6e836e586B53f1da3403FEda923AEd431019': { - name: '(Custom) Protocol.ART Registrar', - }, - '0x0b9BB06Ebf35A755998B60353546ae8A055554d2': { - name: '(Custom) Box Registrar', - }, - '0x04ebA57401184A97C919b0B6b4e8dDE263BCb920': { - name: '(Custom) HipHop Registrar', - }, - '0x1eb4b8506fca65e6B229E346dfBfd349956A66e3': { - name: '(Custom) Club Registrar', - }, - '0x56ca9514363F68d622931dce1566070f86Ce5550': { - name: '(Custom) Kred Registrar', - }, - '0xA86ba3b6d83139a49B649C05DBb69E0726DB69cf': { - name: '(Custom) Luxe Registrar', - }, -}; - -const classifyOwner = (owner_address: string) => { - if (!owner_address) return 1; - - if (owner_address === '0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85') - return 10; - - if (owner_address === '0x58774Bb8acD458A640aF0B88238369A167546ef2') - return 3; - - if (ADDRESS_MAP[owner_address]) return 5; - - if (owner_address === '0x0000000000000000000000000000000000000000') - return 0; - - return 4; -}; - -const computeTLD = (owner_address: string) => { - if (!owner_address) return; - - if (ADDRESS_MAP[owner_address]) return ADDRESS_MAP[owner_address].name; - - if (owner_address === '0x0000000000000000000000000000000000000000') - return ( - - Unsupported TLD (or no domains imported yet) - - ); - - return owner_address; -}; - -export const TLDList = async () => { - const client = createPublicClient({ - chain: mainnet, - transport: http( - process.env.RPC_URL ?? '' //?? 'https://cloudflare-eth.com/rpc' - ), - batch: { - multicall: { - batchSize: 10_240, - }, - }, - }); - - const contract = { - address: '0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e', - abi: [ - { - name: 'owner', - type: 'function', - stateMutability: 'view', - inputs: [{ name: 'node', type: 'bytes32' }], - outputs: [{ name: 'owner', type: 'address' }], - }, - ], - } as const; - - const chunks: string[][] = []; - - const batch_size = 400; - - for (let index = 0; index < TLDs.length; index += batch_size) { - chunks.push(TLDs.slice(index, index + batch_size)); - } - - const results: [string[], any][] = []; - - for (const chunk of chunks) { - const result = await client.multicall({ - contracts: chunk.map( - (tld) => - ({ - ...contract, - args: [namehash(tld)], - functionName: 'owner', - } as any) - ), - } as any); - - results.push([chunk, result]); - } - - const unique_results: Record = {}; - - for (const [chunks, returned] of results) { - let index = 0; - - for (const _chunk in chunks) { - const result = returned[index].result as string; - - const v = unique_results[result] || 0; - - unique_results[result] = v + 1; - - index++; - } - } - - return ( -
-

Totals

-
- {Object.entries(unique_results) - .sort((a, b) => { - return classifyOwner(b[0]) - classifyOwner(a[0]); - }) - .map(([k, v]) => { - const entry = ADDRESS_MAP[k]; - - return ( -
- - {v} - - - - {computeTLD(k)} -
- ); - })} -
-

By Name

- - - - - - - - - {results - .flatMap(([chunks, result]) => { - return chunks.map((chunk, index) => { - return { - result: result[index].result, - owner_index: classifyOwner( - result[index].result as string - ), - data: ADDRESS_MAP[ - result[index].result as string - ], - domain: chunk, - }; - }); - }) - .sort((a, b) => { - return b.owner_index - a.owner_index; - }) - .map((v) => { - return ( - - - - - ); - })} - -
TLDController
.{v.domain} -
- {computeTLD(v.result as string)} -
-
- - {v.result as any} - - {v.result && ( - - )} - - - -
-
-
- ); -}; diff --git a/app/local/content/extras/usertag/Usertag.tsx b/app/local/content/extras/usertag/Usertag.tsx deleted file mode 100644 index 9f45dfff5..000000000 --- a/app/local/content/extras/usertag/Usertag.tsx +++ /dev/null @@ -1,28 +0,0 @@ -import { FC } from 'react'; - -export type UsertagVariant = 'full' | 'small'; - -export const Usertag: FC<{ - name?: string; - image?: string; - variant?: UsertagVariant; -}> = ({ name = 'nick.eth', image = '/nick.eth.png', variant = 'full' }) => { - return ( -
-
- {variant == 'full' && ( -
- -
- )} -
- {name} -
-
-
- ); -}; diff --git a/app/local/content/extras/videos/VideoGallery.tsx b/app/local/content/extras/videos/VideoGallery.tsx deleted file mode 100644 index d9f1db061..000000000 --- a/app/local/content/extras/videos/VideoGallery.tsx +++ /dev/null @@ -1,89 +0,0 @@ -import { FC } from 'react'; - -export const VideoGallery: FC<{}> = () => { - return ( -
- {[ - { - title: 'ETHGlobal Brussels Workshop', - location: 'ETHGlobal Brussels', - description: '', - href: 'https://www.youtube.com/watch?v=TcMUvPPW2oI', - cover: 'https://i3.ytimg.com/vi_webp/TcMUvPPW2oI/mqdefault.webp', - }, - { - title: 'ETHGlobal London Workshop', - location: 'ETHGlobal London', - description: '', - href: 'https://www.youtube.com/watch?v=sT8GcDaNpc4', - cover: 'https://i3.ytimg.com/vi_webp/sT8GcDaNpc4/mqdefault.webp', - }, - { - title: 'ETHDenver ENS Workshop', - location: 'ETHDenver', - description: '', - href: 'https://www.youtube.com/watch?v=hz1KH1qvzB4', - cover: '/content/videos/ethdenver24.webp', - }, - { - title: 'February 2024 Docs Update', - location: 'Documentation', - description: '', - href: 'https://www.youtube.com/watch?v=GwX_m28SSOA', - cover: 'https://i3.ytimg.com/vi_webp/GwX_m28SSOA/mqdefault.webp', - }, - { - title: 'ETHRome ENS Workshop 1', - location: 'ETHRome', - description: - 'Greg, from ENS, gives an introductory workshop around what ENS is, why it is important, how it works, and how to build on top of it.', - href: 'https://www.youtube.com/watch?v=HIDPGdTDCj8', - cover: 'https://i3.ytimg.com/vi_webp/HIDPGdTDCj8/mqdefault.webp', - }, - { - title: 'ETHRome ENS Workshop 2', - location: 'ETHRome', - description: 'Luc, from ENS, ', - href: 'https://www.youtube.com/watch?v=SHuCDqPbAP4', - cover: 'https://i3.ytimg.com/vi_webp/SHuCDqPbAP4/mqdefault.webp', - }, - { - title: 'Cross Chain Interoperability', - location: 'ETHPrague', - description: '', - href: 'https://www.youtube.com/watch?v=URnUs4sSrU4', - cover: 'https://i3.ytimg.com/vi_webp/URnUs4sSrU4/mqdefault.webp', - }, - { - title: 'State of ENS by Nick Johnson', - location: 'Devcon Bogota', - description: - // eslint-disable-next-line quotes - "An overview of ENS's innovations and progress in the last couple of years", - href: 'https://www.youtube.com/watch?v=Pta198KJTaw', - cover: 'https://i3.ytimg.com/vi_webp/Pta198KJTaw/mqdefault.webp', - }, - ].map((entry, index) => ( - -
- {entry.cover && ( - - )} -
-
- {entry.title} -

{entry.location}

- {/*

{entry.description}

*/} -
-
- ))} -
- ); -}; diff --git a/app/local/content/index.ts b/app/local/content/index.ts deleted file mode 100644 index 84c471cf2..000000000 --- a/app/local/content/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -import { MDXComponents } from 'mdx/types'; - -import { demos } from './demos'; -import { extras } from './extras'; -import { prose } from './prose'; - -/** - * Content Components - * This includes examples, demos, and other content that is not suitable for markdown. - * Names are transient and must match the name in the mdx file. - */ -export const contentComponents = { - // Links, Buttons, Images - ...prose, - // Interactive Demos - ...demos, - // Other Content - ...extras, -} as any as Record; diff --git a/app/local/content/prose/breadcrumbs/Breadcrumbs.tsx b/app/local/content/prose/breadcrumbs/Breadcrumbs.tsx deleted file mode 100644 index 734c8b117..000000000 --- a/app/local/content/prose/breadcrumbs/Breadcrumbs.tsx +++ /dev/null @@ -1,151 +0,0 @@ -'use client'; -import clsx from 'clsx'; -import Link from 'next/link'; -import { usePathname } from 'next/navigation'; -import { BreadcrumbList, ListItem, WithContext } from 'schema-dts'; - -import { - isRouteLink, - isSectionData, - routeElement, - routeGroup, -} from '#/config/navigation'; -import { navigation } from '#/config/navigation/protocol'; - -const getPageAndGroup = ( - routes: routeGroup[] | undefined, - path: string -): routeElement[] | undefined => { - for (const group of routes ?? []) { - for (const link of group.links) { - if (isRouteLink(link) && link.href == path) { - return [group, link]; - } - } - } - - return undefined; -}; - -export const Breadcrumbs = () => { - const path = usePathname(); - - // Hide on homepage - if (path == '/') return; - - const section = navigation.find((section) => - section.activePattern.test(path) - ); - - const [group, page] = getPageAndGroup(section?.links, path) || [ - undefined, - undefined, - ]; - - const crumbs = [section, group, page].filter((a) => !!a); - - const crumbs2 = crumbs.map((crumb) => { - if (isSectionData(crumb)) { - return ( - - {crumb.name} - - ); - } - - if (isRouteLink(crumb)) { - return ( - - {crumb.title} - - ); - } - - return crumb.title; - }); - - const schema: WithContext = { - '@context': 'https://schema.org', - '@type': 'BreadcrumbList', - itemListElement: [ - { - '@type': 'ListItem', - position: 1, - name: 'Home', - item: '/', - }, - ...crumbs - .map((crumb, index): ListItem => { - if (isSectionData(crumb)) { - return { - '@type': 'ListItem', - position: index + 2, - name: crumb.name, - item: 'https://docs.ens.domains' + crumb.href, - }; - } - - if (isRouteLink(crumb)) { - return { - '@type': 'ListItem', - position: index + 2, - name: crumb.title, - item: 'https://docs.ens.domains' + crumb.href, - }; - } - - return { - '@type': 'ListItem', - position: index + 2, - name: crumb.title, - }; - }) - .filter((a) => { - return !!a.name; - }), - ], - }; - - return ( -