| 1 | import { labelhash, namehash } from "viem"; |
| 2 | import { ensClient, spinner } from "../utils"; |
| 3 | import { normalize } from "viem/ens"; |
| 4 | import { addresses } from "@ensdomains/ensjs/contracts"; |
| 5 | |
| 6 | export async function getLabelHash(options: { name: string }) { |
| 7 | spinner.start(); |
| 8 | const res = labelhash(options.name as string); |
| 9 | spinner.stop(); |
| 10 | console.log(res); |
| 11 | } |
| 12 | |
| 13 | export async function getNamehash(options: { name: string }) { |
| 14 | spinner.start(); |
| 15 | const res = namehash(options.name as string); |
| 16 | spinner.stop(); |
| 17 | console.log(res); |
| 18 | } |
| 19 | |
| 20 | export async function getResolver({ name }: { name: string }) { |
| 21 | spinner.start(); |
| 22 | const resolver = await ensClient.getEnsResolver({ |
| 23 | name: normalize(name), |
| 24 | }); |
| 25 | spinner.stop(); |
| 26 | console.log(resolver); |
| 27 | } |
| 28 | |
| 29 | export function getDeployments() { |
| 30 | for (const [chainId, contracts] of Object.entries(addresses)) { |
| 31 | console.log(`Chain ID: ${chainId}`); |
| 32 | for (const [contractName, contractData] of Object.entries(contracts)) { |
| 33 | console.log(` ${contractName}: ${contractData.address}`); |
| 34 | } |
| 35 | } |
| 36 | } |