Beranames Docs
  • 🐻OVERVIEW
    • Introducing Beranames
    • Key Components
    • Get in Touch
  • 😎USING BERANAMES
    • Beranames Lifecycle
    • Registering a Beraname
    • Pricing
  • 🧠RESOLVERS
    • Forward Resolution
    • Reverse Resolution
    • Universal Resolver
    • Subdomains
  • Managing other addresses & Contract names
  • 🔨INTEGRATE
    • Contracts & Repositories
    • How to Mint
    • Configure Viem
    • Resolving
    • Listing Beranames on NFT Marketplaces
    • Use Beranames on Metamask
  • 📃RESOURCES
    • Audits
Powered by GitBook
On this page
  • Forward Resolve (from Name to Address)
  • Onchain
  • With Viem
  • Reverse Resolve (from Address to Name)
  • Onchain
  • With Viem
  • Other Providers
  1. INTEGRATE

Resolving

PreviousConfigure ViemNextListing Beranames on NFT Marketplaces

Last updated 5 months ago

Forward Resolve (from Name to Address)

Onchain

Assuming you have minted test.bera with correct data (or correct setAddr), you need to call resolve on the universal resolver passing the dns encoded form of the name and the function you want to call (in this case, addr(bytes node)). Code can be found HERE

With Viem

const ensAddress = await publicClient.getEnsAddress({
  name: normalize('test.bera'),
})

Reverse Resolve (from Address to Name)

Onchain

Assuming you have minted test.bera with correct data (or correct setAddr), you need to call reverse on the universal resolver passing the dns encoded form of the reverse address. Check ENS documentation if you need more, but Anvil has your back.

With Viem

const ensName = await publicClient.getEnsName({
  address: '<your address>',
})
return ensName.replace(".bera", ".🐻⛓️") // => test.🐻⛓️

Please note “ensName.replace(".bera", ".🐻⛓️") // => test.🐻⛓️”. Without this line you will get test.bera. Emojis are much nicer than .bera, but a few limitations prevented us from doing it directly on chain.

Other Providers

Re-Own, WalletConnect, Ethers.js, etcetc.

The contracts are ENS-compatible so it’s really easy to configure them. If you do the work and you want to share it, please reach out and we’ll add it to this page.

🔨
https://viem.sh/docs/ens/actions/getEnsAddress.html
https://viem.sh/docs/ens/actions/getEnsName