> Agents can also search and read this documentation through its [MCP server](https://docs.alldomains.id/protocol/~gitbook/mcp).

# Overview

### **What is AllDomains?**

**AllDomains** is a Web3 platform to create, register, and trade customizable Web3 Identities for .everyone

With AllDomains any user can choose not only a name they desire but also the community they wish to associate with, adding a new layer of customization to their Web3 identity. Be it a Token, an NFT collection, or a DAO, **everyone can create their own TLD** and unite their whole community under a unique brand. &#x20;

{% hint style="info" %}
**AllDomains** opens up **Top Level Domain** (TLD) creation so that any project or community can distribute its own **.\[anything]** domains providing users with the freedom of choice for their Web3 ID.
{% endhint %}

At the same time, AllDomains is the first protocol to **bridge the gap between Web2 and Web3** by enabling Web2 domain name registrations on Solana. To this end, we have launched **pilot domain name** registrations for the **.ID Web2 TLD**. These work for both their initially intended purposes and as Web3 domain names in parallel.

{% hint style="success" %}
**Only trust information provided by these official channels:**\
**Socials:**

* Twitter -> <https://x.com/alldomains>
* Discord ->[ ](https://t.co/RAP675K6hx)<https://discord.gg/alldomains>
* Telegram -> <https://t.me/AllDomainsID>

**Websites:**

* Claim Solana Domain Names: [https://alldomains.id/ ](https://alldomains.id/)
* Claim Eclipse Domain Names:[ https://eclipse.alldomains.id/](https://eclipse.alldomains.id/)
* Claim Monad Testnet Domain Names: h<ttps://monad.alldomains.id/>
* Claim SOON SVM Domain Names: <https://soon.alldomains.id/>
* Claim Sonic Domain Names: <https://sonic.alldomains.id/>
* Bridge to Eclipse, Sonic and more: <https://bridge.alldomains.id/>
* Launch a TLD -> <https://alldomains.id/launch-tld>
  {% endhint %}

{% hint style="danger" %}
**Beware of impersonators/scammers on social platforms**

Our administrators will never:

* Direct message you first
* Ask for funds
* Ask for your private keys
  {% endhint %}


# What is a Web3 domain/TLD

A **Web3 domain** is a human-readable and unique address that is easy to remember & communicate and can be used in place of a Public Key (more commonly known as a Wallet Address).

A **TLD** is the final component of a domain name and it’s the highest level in the hierarchical **AllDomains** registry.

{% hint style="info" %}
**\<human readable domain>.\<top-level-domain>**
{% endhint %}

Unlike Web 2 domains that are hosted on the global network of Domain Name System (DNS) servers, **Web3** domains leverage blockchain technology making them decentralized and more importantly allowing them to interact with blockchain apps and smart contracts.


# AllDomains Features

We are revolutionizing the process of domain creation on Solana by introducing renewable domain names for the first time ever.

*Why renewable domain names?*

Having renewable domain names prevents people from squatting on a whole bag of domain names. Having multiple TLDs with renewal fees ensures that there will always be at least one domain name you are looking for available.

**Hybrid Domain Names**

.ID was a world-first iteration of a hybrid TLD across all blockchain platforms. Claiming an 🥚.ID domain name allows users to make use of the same domain name on both Web2 and associate it with their desired Solana Public Key, allowing users and projects to extract the maximum out of their social… .ID.

**Going multi-chain**

While most of AllDomains is currently built on Solana, our long-term vision extends beyond a single blockchain. Our aim is to become a cross-chain solution, facilitating the bridging of domains from other blockchains to Solana and vice versa.

We are excited to announce that AllDomains is **now live on Eclipse, Sonic, and SOON SVMs**, further expanding our reach. Additionally, we will be **live on Monad as soon as its Mainnet launches.** Our commitment to seamless interoperability continues as we connect domains with major blockchains like Ethereum, Bitcoin, Arbitrum, and more.

**Get your TLD!**

Our TLD Program, also known as TLD House, can support an unlimited number of TLDs.

All NFT collections, games, projects, users, and Web3 communities can now create their OWN unique Web3 domain names upon application. Please contact us at <https://alldomains.id/launch-tld>

**Domain Wrapping**

Most of our domains are available for wrapping as **NFTs** and listed on secondary markets through our own NFT Wrapping contract - NameHouse - a Solana Program that enables any domain from any new TLD to be wrapped as an NFT and traded on any Solana NFT Marketplace.

The NFT wrapper is active for the hybrid Web2 and Web3 .ID TLD. This enables Real World Asset (RWA) trading on Solana.

**Dynamic Pricing and Multiple Claim Choices**\
\
Most of our domain names can be claimed in a multitude of SPLs, and we are always looking to add more to our list!

Our domain names can also be customized to be claimed in various ways:&#x20;

* Claim via NFT
* Claim via SFT
* Claim via QR Code for IRL events
* Claim using multiple SPLs
* Claim using Token Extensions
* Claim using your own $TOKEN

**TLD Yield**

TBA


# Benefits of using Web3 domains

* An easy-to-remember address for sending and receiving cryptocurrency, making transactions as easy as sending an email
* The domain only belongs to the owner, which can not be censored
* Secure and open due to their decentralized and transparent nature
* Status symbol and social identity
* Can be leveraged as a personal or business brand
* Crypto equivalent of a custom license plate
* Wrapped as NFTs can be sold on secondary markets
* Can be [integrated](https://docs.alldomains.id/protocol/integrations) with wallets, dApps, and other tools
* Fun and easy to use


# AllDomains TLDs

There are currently >70 TLDs on 5 different chains under the AllDomains Protocol umbrella, and the list is expanding

You can check the complete list by visiting our websites:\
\
Solana:[ https://alldomains.id](https://alldomains.id)\
\
Eclipse: [https://eclipse.alldomains.id](https://eclipse.alldomains.id/) \
\
Monad: [https://monad.alldomains.id ](https://monad.alldomains.id/)\
\
SOON SVM: [https://soon.alldomains.id ](https://soon.alldomains.id/)\
\
SONIC SVM: [https://sonic.alldomains.id ](https://sonic.alldomains.id/)


# Getting Started

Searching for AllDomains Domains

To search for any AllDomains domain name visit our website:

[**https://alldomains.id/**](https://alldomains.id) \ <br>


# Register a domain name

#### To r**egister a new domain:**

1. Go to[ alldomains.id](https://alldomains.id/)​
2. Search for the domain name you want:

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FDBAMR4ui3mbEtpMkSQcb%2FCapture1.PNG?alt=media&amp;token=70b593be-f116-4bdb-83b9-70d08505a99b" alt=""><figcaption><p>Search for a Domain Name </p></figcaption></figure>

3. If you don't know exactly what you're looking for, scroll up and down the TLD list and find your favorite one! \
   Alternatively, if you know exactly what domain name you want, just type in the complete domain in the search bar (e.g. alldomains.maxi) to get that specific result

{% hint style="info" %}
You can use filters to select certain TLDs to compare prices or check the expiration dates for previously purchased domain names.\
\
Feel free to play around and discover your best choice!
{% endhint %}

4. Once you have decided on the domain name you want to purchase, select the SPL you want to use for your purchase and the renewal period, and click Buy Now.&#x20;

{% hint style="info" %}
Some domain names are only available through community-specific tokens (e.g. .superteam domains require a specific token you can only acquire from Superteam)
{% endhint %}


# Dynamic Pricing

Since some of our partnered **TLDs are priced in different SPLs** ($WIF, $SAMO, $MYRO etc.) with a high volatility rate, we have decided to **peg** the domain name registration fees **at specific $USDC** **values** (based on our partners' preferences).

This tech allowed us to implement SPL pricing for ALL our domain names.

Along with $SOL and $USDC, you can now use select partnered tokens ($WEN, $BONK, $CHAT, $SLERF) to claim ANY of our domain names. If you choose to do so, the swap to $USDC will happen instantly via the current Jupiter Exchange price and their standard 2% exchange fee.\
\
We have already integrated Token Extensions and soon you will have the option to claim our domains using even more tokens!&#x20;

To see the complete list of tokens you can use to claim our domain names hit the *Cog* button above the *Powered by Jupiter* line! Click on any of the mentioned tokens, and prices will update accordingly! &#x20;

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2F5hy5VRdIU15xEMV9oQXD%2FScreenshot%202024-06-11%20132718.png?alt=media&amp;token=57116ba8-8545-4b23-84aa-a0dcc97ad009" alt=""><figcaption><p>Tokens you can use to claim domain names</p></figcaption></figure>


# Buy from a Marketplace

You can also purchase a domain on most of the popular NFT Marketplaces on Solana.

Simply search  “??? Domain Names” ("Poor Domain Names", "Bonk Domain Names" etc.) on any of these marketplaces to start browsing NFT domains&#x20;

e.g.

* <https://www.tensor.trade/trade/bonk_domain_names>&#x20;
* <https://magiceden.io/marketplace/bonk_domain_names>&#x20;


# Selling a Domain

To sell a domain users need to wrap their domains as NFTs. Domains can be wrapped (as NFTs) or unwrapped to reveal the domain at any time. When a user wraps their domain:

1. The domain is transferred to an escrow account
2. The smart contract creates an NFT that is transferred to the user in return
3. When the NFT is unwrapped, the program will burn the NFT and return the domain to the owner

Users can wrap and unwrap their domain names a limitless number of times Once a domain is wrapped (as an NFT) they can view it in their wallet and trade it on any NFT marketplace.

Learn how to wrap/unwrap your Domain on the next page:  [Manage your domains ->](https://docs.alldomains.id/protocol/getting-started/manage-your-domains)


# Manage your Domains

To manage your domains, go to[ ](https://abc.onsol.io/)[alldomains.id](https://alldomains.id/), connect your wallet click on it again, and go to your personal profile:

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FGsiyB6bxCnRYumHP3JpX%2Fimage.png?alt=media&amp;token=6f9fd851-ec4a-47ff-968a-c2938d3525cc" alt=""><figcaption><p>View Profile</p></figcaption></figure>

Once you do so, you will be greeted by the following interface:

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fc4ztam30u4Byn6nhVFjR%2Fimage.png?alt=media&amp;token=6b8445d0-8c05-4ea2-9366-86a5a098c481" alt=""><figcaption><p>Your Profile Dashboard</p></figcaption></figure>

### Extend/Renew domain

You can easily renew in advance and extend your domains. Click Extend, select the period and click Renew!

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2F7CeWqoJtvGK1vBFTxV0c%2Fimage.png?alt=media&amp;token=c98dce44-8514-4ebd-9b0b-8228d574b9c4" alt=""><figcaption><p>Renew your domain name</p></figcaption></figure>

### **Set your Main Domain Name**

If you own multiple AllDomains assets but want a specific one displayed by our Integration Partners (e.g., Birdeye), you must choose a Main Domain!

You can set your favorite domain by clicking the "☆" icon associated with one of your domains and signing off the transaction.

{% hint style="info" %}
If your wallet is already associated with a .sol domain name, our integration partners will display that one first, as there is no protocol consensus yet.

If you want your AllDomains asset to take precedence, move the .sol domain to another wallet.
{% endhint %}

### **Domain Records**

You can edit your domain records by clicking the **Records** button under the domain name.\
See the [Records](https://docs.alldomains.id/protocol/developer-guide/records-svm) section for the complete list.

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fgk2A7DQcK4jKc6ftsdYz%2Fimage.png?alt=media&amp;token=19efedb2-7339-4d44-9a5b-eb9e3c626c72" alt=""><figcaption><p>Edit Domain Records</p></figcaption></figure>

{% hint style="warning" %}
You can only edit records for unwrapped domain names. \
\
See *Wrap/Unwrap a domain name to/from an NFT* below!
{% endhint %}

### Transfer a domain

Easily transfer your domain to another Solana address

1. Click on the Send button next to the domain you want to transfer

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FxAgXEwQ24spvqSdR9EQm%2Fimage.png?alt=media&amp;token=a1c136b3-f48e-4be2-8bd2-87a2f98584e5" alt=""><figcaption><p>Transfer domain</p></figcaption></figure>

2. In the Modal window that appears enter the Solana address/domain name you want to send the domain to and click Transfer

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2F2BTlLGFnydirtwnCsjV0%2Fimage.png?alt=media&amp;token=e4dcb92b-9d92-4a50-804f-8c51c04fd5a1" alt=""><figcaption><p>Transfer your domain name</p></figcaption></figure>

**Wrap /Unwrap a domain name to/from an NFT**

Depending on the state of a domain there is either a "**Wrap**" or "**Unwrap**" button next to it.

If you click on any of the Wrap or Unwrap buttons a modal to change the state from and to an NFT appears depending on the domain's current state.

{% hint style="info" %}
Be sure to have some spare $SOL to generate the NFT token account when wrapping a domain name for the first time.
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FPraK3heto8LU1dbF5qHP%2Fimage.png?alt=media&amp;token=f2c5e43c-0fdf-4d6b-8d38-c08d5ffcb156" alt=""><figcaption><p>Wrap your domain name as NFT</p></figcaption></figure>

{% hint style="info" %}
Wrapping or unwrapping will not affect the way your domain name works! You can still receive SOL, SPLs, or NFTs to a wrapped domain name.
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FLp8U3GYULcOVTfQ80QIU%2Fimage.png?alt=media&amp;token=168eecca-ede4-4f4b-bd90-cb082ecc06ae" alt=""><figcaption><p>Unwrap your domain name</p></figcaption></figure>

Wrapped domain names can be transferred as regular NFTs directly from your Solana Wallet.


# Using your Domain

After registering a new domain name with us, your domain will initially not be displayed anywhere! The domain however is already associated with your wallet address and can be readily used.

If you want to check the domain ownership without wrapping your domain up, head to your profile dashboard!

Among the many uses you can find for your domain name, the most popular by far is simply transferring funds or assets via your wallet!

**Perform a transaction with a domain name**

To send SOL or any other token using a domain name simply add the domain name in the Recipient field, where you would usually add the wallet address. Hit Next, and you’re done!

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fg6MlhRVwEbmqRUxsN4SA%2Fimage.png?alt=media&amp;token=59b04d50-5f2c-4b14-8b70-4045056acc98" alt=""><figcaption><p>Transfer funds using a domain name</p></figcaption></figure>

If you encounter any error while trying to perform a transaction there are a couple of reasons behind it:

1. You have the wrong domain name
2. The wallet you are using has not yet integrated our domain names.

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FcJO62kp99h4MrFLRNkib%2Fimage.png?alt=media&amp;token=2a14e29b-b50b-4f29-9112-9ba8446f0ada" alt=""><figcaption><p>Error with an unregistered domain name</p></figcaption></figure>

More use cases are available via our [integration](https://docs.alldomains.id/protocol/integrations) partners. Just keep an eye on the expanding list of integrations.

Some communities that launched TLDs with us have taken domain names to another level entirely. Some have enabled discord gating, while others allow you to stake your domain names or even offer registration rewards!


# Expiration and Grace Period

At the moment, a 50-day Grace Period is in effect for all domain names

However, the code for having a “grace period” is new, and not all our partners have had a chance to integrate it yet.

{% hint style="info" %}
If your domain expires, you can no longer receive tokens with it or use it in any of our partner's products.\
\
Please check the expiration date of your domain name on your personal dashboard.
{% endhint %}

**After this code gets integrated, this is how the Grace Period will work:**

First 45 days after your domain expires you retain ownership of the asset, and it will still work with all our integrations\
For 5 more days after that you retain ownership of the asset, but it will no longer be useable\
After the grace period passes, the account closes and anyone can register the domain name

We are looking forward to providing a new **“Gift a renewal”** mechanic for our domain names.

Domains in the Grace Period will still show up on Secondary Markets, but after this period passes, they will be dropped from the verified collection and will no longer show up on marketplaces. This ensures **you do not risk buying an expired domain name** without the possibility of renewal.\
\
If you want to ensure you never lose a domain name to expiration [enabling notifications](https://docs.alldomains.id/protocol/getting-started/enable-notifications) will keep your domains safe!<br>


# Enable Notifications

Want to ensure you do not run the risk of losing your domain due to expiration, while also being among the first to discover and benefit from new integrations?

Our [Dialect](https://www.dialect.to/) - Powered notification system can ensure you are always updated with everything happening with your domain name!

To enable Notifications for your domain name, go to our website, <https://alldomains.id/>  and connect the wallet that holds it.

After doing so, click on the ***Notifications Bell*** and then on the ***Set up Notifications*** button

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FsswuQVYtfhwF068v7Dax%2F3Screenshot%202024-04-30%20160727.png?alt=media&amp;token=30bc8b85-ecfa-4ce9-82e7-85aa01161dfb" alt=""><figcaption><p>Setting up Notifications</p></figcaption></figure>

There are three platforms you can choose from:

***1. In App*** notifications will notify you on our website, meaning you will periodically need to check in for new notification

***2. Telegram notifications*** will allow the Dialect bot to DM you whenever a new notification is received

***3. Email*** notifications&#x20;

{% hint style="info" %}
If you want to be 100% sure you never miss anything, you can opt for all three; however, if you’d rather not be bothered too often, you can choose only one or two.
{% endhint %}

\
You can also choose what exactly you want to be notified about:

***1. Domain name expiry*** will notify you each time any of your domain names are getting close to the expiration date:

* 30 days before the domain name enters the Grace Period
* Domain name enters the 45-day Grace Period
* The Grace Period ends, but you still own the domain name for another 5 days

***2. New TLD launch*** will notify you each time a new TLD becomes available

***3. General announcements*** will notify you whenever a new integration comes online and any important product updates\
\
\
To set up any of these notifications follow the steps! They are the standard steps required to verify your identity.


# Verify with Matrica

If you're a member of a community that's implemented the Matrica domain name gating for their Discord, it's crucial to follow these steps for verification:<br>

1\. Go to <https://matrica.io/> and click on the connect button. You can connect either with a Solana Wallet or your Discord account!

2\. You can now start creating your Matrica account and customize it any way you choose!

3\. If you own multiple community domain names and hold these in different wallets you can associate as many domain names/wallets as you choose here <https://matrica.io/settings>

{% hint style="info" %}
This will allow you to get membership roles on a single Discord/Telegram account for assets held across multiple wallets/communities.
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FHjIJWaWd9NyAyXb4wsZQ%2Funnamed%20(3).png?alt=media&amp;token=2be1f738-8525-4b13-b7ee-afc680670100" alt=""><figcaption><p>Matrica Profile Landing Page</p></figcaption></figure>

4\. After following the steps above go to the community server and look for their Matrica channel.\
Follow the steps there and you should be all set.&#x20;

{% hint style="info" %}
&#x20;It can take up to 15 minutes for your roles to refresh so please be patient.
{% endhint %}


# Hybrid Domain Names (.com on Solana)

Welcome to the official documentation for **hybrid domain names on Solana.**

These docs explain how hybrid domains work, how to get started, how to manage your domain, and how trading and on-chain ownership function,  all without breaking how the web already works.

***

### What is .com on Solana?

.com on Solana is a hybrid Web2 / Web3 domain system.

It upgrades traditional .com domains with on-chain ownership, identity, and liquidity, while preserving full DNS functionality, ICANN compatibility, and real-world usage.

Your website stays the same. Your email stays the same.

What changes is how ownership, identity, and transferability work.

This is not a new TLD. These are real .com domains, upgraded.

***

### Who is this for?

* Crypto-native users who want real-world assets on-chain
* Domain investors who want instant settlement and global liquidity
* Founders & businesses who want future-proof digital identity
* Developers building login, payments, and identity systems
* All users who either want to speculate or use the domain names&#x20;


# How It Works

### Web2 and Web3 roles

.com domains continue to exist in the Web2 world:

* Registered via ICANN-compatible registries
* Resolved via DNS
* Used for websites, email, and hosting

The Web3 layer adds:

* On-chain ownership (wallet-based)
* Transferability
* Programmable identity
* Future marketplace liquidity

Web2 remains the legal root.

The blockchain upgrades ownership and utility it does not replace domain law or DNS.

***

### Registration model

AllDomains registers .com domains on your behalf through standard Web2 registries.

Once registered, a corresponding on-chain record is created on Solana that represents:

* Ownership
* Renewal state
* Metadata pointers

This creates a single hybrid domain that works across both worlds.

***

### Ownership model

* AllDomains is the legal Web2 registrant
* You control the domain on-chain via your wallet
* Ownership transfers happen on-chain
* Legal enforcement remains Web2-based

This design ensures compatibility with existing internet rules while enabling Web3 utility.

<br>


# Getting Started

### Step 1: Connect a wallet

Connect any Solana wallet on the AllDomains website.

The connected wallet becomes the owner wallet for your domain.

***

### Step 2: Register or bring a .com on-chain

You can:

* Register a new .com domain
* Bring an existing .com domain on-chain

Both result in a hybrid domain with Web2 and Web3 functionality.

***

### Step 3: Manage your domain

From your profile you can:

* View owned domains
* Manage name servers
* Renew domains
* Transfer ownership

***

### Step 4: Renewals

Hybrid domains must be renewed through AllDomains.

Each renewal:

* Extends the Web2 registration
* Extends the Web3 ownership

Renewals are unified — it’s not possible to renew only one side.

<br>


# Domain Management

### Name servers

Name servers are managed from your domain dashboard.

You can:

* Add name servers
* Remove name servers
* Update them at any time

DNS changes propagate almost instantly.

***

### Using your domain

You can use your .com domain exactly like any other Web2 domain:

* Websites
* Hosting providers
* Email services (Google Workspace, Outlook, etc.)

On-chain functionality does not interfere with Web2 usage.

***

### Transfers between wallets

You can transfer a domain to another wallet as long as name servers are empty.

This prevents accidental transfers of actively used domains.

***

### Wallet loss

If you lose access to your wallet, the domain is lost.

There is currently no recovery mechanism.

Users are strongly encouraged to secure wallets and renew domains early.

<br>


# Trading & Wrapping

### What is wrapping?

Wrapping prepares a domain for resale on marketplaces.

Wrapped domains:

* Are not actively used on Web2
* Can be listed on supported marketplaces

***

### Why name servers must be removed

Domains with active name servers are considered "in use".

To protect buyers and sellers, in-use domains cannot be wrapped or sold.

This prevents selling live websites.

***

### Selling a domain

To sell a domain:

1. Remove name servers
2. Wrap the domain
3. List it on a supported marketplace<br>

***

### Marketplaces

Trading will be supported on major Solana NFT marketplaces.

Secondary sales incur a 5% royalty.

Standard Solana transaction fees apply and are negligible.

<br>


# On-Chain Mechanics

### What is stored on-chain

The on-chain metadata includes:

* Ownership (wallet)
* Unique domain identifier
* Expiry and renewal state
* Metadata pointers (including name server records)

***

### Ownership history

Ownership history is publicly visible on-chain.

***

### Synchronization

Web2 and Web3 records are always synchronized.

It is not possible for ownership or renewal state to become out of sync.

<br>


# FAQ

1\. How is this different from ENS / Unstoppable / other on-chain domains?

ENS and similar systems create new Web3-only domains.\
AllDomains upgrades Web2 domains giving them Web3 utility as well!

.com on Solana preserves real DNS and ICANN compatibility, while adding on-chain ownership and utility. It’s built for use, not just trading.

***

2\. Is my .com still registered with ICANN?

Yes. AllDomains registers and manages the domain through standard ICANN-compatible registries.

***

3\. Who actually owns the domain — me or the protocol?

AllDomains is the legal Web2 registrant, as we register the domain on your behalf.\
You control the domain’s on-chain ownership, management, and transfer via your wallet.

***

4\. What happens if I don’t bring my .com on-chain?

Nothing changes. Your domain continues working exactly as it does today.

Bringing it on-chain is optional.

***

5\. Can I bring any .com on-chain, or only new ones?

You can bring both existing and newly registered .com domains on-chain.

***

6\. Is this just a wrapper or synthetic representation?

No.

This is not a wrapped or mirrored asset. It’s a hybrid system where the Web2 domain remains real and functional, with a native on-chain ownership and utility layer added.

***

7\. Why hasn’t this been done before?

Because it’s extremely hard.

Most past attempts focused on tokenization for trading. Preserving DNS, ICANN compatibility, renewals, disputes, and real usage at scale requires deep integration with Web2 infrastructure.

***

8\. Why did you choose Solana?

Solana offers the speed, low fees, and composability required for internet-scale identity and naming.

Other chains simply aren’t practical for this use case.

***

9\. Is this permanent, or experimental?

This is production infrastructure built on existing Web2 domain standards.

It’s designed to be long-term, not experimental.

***

10\. Is this just for speculation and trading?

No. Trading comes later.

The primary goal is ownership, identity, and real-world utility. Liquidity is a benefit, not the foundation.

***

11\. What happens if AllDomains shuts down?

Your Web2 domain continues working unchanged.

All on-chain records remain publicly available. You can also renew domains for multiple years in advance to reduce risk.

***

12\. Can this be censored or revoked?

The same rules apply as Web2 today.

Legal actions, UDRP rulings, and court orders are enforced at the registry level. The on-chain layer reflects real-world outcomes.

***

13\. What prevents double ownership (Web2 vs Web3)?

Web2 remains the legal root.

On-chain ownership is linked to and enforced through the Web2 registration, preventing conflicting ownership states.

***

14\. What happens during domain renewal?

Renewals are handled through AllDomains and always renew both Web2 and Web3 together.

It’s not possible to renew one without the other.

***

15\. Can this break or be hacked?

The Web2 domain infrastructure remains unchanged.

The on-chain layer uses standard blockchain security assumptions. There is no additional risk to DNS, websites, or email.

***

16\. Is this compliant with existing domain regulations?

Yes. Domains remain governed by existing ICANN, registry, and registrar rules.

***

17\. What stops someone from front-running or stealing domains?

Ownership changes require both valid Web2 registration and on-chain authorization.

There’s no mechanism to claim or steal a domain without proper control.

***

18\. Is this legally recognized ownership?

Legal ownership remains Web2-based.

The on-chain record provides verifiable ownership and transferability within that legal framework.

***

19\. What happens in disputes?

Disputes are resolved exactly as they are today in Web2.

Registries and registrars remain the final authority.

***

20\. Can I transfer my on-chain .com instantly?

Yes. Transfers between wallets are instant, provided the domain is not actively in use (name servers removed).

***

21\. Are there royalties or fees on transfer?

Yes. A 5% royalty applies to secondary market sales. No other protocol fees apply.

Standard Solana transaction fees are negligible.

***

22\. Will marketplaces support this natively?

Yes. Trading will be supported on Magic Eden and Tensor.

***

23\. When will secondary trading go live?

A few days after launch, in the next rollout phase.

***

24\. Can I use this as collateral or in DeFi?

Not at launch. This may be possible in the future, depending on ecosystem integrations.

***

25\. Is ownership history fully transparent?

Yes. Ownership history is publicly visible on-chain.

***

26\. Are premium domains treated differently?

At the moment premium domain names (<5 chars) are not available worldwide

***

27\. Can registrars block this?

Registrars continue to enforce Web2 rules, but cannot arbitrarily override on-chain ownership without legal basis.

***

28\. Does this reduce escrow risk?

Yes. Transfers settle instantly on-chain without traditional escrow delays.

***

29\. Is liquidity expected to be better than Web2?

Yes. On-chain settlement and global marketplaces significantly reduce friction.

***

30\. How do apps resolve a .com on-chain?

Apps query the on-chain record for ownership and metadata, while DNS continues to resolve via standard Web2 infrastructure.

***

31\. Is there an API or SDK?

APIs and developer tools are planned.

***

32\. How do wallets resolve .com names?

Wallets resolve ownership and metadata via Solana, similar to other name services.

***

33\. Can this be used for payments?

Yes. Domains can function as human-readable payment identifiers.

***

34\. What metadata is stored on-chain?

* Ownership (wallet)
* Domain identifier
* Expiry / renewal state
* Metadata pointers  name servers)

***

35\. Is this composable with other protocols?

Yes. It’s designed as a composable identity primitive.

***

36\. Does this work on mobile?

Yes, including Solana-native mobile wallets and apps.

***

37\. Is this Solana-only?

Solana is the first chain.

***

38\. Can other chains integrate later?

Yes. The system is chain-agnostic by design.

***

39\. Do I need crypto to use this?

Yes! All registrations, domain management, etc. are on-chain, so a moderate amount of $SOL and $USDC are required.

***

40\. Do I need a crypto wallet?

Yes, to manage on-chain ownership. Not required to simply use the domain as a website.

***

41\. Is this safe for businesses?

Yes. It preserves existing legal and operational domain standards.

***

42\. What’s the benefit if I never trade my domain?

You still gain verifiable ownership, identity, and future-proof utility.

***

43\. Is this a new TLD?

No. These are real .com domains.

***

44\. Will my registrar still manage my domain?

AllDomains manages registration on your behalf.

***

45\. What’s the downside?

You’re responsible for wallet security, and renewals include a Web3 component.

***

46\. Isn’t this just marketing hype?

No. It’s a functional upgrade to existing internet infrastructure.

***

47\. Didn’t others try this already and fail?

Others focused on speculation. AllDomains focuses on usability and compatibility.

***

48\. Why hasn’t ICANN done this themselves?

ICANN governs policy, not product innovation.

***

49\. Is this just NFTs rebranded?

No. Domain NFTs don’t preserve DNS, renewals, or legal domain frameworks.

***

50\. Is this another Web3 domain cash grab?

No. Pricing is fixed and comparable to traditional domains.

***

51\. What problem does this really solve?

It makes domain ownership programmable, transferable, and interoperable — without breaking the web.

***

52\. Why now?

Infrastructure, blockchains, and demand have finally matured.

***

53\. Who is this actually for?

Businesses, creators, professionals, developers, and of course regular users.

***

54\. Is this sustainable long-term?

Yes. It’s built on the existing global domain economy.

***

55\. What’s stopping big registrars from copying this?

Execution. Hybrid domains require deep Web2 and Web3 integration.

For Later

***

2\. Does this affect my existing website, email, or DNS setup?

No. Everything continues working exactly as it does today.

Your website, hosting, email, and DNS remain unchanged.\ <br>

***

45\. Why should I care if my site already works?

Because ownership, identity, and interoperability are becoming programmable.

This is an upgrade, not a fix.

<br>


# Getting a TLD

As stated before, **AllDomains** opens up **Top-Level Domain** (TLD) creation so that any project, community, or user can distribute its own .***\[anything]*** domains, providing users with the freedom of choice for their Web3 ID.

Our **Get Your TLD** feature enables just that, by allowing you to claim your TLD, set up your own revenue plan, prices, NFTs background, etc.

The choice for your ***.\[anything]*** is yours! Of course, as with any other Web3 asset, some may be more valuable than others! Pay attention to your communities’ needs, rituals, and slogans, and choose the TLD you think best suits you!

Some communities may decide to go for a more formal TLD (.thug), while others for a more viral one (.caw). The choice is yours, just remember, a TLD can be a valuable tool for your projects’ branding, provide value to its users, and drive up your engagement! aim for something that best represents your product, values, and users!

We can offer you a wide variety of custom claim methods for your TLDs:&#x20;

* Claim via NFT
* Claim via SFT
* Claim via QR Code for IRL events
* Claim using multiple SPLs
* Claim using Token Extensions
* Claim using your own $TOKEN

If you want to start a new TLD please contact us via the form here <https://alldomains.id/launch-tld>

{% hint style="danger" %}
**Disclaimer:** Please be aware that certain words with offensive or controversial connotations will not be made available on the AllDomains platform. We are committed to promoting a respectful and inclusive environment for all users.&#x20;
{% endhint %}


# Disclaimer

While our goal is to provide seamless integrations for all new TLDs, it is essential to note that some integrations may not activate automatically. We cannot guarantee that all integrations will go online on day one. We strive to continually improve our platform to deliver the best possible services.

Support will be provided to each TLD to get the same integrations as the existing ones!

We would greatly appreciate your help bringing more integrations for the protocol online. More integrations make all our TLDs more valuable!

The complete list of existing integrations can be viewed [here!](https://docs.alldomains.id/protocol/integrations)


# Developer Guide

This following sections provide informations about:

* [Programs](https://docs.alldomains.id/protocol/developer-guide/programs-svm-and-smart-contracts-evm)
* [**AD SDK**](https://docs.alldomains.id/protocol/developer-guide/ad-sdks)
* [Records](https://docs.alldomains.id/protocol/developer-guide/records-svm)
* [Structure/Architecture](https://docs.alldomains.id/protocol/developer-guide/structure-architecture)
* [Integrations](https://docs.alldomains.id/protocol/integrations)


# Programs (SVM) & Smart Contracts (EVM)

## ANS (SVM)

ANS - All Name Service: a Solana Program that allows users create human readable domain names that can be used in place of a Public Key.&#x20;

Deployed on [Mainnet](https://explorer.solana.com/address/ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK) and [Devnet](https://explorer.solana.com/address/ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK?cluster=devnet).

```
ALTNSZ46uaAUU7XUV6awvdorLGqAsPwa9shm7h4uP2FK
```

## TLD House (SVM)

A Solana Program that gives any project the possibility to have their own TLD (**.anything**) on Solana to give/sell or use in any way they want in their community.&#x20;

Deployed on [Mainnet](https://explorer.solana.com/address/TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S) and [Devnet](https://explorer.solana.com/address/TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S?cluster=devnet).

<pre><code><strong>TLDHkysf5pCnKsVA4gXpNvmy7psXLPEu4LAdDJthT9S
</strong></code></pre>

## ANS Root Contract (EVM)

An EVM Smart contract that gives any project the possibility to have their own TLD (**.anything**) on Solana to give/sell or use in any way they want in their community.&#x20;

Deployed on Monad Mainnet.

```
0xE6d461c863987F2a1096eA3476137F30f75B3d46
```

## ANS Public Resolver Contract (EVM)

An EVM Smart contract resolver that can be used to set the address of an ANS node. It is currently used for main domains can can be extended to more features.

Deployed on Monad Mainnet.

```
0x314582158A0a72802aD8F6EeE6243C73dCf1F562
```

## Name House (SVM)

Domain NFT Wrapping / Unwrapping: a Solana Program that enables any domain from any TLD to be wrapped as an NFT and be traded on any SOLANA NFT marketplace.

Deployed on [Mainnet](https://explorer.solana.com/address/NH3uX6FtVE2fNREAioP7hm5RaozotZxeL6khU1EHx51) and [Devnet](https://explorer.solana.com/address/NH3uX6FtVE2fNREAioP7hm5RaozotZxeL6khU1EHx51?cluster=devnet).

```
NH3uX6FtVE2fNREAioP7hm5RaozotZxeL6khU1EHx51
```

## TLD Manager (SVM)

to be updated

## All Campaign (SVM)

&#x20;to be updated


# AD SDKs

### How to integrate AllDomains Protocol:

libraries are opensource with MIT licenses:\
Typescript: <https://github.com/onsol-labs/tld-parser>\
Rust: [https://github.com/onsol-labs/tld-parse](https://github.com/onsol-labs/tld-parser)[-rs](https://github.com/onsol-labs/tld-parser-rs)

#### 1. Installation

```
npm install @onsol/tldparser
```

#### 2. Domain Resolution

The following code shows how to get the Public Key owner of a domain name

* works with **any AllDomains TLD**

```typescript
import { TldParser } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the owner pubkey of a domain name
async function resolveDomain(domain){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    return await parser.getOwnerFromDomainTld(domain);
}

//get the owner pubkey of "miester.abc";
resolveDomain("miester.abc");

//get the owner pubkey of "miester.bonk"
resolveDomain("miester.bonk");

//get the owner pubkey of "miester.poor"
resolveDomain("miester.poor");

```

#### 3. Get domains owned by a Public Key

**a. Get all owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all the domains owned by a public key
async function getOwnedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);

    // get all owned domains
    let allUserDomains = await parser.getParsedAllUserDomains(owner);

    return allUserDomains;
}

// get all owned domains
getOwnedDomains(new PublicKey(""));
```

**b. Get only unwrapped owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key
async function getOwnedUnwrappedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains
    let unwrappedUserDomains = await parser.getParsedAllUserDomainsUnwrapped(owner);

    return unwrappedUserDomains;
}

// get only unwrapped owned domains
getOwnedUnwrappedDomains(new PublicKey(""));
```

#### 4. Get domains owned by a Public Key from a specific TLD

**a. Get all owned domains from a specific TLD**

<pre class="language-typescript"><code class="lang-typescript">import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the all the domains owned by a public key in a TLD
<strong>async function getOwnedDomainsFromTld(owner, tld){
</strong>
    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get all owned domains from a TLD
    let ownedDomainsFromTld = parser.getParsedAllUserDomainsFromTld(owner, tld);

    return ownedDomainsFromTld;
}

//get all owned domains in the ".abc" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "abc");

//get all owned domains in the ".bonk" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "bonk");

//get all owned domains in the ".poor" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "poor");
</code></pre>

**b. Get all only unwrapped owned domains from a specific TLD**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key from a TLD
async function getOwnedUnwrappedDomainsFromTld(owner, tld){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains from a TLD
    let ownedUnwrappedDomainsFromTld = parser.getParsedAllUserDomainsFromTldUnwrapped(owner, tld);

    return ownedUnwrappedDomainsFromTld;
}

//get owned unwraped domains in the ".abc" Tld, without the "."
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "abc");

//get owned unwraped domains in the ".bonk" Tld
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "bonk");

//get owned unwraped domains in the ".poor" Tld
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "poor");
```

#### 5.  Get all active AllDomains TLDs

```typescript
import { getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

//get all active AllDomains TLDs
const allTlds = await getAllTld(connection);
```

#### 6.  Get all domains registered in All TLDs&#x20;

```typescript
import { NameRecordHeader, TldParser, findAllDomainsForTld, getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// slow
// please use no. 8 for a batch/faster implementation 
// this code doesn't check if a domain is expired or not
async function getAllRegisteredDomains(connection: Connection){
    //get all TLDs
    const allTlds = await getAllTld(connection);
    const parser = new TldParser(connection);
    let domains = [];
    for (let tld of allTlds) {

        //get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, tld.parentAccount);
            
        //get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(connection, tld.parentAccount);

        if (!parentNameRecord || !parentNameRecord.owner) return;
        
        //parse all name accounts in a specific TLD
        for (let nameAccount of allNameAccountsForTld) {

            //get domain as string without the tld
            const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord.owner);
            domains.push(                {
                nameAccount: nameAccount,
                domain: `${domain}${tld.tld}`
            });
        }
    }
    return domains;
}

// get all domains registered on AllDomains
console.log(await getAllRegisteredDomains(connection))

```

7. #### &#x20;Get User Main Domain&#x20;

```typescript
import { MainDomain, findMainDomain } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";


// returns MainDomain struct if it is available. it will return undefined if it is not.
// MainDomains are usually shown as mainDomain.domain + mainDomain.tld 
// the mainDomain.nameAccount is proof that the user has set it.
const fetchMainDomain = async (connection: Connection, pubkey: string | PublicKey): Promise<MainDomain | undefined> => {
    if (typeof pubkey === "string") {
        pubkey = new PublicKey(pubkey)
    }
    const [mainDomainPubkey] = findMainDomain(pubkey);
    let mainDomain = undefined;
    try {
        mainDomain = await MainDomain.fromAccountAddress(
            connection,
            mainDomainPubkey,
        );
        return mainDomain
    } catch (e) {
        console.log("No main domain found")
    }
    return mainDomain
};


const CONNECTION = new Connection("");
console.log(await fetchMainDomain(CONNECTION, "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"))

// MainDomain {
//     nameAccount: PublicKey [PublicKey(9YzfCEHb62bQ47snUyjkxhC9Eb6y7CSodK3m8CKWstjV)] {
//       _bn: <BN: 7f0fb1f72ae0af9c5e7f5e4190d02ed2a720e88fb5787425157b9a9ec3fc39ec>
//     },
//     tld: '.abc',
//     domain: 'miester'
//   }
```

#### 8. Batch get AllDomains Domains

```typescript
import {
    ANS_PROGRAM_ID,
    findNameHouse,
    findNftRecord,
    getAllTld,
    getHashedName,
    getNameAccountKeyWithBump,
    NameRecordHeader,
    NftRecord,
    TldParser,
} from "@onsol/tldparser";
import {
    Connection,
    GetProgramAccountsResponse,
    PublicKey,
} from "@solana/web3.js";
import { setTimeout } from "timers/promises";

const connection = new Connection("");

async function findAllDomainsForTld(
    connection: Connection,
    parentAccount: PublicKey,
): Promise<{ pubkey: PublicKey; nameRecordHeader: NameRecordHeader }[]> {
    const filters: any = [
        {
            memcmp: {
                offset: 8,
                bytes: parentAccount.toBase58(),
            },
        },
    ];

    const accounts: GetProgramAccountsResponse =
        await connection.getProgramAccounts(ANS_PROGRAM_ID, {
            filters: filters,
        });
    return accounts.map((a) => {
        return {
            pubkey: a.pubkey,
            nameRecordHeader: NameRecordHeader.fromAccountInfo(a.account),
        };
    });
}

export async function performReverseLookupBatched(
    connection: Connection,
    nameAccounts: PublicKey[],
    tldHouse: PublicKey,
): Promise<(string | undefined)[]> {
    let reverseLookupDomains: (string | undefined)[] = [];

    while (nameAccounts.length > 0) {
        const currentBatch = nameAccounts.splice(0, 100);

        const promises = currentBatch.map(async (nameAccount) => {
            const reverseLookupHashedName = await getHashedName(
                nameAccount.toBase58(),
            );
            const [reverseLookUpAccount] = getNameAccountKeyWithBump(
                reverseLookupHashedName,
                tldHouse,
                undefined,
            );
            return reverseLookUpAccount;
        });

        const reverseLookUpAccounts: PublicKey[] = await Promise.all(promises);
        const reverseLookupAccountInfos =
            await connection.getMultipleAccountsInfo(reverseLookUpAccounts);

        const batchDomains = reverseLookupAccountInfos.map(
            (reverseLookupAccountInfo) => {
                const domain = reverseLookupAccountInfo?.data
                    .subarray(200, reverseLookupAccountInfo?.data.length)
                    .toString();
                return domain;
            },
        );

        reverseLookupDomains = reverseLookupDomains.concat(batchDomains);
    }

    return reverseLookupDomains;
}

// onlyDomains will grab only domains and no nfts
async function getAllRegisteredDomains(
    tldExpected?: string,
    onlyDomains: boolean = false,
) {
    // get all TLDs
    const allTlds = await getAllTld(connection);

    const domains = [];
    for (const tld of allTlds) {
        if (tldExpected) {
            if (tld.tld != tldExpected) continue;
        } 
        // get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(
            connection,
            tld.parentAccount,
        );
        if (!parentNameRecord) continue;
        if (!parentNameRecord.owner) continue;

        // get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(
            connection,
            tld.parentAccount,
        );
        await setTimeout(50);
        
        const [nameHouseAccount] = findNameHouse(parentNameRecord.owner);

        const nameAccountPubkeys = allNameAccountsForTld.map((a) => a.pubkey);

        const domainsReverse = await performReverseLookupBatched(
            connection,
            nameAccountPubkeys,
            parentNameRecord.owner,
        );

        let index = 0;
        for (const domain of domainsReverse) {
            const [nftRecord] = findNftRecord(
                allNameAccountsForTld[index].pubkey,
                nameHouseAccount,
            );
            let finalOwner =
                allNameAccountsForTld[index].nameRecordHeader.owner?.toString();
            if (finalOwner == nftRecord.toString() && !onlyDomains) {
                const nftRecordData = await NftRecord.fromAccountAddress(
                    connection,
                    nftRecord,
                );
                const largestAccounts =
                    await connection.getTokenLargestAccounts(
                        nftRecordData.nftMintAccount,
                    );
                if (largestAccounts.value.length > 0) {
                    const largestAccountInfo =
                        await connection.getParsedAccountInfo(
                            largestAccounts.value[0].address,
                        );
                    if (largestAccountInfo?.value?.data) {
                        finalOwner = new PublicKey(
                            // @ts-ignore
                            largestAccountInfo.value.data.parsed.info.owner,
                        ).toString();
                    }
                }
                await setTimeout(50);
            }
            domains.push({
                nameAccount: allNameAccountsForTld[index].pubkey,
                domain: `${domain}${tld.tld}`,
                owner: finalOwner,
                expiresAt:
                    allNameAccountsForTld[index].nameRecordHeader.expiresAt,
                createdAt:
                    allNameAccountsForTld[index].nameRecordHeader.createdAt,
            });
            index += 1;
        }
    }
    return domains;
}

async function main() {
    // or ".eyekon" or ".superteam" or ".monke"
    // if tldExpected is undefined it will grab all domains
    const tldExpected: string | undefined = ".zk";
    // if set true it will grab only domains and no nfts
    const onlyDomains = false;
    const domains = await getAllRegisteredDomains(tldExpected, onlyDomains);
    console.log(JSON.stringify(domains));
    // console.log(domains?.length)
}

// get all domains registered on AllDomains
main();
```

#### 9. Batch get Main Domains

```typescript
import {
  MainDomain,
  findMainDomain,
} from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
import pLimit from "p-limit";

// const connection = new Connection("");

export const getMultipleMainDomains = async (
  connection: Connection,
  pubkeys: PublicKey[],
): Promise<{ pubkey: string; mainDomain: string | undefined }[]> => {
  const mainDomainKeys = pubkeys.map((pubkey) => findMainDomain(pubkey)[0]);
  const mainDomainAccounts =
    await connection.getMultipleAccountsInfo(mainDomainKeys);

  return pubkeys.map((pubkey, index) => {
    const mainDomainAccount = mainDomainAccounts[index];
    if (!!mainDomainAccount?.data) {
      const mainDomainData = MainDomain.fromAccountInfo(mainDomainAccount)[0];
      return {
        pubkey: pubkey.toString(),
        mainDomain: mainDomainData.domain + mainDomainData.tld,
      };
    }
    return { pubkey: pubkey.toString(), mainDomain: undefined };
  });
};

// retrives users main domain in batches of 100 with pLimit of 20 it calls the rpc 20 times per second
// thus, 2000 accounts data can be fetched per second.
// pLimit could be increased depending on your rpc limits.
async function getMainDomainsSample(connection: Connection, data: any[]) {
  const mainDomains: { pubkey: string; mainDomain: string | undefined }[] = [];
  const batches = [];
  for (let i = 0; i < data.length; i += 100) {
    batches.push(data.slice(i, i + 100));
  }
  const limit = pLimit(20);

  await Promise.all(
    batches.map(async (batch) => {
      await limit(async () => {
        const publicKeys = batch.map((data) =>
            data.userPubkey ? new PublicKey(data.userPubkey) : PublicKey.default,
        );
        mainDomains.push(
          ...(await getMultipleMainDomains(connection, publicKeys)),
        );
      });
    }),
  );
  return mainDomains
}
```


# SVM SDKs


# Solana mainnet SDK

### How to integrate AllDomains Protocol:

libraries are opensource with MIT licenses:\
Typescript: <https://github.com/onsol-labs/tld-parser>\
Rust: [https://github.com/onsol-labs/tld-parse](https://github.com/onsol-labs/tld-parser)[-rs](https://github.com/onsol-labs/tld-parser-rs)

#### 1. Installation

```
npm install @onsol/tldparser
```

#### 2. Domain Resolution

The following code shows how to get the Public Key owner of a domain name

* works with **any AllDomains TLD**

```typescript
import { TldParser } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the owner pubkey of a domain name
async function resolveDomain(domain){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    return await parser.getOwnerFromDomainTld(domain);
}

//get the owner pubkey of "miester.solana";
resolveDomain("miester.solana");

//get the owner pubkey of "miester.bonk"
resolveDomain("miester.bonk");

//get the owner pubkey of "miester.poor"
resolveDomain("miester.poor");

```

#### 3. Get domains owned by a Public Key

**a. Get all owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all the domains owned by a public key
async function getOwnedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);

    // get all owned domains
    let allUserDomains = await parser.getParsedAllUserDomains(owner);

    return allUserDomains;
}

// get all owned domains
getOwnedDomains(new PublicKey(""));
```

**b. Get only unwrapped owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key
async function getOwnedUnwrappedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains
    let unwrappedUserDomains = await parser.getParsedAllUserDomainsUnwrapped(owner);

    return unwrappedUserDomains;
}

// get only unwrapped owned domains
getOwnedUnwrappedDomains(new PublicKey(""));
```

#### 4. Get domains owned by a Public Key from a specific TLD

**a. Get all owned domains from a specific TLD**

<pre class="language-typescript"><code class="lang-typescript">import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the all the domains owned by a public key in a TLD
<strong>async function getOwnedDomainsFromTld(owner, tld){
</strong>
    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get all owned domains from a TLD
    let ownedDomainsFromTld = parser.getParsedAllUserDomainsFromTld(owner, tld);

    return ownedDomainsFromTld;
}

//get all owned domains in the ".solana" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "solana");

//get all owned domains in the ".bonk" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "bonk");

//get all owned domains in the ".poor" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "poor");
</code></pre>

**b. Get all only unwrapped owned domains from a specific TLD**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key from a TLD
async function getOwnedUnwrappedDomainsFromTld(owner, tld){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains from a TLD
    let ownedUnwrappedDomainsFromTld = parser.getParsedAllUserDomainsFromTldUnwrapped(owner, tld);

    return ownedUnwrappedDomainsFromTld;
}

// get owned unwraped domains in the ".solana" Tld, without the "."
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "solana");

// get owned unwraped domains in the ".bonk" Tld
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "bonk");

// get owned unwraped domains in the ".poor" Tld
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "poor");
```

#### 5.  Get all active AllDomains TLDs

```typescript
import { getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all active AllDomains TLDs
const allTlds = await getAllTld(connection);
```

#### 6.  Get all domains registered in All TLDs&#x20;

```typescript
import { NameRecordHeader, TldParser, findAllDomainsForTld, getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// slow
// please use no. 8 for a batch/faster implementation 
// this code doesn't check if a domain is expired or not
async function getAllRegisteredDomains(connection: Connection){
    //get all TLDs
    const allTlds = await getAllTld(connection);
    const parser = new TldParser(connection);
    let domains = [];
    for (let tld of allTlds) {

        //get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, tld.parentAccount);
            
        //get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(connection, tld.parentAccount);

        if (!parentNameRecord || !parentNameRecord.owner) return;
        
        //parse all name accounts in a specific TLD
        for (let nameAccount of allNameAccountsForTld) {

            //get domain as string without the tld
            const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord.owner);
            domains.push(                {
                nameAccount: nameAccount,
                domain: `${domain}${tld.tld}`
            });
        }
    }
    return domains;
}

// get all domains registered on AllDomains
console.log(await getAllRegisteredDomains(connection))

```

7. #### &#x20;Get User Main Domain&#x20;

```typescript
import { MainDomain, findMainDomain } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";


// returns MainDomain struct if it is available. it will return undefined if it is not.
// MainDomains are usually shown as mainDomain.domain + mainDomain.tld 
// the mainDomain.nameAccount is proof that the user has set it.
const fetchMainDomain = async (connection: Connection, pubkey: string | PublicKey): Promise<MainDomain | undefined> => {
    if (typeof pubkey === "string") {
        pubkey = new PublicKey(pubkey)
    }
    const [mainDomainPubkey] = findMainDomain(pubkey);
    let mainDomain = undefined;
    try {
        mainDomain = await MainDomain.fromAccountAddress(
            connection,
            mainDomainPubkey,
        );
        return mainDomain
    } catch (e) {
        console.log("No main domain found")
    }
    return mainDomain
};


const CONNECTION = new Connection("");
console.log(await fetchMainDomain(CONNECTION, "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"))

// MainDomain {
//     nameAccount: PublicKey [PublicKey(9YzfCEHb62bQ47snUyjkxhC9Eb6y7CSodK3m8CKWstjV)] {
//       _bn: <BN: 7f0fb1f72ae0af9c5e7f5e4190d02ed2a720e88fb5787425157b9a9ec3fc39ec>
//     },
//     tld: '.solana',
//     domain: 'miester'
//   }
```

#### 8. Batch get AllDomains Domains

```typescript
import {
    ANS_PROGRAM_ID,
    findNameHouse,
    findNftRecord,
    getAllTld,
    getHashedName,
    getNameAccountKeyWithBump,
    NameRecordHeader,
    NftRecord,
    TldParser,
} from "@onsol/tldparser";
import {
    Connection,
    GetProgramAccountsResponse,
    PublicKey,
} from "@solana/web3.js";
import { setTimeout } from "timers/promises";

const connection = new Connection("");

async function findAllDomainsForTld(
    connection: Connection,
    parentAccount: PublicKey,
): Promise<{ pubkey: PublicKey; nameRecordHeader: NameRecordHeader }[]> {
    const filters: any = [
        {
            memcmp: {
                offset: 8,
                bytes: parentAccount.toBase58(),
            },
        },
    ];

    const accounts: GetProgramAccountsResponse =
        await connection.getProgramAccounts(ANS_PROGRAM_ID, {
            filters: filters,
        });
    return accounts.map((a) => {
        return {
            pubkey: a.pubkey,
            nameRecordHeader: NameRecordHeader.fromAccountInfo(a.account),
        };
    });
}

export async function performReverseLookupBatched(
    connection: Connection,
    nameAccounts: PublicKey[],
    tldHouse: PublicKey,
): Promise<(string | undefined)[]> {
    let reverseLookupDomains: (string | undefined)[] = [];

    while (nameAccounts.length > 0) {
        const currentBatch = nameAccounts.splice(0, 100);

        const promises = currentBatch.map(async (nameAccount) => {
            const reverseLookupHashedName = await getHashedName(
                nameAccount.toBase58(),
            );
            const [reverseLookUpAccount] = getNameAccountKeyWithBump(
                reverseLookupHashedName,
                tldHouse,
                undefined,
            );
            return reverseLookUpAccount;
        });

        const reverseLookUpAccounts: PublicKey[] = await Promise.all(promises);
        const reverseLookupAccountInfos =
            await connection.getMultipleAccountsInfo(reverseLookUpAccounts);

        const batchDomains = reverseLookupAccountInfos.map(
            (reverseLookupAccountInfo) => {
                const domain = reverseLookupAccountInfo?.data
                    .subarray(200, reverseLookupAccountInfo?.data.length)
                    .toString();
                return domain;
            },
        );

        reverseLookupDomains = reverseLookupDomains.concat(batchDomains);
    }

    return reverseLookupDomains;
}

// onlyDomains will grab only domains and no nfts
async function getAllRegisteredDomains(
    tldExpected?: string,
    onlyDomains: boolean = false,
) {
    // get all TLDs
    const allTlds = await getAllTld(connection);

    const domains = [];
    for (const tld of allTlds) {
        if (tldExpected) {
            if (tld.tld != tldExpected) continue;
        } 
        // get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(
            connection,
            tld.parentAccount,
        );
        if (!parentNameRecord) continue;
        if (!parentNameRecord.owner) continue;

        // get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(
            connection,
            tld.parentAccount,
        );
        await setTimeout(50);
        
        const [nameHouseAccount] = findNameHouse(parentNameRecord.owner);

        const nameAccountPubkeys = allNameAccountsForTld.map((a) => a.pubkey);

        const domainsReverse = await performReverseLookupBatched(
            connection,
            nameAccountPubkeys,
            parentNameRecord.owner,
        );

        let index = 0;
        for (const domain of domainsReverse) {
            const [nftRecord] = findNftRecord(
                allNameAccountsForTld[index].pubkey,
                nameHouseAccount,
            );
            let finalOwner =
                allNameAccountsForTld[index].nameRecordHeader.owner?.toString();
            if (finalOwner == nftRecord.toString() && !onlyDomains) {
                const nftRecordData = await NftRecord.fromAccountAddress(
                    connection,
                    nftRecord,
                );
                const largestAccounts =
                    await connection.getTokenLargestAccounts(
                        nftRecordData.nftMintAccount,
                    );
                if (largestAccounts.value.length > 0) {
                    const largestAccountInfo =
                        await connection.getParsedAccountInfo(
                            largestAccounts.value[0].address,
                        );
                    if (largestAccountInfo?.value?.data) {
                        finalOwner = new PublicKey(
                            // @ts-ignore
                            largestAccountInfo.value.data.parsed.info.owner,
                        ).toString();
                    }
                }
                await setTimeout(50);
            }
            domains.push({
                nameAccount: allNameAccountsForTld[index].pubkey,
                domain: `${domain}${tld.tld}`,
                owner: finalOwner,
                expiresAt:
                    allNameAccountsForTld[index].nameRecordHeader.expiresAt,
                createdAt:
                    allNameAccountsForTld[index].nameRecordHeader.createdAt,
            });
            index += 1;
        }
    }
    return domains;
}

async function main() {
    // or ".eyekon" or ".superteam" or ".monke"
    // if tldExpected is undefined it will grab all domains
    const tldExpected: string | undefined = ".zk";
    // if set true it will grab only domains and no nfts
    const onlyDomains = false;
    const domains = await getAllRegisteredDomains(tldExpected, onlyDomains);
    console.log(JSON.stringify(domains));
    // console.log(domains?.length)
}

// get all domains registered on AllDomains
main();
```

#### 9. Batch get Main Domains

```typescript
import {
  MainDomain,
  findMainDomain,
} from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
import pLimit from "p-limit";

// const connection = new Connection("");

export const getMultipleMainDomains = async (
  connection: Connection,
  pubkeys: PublicKey[],
): Promise<{ pubkey: string; mainDomain: string | undefined }[]> => {
  const mainDomainKeys = pubkeys.map((pubkey) => findMainDomain(pubkey)[0]);
  const mainDomainAccounts =
    await connection.getMultipleAccountsInfo(mainDomainKeys);

  return pubkeys.map((pubkey, index) => {
    const mainDomainAccount = mainDomainAccounts[index];
    if (!!mainDomainAccount?.data) {
      const mainDomainData = MainDomain.fromAccountInfo(mainDomainAccount)[0];
      return {
        pubkey: pubkey.toString(),
        mainDomain: mainDomainData.domain + mainDomainData.tld,
      };
    }
    return { pubkey: pubkey.toString(), mainDomain: undefined };
  });
};

// retrives users main domain in batches of 100 with pLimit of 20 it calls the rpc 20 times per second
// thus, 2000 accounts data can be fetched per second.
// pLimit could be increased depending on your rpc limits.
async function getMainDomainsSample(connection: Connection, data: any[]) {
  const mainDomains: { pubkey: string; mainDomain: string | undefined }[] = [];
  const batches = [];
  for (let i = 0; i < data.length; i += 100) {
    batches.push(data.slice(i, i + 100));
  }
  const limit = pLimit(20);

  await Promise.all(
    batches.map(async (batch) => {
      await limit(async () => {
        const publicKeys = batch.map((data) =>
            data.userPubkey ? new PublicKey(data.userPubkey) : PublicKey.default,
        );
        mainDomains.push(
          ...(await getMultipleMainDomains(connection, publicKeys)),
        );
      });
    }),
  );
  return mainDomains
}
```

Solana kit:\
<https://www.npmjs.com/package/@onsol/tldparser-kit>


# Eclipse mainnet SDK

### How to integrate AllDomains Protocol:

libraries are opensource with MIT licenses:\
Typescript: <https://github.com/onsol-labs/tld-parser>\
Rust: [https://github.com/onsol-labs/tld-parse](https://github.com/onsol-labs/tld-parser)[-rs](https://github.com/onsol-labs/tld-parser-rs)

#### 1. Installation

```
npm install @onsol/tldparser
```

#### 2. Domain Resolution

The following code shows how to get the Public Key owner of a domain name

* works with **any AllDomains TLD**

```typescript
import { TldParser } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the owner pubkey of a domain name
async function resolveDomain(domain){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    return await parser.getOwnerFromDomainTld(domain);
}

//get the owner pubkey of "miester.turbo";
resolveDomain("miester.turbo");

```

#### 3. Get domains owned by a Public Key

**a. Get all owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all the domains owned by a public key
async function getOwnedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);

    // get all owned domains
    let allUserDomains = await parser.getParsedAllUserDomains(owner);

    return allUserDomains;
}

// get all owned domains
getOwnedDomains(new PublicKey(""));
```

**b. Get only unwrapped owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key
async function getOwnedUnwrappedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains
    let unwrappedUserDomains = await parser.getParsedAllUserDomainsUnwrapped(owner);

    return unwrappedUserDomains;
}

// get only unwrapped owned domains
getOwnedUnwrappedDomains(new PublicKey(""));
```

#### 4. Get domains owned by a Public Key from a specific TLD

**a. Get all owned domains from a specific TLD**

<pre class="language-typescript"><code class="lang-typescript">import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the all the domains owned by a public key in a TLD
<strong>async function getOwnedDomainsFromTld(owner, tld){
</strong>
    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get all owned domains from a TLD
    let ownedDomainsFromTld = parser.getParsedAllUserDomainsFromTld(owner, tld);

    return ownedDomainsFromTld;
}

// get all owned domains in the ".turbo" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "turbo");
</code></pre>

**b. Get all only unwrapped owned domains from a specific TLD**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key from a TLD
async function getOwnedUnwrappedDomainsFromTld(owner, tld){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains from a TLD
    let ownedUnwrappedDomainsFromTld = parser.getParsedAllUserDomainsFromTldUnwrapped(owner, tld);

    return ownedUnwrappedDomainsFromTld;
}

// get owned unwraped domains in the ".turbo" Tld, without the "."
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "turbo");
```

#### 5.  Get all active AllDomains TLDs

```typescript
import { getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all active AllDomains TLDs
const allTlds = await getAllTld(connection);
```

#### 6.  Get all domains registered in All TLDs&#x20;

```typescript
import { NameRecordHeader, TldParser, findAllDomainsForTld, getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://mainnetbeta-rpc.eclipse.xyz';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// slow
// please use no. 8 for a batch/faster implementation 
// this code doesn't check if a domain is expired or not
async function getAllRegisteredDomains(connection: Connection){
    //get all TLDs
    const allTlds = await getAllTld(connection);
    const parser = new TldParser(connection);
    let domains = [];
    for (let tld of allTlds) {

        //get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, tld.parentAccount);
            
        //get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(connection, tld.parentAccount);

        if (!parentNameRecord || !parentNameRecord.owner) return;
        
        //parse all name accounts in a specific TLD
        for (let nameAccount of allNameAccountsForTld) {

            //get domain as string without the tld
            const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord.owner);
            domains.push(                {
                nameAccount: nameAccount,
                domain: `${domain}${tld.tld}`
            });
        }
    }
    return domains;
}

// get all domains registered on AllDomains
console.log(await getAllRegisteredDomains(connection))

```

7. #### &#x20;Get User Main Domain&#x20;

```typescript
import { MainDomain, findMainDomain } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";


// returns MainDomain struct if it is available. it will return undefined if it is not.
// MainDomains are usually shown as mainDomain.domain + mainDomain.tld 
// the mainDomain.nameAccount is proof that the user has set it.
const fetchMainDomain = async (connection: Connection, pubkey: string | PublicKey): Promise<MainDomain | undefined> => {
    if (typeof pubkey === "string") {
        pubkey = new PublicKey(pubkey)
    }
    const [mainDomainPubkey] = findMainDomain(pubkey);
    let mainDomain = undefined;
    try {
        mainDomain = await MainDomain.fromAccountAddress(
            connection,
            mainDomainPubkey,
        );
        return mainDomain
    } catch (e) {
        console.log("No main domain found")
    }
    return mainDomain
};


const CONNECTION = new Connection("");
console.log(await fetchMainDomain(CONNECTION, "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"))

// MainDomain {
//     nameAccount: PublicKey [PublicKey(9YzfCEHb62bQ47snUyjkxhC9Eb6y7CSodK3m8CKWstjV)] {
//       _bn: <BN: 7f0fb1f72ae0af9c5e7f5e4190d02ed2a720e88fb5787425157b9a9ec3fc39ec>
//     },
//     tld: '.turbo',
//     domain: 'miester'
//   }
```

#### 8. Batch get AllDomains Domains

```typescript
import {
    ANS_PROGRAM_ID,
    findNameHouse,
    findNftRecord,
    getAllTld,
    getHashedName,
    getNameAccountKeyWithBump,
    NameRecordHeader,
    NftRecord,
    TldParser,
} from "@onsol/tldparser";
import {
    Connection,
    GetProgramAccountsResponse,
    PublicKey,
} from "@solana/web3.js";
import { setTimeout } from "timers/promises";

const connection = new Connection("");

async function findAllDomainsForTld(
    connection: Connection,
    parentAccount: PublicKey,
): Promise<{ pubkey: PublicKey; nameRecordHeader: NameRecordHeader }[]> {
    const filters: any = [
        {
            memcmp: {
                offset: 8,
                bytes: parentAccount.toBase58(),
            },
        },
    ];

    const accounts: GetProgramAccountsResponse =
        await connection.getProgramAccounts(ANS_PROGRAM_ID, {
            filters: filters,
        });
    return accounts.map((a) => {
        return {
            pubkey: a.pubkey,
            nameRecordHeader: NameRecordHeader.fromAccountInfo(a.account),
        };
    });
}

export async function performReverseLookupBatched(
    connection: Connection,
    nameAccounts: PublicKey[],
    tldHouse: PublicKey,
): Promise<(string | undefined)[]> {
    let reverseLookupDomains: (string | undefined)[] = [];

    while (nameAccounts.length > 0) {
        const currentBatch = nameAccounts.splice(0, 100);

        const promises = currentBatch.map(async (nameAccount) => {
            const reverseLookupHashedName = await getHashedName(
                nameAccount.toBase58(),
            );
            const [reverseLookUpAccount] = getNameAccountKeyWithBump(
                reverseLookupHashedName,
                tldHouse,
                undefined,
            );
            return reverseLookUpAccount;
        });

        const reverseLookUpAccounts: PublicKey[] = await Promise.all(promises);
        const reverseLookupAccountInfos =
            await connection.getMultipleAccountsInfo(reverseLookUpAccounts);

        const batchDomains = reverseLookupAccountInfos.map(
            (reverseLookupAccountInfo) => {
                const domain = reverseLookupAccountInfo?.data
                    .subarray(200, reverseLookupAccountInfo?.data.length)
                    .toString();
                return domain;
            },
        );

        reverseLookupDomains = reverseLookupDomains.concat(batchDomains);
    }

    return reverseLookupDomains;
}

// onlyDomains will grab only domains and no nfts
async function getAllRegisteredDomains(
    tldExpected?: string,
    onlyDomains: boolean = false,
) {
    // get all TLDs
    const allTlds = await getAllTld(connection);

    const domains = [];
    for (const tld of allTlds) {
        if (tldExpected) {
            if (tld.tld != tldExpected) continue;
        } 
        // get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(
            connection,
            tld.parentAccount,
        );
        if (!parentNameRecord) continue;
        if (!parentNameRecord.owner) continue;

        // get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(
            connection,
            tld.parentAccount,
        );
        await setTimeout(50);
        
        const [nameHouseAccount] = findNameHouse(parentNameRecord.owner);

        const nameAccountPubkeys = allNameAccountsForTld.map((a) => a.pubkey);

        const domainsReverse = await performReverseLookupBatched(
            connection,
            nameAccountPubkeys,
            parentNameRecord.owner,
        );

        let index = 0;
        for (const domain of domainsReverse) {
            const [nftRecord] = findNftRecord(
                allNameAccountsForTld[index].pubkey,
                nameHouseAccount,
            );
            let finalOwner =
                allNameAccountsForTld[index].nameRecordHeader.owner?.toString();
            if (finalOwner == nftRecord.toString() && !onlyDomains) {
                const nftRecordData = await NftRecord.fromAccountAddress(
                    connection,
                    nftRecord,
                );
                const largestAccounts =
                    await connection.getTokenLargestAccounts(
                        nftRecordData.nftMintAccount,
                    );
                if (largestAccounts.value.length > 0) {
                    const largestAccountInfo =
                        await connection.getParsedAccountInfo(
                            largestAccounts.value[0].address,
                        );
                    if (largestAccountInfo?.value?.data) {
                        finalOwner = new PublicKey(
                            // @ts-ignore
                            largestAccountInfo.value.data.parsed.info.owner,
                        ).toString();
                    }
                }
                await setTimeout(50);
            }
            domains.push({
                nameAccount: allNameAccountsForTld[index].pubkey,
                domain: `${domain}${tld.tld}`,
                owner: finalOwner,
                expiresAt:
                    allNameAccountsForTld[index].nameRecordHeader.expiresAt,
                createdAt:
                    allNameAccountsForTld[index].nameRecordHeader.createdAt,
            });
            index += 1;
        }
    }
    return domains;
}

async function main() {
    // or ".eyekon" or ".superteam" or ".monke"
    // if tldExpected is undefined it will grab all domains
    const tldExpected: string | undefined = ".zk";
    // if set true it will grab only domains and no nfts
    const onlyDomains = false;
    const domains = await getAllRegisteredDomains(tldExpected, onlyDomains);
    console.log(JSON.stringify(domains));
    // console.log(domains?.length)
}

// get all domains registered on AllDomains
main();
```

#### 9. Batch get Main Domains

```typescript
import {
  MainDomain,
  findMainDomain,
} from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
import pLimit from "p-limit";

// const connection = new Connection("");

export const getMultipleMainDomains = async (
  connection: Connection,
  pubkeys: PublicKey[],
): Promise<{ pubkey: string; mainDomain: string | undefined }[]> => {
  const mainDomainKeys = pubkeys.map((pubkey) => findMainDomain(pubkey)[0]);
  const mainDomainAccounts =
    await connection.getMultipleAccountsInfo(mainDomainKeys);

  return pubkeys.map((pubkey, index) => {
    const mainDomainAccount = mainDomainAccounts[index];
    if (!!mainDomainAccount?.data) {
      const mainDomainData = MainDomain.fromAccountInfo(mainDomainAccount)[0];
      return {
        pubkey: pubkey.toString(),
        mainDomain: mainDomainData.domain + mainDomainData.tld,
      };
    }
    return { pubkey: pubkey.toString(), mainDomain: undefined };
  });
};

// retrives users main domain in batches of 100 with pLimit of 20 it calls the rpc 20 times per second
// thus, 2000 accounts data can be fetched per second.
// pLimit could be increased depending on your rpc limits.
async function getMainDomainsSample(connection: Connection, data: any[]) {
  const mainDomains: { pubkey: string; mainDomain: string | undefined }[] = [];
  const batches = [];
  for (let i = 0; i < data.length; i += 100) {
    batches.push(data.slice(i, i + 100));
  }
  const limit = pLimit(20);

  await Promise.all(
    batches.map(async (batch) => {
      await limit(async () => {
        const publicKeys = batch.map((data) =>
            data.userPubkey ? new PublicKey(data.userPubkey) : PublicKey.default,
        );
        mainDomains.push(
          ...(await getMultipleMainDomains(connection, publicKeys)),
        );
      });
    }),
  );
  return mainDomains
}
```


# SOON mainnet SDK

How to integrate AllDomains Protocol:

Libraries are opensource with MIT licenses:\
Typescript: <https://github.com/onsol-labs/tld-parser>\
Rust: [https://github.com/onsol-labs/tld-parse](https://github.com/onsol-labs/tld-parser)[-rs](https://github.com/onsol-labs/tld-parser-rs)

#### 1. Installation

```
npm install @onsol/tldparser
```

#### 2. Domain Resolution

The following code shows how to get the Public Key owner of a domain name

* works with **any AllDomains TLD**

```typescript
import { TldParser } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the owner pubkey of a domain name
async function resolveDomain(domain){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    return await parser.getOwnerFromDomainTld(domain);
}

//get the owner pubkey of "miester.soon";
resolveDomain("miester.soon");

```

#### 3. Get domains owned by a Public Key

**a. Get all owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all the domains owned by a public key
async function getOwnedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);

    // get all owned domains
    let allUserDomains = await parser.getParsedAllUserDomains(owner);

    return allUserDomains;
}

// get all owned domains
getOwnedDomains(new PublicKey(""));
```

**b. Get only unwrapped owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key
async function getOwnedUnwrappedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains
    let unwrappedUserDomains = await parser.getParsedAllUserDomainsUnwrapped(owner);

    return unwrappedUserDomains;
}

// get only unwrapped owned domains
getOwnedUnwrappedDomains(new PublicKey(""));
```

#### 4. Get domains owned by a Public Key from a specific TLD

**a. Get all owned domains from a specific TLD**

<pre class="language-typescript"><code class="lang-typescript">import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the all the domains owned by a public key in a TLD
<strong>async function getOwnedDomainsFromTld(owner, tld){
</strong>
    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get all owned domains from a TLD
    let ownedDomainsFromTld = parser.getParsedAllUserDomainsFromTld(owner, tld);

    return ownedDomainsFromTld;
}

// get all owned domains in the ".soon" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "soon");
</code></pre>

**b. Get all only unwrapped owned domains from a specific TLD**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key from a TLD
async function getOwnedUnwrappedDomainsFromTld(owner, tld){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains from a TLD
    let ownedUnwrappedDomainsFromTld = parser.getParsedAllUserDomainsFromTldUnwrapped(owner, tld);

    return ownedUnwrappedDomainsFromTld;
}

// get owned unwraped domains in the ".soon" Tld, without the "."
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "soon");
```

#### 5.  Get all active AllDomains TLDs

```typescript
import { getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all active AllDomains TLDs
const allTlds = await getAllTld(connection);
```

#### 6.  Get all domains registered in All TLDs&#x20;

```typescript
import { NameRecordHeader, TldParser, findAllDomainsForTld, getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://rpc.mainnet.soo.network/rpc';

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// slow
// please use no. 8 for a batch/faster implementation 
// this code doesn't check if a domain is expired or not
async function getAllRegisteredDomains(connection: Connection){
    //get all TLDs
    const allTlds = await getAllTld(connection);
    const parser = new TldParser(connection);
    let domains = [];
    for (let tld of allTlds) {

        //get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, tld.parentAccount);
            
        //get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(connection, tld.parentAccount);

        if (!parentNameRecord || !parentNameRecord.owner) return;
        
        //parse all name accounts in a specific TLD
        for (let nameAccount of allNameAccountsForTld) {

            //get domain as string without the tld
            const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord.owner);
            domains.push(                {
                nameAccount: nameAccount,
                domain: `${domain}${tld.tld}`
            });
        }
    }
    return domains;
}

// get all domains registered on AllDomains
console.log(await getAllRegisteredDomains(connection))

```

7. #### &#x20;Get User Main Domain&#x20;

```typescript
import { MainDomain, findMainDomain } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";


// returns MainDomain struct if it is available. it will return undefined if it is not.
// MainDomains are usually shown as mainDomain.domain + mainDomain.tld 
// the mainDomain.nameAccount is proof that the user has set it.
const fetchMainDomain = async (connection: Connection, pubkey: string | PublicKey): Promise<MainDomain | undefined> => {
    if (typeof pubkey === "string") {
        pubkey = new PublicKey(pubkey)
    }
    const [mainDomainPubkey] = findMainDomain(pubkey);
    let mainDomain = undefined;
    try {
        mainDomain = await MainDomain.fromAccountAddress(
            connection,
            mainDomainPubkey,
        );
        return mainDomain
    } catch (e) {
        console.log("No main domain found")
    }
    return mainDomain
};


const CONNECTION = new Connection("");
console.log(await fetchMainDomain(CONNECTION, "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"))

// MainDomain {
//     nameAccount: PublicKey [PublicKey(9YzfCEHb62bQ47snUyjkxhC9Eb6y7CSodK3m8CKWstjV)] {
//       _bn: <BN: 7f0fb1f72ae0af9c5e7f5e4190d02ed2a720e88fb5787425157b9a9ec3fc39ec>
//     },
//     tld: '.soon',
//     domain: 'miester'
//   }
```

#### 8. Batch get AllDomains Domains

```typescript
import {
    ANS_PROGRAM_ID,
    findNameHouse,
    findNftRecord,
    getAllTld,
    getHashedName,
    getNameAccountKeyWithBump,
    NameRecordHeader,
    NftRecord,
    TldParser,
} from "@onsol/tldparser";
import {
    Connection,
    GetProgramAccountsResponse,
    PublicKey,
} from "@solana/web3.js";
import { setTimeout } from "timers/promises";

const connection = new Connection("");

async function findAllDomainsForTld(
    connection: Connection,
    parentAccount: PublicKey,
): Promise<{ pubkey: PublicKey; nameRecordHeader: NameRecordHeader }[]> {
    const filters: any = [
        {
            memcmp: {
                offset: 8,
                bytes: parentAccount.toBase58(),
            },
        },
    ];

    const accounts: GetProgramAccountsResponse =
        await connection.getProgramAccounts(ANS_PROGRAM_ID, {
            filters: filters,
        });
    return accounts.map((a) => {
        return {
            pubkey: a.pubkey,
            nameRecordHeader: NameRecordHeader.fromAccountInfo(a.account),
        };
    });
}

export async function performReverseLookupBatched(
    connection: Connection,
    nameAccounts: PublicKey[],
    tldHouse: PublicKey,
): Promise<(string | undefined)[]> {
    let reverseLookupDomains: (string | undefined)[] = [];

    while (nameAccounts.length > 0) {
        const currentBatch = nameAccounts.splice(0, 100);

        const promises = currentBatch.map(async (nameAccount) => {
            const reverseLookupHashedName = await getHashedName(
                nameAccount.toBase58(),
            );
            const [reverseLookUpAccount] = getNameAccountKeyWithBump(
                reverseLookupHashedName,
                tldHouse,
                undefined,
            );
            return reverseLookUpAccount;
        });

        const reverseLookUpAccounts: PublicKey[] = await Promise.all(promises);
        const reverseLookupAccountInfos =
            await connection.getMultipleAccountsInfo(reverseLookUpAccounts);

        const batchDomains = reverseLookupAccountInfos.map(
            (reverseLookupAccountInfo) => {
                const domain = reverseLookupAccountInfo?.data
                    .subarray(200, reverseLookupAccountInfo?.data.length)
                    .toString();
                return domain;
            },
        );

        reverseLookupDomains = reverseLookupDomains.concat(batchDomains);
    }

    return reverseLookupDomains;
}

// onlyDomains will grab only domains and no nfts
async function getAllRegisteredDomains(
    tldExpected?: string,
    onlyDomains: boolean = false,
) {
    // get all TLDs
    const allTlds = await getAllTld(connection);

    const domains = [];
    for (const tld of allTlds) {
        if (tldExpected) {
            if (tld.tld != tldExpected) continue;
        } 
        // get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(
            connection,
            tld.parentAccount,
        );
        if (!parentNameRecord) continue;
        if (!parentNameRecord.owner) continue;

        // get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(
            connection,
            tld.parentAccount,
        );
        await setTimeout(50);
        
        const [nameHouseAccount] = findNameHouse(parentNameRecord.owner);

        const nameAccountPubkeys = allNameAccountsForTld.map((a) => a.pubkey);

        const domainsReverse = await performReverseLookupBatched(
            connection,
            nameAccountPubkeys,
            parentNameRecord.owner,
        );

        let index = 0;
        for (const domain of domainsReverse) {
            const [nftRecord] = findNftRecord(
                allNameAccountsForTld[index].pubkey,
                nameHouseAccount,
            );
            let finalOwner =
                allNameAccountsForTld[index].nameRecordHeader.owner?.toString();
            if (finalOwner == nftRecord.toString() && !onlyDomains) {
                const nftRecordData = await NftRecord.fromAccountAddress(
                    connection,
                    nftRecord,
                );
                const largestAccounts =
                    await connection.getTokenLargestAccounts(
                        nftRecordData.nftMintAccount,
                    );
                if (largestAccounts.value.length > 0) {
                    const largestAccountInfo =
                        await connection.getParsedAccountInfo(
                            largestAccounts.value[0].address,
                        );
                    if (largestAccountInfo?.value?.data) {
                        finalOwner = new PublicKey(
                            // @ts-ignore
                            largestAccountInfo.value.data.parsed.info.owner,
                        ).toString();
                    }
                }
                await setTimeout(50);
            }
            domains.push({
                nameAccount: allNameAccountsForTld[index].pubkey,
                domain: `${domain}${tld.tld}`,
                owner: finalOwner,
                expiresAt:
                    allNameAccountsForTld[index].nameRecordHeader.expiresAt,
                createdAt:
                    allNameAccountsForTld[index].nameRecordHeader.createdAt,
            });
            index += 1;
        }
    }
    return domains;
}

async function main() {
    // or ".soon" or ".superteam" or ".monke"
    // if tldExpected is undefined it will grab all domains
    const tldExpected: string | undefined = ".zk";
    // if set true it will grab only domains and no nfts
    const onlyDomains = false;
    const domains = await getAllRegisteredDomains(tldExpected, onlyDomains);
    console.log(JSON.stringify(domains));
    // console.log(domains?.length)
}

// get all domains registered on AllDomains
main();
```

#### 9. Batch get Main Domains

```typescript
import {
  MainDomain,
  findMainDomain,
} from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
import pLimit from "p-limit";

// const connection = new Connection("");

export const getMultipleMainDomains = async (
  connection: Connection,
  pubkeys: PublicKey[],
): Promise<{ pubkey: string; mainDomain: string | undefined }[]> => {
  const mainDomainKeys = pubkeys.map((pubkey) => findMainDomain(pubkey)[0]);
  const mainDomainAccounts =
    await connection.getMultipleAccountsInfo(mainDomainKeys);

  return pubkeys.map((pubkey, index) => {
    const mainDomainAccount = mainDomainAccounts[index];
    if (!!mainDomainAccount?.data) {
      const mainDomainData = MainDomain.fromAccountInfo(mainDomainAccount)[0];
      return {
        pubkey: pubkey.toString(),
        mainDomain: mainDomainData.domain + mainDomainData.tld,
      };
    }
    return { pubkey: pubkey.toString(), mainDomain: undefined };
  });
};

// retrives users main domain in batches of 100 with pLimit of 20 it calls the rpc 20 times per second
// thus, 2000 accounts data can be fetched per second.
// pLimit could be increased depending on your rpc limits.
async function getMainDomainsSample(connection: Connection, data: any[]) {
  const mainDomains: { pubkey: string; mainDomain: string | undefined }[] = [];
  const batches = [];
  for (let i = 0; i < data.length; i += 100) {
    batches.push(data.slice(i, i + 100));
  }
  const limit = pLimit(20);

  await Promise.all(
    batches.map(async (batch) => {
      await limit(async () => {
        const publicKeys = batch.map((data) =>
            data.userPubkey ? new PublicKey(data.userPubkey) : PublicKey.default,
        );
        mainDomains.push(
          ...(await getMultipleMainDomains(connection, publicKeys)),
        );
      });
    }),
  );
  return mainDomains
}
```


# Sonic mainnet SDK

How to integrate AllDomains Protocol:

Libraries are opensource with MIT licenses:\
Typescript: <https://github.com/onsol-labs/tld-parser>\
Rust: [https://github.com/onsol-labs/tld-parse](https://github.com/onsol-labs/tld-parser)[-rs](https://github.com/onsol-labs/tld-parser-rs)

#### 1. Installation

```
npm install @onsol/tldparser
```

#### 2. Domain Resolution

The following code shows how to get the Public Key owner of a domain name

* works with **any AllDomains TLD**

```typescript
import { TldParser } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the owner pubkey of a domain name
async function resolveDomain(domain){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    return await parser.getOwnerFromDomainTld(domain);
}

//get the owner pubkey of "miester.sonic";
resolveDomain("miester.sonic");

```

#### 3. Get domains owned by a Public Key

**a. Get all owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all the domains owned by a public key
async function getOwnedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);

    // get all owned domains
    let allUserDomains = await parser.getParsedAllUserDomains(owner);

    return allUserDomains;
}

// get all owned domains
getOwnedDomains(new PublicKey(""));
```

**b. Get only unwrapped owned domains**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key
async function getOwnedUnwrappedDomains(owner: PublicKey){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains
    let unwrappedUserDomains = await parser.getParsedAllUserDomainsUnwrapped(owner);

    return unwrappedUserDomains;
}

// get only unwrapped owned domains
getOwnedUnwrappedDomains(new PublicKey(""));
```

#### 4. Get domains owned by a Public Key from a specific TLD

**a. Get all owned domains from a specific TLD**

<pre class="language-typescript"><code class="lang-typescript">import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get the all the domains owned by a public key in a TLD
<strong>async function getOwnedDomainsFromTld(owner, tld){
</strong>
    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get all owned domains from a TLD
    let ownedDomainsFromTld = parser.getParsedAllUserDomainsFromTld(owner, tld);

    return ownedDomainsFromTld;
}

// get all owned domains in the ".sonic" Tld, without the "."
getOwnedDomainsFromTld(new PublicKey(""), "sonic");
</code></pre>

**b. Get all only unwrapped owned domains from a specific TLD**

```typescript
import { TldParser, NameRecordHeader } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get only the unwrapped domains owned by a public key from a TLD
async function getOwnedUnwrappedDomainsFromTld(owner, tld){

    // initialize a Tld Parser
    const parser = new TldParser(connection);
    
    // get only unwrapped domains from a TLD
    let ownedUnwrappedDomainsFromTld = parser.getParsedAllUserDomainsFromTldUnwrapped(owner, tld);

    return ownedUnwrappedDomainsFromTld;
}

// get owned unwraped domains in the ".sonic" Tld, without the "."
getOwnedUnwrappedDomainsFromTld(new PublicKey(""), "sonic");
```

#### 5.  Get all active AllDomains TLDs

```typescript
import { getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// get all active AllDomains TLDs
const allTlds = await getAllTld(connection);
```

#### 6.  Get all domains registered in All TLDs&#x20;

```typescript
import { NameRecordHeader, TldParser, findAllDomainsForTld, getAllTld } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

export const SONIC_MAINNET = "https://rpc.mainnet-alpha.sonic.game/";

// initialize a Solana Connection
const connection = new Connection(RPC_URL);

// slow
// please use no. 8 for a batch/faster implementation 
// this code doesn't check if a domain is expired or not
async function getAllRegisteredDomains(connection: Connection){
    //get all TLDs
    const allTlds = await getAllTld(connection);
    const parser = new TldParser(connection);
    let domains = [];
    for (let tld of allTlds) {

        //get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(connection, tld.parentAccount);
            
        //get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(connection, tld.parentAccount);

        if (!parentNameRecord || !parentNameRecord.owner) return;
        
        //parse all name accounts in a specific TLD
        for (let nameAccount of allNameAccountsForTld) {

            //get domain as string without the tld
            const domain = await parser.reverseLookupNameAccount(nameAccount, parentNameRecord.owner);
            domains.push(                {
                nameAccount: nameAccount,
                domain: `${domain}${tld.tld}`
            });
        }
    }
    return domains;
}

// get all domains registered on AllDomains
console.log(await getAllRegisteredDomains(connection))

```

7. #### &#x20;Get User Main Domain&#x20;

```typescript
import { MainDomain, findMainDomain } from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";


// returns MainDomain struct if it is available. it will return undefined if it is not.
// MainDomains are usually shown as mainDomain.domain + mainDomain.tld 
// the mainDomain.nameAccount is proof that the user has set it.
const fetchMainDomain = async (connection: Connection, pubkey: string | PublicKey): Promise<MainDomain | undefined> => {
    if (typeof pubkey === "string") {
        pubkey = new PublicKey(pubkey)
    }
    const [mainDomainPubkey] = findMainDomain(pubkey);
    let mainDomain = undefined;
    try {
        mainDomain = await MainDomain.fromAccountAddress(
            connection,
            mainDomainPubkey,
        );
        return mainDomain
    } catch (e) {
        console.log("No main domain found")
    }
    return mainDomain
};


const CONNECTION = new Connection("");
console.log(await fetchMainDomain(CONNECTION, "2EGGxj2qbNAJNgLCPKca8sxZYetyTjnoRspTPjzN2D67"))

// MainDomain {
//     nameAccount: PublicKey [PublicKey(9YzfCEHb62bQ47snUyjkxhC9Eb6y7CSodK3m8CKWstjV)] {
//       _bn: <BN: 7f0fb1f72ae0af9c5e7f5e4190d02ed2a720e88fb5787425157b9a9ec3fc39ec>
//     },
//     tld: '.sonic',
//     domain: 'miester'
//   }
```

#### 8. Batch get AllDomains Domains

```typescript
import {
    ANS_PROGRAM_ID,
    findNameHouse,
    findNftRecord,
    getAllTld,
    getHashedName,
    getNameAccountKeyWithBump,
    NameRecordHeader,
    NftRecord,
    TldParser,
} from "@onsol/tldparser";
import {
    Connection,
    GetProgramAccountsResponse,
    PublicKey,
} from "@solana/web3.js";
import { setTimeout } from "timers/promises";

const connection = new Connection("");

async function findAllDomainsForTld(
    connection: Connection,
    parentAccount: PublicKey,
): Promise<{ pubkey: PublicKey; nameRecordHeader: NameRecordHeader }[]> {
    const filters: any = [
        {
            memcmp: {
                offset: 8,
                bytes: parentAccount.toBase58(),
            },
        },
    ];

    const accounts: GetProgramAccountsResponse =
        await connection.getProgramAccounts(ANS_PROGRAM_ID, {
            filters: filters,
        });
    return accounts.map((a) => {
        return {
            pubkey: a.pubkey,
            nameRecordHeader: NameRecordHeader.fromAccountInfo(a.account),
        };
    });
}

export async function performReverseLookupBatched(
    connection: Connection,
    nameAccounts: PublicKey[],
    tldHouse: PublicKey,
): Promise<(string | undefined)[]> {
    let reverseLookupDomains: (string | undefined)[] = [];

    while (nameAccounts.length > 0) {
        const currentBatch = nameAccounts.splice(0, 100);

        const promises = currentBatch.map(async (nameAccount) => {
            const reverseLookupHashedName = await getHashedName(
                nameAccount.toBase58(),
            );
            const [reverseLookUpAccount] = getNameAccountKeyWithBump(
                reverseLookupHashedName,
                tldHouse,
                undefined,
            );
            return reverseLookUpAccount;
        });

        const reverseLookUpAccounts: PublicKey[] = await Promise.all(promises);
        const reverseLookupAccountInfos =
            await connection.getMultipleAccountsInfo(reverseLookUpAccounts);

        const batchDomains = reverseLookupAccountInfos.map(
            (reverseLookupAccountInfo) => {
                const domain = reverseLookupAccountInfo?.data
                    .subarray(200, reverseLookupAccountInfo?.data.length)
                    .toString();
                return domain;
            },
        );

        reverseLookupDomains = reverseLookupDomains.concat(batchDomains);
    }

    return reverseLookupDomains;
}

// onlyDomains will grab only domains and no nfts
async function getAllRegisteredDomains(
    tldExpected?: string,
    onlyDomains: boolean = false,
) {
    // get all TLDs
    const allTlds = await getAllTld(connection);

    const domains = [];
    for (const tld of allTlds) {
        if (tldExpected) {
            if (tld.tld != tldExpected) continue;
        } 
        // get the parent name record for a TLD
        const parentNameRecord = await NameRecordHeader.fromAccountAddress(
            connection,
            tld.parentAccount,
        );
        if (!parentNameRecord) continue;
        if (!parentNameRecord.owner) continue;

        // get all name accounts in a specific TLD
        const allNameAccountsForTld = await findAllDomainsForTld(
            connection,
            tld.parentAccount,
        );
        await setTimeout(50);
        
        const [nameHouseAccount] = findNameHouse(parentNameRecord.owner);

        const nameAccountPubkeys = allNameAccountsForTld.map((a) => a.pubkey);

        const domainsReverse = await performReverseLookupBatched(
            connection,
            nameAccountPubkeys,
            parentNameRecord.owner,
        );

        let index = 0;
        for (const domain of domainsReverse) {
            const [nftRecord] = findNftRecord(
                allNameAccountsForTld[index].pubkey,
                nameHouseAccount,
            );
            let finalOwner =
                allNameAccountsForTld[index].nameRecordHeader.owner?.toString();
            if (finalOwner == nftRecord.toString() && !onlyDomains) {
                const nftRecordData = await NftRecord.fromAccountAddress(
                    connection,
                    nftRecord,
                );
                const largestAccounts =
                    await connection.getTokenLargestAccounts(
                        nftRecordData.nftMintAccount,
                    );
                if (largestAccounts.value.length > 0) {
                    const largestAccountInfo =
                        await connection.getParsedAccountInfo(
                            largestAccounts.value[0].address,
                        );
                    if (largestAccountInfo?.value?.data) {
                        finalOwner = new PublicKey(
                            // @ts-ignore
                            largestAccountInfo.value.data.parsed.info.owner,
                        ).toString();
                    }
                }
                await setTimeout(50);
            }
            domains.push({
                nameAccount: allNameAccountsForTld[index].pubkey,
                domain: `${domain}${tld.tld}`,
                owner: finalOwner,
                expiresAt:
                    allNameAccountsForTld[index].nameRecordHeader.expiresAt,
                createdAt:
                    allNameAccountsForTld[index].nameRecordHeader.createdAt,
            });
            index += 1;
        }
    }
    return domains;
}

async function main() {
    // or ".sonic" or ".superteam" or ".monke"
    // if tldExpected is undefined it will grab all domains
    const tldExpected: string | undefined = ".zk";
    // if set true it will grab only domains and no nfts
    const onlyDomains = false;
    const domains = await getAllRegisteredDomains(tldExpected, onlyDomains);
    console.log(JSON.stringify(domains));
    // console.log(domains?.length)
}

// get all domains registered on AllDomains
main();
```

#### 9. Batch get Main Domains

```typescript
import {
  MainDomain,
  findMainDomain,
} from "@onsol/tldparser";
import { Connection, PublicKey } from "@solana/web3.js";
import pLimit from "p-limit";

// const connection = new Connection("");

export const getMultipleMainDomains = async (
  connection: Connection,
  pubkeys: PublicKey[],
): Promise<{ pubkey: string; mainDomain: string | undefined }[]> => {
  const mainDomainKeys = pubkeys.map((pubkey) => findMainDomain(pubkey)[0]);
  const mainDomainAccounts =
    await connection.getMultipleAccountsInfo(mainDomainKeys);

  return pubkeys.map((pubkey, index) => {
    const mainDomainAccount = mainDomainAccounts[index];
    if (!!mainDomainAccount?.data) {
      const mainDomainData = MainDomain.fromAccountInfo(mainDomainAccount)[0];
      return {
        pubkey: pubkey.toString(),
        mainDomain: mainDomainData.domain + mainDomainData.tld,
      };
    }
    return { pubkey: pubkey.toString(), mainDomain: undefined };
  });
};

// retrives users main domain in batches of 100 with pLimit of 20 it calls the rpc 20 times per second
// thus, 2000 accounts data can be fetched per second.
// pLimit could be increased depending on your rpc limits.
async function getMainDomainsSample(connection: Connection, data: any[]) {
  const mainDomains: { pubkey: string; mainDomain: string | undefined }[] = [];
  const batches = [];
  for (let i = 0; i < data.length; i += 100) {
    batches.push(data.slice(i, i + 100));
  }
  const limit = pLimit(20);

  await Promise.all(
    batches.map(async (batch) => {
      await limit(async () => {
        const publicKeys = batch.map((data) =>
            data.userPubkey ? new PublicKey(data.userPubkey) : PublicKey.default,
        );
        mainDomains.push(
          ...(await getMultipleMainDomains(connection, publicKeys)),
        );
      });
    }),
  );
  return mainDomains
}
```


# EVM SDKs


# Monad SDK

## AllDomains Monad EVM SDK Documentation

### Overview

The AllDomains Monad EVM SDK is a library designed to interact with top-level domain (TLD) names on EVM-compatible chains (e.g., Monad). This SDK provides functionality to manage domain names, retrieve ownership details, and handle domain records across supported blockchains.

### Supported Chains

* Monad (EVM)

### Supported TLDs

* .mon
* .nad
* .chog
* .mokadel
* .molandak
* .mouch
* .moyaki
* .salmonad

### Installation

To install the AllDomains Monad EVM SDK, add the following line to your `package.json` or run the command:

```bash
npm install @onsol/tldparser
```

### Usage Examples

#### 1. Initialize EVM Connection

```javascript
import { TldParser, NetworkWithRpc } from '@onsol/tldparser';
import { getAddress } from 'ethers';

// Set up RPC URL and initialize a network instance
const RPC_URL = 'https://rpc.monad.xyz';
const PUBLIC_KEY = getAddress('0x94Bfb92da83B27B39370550CA038Af96d182462f');
const settings = new NetworkWithRpc('monad', 143, RPC_URL);

// Create an instance of TldParser
const parser = new TldParser(settings, 'monad');
```

#### 2. Get All User Domains

```javascript
const allDomains = await parser.getAllUserDomains(PUBLIC_KEY);
// Output: [NameRecord { domain_name: "miester", tld: ".mon", ... }]
```

#### 3. Get Domains for a Specific TLD

```javascript
const tldDomains = await parser.getAllUserDomainsFromTld(PUBLIC_KEY, '.mon');
// Output: [NameRecord { domain_name: "miester", tld: ".mon", ... }]
```

#### 4. Get Domain Owner

```javascript
const owner = await parser.getOwnerFromDomainTld('miester.mon');
// Output: "0x94Bfb92da83B27B39370550CA038Af96d182462f"
```

#### 5. Get Name Record

```javascript
const nameRecord = await parser.getNameRecordFromDomainTld('miester.mon');
// Output: NameRecord { created_at, domain_name, expires_at, main_domain_address, tld, transferrable }
```

#### 6. Get Main Domain (Favourite Domain)

<pre class="language-javascript"><code class="lang-javascript">const ownedDomainsReceived = await parser.getMainDomain(PUBLIC_KEY) ;
<strong>// Output: &#x3C;NameRecord> {
</strong>//    created_at: '1795616523',
//    domain_name: 'miester',
//    expires_at: '1795616823',
//    main_domain_address: PUBLIC_KEY,
//    tld: '.mon',
//    transferrable: true,
// };
</code></pre>

### Core Methods (Available on Both Chains)

* `getAllUserDomains(userAccount)`: Retrieves all domains owned by a user.
* `getAllUserDomainsFromTld(userAccount, tld)`: Retrieves domains for a specific TLD.
* `getOwnerFromDomainTld(domainTld)`: Retrieves the owner of a domain.
* `getNameRecordFromDomainTld(domainTld)`: Retrieves detailed record data for a domain.
* `getMainDomain(userAddress)`: Retrieves the user's main domain.


# Records API

This document covers the new Records API added to \`@onsol/tldparser\`. These features provide unified access to domain records across both Solana (SVM) and Monad (EVM) chains.

## Records API Documentation

This document covers the new Records API added to `@onsol/tldparser`. These features provide unified access to domain records across both **Solana (SVM)** and **Monad (EVM)** chains.

### Overview

The Records API enables developers to:

* Fetch individual domain records (Twitter, Discord, avatars, crypto addresses, etc.)
* Batch-fetch multiple records efficiently
* Resolve avatar URLs with automatic gateway conversion (IPFS, Arweave, NFTs)
* Look up main domains for multiple addresses in a single call

### Installation

```bash
npm/yarn install @onsol/tldparser
```

### Quick Start

```typescript
import { TldParser, Record, NetworkWithRpc } from '@onsol/tldparser';
import { Connection } from '@solana/web3.js';

// Solana
const connection = new Connection('https://api.mainnet-beta.solana.com');
const parser = new TldParser(connection);

// Monad (EVM)
const evmSettings = new NetworkWithRpc('monad', 143, 'https://rpc.monad.xyz');
const evmParser = new TldParser(evmSettings, 'monad');
```

***

### API Reference

#### `getRecord(domainTld, record)`

Fetch a single record for a domain.

**Parameters:**

| Parameter   | Type     | Description                                                    |
| ----------- | -------- | -------------------------------------------------------------- |
| `domainTld` | `string` | Full domain with TLD (e.g., `"miester.poor"`, `"miester.mon"`) |
| `record`    | `Record` | The record type to fetch                                       |

**Returns:** `Promise<string | null>`

**Example:**

```typescript
const twitter = await parser.getRecord('miester.poor', Record.Twitter);
// => "@miester" or null
```

**How it works:**

* **SVM (Solana):** Derives a sub-account PDA from `Record.Twitter + "." + domain` → fetches `Twitter.miester.poor`
* **EVM (Monad):** Calls `text(namehash, "com.twitter")` on the resolver contract

***

#### `getRecords(domainTld, records?)`

Batch-fetch multiple records for a domain.

**Parameters:**

| Parameter   | Type       | Description                                       |
| ----------- | ---------- | ------------------------------------------------- |
| `domainTld` | `string`   | Full domain with TLD                              |
| `records`   | `Record[]` | Array of record types (optional, defaults to all) |

**Returns:** `Promise<RecordResult>`

```typescript
type RecordResult = {
    [key in Record]?: string | null;
};
```

**Example:**

```typescript
const records = await parser.getRecords('miester.poor', [
    Record.Twitter,
    Record.Discord,
    Record.Pic,
    Record.ETH,
]);
// => { Twitter: "@miester", Discord: "miester#1234", Pic: "ipfs://Qm...", ETH: "0x..." }
```

**Performance:**

* **SVM:** Uses `getMultipleAccountsInfo` for efficient batch fetching
* **EVM:** Uses `Promise.all` for parallel contract calls

***

#### `getAvatar(domainTld, options?)`

Fetch and resolve avatar URL to an HTTP-accessible endpoint.

**Parameters:**

| Parameter   | Type            | Description                    |
| ----------- | --------------- | ------------------------------ |
| `domainTld` | `string`        | Full domain with TLD           |
| `options`   | `AvatarOptions` | Custom gateway URLs (optional) |

```typescript
interface AvatarOptions {
    ipfsGateway?: string;     // Default: "https://ipfs.io"
    arweaveGateway?: string;  // Default: "https://arweave.net"
    nftGateway?: string;      // Default: "https://alldomains.id/api"
}
```

**Returns:** `Promise<string | null>`

**Example:**

```typescript
// Basic usage
const avatar = await parser.getAvatar('miester.poor');
// => "https://ipfs.io/ipfs/QmXxxx..."

// Custom gateways
const avatar = await parser.getAvatar('miester.poor', {
    ipfsGateway: 'https://cloudflare-ipfs.com',
    arweaveGateway: 'https://arweave.net',
});
```

**Supported formats:**

| Input Format                | Output                                       |
| --------------------------- | -------------------------------------------- |
| `ipfs://QmXxx`              | `https://ipfs.io/ipfs/QmXxx`                 |
| `QmXxx...` (raw CIDv0)      | `https://ipfs.io/ipfs/QmXxx...`              |
| `bafyxxx...` (raw CIDv1)    | `https://ipfs.io/ipfs/bafyxxx...`            |
| `ar://txId`                 | `https://arweave.net/txId`                   |
| `arwv://txId`               | `https://arweave.net/txId`                   |
| `https://...`               | unchanged                                    |
| `data:image/...`            | unchanged                                    |
| `mpl:<mint>`                | `https://alldomains.id/api/nft/mpl/<mint>`   |
| `core:<asset>`              | `https://alldomains.id/api/nft/core/<asset>` |
| `eip155:1/erc721:0x.../123` | `https://alldomains.id/api/nft/evm/...`      |

**NFT Gateway Requirement:**

The NFT gateway endpoint **must return the actual image data** (not JSON metadata). When implementing a custom NFT gateway, the endpoint should:

1. Fetch the NFT metadata from the blockchain
2. Extract the `image` field from the metadata
3. **Return the raw image bytes** with appropriate `Content-Type` header

The default gateway (`https://alldomains.id/api`) handles this automatically for:

* **Metaplex Token Metadata** (`mpl:`) - Fetches metadata and returns the image
* **Metaplex Core** (`core:`) - Fetches Core asset and returns the image
* **EVM NFTs** (`eip155:`) - Resolves ERC-721/ERC-1155 tokenURI and returns the image

```typescript
// Custom NFT gateway example
const avatar = await parser.getAvatar('miester.poor', {
    nftGateway: 'https://your-gateway.com/api'
});
// Results in: https://your-gateway.com/api/nft/mpl/<mint>
// Your endpoint should return: image/png, image/jpeg, etc.
```

***

### Record Types

```typescript
import { Record } from '@onsol/tldparser';
```

#### Social Records

| Record            | SVM Key    | EVM Key        |
| ----------------- | ---------- | -------------- |
| `Record.Twitter`  | `Twitter`  | `com.twitter`  |
| `Record.Discord`  | `Discord`  | `com.discord`  |
| `Record.Github`   | `Github`   | `com.github`   |
| `Record.Reddit`   | `Reddit`   | `com.reddit`   |
| `Record.Telegram` | `Telegram` | `org.telegram` |

#### Profile Records

| Record         | SVM Key | EVM Key  |
| -------------- | ------- | -------- |
| `Record.Pic`   | `Pic`   | `avatar` |
| `Record.Email` | `Email` | `email`  |
| `Record.Url`   | `Url`   | `url`    |

#### Crypto Address Records

| Record           | SVM Key   | EVM Key   |
| ---------------- | --------- | --------- |
| `Record.SOL`     | `SOL`     | `sol`     |
| `Record.ETH`     | `ETH`     | `eth`     |
| `Record.BTC`     | `BTC`     | `btc`     |
| `Record.APTOS`   | `APTOS`   | `aptos`   |
| `Record.NEAR`    | `NEAR`    | `near`    |
| `Record.BASE`    | `BASE`    | `base`    |
| `Record.SUI`     | `SUI`     | `sui`     |
| `Record.LTC`     | `LTC`     | `ltc`     |
| `Record.DOGE`    | `DOGE`    | `doge`    |
| `Record.STACKS`  | `STACKS`  | `stacks`  |
| `Record.LATTICA` | `Lattica` | `lattica` |
| `Record.POINT`   | `POINT`   | `point`   |

#### Storage Records

| Record        | SVM Key | EVM Key   |
| ------------- | ------- | --------- |
| `Record.IPFS` | `IPFS`  | `ipfs`    |
| `Record.ARWV` | `ARWV`  | `arweave` |

***

### Utility Functions

#### `resolveAvatarUrl(record, options?)`

Standalone utility to resolve avatar URLs. Used internally by `getAvatar()`.

```typescript
import { resolveAvatarUrl } from '@onsol/tldparser';

const httpUrl = resolveAvatarUrl('ipfs://QmXxxx');
// => "https://ipfs.io/ipfs/QmXxxx"
```

#### `getReverseNode(address)` (EVM only)

Compute the reverse node hash for an address (used for reverse resolution).

```typescript
import { getReverseNode } from '@onsol/tldparser';

const reverseNode = getReverseNode('0x94Bfb92da83B27B39370550CA038Af96d182462f');
// => "0x..." (namehash of "94bfb92da83b27b39370550ca038af96d182462f.addr.reverse")
```

***

### EVM Chain Configuration

The EVM parser now includes resolver contract addresses:

```typescript
// Monad Mainnet
{
    chainId: 143,
    rootContractAddress: '0xE6d461c863987F2a1096eA3476137F30f75B3d46',
    registryContractAddress: '0xa4338eadf4D2e0851eFb225b0Eab90bE47A095F1',
    resolverAddress: '0x314582158A0a72802aD8F6EeE6243C73dCf1F562',
    reverseRegistrarAddress: '0x270BC6b51006F4C5cbe1c38238a0cC6CAeCFbff1',
}
```

***

### Architecture Notes

#### SVM Implementation

Records on Solana are stored as **sub-accounts** derived from the parent domain:

```
Domain: miester.poor
Twitter Record: Twitter.miester.poor (separate PDA)
Discord Record: Discord.miester.poor (separate PDA)
```

The `getRecords()` method uses `getMultipleAccountsInfo` to batch-fetch all record accounts in a single RPC call.

#### EVM Implementation

Records on EVM chains are stored in a **resolver contract** using ENS-compatible text records:

```solidity
function text(bytes32 node, string key) view returns (string)
function name(bytes32 node) view returns (string) // reverse resolution
```

The namehash is computed using the ANS-compatible algorithm (same as ENS but without normalization).

### Complete Example

```typescript
import { TldParser, Record, NetworkWithRpc } from '@onsol/tldparser';
import { Connection } from '@solana/web3.js';

async function main() {
    // === Solana ===
    const connection = new Connection('https://api.mainnet-beta.solana.com');
    const parser = new TldParser(connection);

    // Get a single record
    const twitter = await parser.getRecord('miester.poor', Record.Twitter);
    console.log('Twitter:', twitter);

    // Get multiple records
    const records = await parser.getRecords('miester.poor', [
        Record.Twitter,
        Record.Discord,
        Record.Pic,
    ]);
    console.log('Records:', records);

    // Get avatar
    const avatar = await parser.getAvatar('miester.poor');
    console.log('Avatar:', avatar);

    // Batch main domain lookup
    const mainDomains = await parser.getMainDomains([
        'GjJCJ1gzqKBp9Mw8bELDJaZG6Lp8sHXTcUb5YWPXQZJ3',
    ]);
    console.log('Main Domains:', mainDomains);

    // === Monad (EVM) ===
    const evmSettings = new NetworkWithRpc('monad', 143, 'https://rpc.monad.xyz');
    const evmParser = new TldParser(evmSettings, 'monad');

    // Get a single record
    const evmTwitter = await evmParser.getRecord('miester.mon', Record.Twitter);
    console.log('EVM Twitter:', evmTwitter);

    // Get multiple records
    const evmRecords = await evmParser.getRecords('miester.mon', [
        Record.Twitter,
        Record.Discord,
        Record.Pic,
    ]);
    console.log('EVM Records:', evmRecords);

    // Get avatar with custom gateway
    const evmAvatar = await evmParser.getAvatar('miester.mon', {
        ipfsGateway: 'https://cloudflare-ipfs.com',
    });
    console.log('EVM Avatar:', evmAvatar);

    // Batch main domain lookup
    const evmMainDomains = await evmParser.getMainDomains([
        '0x94Bfb92da83B27B39370550CA038Af96d182462f',
    ]);
    console.log('EVM Main Domains:', evmMainDomains);
}

main();
```


# Records (SVM)

The following records are currently available on AllDomains Protocol:

| Name     | Value                |
| -------- | -------------------- |
| IPFS     | An IPFS CID          |
| ARWV     | An Arweave address   |
| SOL      | A address            |
| ETH      | An ETH address       |
| BTC      | A BTC address        |
| LTC      | A LTC address        |
| DOGE     | A DOGE address       |
| email    | An Email address     |
| url      | A website URL        |
| discord  | A discord username   |
| github   | A Github username    |
| reddit   | A Reddit username    |
| twitter  | A Twitter username   |
| telegram | A Telegram username  |
| pic      | A Profile picture    |
| SHDW     | A SHDW DRIVE address |

#### Resolving a record:

```typescript
import { NameRecordHeader, getDomainKey, Record } from "@onsol/tldparser";
import { Connection } from "@solana/web3.js";

const RPC_URL = 'https://api.mainnet-beta.solana.com';
const connection = new Connection(RPC_URL);

//domain
const domain = "vlad.abc";

/**
we are getting the IPFS record value here but any from the list can be used
**/
const recordPubkey = (await getDomainKey(Record.IPFS + "." + domain, true)).pubkey
const nameRecord = await NameRecordHeader.fromAccountAddress(connection, recordPubkey);
const idx = nameRecord?.data?.indexOf(0x00);

//get the record value
const recordValue = nameRecord?.data?.subarray(0, idx).toString();
```


# Structure/Architecture

NameRecord:

```rust
#[account]
pub struct NameRecordHeader {
    // Names are hierarchical.  `parent_name` contains the account address of the parent
    // name, or `Pubkey::default()` if no parent exists.
    pub parent_name: Pubkey,

    // The owner of this name
    pub owner: Pubkey,

    // The class of data this account represents
    // If `Pubkey::default()` the data is unspecified.
    pub nclass: Pubkey,

    // expires_at is an unix timestamp in UTC.
    // programs must respect the expiry_at. after by which a rent is void.
    // the data is invalid unless extended by the owner or
    // new owner comes with new data replacing the old one.
    // defaults to 0
    // if it is 0, the domain is forever
    pub expires_at: u64,

    // time in unix timestamp in utc.
    // when the name account has been created.
    pub created_at: u64,

    // immutable owner domains
    pub non_transferable: bool,
}
```


# Integrations

**AllDomains** can seamlessly integrate with any application within all ecosystems it's been deployed.

Expanding its utility, you can utilize our domain names across the following products on the respective ecosystems:

###


# Solana

### **Wallets:**

| Name              | About                                                                 |
| ----------------- | --------------------------------------------------------------------- |
| **Solflare**      | [https://x.com/solflare\_wallet](https://twitter.com/solflare_wallet) |
| **Phantom**       | [https://x.com/phantom](https://twitter.com/phantom)                  |
| **Helium Wallet** | [https://x.com/helium](https://twitter.com/helium)                    |
| **Backpack**      | [https://x.com/Backpack](https://twitter.com/Backpack)                |
| **Nightly**       | <https://x.com/Nightly_app>                                           |

### **Marketplaces:**

| Name          | About                       |
| ------------- | --------------------------- |
| **MagicEden** | <https://magiceden.io/>     |
| **Tensor**    | <https://www.tensor.trade/> |

### Explorers:

| Name               | About                          |
| ------------------ | ------------------------------ |
| **SolanaFM**       | <https://solana.fm/>           |
| **Solscan**        | <https://solscan.io/>          |
| **SolanaExplorer** | <https://explorer.solana.com/> |
| **Helius Orb**     | <https://orb.helius.dev/>      |

### **Tools:**

| Name                                            | About                                                                                                                                                                                                            |
| ----------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Squads**                                      | <p><a href="https://squads.xyz/"><https://squads.xyz/></a><a href="https://twitter.com/SquadsProtocol"><br></a>Solana MultiSig management protocol for web3 native teams</p>                                     |
| **Dialect**                                     | <p><a href="https://www.dialect.to/"><https://www.dialect.to/></a><a href="https://twitter.com/saydialect"><br></a>Enabling a more engaging dapp experience with timely, targeted messages and notifications</p> |
| **Solstis**[ ](https://twitter.com/solstis_app) | <https://solstis.app/>                                                                                                                                                                                           |
| **Solana ChatGPT Plugin**                       | <https://chatgpt.solanalabs.com/>                                                                                                                                                                                |
| **FluxBeam**                                    | <https://www.fluxbeam.xyz/>                                                                                                                                                                                      |
| **Solfees**                                     | <https://www.solfees.fyi/>                                                                                                                                                                                       |
| **Birdeye**                                     | <https://birdeye.so/>                                                                                                                                                                                            |
| **CryptoSlam**                                  | <https://www.cryptoslam.io/>                                                                                                                                                                                     |
| **Solworks AirdropChecker**                     | <https://solana-airdrop-checker.solworks.dev/>                                                                                                                                                                   |
| **SolChat**                                     | <https://www.solchat.io/>                                                                                                                                                                                        |
| **Matrica**                                     | <https://business.matrica.io/general>                                                                                                                                                                            |
| **SolMail**                                     | <https://www.solmail.so/>                                                                                                                                                                                        |
| **Rugcheck**                                    | <https://rugcheck.xyz/verify/token>                                                                                                                                                                              |
| **Jupiter Portfolio**                           | <https://portfolio.jup.ag/>                                                                                                                                                                                      |
| **Webacy**                                      | <https://www.webacy.com/>                                                                                                                                                                                        |
| **Biblio**                                      | <https://biblio.tech/>                                                                                                                                                                                           |
| **DotBlinkMe**                                  | <https://www.dotblink.me/search>                                                                                                                                                                                 |
| **TipLink**                                     | <https://tiplink.io/>                                                                                                                                                                                            |
| **CarrotDeFi**                                  | <https://use.deficarrot.com/>                                                                                                                                                                                    |
| **Realms**                                      | <https://app.realms.today/realms>                                                                                                                                                                                |
| **Solana Agent Kit**                            | <https://www.solanaagentkit.xyz/>                                                                                                                                                                                |
| **Step Finance**                                | <https://app.step.finance/en/dashboard>                                                                                                                                                                          |
| **Sharp Trade**                                 | <https://app.sharptrade.fi/>                                                                                                                                                                                     |


# Eclipse

### **Wallets:**

| Name                     | About                          |
| ------------------------ | ------------------------------ |
| **Backpack**             | <https://twitter.com/Backpack> |
| **Salmon** (In Progress) | <https://x.com/salmonwallet>   |
| **Nightly**              | <https://x.com/Nightly_app>    |

### **Marketplaces:**

| Name                    | About                    |
| ----------------------- | ------------------------ |
| **Scope** (In Progress) | <https://x.com/scopenft> |

### Explorers:

| Name                    | About                                                                         |
| ----------------------- | ----------------------------------------------------------------------------- |
| **Eclipse XRAY**        | <https://www.eclipsexray.id/>                                                 |
| **EclipseScan**         | <https://eclipsescan.xyz/>                                                    |
| **Explorer \| Eclipse** | [https://explorer.eclipse.xyz/](https://explorer.eclipse.xyz/?cluster=devnet) |

### **Tools:**

| Name              | About                         |
| ----------------- | ----------------------------- |
| **Nimbus**        | <https://getnimbus.io/>       |
| **FightHorse**    | <https://x.com/thefighthorse> |
| **MoonLaunchFun** | <https://x.com/Moonlaunchfun> |

### Analytics

| Name               | About                            |
| ------------------ | -------------------------------- |
| **Pine Analytics** | <https://www.pineanalytics.xyz/> |

### Leaderboards

| Name            | About                                       |
| --------------- | ------------------------------------------- |
| **Sharp Trade** | <https://eclipse.sharptrade.fi/leaderboard> |
| **Purebet**     | <https://exchange.purebet.io/leaderboard>   |
| **Invariant**   | <https://eclipse.invariant.app/points>      |

### Gaming

| Name                  | About                                 |
| --------------------- | ------------------------------------- |
| **Cryptara Conquest** | <https://eclipse.cryptara.world/home> |


# Monad

## Wallets:

| Name            | About                       |
| --------------- | --------------------------- |
| **Haha Wallet** | <https://x.com/haha_app>    |
| **Nightly**     | <https://x.com/Nightly_app> |

## Tools:

| Name                       | About                                   |
| -------------------------- | --------------------------------------- |
| **Narwhal Finance**        | <https://testnet.narwhal.finance/>      |
| **Dirol Protocol**         | <https://www.dirol.network/>            |
| **Clober DEX**             | <https://www.clober.io/>                |
| **shMonad (Fastlane)**     | <https://shmonad.xyz/>                  |
| **Montools Bulk Transfer** | <https://montools.xyz/bulktransfer>     |
| **Monorail**               | <https://testnet-preview.monorail.xyz/> |
| **MadnessExchange**        | <https://madness.finance/>              |
| **Gemoon**                 | <https://gemoon.xyz/>                   |
| **Purps Exchange**         | <https://app.purps.xyz/swap>            |


# SOON SVM

| Name                     | About                           |
| ------------------------ | ------------------------------- |
| **SOON Explorer (BETA)** | <https://soo.network/ecosystem> |


# Sonic SVM

## Wallets

| Name     | About                          |
| -------- | ------------------------------ |
| Backpack | <https://twitter.com/Backpack> |


# Partner Guide

If you have enabled your own TLDs: Congratulations! You are on your way to making your community far more visible in all its blockchain interactions and cementing yourself as a Solana household name!

This guide is designed to inform you on the various ways you can leverage your TLD to optimize the usefulness and attractiveness of your domain names by ensuring you leverage our integrations to their highest potential.


# How to set up Matrica

You can now reward your most faithful community members by enabling domain name-based Matrica role verification!&#x20;

These roles can be used in various ways, either purely as vanity roles or by gating access to specific channels, perks (like limiting access to giveaway channels), and holder bonuses inside your Discord and/or Telegram.

## **Getting Started and Matrica Plans**

{% hint style="danger" %}
Be sure the person that is in charge of this process has role creation privileges in Discord and Bot Invite privileges in Discord/Telegram
{% endhint %}

To get your Matrica profile started visit <https://business.matrica.io/> and join their Discord here: <https://discord.gg/matricalabs>

Follow these steps

1\. Fill in the required information

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FweR8Uum3k34EsbsqABNp%2Funnamed%20(6).png?alt=media&amp;token=6bd8bc40-801c-470c-ab34-2ab0fb05f72d" alt=""><figcaption><p>The Matrica Community Application Form</p></figcaption></figure>

2. Select either a Premium or Enterprise Plan:

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FDREz0k6MBCExooC0Y244%2Funnamed%20(7).png?alt=media&amp;token=3fb5d1d9-e87b-422a-abb9-646ddc273ef2" alt=""><figcaption><p>Matrica Community Plans</p></figcaption></figure>

If you choose the Premium Plan, enabling domain name roles will also require a one-off $500 investment, as this is a custom service.

This service is free for partners on Matrica’s Enterprise Plan.

3. To get the required details for making the one-time payment please open a ticket in the Matrica Discord or contact their team here <https://calendly.com/MatricaLabs>&#x20;

{% hint style="info" %}
Alternatively, you can also request support from AllDomains who will be happy to assist and put you in contact with the Matrica team.
{% endhint %}

4. Matrica will then enable domain name verification for your Discord and Telegram communities.

## **Setting up Discord Verification**

1. Go to your “Verification” page and invite the Matrica Bot to your Discord Server. This will automatically create the Bot's “Matrica” role in your Discord.
2. Create the role(s) you want your domain name holders to have (e.g., .bonk domain; feel free to be creative).
3. Make sure that the “Matrica” role is above the one(s) you just created in your Role Priority list on Discord.

{% hint style="info" %}
You can even put Matrica as the highest on the Role List to make sure everyone gets their role
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fu7QwR0TjkMTbCdJ37FKn%2Funnamed%20(5).png?alt=media&amp;token=67228545-f8b3-4aa9-8f43-afc22eca0579" alt=""><figcaption><p>Move Matrica ABOVE the Roles you want it to control</p></figcaption></figure>

### **Setting up the Rules**&#x20;

Now that the bot has been set up in your Discord is time to create the verifying rules.

1. Head back to <https://business.matrica.io/verification> and click the ***Create New Rule*** button:

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fy6zbnjlQvO3nKRi4RjJ4%2Funnamed%20(4).png?alt=media&amp;token=eedaf3c1-8030-41bd-844a-5cbfa6c61698" alt=""><figcaption><p>Create Verifying Rules</p></figcaption></figure>

2. Select the *Role* you want to assign, then select “Domain” for the *Role Type*.
3. Identify your community’s TLD and select it from the dropdown list.

{% hint style="danger" %}
Be sure to **check the AllDomain Only button**; otherwise, .sol domain names might also be considered!
{% endhint %}

4. Select the number of domain names a user should own to get the specified role (should be at least 1).&#x20;
5. You can add tiered domain-holding Roles (e.g 1 domain = shrimp role, 5 domains = dolphin role, etc.). Click Save and you’re done
6. You can also add multiple Rules for the same Role (e.g.: hold 1 domain and/or 1 NFT).&#x20;

Let’s take the image above as an example: All users that hold at least 1 ***.all*** domain name will automatically be assigned the “he like orange” role.

With this integration, you can add multiple rules and play around in many fun and creative ways.&#x20;

{% hint style="info" %}
Find out what best suits your community’s needs, and don’t be afraid to experiment.
{% endhint %}

Now, you can gate specific channels to specific user roles and even layer up your access based on domain name ownership. One great example is giving only certain members access to Subber Raffles, while others can, depending on their role, access FCFS Giveaways.

## **Setting up Telegram Gating**

Setting up Telegram is easier: Just invite the Telegram Bot to your Group and create the rules.

{% hint style="danger" %}
**If you want your Telegram Group to stay Public do not use the Matrica Bot!**
{% endhint %}

The Telegram Bot can only gate **the entire group** and **can not be used to gate** just certain parts of it **(Topics)**. This essentially transforms your Public Group into a Private Group (gated by domain name ownership)

## Additional sources and information

For a more in-depth look at setting up Matrica verification (NFTs, Tokens, etc. included) visit their Set Up Guide here <https://docs.matrica.io/guides/community-guide>

Also, if your users are new to Matrica feel free to share this “How to Verify” guide with them: [Verify with Matrica](https://docs.alldomains.id/protocol/getting-started/verify-with-matrica)


# .sol PLUS domain names

### What is .sol PLUS?

.sol PLUS is an upgraded version of your existing .sol domain on Solana. By upgrading your .sol domain with AllDomains, you transform it into a renewable, revenue-sharing asset — keeping your same .sol domain name but unlocking powerful new benefits like:

* Ongoing royalties from future sales and renewals
* Partnership revenue shared with you, SNS, and AllDomains
* Prevention of domain dormancy and squatting

***

### How Does .sol PLUS Work?

#### Upgrading Your Domain

When you upgrade your .sol domain, you transfer its ownership to AllDomains’ smart contract. In return, you receive full ownership of your .sol PLUS domain — which keeps the exact same domain name as your original (e.g., upgrading 1.sol means you now own 1.sol under the .sol PLUS system).

This process is permanent and irreversible, so upgrading your domain commits you to the .sol PLUS system and its benefits.

***

#### Renewals

* The upgrader of a .sol domain can renew their .sol PLUS domain for free every year, indefinitely, as long as they renew before the expiration date.
* If you sell your .sol PLUS domain, the new owner will be responsible for renewal fees.
* There is a 50-day grace period after expiration to renew your domain before it is returned to AllDomains and made available for resale.

Renewal notifications will be sent via Dialect, Email, and Telegram to keep you informed.\
\
Renewal costs:\
**Upgrader:** \
$0/year (renew must be done yearly)\
**Rest:**\
1 char domains $375/yr\
2 char domains $350/yr\
3 char domains $320/yr\
4 char domains $80/yr\
5+ char domains $10/yr

***

#### Revenue Sharing Model

Every time a .sol PLUS domain generates revenue through sales or renewals, the proceeds are split as follows:

| **Party**  | **Share of Royalties** |
| ---------- | ---------------------- |
| Upgrader   | 40%                    |
| AllDomains | 40%                    |
| SNS        | 20%                    |

* The upgrader receives 40% of all future royalties, including secondary sales and renewals.
* AllDomains and SNS share the remaining royalties.
* Royalties are tracked and paid out automatically on-chain with every transaction generating revenue.\
  \
  E.G.:

You upgrade 1.sol to the 1.sol PLUS system\
You then sell this domain for 100 $SOL\
You receive: 95 $SOL + 40% Royalties (2 $SOL)\
AllDomains receives: 40% Royalties (2 $SOL)\
SNS receives: 20% Royalties (1 $SOL) \
\
If the new buyer sells the domain again, the royalties generated will once again be split at the same ratio between you, AllDomains and SNS.

### Benefits of Upgrading to .sol PLUS

#### For Domain Owners

* Ongoing Royalties: Earn passive income from your domain’s future sales and renewals.
* Renewability: Keep your domain active and avoid losing it due to dormancy.
* Market Liquidity: Domains that are abandoned or not renewed can return to the market, increasing availability.
* Partnership: Become an active participant in the Solana naming ecosystem and share in the revenue generated.<br>

#### For SNS

* Gains new, recurring revenue streams from renewals and sales.
* Helps revive dormant or inactive domains and increase market turnover.
* Maintains control of the .sol TLD while partnering to improve the ecosystem.<br>

#### For AllDomains

* Enables strategic growth by tapping into the existing .sol user base.
* Creates a sustainable, recurring revenue business model.
* Boosts engagement and liquidity in the Solana domain market.

***

### How to Upgrade Your .sol Domain

1. Connect your Solana wallet to the AllDomains website.
2. Select the .sol domain you want to upgrade.
3. Confirm the upgrade transaction (standard Solana gas fees apply).
4. Receive your .sol PLUS domain with renewability and royalty benefits.


# FAQ

#### What is .sol PLUS?

.sol PLUS is an upgraded version of your existing .sol domain. By upgrading your .sol domain with AllDomains, you gain revenue-sharing benefits while retaining your original domain name and unlocking new recurring income opportunities.

***

#### Why upgrade to .sol PLUS domain names?

Upgrading to .sol PLUS transforms your existing .sol domain into a powerful, revenue-generating digital asset. Here’s why upgrading is the smartest move for your domain:

* **Earn Recurring Royalties:** As the upgrader, receive **40% of all future royalties** from sales and renewals — creating ongoing passive income.
* **Maintain Full Ownership:** Your domain name stays exactly the same (.sol), fully compatible with all wallets and dApps.
* **Market Liquidity:** Renewal fees discourage squatting, while abandoned domains return to the market — keeping the ecosystem vibrant.
* **Partnership Benefits:** Share revenue with AllDomains and SNS, strengthening the Solana naming ecosystem.
* **Secure and Transparent:** Royalties and ownership are tracked automatically on-chain for complete transparency.

Upgrade now to unlock these advantages and position yourself as a leader in the future of Solana domain ownership.

***

#### How does upgrading work?

When you upgrade your .sol domain, you transfer ownership to AllDomains’ smart contract and receive the corresponding .sol PLUS domain — keeping the same domain name and gaining new features.

Upgrading is permanent and irreversible.

***

#### How do renewals work?

* The **upgrader** of a .sol PLUS domain receives **40% of all royalties** from future sales and renewals. The remaining royalties are split between AllDomains (40%) and SNS (20%). Only the original upgrader is entitled to this 40% share, regardless of future owners.

***

#### How does revenue sharing work?

* You receive **40% of all royalties** from future sales and renewals of your .sol PLUS domain.
* AllDomains and SNS share the remaining royalties (40% and 20%, respectively).
* Royalties are automatically tracked and distributed on-chain.

***

#### Can I sell my upgraded .sol PLUS domain?

Yes. When you sell your domain, the new owner takes over renewal responsibilities, but you continue to earn 40% royalties as the upgrader on all future sales and renewals.

***

#### What happens if I don’t renew?

If the domain isn’t renewed within the 50-day grace period, it returns to AllDomains for resale — keeping the domain market active and liquid.

***

#### Will upgrading affect my existing .sol domain’s compatibility?

No. Your domain stays fully compatible with all SNS integrations, wallets, and dApps — just with the added benefits of renewability and royalties.

***

#### Are there any extra fees?

Upgrading and transactions incur only standard, minimal Solana network fees. There are no extra charges by AllDomains.

***

#### Can I revert back to a regular .sol domain?

No. Upgrading to .sol PLUS is a permanent decision and cannot be reversed.

***

If you have more questions or need help upgrading, please visit our Discord for support


# .token Domain Names

In collaboration with @Rugcheckxyz we are launching .token domain names.

Our new enhanced .token domains have been created to battle a by-product of Solana's success.&#x20;

Approximately 15,000 new tokens are launched on Solana daily, making manual verification methods impossible.\
\
Platforms such as RugCheck have been designed to allow users to check and verify a token’s viability and identify potential risks. RugCheck requests are also at an all-time high, processing thousands of token audits every day.


# How does {ticker}.token work?

This partnership with [@Rugcheckxyz](https://x.com/Rugcheckxyz) will allow domain names to be registered by TOKEN teams aiming at long-term stability and building trust with their users! These domain names will serve as an on-chain identity for projects hosting all the associated information and links for the project on the domain's metadata.&#x20;

There is a multitude of perks for your .token domain names:

* Token verification with automatic eligibility check via [https://rugcheck.xyz](https://rugcheck.xyz/)
* The domain acts as a verification badge for the project’s mint address&#x20;
* .Token domains can also hold associated metadata\* i.e description, website, X, telegram, discord URLs&#x20;
* Allows users to search explorers using {ticker}.token to view project funds and activity quickly without the need to locate and copy/paste addresses

You can also think of ***.token domain name*** verification as an ***authenticity certificate:***\
\
Getting a .token domain name for your $TICKER will allow you to:

* Verify token ownership: Authenticate the identity of the token and check that the funds are safe
* Combat fake tokens: Reduce the risk of swaps between counterfeit versions of the token
* Build community trust: Signal users that the token is trustworthy and has a long-term vision
* Improve trust scores: Many protocols prioritize verified tokens. RugCheck will perform regular automatic audits of verified tokens. Should a token fail an audit or not be renewed, the token domain will be revoked

{% hint style="info" %}
\*Token Metadata Storage:

**Alpha version (current):** Web2 DB

**Second version:** On-chain Program that owns the Records for each Token’s Metadata. The authorities that can change the data will be @AllDomains\_ and [@Rugcheckxyz](https://x.com/Rugcheckxyz)

**Third version:** Add a more complex ACL for managing the Metadata. This could be either multiple parties or a DAO.
{% endhint %}


# How to register a .token domain name

Head over to <https://rugcheck.xyz/verify/token>

{% hint style="info" %}
Only tokens that pass the automated analytics checks will be allowed to apply
{% endhint %}

**Requirements to claim:**

* Symbol must not already exist on the verified list
* &#x20;Must not be a duplicate
* Token must have a Rugcheck score below 2000
* &#x20;Mint authority must be revoked
* Freeze authority must be revoked
* Metadata must be set
* Liquidity must be locked in a Rugcheck-approved locker (for new tokensor existing strict list, this isn't required).\
  The list of approved lockers can be accessed here <https://rugcheck.xyz/integrations>&#x20;
* Token must be older than 72 hours&#x20;

Eligible projects will then be allowed to claim their .token domain name.&#x20;

Similar to all our standard domains, token domains are renewable. However, please note that we withhold the right to revoke the token domain if the token fails subsequent audits and you fail to make the necessary improvements.

Claim your domain name, and you’re all set!\ <br>

<br>


# AllDomains Bridge

Unlock the power of cross-chain interoperability with the AllDomains Solana - Eclipse bridge. You can now easily transfer assets and data between the Solana blockchain and Eclipse, empowering seamless interactions across two of the most powerful blockchain ecosystems in Web3.

{% hint style="info" %}
**What are crypto bridges?**\
Crypto bridges are software protocols that facilitate communication between different blockchains, much like a bridge connecting two islands for travel. They enable direct cross-chain asset transfers with just a few clicks, bypassing the need for centralized exchanges and their lengthy processes.
{% endhint %}

#### Here’s everything you can expect from the AllDomains Solana - Eclipse bridge:

**Bridge swiftly:** Transfer tokens from Solana to Eclipse and back again without needing to use centralized exchanges or using complex bridges.

**Fastest way to do it:** Want to swap your Eclipse $ETH to Solana $SOL? It takes less than a minute for our bridge to do just that! &#x20;

**Safely transfer assets:** With Hyperlane as our trusted provider, you can bridge with confidence and without worry.

**Jumpstart your Eclipse journey:** Our *Get Gas* feature will ensure you get the gas needed to transact instantly.

This is another step towards AllDomains being able to provide multi-chain identities and a unified social graph.\
\
Bridge your tokens here: <https://bridge.alldomains.id/><br>


# Using the Bridge

Our Solana - Eclipse bridge works both ways, meaning you can either:\
\
A. Bridge from Solana to Eclipse\
Or\
B. Bridge from Eclipse to Solana

#### To bridge from Solana to Eclipse, follow these steps:

1\. Connect your Solana Wallet

2\. Select the amount of $SOL you want to bridge

3\. In the \*Recipient\* field, add the Eclipse wallet address or domain name you want to receive your $SOL

4\. Click \*Continue\*, check the details, click \*Send to Eclipse\* and approve the transaction.

{% hint style="success" %}
Make  sure you have enough Gas ($SOL) left in your wallet for the transaction to pass.
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FyBfHAsrU0DPLt7F9i84A%2FScreenshot%202024-12-19%20145419.png?alt=media&amp;token=ffa4dff5-cf4e-4a3f-99e9-a8231d304bb1" alt=""><figcaption><p>Solana to Eclipse Bridge</p></figcaption></figure>

You can only bridge Solana $SOL to Eclipse $SOL using this route. You will need some Eclipse $ETH (Gas) to start transacting. If you lack Gas in your Eclipse wallet, see the following page: [Get Gas](https://docs.alldomains.id/protocol/alldomains-bridge/get-gas)

{% hint style="info" %}
The bridging process will take about a minute to complete.&#x20;
{% endhint %}

#### To bridge from Eclipse to Solana, follow these steps:

1. Connect your Eclipse wallet
2. Select the token you want to bridge: either $SOL or $ETH !If you choose to bridge $ETH this will be automatically swapped to $SOL via Hyperlane
3. In the *Recipient* field, add the **Solana wallet address or domain name** you want to receive your $SOL
4. Click *Continue*, check the details, click *Send to Solana,* and approve the transaction.&#x20;

{% hint style="success" %}
Be sure you have enough Gas ($ETH) left in your wallet for the transaction to pass.
{% endhint %}

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2Fd4vGUzCfgwW3ELovrjIl%2FScreenshot%202024-12-19%20145550.png?alt=media&amp;token=7f96579a-e958-4b40-96da-81258770ef03" alt=""><figcaption><p>Eclipse to Solana Bridge</p></figcaption></figure>

Congratulations! You’ve just bridged from Solana to Eclipse, and back again!

You now know how to quickly transfer assets between the Solana and Eclipse blockchains, empowering seamless interactions across two of the most powerful blockchain ecosystems in Web3.


# Get Gas

As with any blockchain, you will need to pay a small amount of money (gas) in the chain’s native token (in Eclipse’s case, that’s $ETH) to be able to perform any kind of transaction.

If you just bridged your $SOL (or $USDC) and only own these assets in your Eclipse wallet, you must swap a small amount of these into $ETH to be able to use the chain.

#### The Get Gas feature on our website allows you to get gas in four easy steps:

1. Connect your Eclipse Wallet
2. Select the token ($SOL/$USDC) you want to swap for $ETH
3. Select the amount you want to swap ($5/$10/$20)
4. Click Get Gas and approve the transaction

<figure><img src="https://4163218443-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FW79USbvVh7YhdsI3PhOO%2Fuploads%2FMYBcaBH8J8sFFB8sOdjA%2FScreenshot%202024-12-19%20134302.png?alt=media&amp;token=a698aa48-29dc-4f04-9221-36a31abe7af4" alt=""><figcaption><p>Get Gas </p></figcaption></figure>

Since Eclipse is an SVM (Solana Virtual Machine), the gas you just loaded should be enough to get you through plenty of transactions.

If you run out of gas at any point, you can return and load more from the Get Gas feature.


# Links

Socials:

* Twitter -> <https://x.com/alldomains>&#x20;
* Discord -> <https://discord.gg/alldomains>
* Telegram -> <https://t.me/AllDomainsID>

Websites:

* Claim Solana Domain Names: [https://alldomains.id/ ](https://alldomains.id/)
* Claim Eclipse Domain Names:[ https://eclipse.alldomains.id/](https://eclipse.alldomains.id/)
* Claim Monad Testnet Domain Names: h<ttps://monad.alldomains.id/>
* Claim SOON SVM Domain Names: <https://soon.alldomains.id/>
* Claim Sonic Domain Names: <https://sonic.alldomains.id/>
* Bridge to Eclipse, Sonic and more: <https://bridge.alldomains.id/>
* Launch a TLD -> <https://alldomains.id/launch-tld>


# Brand kit

Please access the AllDomains Brand Kit here:

<https://xd.adobe.com/view/f6a65052-0d69-4e58-92cc-13f915d07493-a3f5/specs/>\ <br>


# Roadmap

## AllDomains Roadmap 2025–2026: From Identity to Ecosystem

For the past three years, AllDomains has shipped consistently, through bear and bull markets alike. We started with domains and built trust by delivering integrations, products, and partnerships. Today, over 100 projects, from wallets and explorers to communities and TLD partners, all use our infrastructure.

But domains were just the beginning. With over 1.5 million registrations across Solana, Eclipse, Sonic, Monad testnet, AllDomains has a proven track record. Our breakthrough .id domains — the first to work seamlessly across both Web2 and Web3, demonstrated that the future of identity is hybrid.&#x20;

Now comes the next phase. With the launch of $ADNS, we are moving from a single product to a living ecosystem powered by InfoFi intelligence, a cross-chain social graph with seamless value transfers, and the unstoppable momentum of community-driven growth.&#x20;

This roadmap is the blueprint for how domain names evolve, how identity becomes infrastructure, and how ownership turns into an economy.

The endgame is clear: AllDomains is moving past domain name service to become the identity network and economic layer of Web3 - open, composable, and powered by community ownership.

### Perfect Timing, Powerful Momentum

The stars are aligning for AllDomains. Seeker SZN is live right now, with .skr domains powered by our infrastructure driving massive adoption. AllDomains Experience Season 2 will bring additional incentives for Seeker users, creating a direct bridge between mobile crypto adoption and our ecosystem. Meanwhile, Monad mainnet approaches in Q3-Q4, where we're already positioned with over 940,000 domains registered on testnet and getting ready for the mainnet launch.

With Eclipse and Seeker onboarding, domains are becoming an important part of Web3 infrastructure. This isn’t just good timing. It’s strategic positioning, placing AllDomains at the intersection of mobile crypto, new chain launches, and the rise of identity as core infrastructure.

### From Identity → Full Ecosystem

Owning your name was just the beginning. The real mission is bigger: building the most powerful cross-chain identity protocol in crypto, not just a name service, but the infrastructure layer for Web3 identity, and expanding that identity into an ecosystem of products.

Not every product will require a domain, but every product will connect back into the same identity system, with $ADNS at the core and making everything more intuitive, efficient, and powerful:

* Domains will anchor identity turning names into the foundation of ownership and access.
* Tokenizing 300M+ Web2 domains unlocking a $300B+ real-world asset class inside a unified marketplace that bridges Web2 and Web3.
* Bridges and swaps will move value seamlessly scaling chain by chain, asset by asset.
* InfoFi products will surface intelligence delivering insights and unlocking new earning opportunities through data-driven tools.
* SocialFi tools will connect people and projects transforming on-chain identity into reputation, community, and collaboration.
* Privacy layers will secure ownership and communication enabling private domains and encrypted messaging between users.
* Open Graph Protocol will unify profiles bringing assets, activity, and reputation together across chains.
* Leveraging AI-powered tools will enhance every interaction  optimizing user experience and protocol efficiency at scale.

This is how domains evolve from basic aliases into intelligent, functional, financial, and social assets; the glue that makes Web3 durable.

### Ignition (Q3 2025): $ADNS goes live, utility from day one

The story begins with the $ADNS Token Generation Event (TGE).

This isn't just a launch, it's ignition. $ADNS goes live with real utility from day one: trading incentives, rewards linked to protocol activity, and upcoming Season 2 of the AllDomains Experience with special benefits for Seeker users to new participants and long-term community members.&#x20;

For the first time, users' engagement and activity across domains will directly connect back to the token, enhanced by recommendations and personalized experiences.

Crucially, 50% of protocol revenues, from registrations, renewals, and fees, will now flow back into the token. Future products will also allocate a share, creating a compounding effect as the ecosystem expands.

It's a clean, on-chain launch that sets the tone: transparent, community-driven, and aligned with growth.

### Expansion (Q4 2025): From domains to infrastructure

After ignition, the roadmap expands. Q4 is about scaling utility and proving that AllDomains is more than domains.

The quarter opens with our strategic validator partnership alongside DeFiDev Corp, co-launching a validator that gives the community a direct way to stake into AllDomains growth while also securing the network.&#x20;

Our existing bridge evolves into Bridge 2.0, expanding from today’s limited routes into a flagship product that scales chain by chain and asset by asset. Together with advanced swaps, it enables seamless asset movement across chains and ecosystems.

<br>

With Monad mainnet expected, we're positioned to be day-one ready with our massive testnet adoption. Meanwhile, our swaps evolution becomes more than just a feature; it’s a comprehensive liquidity layer across Solana and beyond, enabling cross-chain value transfer and friction-less user experiences.

The InfoFi tools reveal another major milestone. Already powering private launchpads in beta, these data-driven platforms unlock new earning opportunities through on-chain insights and analytics enhanced by machine learning.&#x20;

Culture meets technology with emoji TLDs and subdomains, new namespaces that expand identity into expression and drive viral adoption. The quarter culminates with a fundamental shift toward decentralization, beginning with open-sourcing core components of the AllDomains protocol. Domain resolution, TLD management, and modular SDKs for wallet and dApp integration become publicly available, inviting the broader developer community to build, contribute, and innovate on our infrastructure.

The Builder Rewards Program launches alongside, offering grants, bounties, and revenue sharing for developers who contribute to the open protocol. This creates a flywheel effect: more developers, better products, stronger ecosystem, higher token utility.

Q4 turns AllDomains from a single product into a multi-product ecosystem with infrastructure support and community ownership.

### Unification (Q1 2026): Web2 meets Web3 identity

Identity isn't just Web3-native. Building on our proven .id success, we'll expand Web2 tokenization to .com, .net, and .org and others, linking them directly to wallets and on-chain profiles. This creates an enterprise adoption pathway for traditional companies looking to tokenize their existing domains and bridge into Web3 ownership. Imagine using the same name for your website, your payments, and your decentralized identity.\
\
For the first time, enterprises and individuals can unify their Web2 domains with Web3 identity payments, profiles, and ownership tied together.

This phase also introduces the Open Graph Protocol: identity-based profiles connecting across chains to offer bespoke and uninterrupted experiences. Social features, reputation systems, and governance tools will tie communities and projects closer together, while intelligent algorithms surface relevant connections and opportunities.

The decentralization movement accelerates with DAO rollout for community-led governance of namespaces, rewards, and protocol evolution. $ADNS holders won't just hold tokens, they'll shape the protocol's future, create new TLDs using $ADNS, and unlock new utility across the open ecosystem. This is where the protocol becomes truly community-owned, with the Builder Rewards Program driving continuous innovation, guided by key figures from across the Solana ecosystem serving as advisors and council members.

Probably one of our most exciting products of 2025 will be privacy-first domains, powered by zero-knowledge technology. Privacy-first domains let users transact and connect using domains without exposing their wallets, essential for both individuals and enterprises.

### Q2 2026 — The Identity Network & Economic Layer

By mid-2026, the roadmap completes its arc. Domains, bridges, swaps, validators, marketplaces, privacy layers, and social extensions will all interconnect into one unified system. The open protocol thrives with contributions from developers worldwide, while the Builder Rewards Program and AI-assisted development tools fuel continuous innovation. Projects will launch TLDs permissionlessly using $ADNS and the community will govern protocol evolution through decentralized governance.

Private domains expand with encrypted messaging between domain holders, creating secure communication channels without revealing underlying wallet addresses.

At this stage, AllDomains is no longer "a name service." It's the Identity Network and Economic Layer, the community-owned infrastructure that powers how people, projects, and value move through Web3.

### Endgame: The Identity Network

The world has already seen billion-dollar domain protocols. Now imagine that multiplied by de-fi, InfoFi, social, privacy, and Web2 onboarding, that’s the scale we’re building toward. AllDomains shows what comes after domains. Identity tied to liquidity and data. AI-enhanced user experiences. Social graph tied to governance. Web2 seamlessly integrated with Web3. Private domain ownership with encrypted communication. An entire economic layer built on who you are, enhanced by intelligence that makes everything work better.

That's why we built $ADNS differently: community-first, with real distribution, transparent liquidity, AI-powered efficiency, and revenue flowing back into the token.

This isn't about hype. It's about building the intelligent rails of Web3 identity and the economic infrastructure of tomorrow. And we're just getting started!

<br>


# Contact

Twitter -> <https://twitter.com/AllDomains_>

Github -> <https://github.com/onsol-labs>

Discord -> <https://discord.gg/alldomains>

Email -> <contact@alldomains.id>

Telegram -> <https://t.me/AllDomainsID><br>


