Dynamic Records Resolution

Overview

Previously, retrieving records attached to an ENS name stored offchain required querying gateways via API calls (when supported). JustaName now introduces a breakthrough solution that enables fully onchain dynamic record resolution.

The Solution: `records()` function

JustaName now supports a new function records() returns (string[]) that returns an array of all record types attached to an ENS name. This enables clients to discover available records dynamically and perform targeted onchain resolution.

Example Response Format

[
  'addr(60)',
  'addr(246)', 
  'addr(820)',
  'addr(2147483704)',
  'addr(2147492101)',
  'text(com.github_justverified.eth)',
  'text(avatar)',
  'text(header)',
  'text(test)',
  'text(com.twitter_justverified.eth)',
  'text(display)',
  'text(org.telegram_justverified.eth)',
  'text(com.discord_justverified.eth)',
  'text(email_justverified.eth)',
  'text(Age)',
]

Benefits

Dynamic Resolution: Instead of guessing which records exist, clients can query the available record keys and resolve only what's actually present.

Onchain Operations: All operations are performed onchain, eliminating dependency on external gateways and API availability.

Efficiency: Reduces unnecessary calls by only resolving existing records.

Implementation Example

The following code demonstrates how to implement dynamic ENS record resolution:

Usage

  • Get Available Records: Call getRecordsKeys(name) to retrieve all available record types for an ENS name

  • Parse Record Types: The function categorizes records into text records and coin/address records

  • Dynamic Resolution: Use the discovered record keys to perform targeted resolution with getRecords()

Last updated

Was this helpful?