๐Ÿค
Web3API.resolve

resolveDomain

Resolves an Unstoppable domain and returns the address (asynchronous).

Options:

  • currency(optional): The currency to query. Available values : eth, 0x1. Default value : eth.
  • domain (required): Domain to be resolved.
JS
React
curl
Unity
1
// get polygon NFTs for address
2
const options = { currency: "eth", domain: "brad.crypto" };
3
const resolve = await Moralis.Web3API.resolve.resolveDomain(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchDomain = async () => {
7
// get polygon NFTs for address
8
const options = { currency: "eth", domain: "brad.crypto" };
9
const resolve = await Web3Api.resolve.resolveDomain(options);
10
console.log(resolve);
11
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/resolve/brad.crypto?currency=eth' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchDomain()
8
{
9
Resolve resolve = await Moralis.Web3Api.Resolve.ResolveDomain(domain: "brad.crypto" currency: "eth");
10
Debug.Log(resolve.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"address": "0x057Ec652A4F150f7FF94f089A38008f49a0DF88e"
3
}
Copied!

resolveAddress

Reverse resolves an address and returns the ENS domain (if exists).

Options:

  • address (required): Ethereum address to be reverse resolved.
JS
React
curl
Unity
1
// get ENS domain of an address
2
const options = { address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" };
3
const resolve = await Moralis.Web3API.resolve.resolveAddress(options);
Copied!
1
import React from "react";
2
import { useMoralisWeb3Api } from "react-moralis";
3
โ€‹
4
const Web3Api = useMoralisWeb3Api();
5
โ€‹
6
const fetchAddress = async () => {
7
// get ENS domain of an address
8
const options = { address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045" };
9
const resolve = await Web3Api.resolve.resolveAddress(options);
10
console.log(resolve);
11
};
Copied!
1
curl -X 'GET' \
2
'https://deep-index.moralis.io/api/v2/resolve/0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045/reverse' \
3
-H 'accept: application/json' \
4
-H 'X-API-Key: MY-API-KEY'
Copied!
1
using MoralisUnity;
2
using MoralisUnity.Web3Api.Models;
3
using UnityEngine;
4
โ€‹
5
public class Example
6
{
7
public async void fetchAddress()
8
{
9
Ens result = await Moralis.Web3Api.Resolve.ResolveAddress(address: "0xd8dA6BF26964aF9D7eEd9e03E53415D37aA96045");
10
Debug.Log(result.ToJson());
11
}
12
}
Copied!

Example result:

1
{
2
"name": "vitalik.eth"
3
}
Copied!

Tutorial

Legacy UI is present in this video, some things might be slightly different
Practical example showing how ENS Domain resolution works in Ethereum. Also demonstrating Unstoppable Domains.