Skip to content

Commit

Permalink
Introduce TLDs Page, Update Styling, Rework Navigation (#27)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucemans committed Dec 4, 2023
1 parent 5a089b7 commit d64a5e6
Show file tree
Hide file tree
Showing 15 changed files with 2,858 additions and 118 deletions.
15 changes: 15 additions & 0 deletions content/dns/tlds.mdx
@@ -0,0 +1,15 @@
import { WIP } from "@/components/wip/WIP";

{/* * @type {import('@/lib/mdxPageProps').MdxMetaProps} */}
export const meta = {
title: 'Supported TLD List',
description: '',
emoji: '📝',
contributors: ['lucemans']
};

# Supported TLD List

Allongside the `.eth` Top Level Domain, the ENS Protocol also supports most of your favourite DNS Top Level Domains (such as `.com`, `.cash` or `.domains`). The list below aims to show all TLDs and their current status.

<TLDList />
2 changes: 0 additions & 2 deletions content/index.mdx
Expand Up @@ -29,8 +29,6 @@ contributors: [
<h2>Learn more</h2>
<p>Try out ENS</p>

{/* <VideoComponent src="https://v3x.space/ens-docs/intro5" /> */}

<div className="grid grid-cols-2 gap-x-3 gap-y-3">
<QuickBannerLink
title="I'm building a dApp"
Expand Down
2 changes: 2 additions & 0 deletions content/learn/dns.mdx
Expand Up @@ -112,4 +112,6 @@ DNS names are widely used and many users may already have one without even reali
In addition to allowing any DNSSEC enabled name to be imported, ENS also allows existing DNS TLDs to take control of their smart-contract resolution process.
Resulting in even more seamless integration with the DNS system.

A list of all supported TLDs can be found [here](/dns/tlds)

<>{/* TODO: Insert examples of protocol.art .kred etc */}</>
7 changes: 4 additions & 3 deletions content/resolvers/ccip.mdx
Expand Up @@ -15,8 +15,8 @@ export const meta = {
{/* This document covers what it takes to write a gateway resolver. */}

The source of truth for a name and its subdomains does not always have to be on-chain or on Ethereum L1 at all.
By leveraging [EIP-3668](https://eips.ethereum.org/EIPS/eip-3668), the Cross Chain Interoperability Protocol (CCIP for short), we can load information about a name (and its subnames) by hitting a so called "Gateway".
This enables for storing names, addresses, records, and more on other chains, or even off-chain.
By leveraging [EIP-3668](https://eips.ethereum.org/EIPS/eip-3668), the Cross Chain Interoperability Protocol (or CCIP Read for short), we can load information by hitting a so called "Gateway".
Within the context of ENS, this enables us, to read names, addresses, records, and more from other chains, or even off-chain.

## How does it work?

Expand Down Expand Up @@ -57,7 +57,8 @@ This service can be a server, a serverless function, worker, etc.
The URL for this gateway is determined by the `OffchainLookup` error, and is passed as a parameter to the error.

### Template Repositories
<Repository src="ensdomains/offchain-resolver" description="CCIP Offchain ENS Resolver Cloudflare Workers"/>
<Repository src="ensdomains/offchain-resolver" description="CCIP Offchain ENS Resolver with Cloudflare Workers"/>
<Repository src="ensdomains/offchain-gateway-rs" description="Offchain CCIP Gateway Resolver implementation in Rust (& postgres)"/>
<Repository src="ensdomains/offchain-resolver-example" />
<Repository src="gskril/ens-offchain-resolver-read-from-api" />

Expand Down
6 changes: 5 additions & 1 deletion content/resolvers/quickstart.mdx
Expand Up @@ -39,4 +39,8 @@ interface ExtendedResolver {

<Note>
Don't forget to add `0x9061b923` to your [EIP-165](https://eips.ethereum.org/) `supportsInterface()` implementation.
</Note>
</Note>

## Offchain Resolution

When you write your own resolver you are able to leverage the power of CCIP Read. More about writing a ccip-enabled resolver [here](/resolvers/ccip)
16 changes: 14 additions & 2 deletions docs/app/globals.css
Expand Up @@ -48,12 +48,13 @@
@font-face {
font-family: 'Inter';
font-display: swap;
src: url('/fonts/sans-serif/inter/Inter-VariableFont_slnt,wght.ttf') format('truetype');
src: url('/fonts/sans-serif/inter/Inter-VariableFont_slnt,wght.ttf')
format('truetype');
}

@media (min-width: 768px) {
:root {
font-size: 18px;
font-size: 16px;
}
}

Expand All @@ -65,6 +66,13 @@
@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-lg bg-ens-light-background-primary dark:bg-ens-dark-background-primary border border-ens-light-border dark:border-ens-dark-border;
}
.card2 {
@apply rounded-lg 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;
}
Expand All @@ -74,6 +82,10 @@
/* width: 720px; */
}

.prose > * {
margin-left: 0;
}

.prose > p + p {
/* @apply !mt-0 mb-0; */
}
Expand Down
2 changes: 2 additions & 0 deletions docs/src/content/extras/index.ts
@@ -1,11 +1,13 @@
import { ChainDeployments } from './deployments/deployment';
import { DNSUsageExamples } from './dns/DNSUsageExamples';
import { QuickBannerLink } from './home/QuickLink';
import { TLDList } from './tld-list/TLDList';
import { Usertag } from './usertag/Usertag';

export const extras = {
DNSUsageExamples,
QuickBannerLink,
Usertag,
ChainDeployments,
TLDList,
};
132 changes: 132 additions & 0 deletions docs/src/content/extras/tld-list/TLDList.tsx
@@ -0,0 +1,132 @@
import { createPublicClient, http, MulticallReturnType, namehash } from 'viem';
import { mainnet } from 'viem/chains';

import { TLDs } from '@/lib/tld-list';

const ADDRESS_MAP = {
'0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85': (
<span className="text-ens-light-blue-primary">ETH Registrar</span>
),
'0x58774Bb8acD458A640aF0B88238369A167546ef2': (
<span className="text-ens-light-green-bright">DNS Registrar</span>
),
'0x828D6e836e586B53f1da3403FEda923AEd431019':
'(Custom) Protocol.ART Registrar',
'0x0b9BB06Ebf35A755998B60353546ae8A055554d2': '(Custom) Box Registrar',
'0x04ebA57401184A97C919b0B6b4e8dDE263BCb920': '(Custom) HipHop Registrar',
'0x1eb4b8506fca65e6B229E346dfBfd349956A66e3': '(Custom) Club Registrar',
'0x56ca9514363F68d622931dce1566070f86Ce5550': '(Custom) Kred Registrar',
'0xA86ba3b6d83139a49B649C05DBb69E0726DB69cf': '(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];

if (owner_address === '0x0000000000000000000000000000000000000000')
return (
<span className="text-ens-light-grey-primary">Unsupported TLD</span>
);

return owner_address;
};

export const TLDList = async () => {
const client = createPublicClient({
chain: mainnet,
transport: http(
process.env.RPC_URL ?? 'https://cloudflare-eth.com/rpc'
),
});

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[][] = [];

for (let index = 0; index < TLDs.length; index += 100) {
chunks.push(TLDs.slice(index, index + 100));
}

const results: [string[], MulticallReturnType][] = [];

for (const chunk of chunks) {
const result = await client.multicall({
contracts: chunk.map((tld) => ({
...contract,
args: [namehash(tld)],
functionName: 'owner',
})),
});

results.push([chunk, result]);
}

return (
<div>
<table>
<thead>
<tr>
<th>TLD</th>
<th>Controller</th>
<th>Notes</th>
</tr>
</thead>
<tbody>
{results
.flatMap(([chunks, result]) => {
return chunks.map((chunk, index) => {
return {
result: result[index].result,
owner_index: classifyOwner(
result[index].result as string
),
domain: chunk,
};
});
})
.sort((a, b) => {
return b.owner_index - a.owner_index;
})
.map((v) => {
return (
<tr key={v.domain}>
<td>.{v.domain}</td>
<td>{computeTLD(v.result as string)}</td>
<td></td>
</tr>
);
})}
</tbody>
</table>
</div>
);
};
2 changes: 1 addition & 1 deletion docs/src/layout/PageLayout.tsx
Expand Up @@ -34,7 +34,7 @@ export const Layout: FC<{
<Header />
<Sidebar />

<div className="relative px-4 pt-14 sm:px-6 lg:px-8">
<div className="relative px-4 pt-24 sm:px-6 lg:px-8">
<main className="relative py-16">
<script
type="application/ld+json"
Expand Down

0 comments on commit d64a5e6

Please sign in to comment.