@ensdomains/ensjs
Due the functionality been forked from ENS, the libraries can be used to interact with vet.domains programmatically.
You can learn more about the functionality and how to use it on https://github.com/ensdomains/ensjs-v3 (opens in a new tab)
All contract interactions are supported, subgraph lookups are currently not supported.
import { getAvailable, getOwner, getExpiry, _getAddr, getRecords, getResolver, getPrice } from "@ensdomains/ensjs/public"
import { createPublicClient, createWalletClient, custom } from 'viem'
import { useConnex } from "@vechain/dapp-kit-react"
// ..
const connex = useConnex()
const publicClient = createPublicClient({
chain: testnet,
transport: custom(new Provider({ connex }))
})
const name = 'user.vet'
const available = await isAvailable(publicClient, { name })
console.log('Domain is currently', available ? 'available' : 'unavailable')
const owner = await getOwner(publicClient, { name })
console.log('Current owner is', owner?.owner)
const address = await getAddressRecord(publicClient, { name })
console.log('Address record set to', address?.value)