This repository contains JS/TS libraries to resolve domains & addresses registered with AZERO.ID.
It's built as a monorepo and contains the following packages:
@azns/resolver-core
– Vanilla JS/TS Library@azns/resolver-react
– React-Hooks Library (depends on@azns/resolver-core
)
Additionally, multiple working examples are provided for both packages.
📃 Integration Guide: https://docs.azero.id/integration
👩💻 Interface Documentation: https://azero-id.github.io/resolver/
Currently, this package is not production-ready and only works on the Aleph Zero Testnet. Aleph Zero Mainnet contract addresses are provided as soon as our contracts are deployed there.
Install the package from the npm registry:
npm install @azns/resolver-core
# or
pnpm add @azns/resolver-core
# or
yarn add @azns/resolver-core
Resolve domain → address via resolveDomainToAddress
:
import { SupportedChainId, resolveDomainToAddress } from '@azns/resolver-core'
const { address, error } = await resolveDomainToAddress('domains.tzero', {
chainId: SupportedChainId.AlephZeroTestnet,
})
// Print result
if (error) console.log(error.message)
else console.log(address)
Resolve address → primary domain(s) via resolveAddressToDomain
:
import { SupportedChainId, resolveAddressToDomain } from '@azns/resolver-core'
const { primaryDomain, error } = await resolveAddressToDomain(
'5EeBxqQ7Kz6hcchEgkBn9ybBS4UaqGggi2Rq5weNyEZ9DjAK',
{
chainId: SupportedChainId.AlephZeroTestnet,
},
)
// Print result
if (error) console.log(error.message)
else console.log(primaryDomain)
Install the packages from the npm registry:
npm install @azns/resolver-core @azns/resolver-react
# or
pnpm add @azns/resolver-core @azns/resolver-react
# or
yarn add @azns/resolver-core @azns/resolver-react
Resolve domain → address via useResolveDomainToAddress
:
import { SupportedChainId } from '@azns/resolver-core'
import { useResolveDomainToAddress } from '@azns/resolver-react'
const { address, error } = useResolveDomainToAddress('domains.tzero', {
chainId: SupportedChainId.AlephZeroTestnet,
})
Resolve address → primary domain(s) via useResolveAddressToDomain
:
import { SupportedChainId } from '@azns/resolver-core'
import { useResolveAddressToDomain } from '@azns/resolver-react'
const { primaryDomain, error } = useResolveAddressToDomain(
'5EeBxqQ7Kz6hcchEgkBn9ybBS4UaqGggi2Rq5weNyEZ9DjAK',
{
chainId: SupportedChainId.AlephZeroTestnet,
},
)
# Setup Node.js (recommended via nvm)
# Install pnpm: https://pnpm.io/installation (recommended via node corepack)
# Clone this repository
# Install dependencies
pnpm i
# Build packages & Run examples:
# - Vanilla Example starts on http://localhost:4000
# - Next.js Example starts on http://localhost:3000
pnpm run dev:examples