Skip to content

Conversation

@shrugs
Copy link
Collaborator

@shrugs shrugs commented Nov 19, 2025

Context

  • currently working against ensdomains/namechain commit 9e31679
  • no longer works against the test ENSv2 Sepolia deployment due to implementation drift
  • all other TODO deferred to Epic: ENSv2 Indexing + API #1419

Known Issues

The below example queries are out of date following GraphQL API improvements, they need to be updated to match the new api.

Running

Fetch the latest ens-test-env

git clone git@github.com:namehash/ens-test-env.git
cd ens-test-env

docker compose up

Then access http://localhost:4334/api/graphql.

Example Queries

Domain by Name

query DomainByName {
  domain(by: { name: "eth" }) {
    id
    label

    ... on ENSv1Domain {
      children {
        edges {
          node {
            label
          }
        }
      }
    }

    ... on ENSv2Domain {
      subregistry {
        domains {
          edges {
            node {
              label
            }
          }
        }
      }
    }
  }
}

Domains by Owner

query Account {
  account(address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") {
    domains {
      edges {
        node {
          id
          label
          owner { address }
          registration { expiration }
          ... on ENSv1Domain {
            parent { label }
          }
          ... on ENSv2Domain {
            canonicalId
            registry { contract { chainId address }}
          }
        }
      }
    }
  }
}

DedicatedResolvers by Owner

query Account {
  account(address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") {
    dedicatedResolvers {
      edges {
        node {
          id
          dedicated {
            records { coinTypes }
          }
        }
      }
    }
  }
}

Permissions by User

query PermissionsByUser {
  account(address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") {
    permissions {
      edges {
        node {
          resource { permissions { contract { chainId, address } } }
          roles
        }
      }
    }
  }
}

Permissions by Contract

query PermissionsByContract {
  permissions(
    for: {
      # ETHRegistry on L1
      chainId: 15658733
      address: "0x1291be112d480055dafd8a610b7d1e203891c274"
    }
  ) {
    resources {
      edges {
        node {
          resource
          users {
            edges {
              node {
                id
                user { address }
                roles
              }
            }
          }
        }
      }
    }
  }
}

Domains by (v2) Registry

query RegistryByContract {
  registry(
    by: {
      # ETHRegistry
      contract: {
        chainId: 15658733
        address: "0x1291be112d480055dafd8a610b7d1e203891c274"
      }
    }
  ) {
    domains {
      edges {
        node {
          label
        }
      }
    }
  }
}

Resolver Record Keys

Remember that this API does NOT provide record values, because Forward Resolution MUST be followed to arrive at valid records for a given name: a direct lookup is NOT ENS-protocol-compliant.

query ResolverKeys {
  resolver(
    by: {
      contract: {
        # some DedicatedResolver
        chainId: 15658733
        address: "0x41953f2a8dfa6c4cd22fd7a899fa68df4fb3c6d1"
      }
    }
  ) {
    records {
      edges {
        node {
          node
          name
          coinTypes
          keys
        }
      }
    }
  }
}
query ResolverKeys {
  resolver(
    by: {
      contract: {
        # L1 DedicatedResolver for bridge.eth
        chainId: 15658733
        address: "0xdA5d29814b03353d9Bf49225ca63363542C6519F"
      }
    }
  ) {
    # all records (including dedicated records)
    records {
      edges {
        node {
          node
          coinTypes
          keys
        }
      }
    }

    # dedicated records
    dedicated {
      records {
        keys
      }
    }
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants