Usage

2.1 Resolve domain name

The name method allows you to resolve a domain name. It returns a Promise that resolves with the domain name or rejects with an error if the resolution fails.

Parameter:

  • domainName (string.taiko): The domain name you want to resolve.

Example:

import DotTaiko, { getTaikoAddress } from '@dotnames/dotTaiko'
import { providers } from "ethers";
const provider = new providers.JsonRpcProvider("https://rpc.jolnir.taiko.xyz");

const dotTaiko = new DotTaiko({ provider, taikoAddress: getTaikoAddress('167007') });

const domainName = "---Enter domain name to resolve---";
const owner = await dotTaiko.name(domainName).getAddress();
console.log("Owner of given domain name:- ", owner)

2.2 Resolve wallet address

The getName method allows you to resolve the address. It returns a Promise that resolves with the wallet address or rejects with an error if the resolution fails.

Parameter:

  • walletAddress (0x${string}): The wallet address you want to resolve.

Example:

import DotTaiko, { getTaikoAddress } from '@dotnames/dotTaiko'
import { providers } from "ethers";
const provider = new providers.JsonRpcProvider("https://rpc.jolnir.taiko.xyz");

const dotTaiko = new DotTaiko({ provider, taikoAddress: getTaikoAddress('167007') });

const walletAddress = "---Enter Wallet Address---";
const domain = await dotTaiko.getName(walletAddress);
console.log("Domain name for given address:- ", domainName);

2.3 Fetch records for a specified domain name

The getText method allows you to fetch the records of a domain name. It returns a Promise that resolves with the content or rejects with an error if the resolution fails.

Parameter:

  • domainName (string.taiko): The domain name you want to fetch content.

  • key (”com.discord”, ”avatar”, etc): The domain name you want to resolve.

Example:

import DotTaiko, { getTaikoAddress } from '@dotnames/dotTaiko'
import { providers } from "ethers";
const provider = new providers.JsonRpcProvider("https://rpc.jolnir.taiko.xyz");

const dotTaiko = new DotTaiko({ provider, taikoAddress: getTaikoAddress('167007') });
const domainName = "---Enter domain name to resolve---";

const discordProfile = await dotTaiko.name(domainName).getText("com.discord");
console.log("Discord Profile:- ", discordProfile);

//To fetch multiple content,
//Example

const allData = await dotTaiko.name(domainName)
      .getText([
        "snapshot", "notice", "com.discord", "com.github",
        "com.reddit", "com.twitter","org.telegram","eth.ens.delegate",
      ]);

//This will return all the available data for a specific domain name