The goal is to extend the Address scalar type to accept and resolve .eth names, such that the resolvers only see the resolved address. The ethereum-ens library could be used to perform the resolution.
We'll need to introduce an extra configuration option to set the address of the ENS contract. We can also support a keyword identifying the network against a set of hardcoded values (e.g. MAINNET, ROPSTEN, KOVAN, etc.).
Notes:
The parseValue and parseLiteral of the Address scalar type would perform the ENS name => address resolution. It is not clear to me if these methods can be async or can return a promise, and if graphql-js will await on it before invoking the resolvers.
If not, we will have to deal with this manually, by having the parse* methods return a promise, and downstream resolvers would have to await on it. If the passed in address is an actual address (not a name), a resolved Promise can be used.
The goal is to extend the
Address
scalar type to accept and resolve.eth
names, such that the resolvers only see the resolved address. The ethereum-ens library could be used to perform the resolution.We'll need to introduce an extra configuration option to set the address of the ENS contract. We can also support a keyword identifying the network against a set of hardcoded values (e.g. MAINNET, ROPSTEN, KOVAN, etc.).
Notes:
parseValue
andparseLiteral
of the Address scalar type would perform the ENS name => address resolution. It is not clear to me if these methods can be async or can return a promise, and if graphql-js will await on it before invoking the resolvers.