Git Product home page Git Product logo

ens-subgraph's Introduction

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
    }
  }
}

ens-subgraph's People

Contributors

0xzoomeye avatar arachnid avatar data-nexus avatar davekaj avatar decanus avatar html5cat avatar jefflau avatar leonmanrolls avatar leoyvens avatar lutter avatar makoto avatar paulieb14 avatar storywithoutend avatar tateb avatar timmclean avatar web3pm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ens-subgraph's Issues

Support text records such as phone email, twitter username or discord

Hi, I see that the ENS supports text records such as adding email, url, phone number, discord name or twitter into the ens domain.

Would it be possible to support those values in the ens graph? I see the query has TextChanged but not anything related to get the text.

(I am not so familiar with the tech, so if I am wrong please let me know)).

Add parent domain in NewOwner.

so that we can query number of reverse record registered with this query.

   newOwners(
    first:5,orderBy:blockNumber, orderDirection:desc,
    where:{domain:"0x91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2"}
  ){    
    blockNumber
    domain{
      name
      parent{
        name
      }
    }
  }

where 0x91.. is the namehash of addr.reverse

*Changed event with no resolver

The following query fails as there's a name changed event out there with no resolver set.

{
    nameChangeds(where:{blockNumber_gt:11490000}){
    id
    name
    resolver{
      domain{
        name
      }
      address
    }
  }
}

Investigate

  • Whether this happens on NameChanged or all (Addr|MulticoinAddr|Abi|Pubkey|Text|Contenthash|Interface|Authorisation)Changed
  • Fix the bug

subgraph resolve error

I run the command:
yarn setup

You get an error:
โœ– Failed to deploy to Graph node http://127.0.0.1:8020/: subgraph resolve error: resolve error: Serialization error: Invalid operation type error. at line 28 column 3
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I deleted the contents of the schema.graphql file:

  • kind: ethereum/contract
    name: NameWrapper
    network: ethereum
    source:
    abi: NameWrapper
    mapping:
    kind: ethereum/events
    apiVersion: 0.0.5
    language: wasm/assemblyscript
    file: ./src/nameWrapper.ts
    entities:
    - NameWrapper
    abis:
    - name: NameWrapper
    file: ./abis/NameWrapper.json
    eventHandlers:
    - event: "NameWrapped(indexed bytes32,bytes,address,uint32,uint64)"
    handler: handleNameWrapped
    - event: "NameUnwrapped(indexed bytes32,address)"
    handler: handleNameUnwrapped
    - event: "FusesSet(indexed bytes32,uint32,uint64)"
    handler: handleFusesSet

yarn setup
It works.

Revision: 64564ba

Please help me!

`NewOwner` with ID "66288922-138" but an entity of type `NewResolver`, which has an interface in common with `NewOwner`, exists with the same ID

When I deploy this subgraph to my own node I got this error

Subgraph failed with non-deterministic error: Error while processing block stream for a subgraph: tried to set entity of type `NewOwner` with ID "66288922-138" but an entity of type `NewResolver`, which has an interface in common with `NewOwner`, exists with the same ID, retry_delay_s: 120, attempt: 0, sgd: 1, subgraph_id: QmdF7PcBCU1FN5Wc49Sdft1q1VbRQMmFrHedS95H4R7BsA, component: SubgraphInstanceManager

Does anybody has encounter this issue

Cannot find the ens.nameByHash() function code.

In ens-subgraph/src/ensRegistry.ts, line 97, I found this:
let label = ens.nameByHash(event.params.label.toHexString())
There's only an empty declaration in graph-ts lib for this function.
Could anybody tell me where can I found the implementation code?
Thanks.

Try to build subgraph on local graphnode Error

I got this error: "ens_name_by_hash is deprecated " when sync data from my local blockchain network;
I Pull newest version of graphnode on github and deploy subgraph and got this issue
docker-compose.yml
version: '3' services: graph-node: image: graphprotocol/graph-node ports: - '8000:8000' - '8001:8001' - '8020:8020' - '8030:8030' - '8040:8040' depends_on: - ipfs - postgres extra_hosts: - host.docker.internal:host-gateway environment: postgres_host: postgres postgres_user: graph-node postgres_pass: let-me-in postgres_db: graph-node ipfs: 'ipfs:5001' ethereum: 'mainnet:http://host.docker.internal:8545' GRAPH_LOG: info ipfs: image: ipfs/go-ipfs:v0.10.0 ports: - '5001:5001' volumes: - ./data/ipfs:/data/ipfs postgres: image: postgres ports: - '5432:5432' command: [ "postgres", "-cshared_preload_libraries=pg_stat_statements" ] environment: POSTGRES_USER: graph-node POSTGRES_PASSWORD: let-me-in POSTGRES_DB: graph-node # FIXME: remove this env. var. which we shouldn't need. Introduced by # <https://github.com/graphprotocol/graph-node/pull/3511>, maybe as a # workaround for https://github.com/docker/for-mac/issues/6270? PGDATA: "/var/lib/postgresql/data" POSTGRES_INITDB_ARGS: "-E UTF8 --locale=C" volumes: - ./data/postgres:/var/lib/postgresql/data

How do I can fix this problem? Is this on configuration of IPFS I need to updated anything

subdomains does not show names

All subdomains are displayed like this:

0x24fc107f68a32a6cc2e2d5a22ddf2415510fcd05c3c23239af32cb96b321a083.abc.eth

0xbda9184fb52d596327376b8cf4de2ebf28987c38302e856199c18cf3b727668d.abc.eth

Request URL: http://localhost:8000/subgraphs/name/graphprotocol/ens

"labelName": null

{
	"data": {
		"domain": {
			"id": "0x9f5cd92e2589fadd191e7e7917b9328d03dc84b7a67773db26efb7d0a4635677",
			"labelName": "abc",
			"subdomains": [{
				"id": "0x9a03fd7ee9d13313ea91969d3bd5c8245df92b93159b4b93f4f5bf9a68b01171",
				"labelName": null,
				"labelhash": "0x24fc107f68a32a6cc2e2d5a22ddf2415510fcd05c3c23239af32cb96b321a083",
				"isMigrated": true,
				"name": "[24fc107f68a32a6cc2e2d5a22ddf2415510fcd05c3c23239af32cb96b321a083].abc.eth",
				"owner": {
					"id": "0x196d36d0156ed95cf8fd865cc5739cdbb6d49b7f",
					"__typename": "Account"
				},
				"__typename": "Domain"
			}, {
				"id": "0x9bb6080c4363854e814e975967d47c7cd5d735dc8ac30708c9d9915b79663261",
				"labelName": null,
				"labelhash": "0xbda9184fb52d596327376b8cf4de2ebf28987c38302e856199c18cf3b727668d",
				"isMigrated": true,
				"name": "[bda9184fb52d596327376b8cf4de2ebf28987c38302e856199c18cf3b727668d].abc.eth",
				"owner": {
					"id": "0x196d36d0156ed95cf8fd865cc5739cdbb6d49b7f",
					"__typename": "Account"
				},
				"__typename": "Domain"
			}, {
				"id": "0xa87df75741af9f07d5765eda486d58b200418f878d23d79f90a25be492a53416",
				"labelName": null,
				"labelhash": "0xdfa57c542fea29ed292cef0ce135d0e22189365fa59abedc7a310b751ace684f",
				"isMigrated": true,
				"name": "[dfa57c542fea29ed292cef0ce135d0e22189365fa59abedc7a310b751ace684f].abc.eth",
				"owner": {
					"id": "0x0000000000000000000000000000000000000000",
					"__typename": "Account"
				},
				"__typename": "Domain"
			}, {
				"id": "0xf68e0542cc4ec1a5bdc3362696f10792b97f695e66339bc36dacd7e1b121a130",
				"labelName": null,
				"labelhash": "0x7624778dedc75f8b322b9fa1632a610d40b85e106c7d9bf0e743a9ce291b9c6f",
				"isMigrated": true,
				"name": "[7624778dedc75f8b322b9fa1632a610d40b85e106c7d9bf0e743a9ce291b9c6f].abc.eth",
				"owner": {
					"id": "0x0000000000000000000000000000000000000000",
					"__typename": "Account"
				},
				"__typename": "Domain"
			}],
			"__typename": "Domain"
		}
	}
}

What is the reason for this?

Testnets?

Any chance to get this deployed for let's say rinkeby, other than... doing it myself "unofficially"? ๐Ÿ˜ƒ

Error syncing subgraph

When syncing the subgraph I get an error when it gets to block 16934752. This is when the first ENS domain was wrapped.

The error refers to domain firstwrappedname.eth which does exist in the domains table of the postgreSQL database

Here is the error and stack-trace:

ERROR Subgraph failed with non-deterministic error: failed to process trigger: block #16934752 (0xc616โ€ฆ7aec), transaction cdfd894595e7d3b898cb9c58235f33e8286a46097c15ca18c1bffe59e6cc9a37: Entity WrappedDomain[0xc44eec7fb870ae46d4ef4392d33fbbbdc164e7817a86289a1fe30e5f4d98ae85]: missing value for non-nullable field domain wasm backtrace: 0: 0x3847 - <unknown>!src/types/schema/WrappedDomain#save 1: 0x4693 - <unknown>!src/nameWrapper/makeWrappedTransfer 2: 0x4873 - <unknown>!src/nameWrapper/handleTransferSingle , retry_delay_s: 120, attempt: 0, sgd: 1, subgraph_id: QmXbT1RGq4hrqhYPtcd1muDu7Hg2f9uUXRPeP6ZHNU3NL8, component: SubgraphInstanceManager

Help using ens subgraph

I have had success querying the ens subgraph for mint price & other data. However, I cannot seem to get a query which returns all transfer events for a domain. I want to display a domains entire sales history but cannot seem to get the correct query.

I tried tinkering with transfer(){}, transfers(){}, & all other sorts of things but havnt had any success.

I cannot find any documentation on what that query would look like. Is it possible to get all transfer history for a particular domain with this subgraph?

No way to determine primary ENS name

The following query returns a list of domains under an address but there's no way to tell which one is the primary ENS name:

domains(
  where: {
      resolvedAddress: "0x983110309620d911731ac0932219af06091b6744"
  }
)  {
  name
}

On app.ens.domains it shows the address has a primary ENS name:
Primary ENS Name (reverse record): brantly.eth

Failed to compile subgraph, Import file not found

Getting an error when trying to build this (so I can deploy it to a local graph node). What am I doing wrong here? I pulled down the repo, did an npm install, and then it doesn't seem to build.

Using graph-cli version 0.19.0.

% graph build
  Skip migration: Bump mapping apiVersion from 0.0.1 to 0.0.2
  Skip migration: Bump mapping apiVersion from 0.0.2 to 0.0.3
  Skip migration: Bump mapping apiVersion from 0.0.3 to 0.0.4
  Skip migration: Bump mapping specVersion from 0.0.1 to 0.0.2
โœ” Apply migrations
โœ” Load subgraph from subgraph.yaml
  Compile data source: ENSRegistry => build/ENSRegistry/ENSRegistry.wasm
โœ– Failed to compile subgraph: Failed to compile data source mapping: Import file 'src/types/ENSRegistry/EnsRegistry.ts' not found.
Error: Failed to compile data source mapping: Import file 'src/types/ENSRegistry/EnsRegistry.ts' not found.
    at Compiler._compileDataSourceMapping (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:312:13)
    at /Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:206:20
    at updateInDeepMap (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1971:22)
    at updateInDeepMap (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at updateInDeepMap (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1980:23)
    at Map.updateIn (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:1278:26)
    at /Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/src/compiler.js:205:24
    at /Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:3016:46
    at List.__iterate (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:2206:13)
    at IndexedIterable.mappedSequence.__iterateUncached (/Users/kian/.nvm/versions/node/v14.1.0/lib/node_modules/@graphprotocol/graph-cli/node_modules/immutable/dist/immutable.js:3015:23)

Local deployment

Hello,
i'm trying to deploy ens contracts (registry and one resolver only) and configure use ens-subgraph to index domains.
After registering domains using the registry and the resolver, domains are properly registered but with wrong name (and labelName).
It use the form with the label as hex string.
Digging in the code, i found :

export function handleNameChanged(event: NameChangedEvent): void {
  if(event.params.name.indexOf("\u0000") != -1) return;

  let resolverEvent = new NameChanged(createEventID(event))
  resolverEvent.resolver = createResolverID(event.params.node, event.address)
  resolverEvent.blockNumber = event.block.number.toI32()
  resolverEvent.transactionID = event.transaction.hash
  resolverEvent.name = event.params.name
  resolverEvent.save()
}

Is there a reason to not update the domain name and labelName at this point?

Add Reverse Record to Account query

Right now Account only returns

id: ID!
domains: [Domain!]!
registrations: [Registration!]

it would be helpful to add a reverse record to the schema

image

Null value resolved for non-null field `resolver` Error

I think there are some ResolverEvents that have null set for resolver field.

Query to replicate:

resolverEvents(first:2, where:{ resolver_not: null, blockNumber_gt: 14891090}) {     	
   id
   transactionID
  blockNumber
  resolver { 
    id     	
  }
}

image

If I comment out the resolver fields, and run the same query, this is what I get,

image

Interestingly, transaction IDs for both the records are same i.e. 0xc5141297ff039da6fef3fa6b7903d35ac1e7ba250a053040974e659d264bd97f, and the second one for some reason has resolver set to null.

Null labelName for many subdomains

Hi there,

I was investigating the issue with the labelName being null for some subdomains and I came across the code responsible in the ensRegistry.ts file. It appears to be happening in lines 53 to 56 in the fbddf98 version.

let label = ens.nameByHash(event.params.label.toHexString())
if (label != null) {
domain.labelName = label
}

I was wondering if this is a known issue and if there is anything that can be done to fix it. I've included some examples below.

Please let me know if you have any thoughts or insights on this matter.

Examples

LabelName is null
Screen Shot 2022-12-14 at 10 51 42 PM

LabelName is correct
Screen Shot 2022-12-14 at 10 51 47 PM

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.