0xli / ens-subgraph-dns3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ENS Subgraph

This Subgraph sources events from the ENS contracts. This includes the ENS registry, the Auction Registrar, and any resolvers that are created and linked to domains. The resolvers are added through dynamic data sources. More information on all of this can be found at The Graph Documentation.

Example Queries

Here we have example queries, so that you don't have to type them in yourself eachtime in the graphiql playground:

{
  domains {
    id
    labelName
    labelhash
    parent {
      id
    }
    subdomains {
      id
    }
    owner {
      id
    }
    resolver {
      id
    }
    ttl
  }
  resolvers {
    id
    address
    domain {
      id
    }
    events {
      id
      node
      ... on AddrChanged {
        a
      }
      ... on NameChanged {
        name
      }
      ... on AbiChanged {
        contentType
      }
      ... on PubkeyChanged {
        x
        y
      }
      ... on TextChanged {
        indexedKey
        key
      }
      ... on ContenthashChanged {
        hash
      }
      ... on InterfaceChanged {
        interfaceID
        implementer
      }
      ... on AuthorisationChanged {
        owner
        target
        isAuthorized
      }
    }
  }
  registrations(where: { labelName_not: null }, orderBy: expiryDate, orderDirection: asc, first: 10, skip: 0) {
    expiryDate
    labelName
    domain{
      name
      labelName
    }
  }
}

部署说明

准备工作:

  1. 修改./src/config.ts,指定tld和该tldnamehash
  2. 修改./subgraph.yaml,注意编辑dataSources下面每个sourceaddressstartBlock
  3. checkout https://github.com/graphprotocol/graph-node,和当前repo放在同一级路径下,并按其说明文档启动docker。

进入 graph-node 根目录

cd ./docker
rm -rf data/
docker-compose up

回到当前 sub-graph 根目录

yarn
yarn codegen
yarn create-local
yarn deploy-local

About


Languages

Language:TypeScript 100.0%