[WIP] Implementation of plugins for ERC165, ERC721 and cryptokitties#116
[WIP] Implementation of plugins for ERC165, ERC721 and cryptokitties#116leonprou wants to merge 13 commits into
Conversation
raulk
left a comment
There was a problem hiding this comment.
Some initial feedback. I think we're off to a very good start!
| const query = ` | ||
| { | ||
| account(address:"0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") { | ||
| supportsInterface(interfaceID: "0x01ffc9a7") |
There was a problem hiding this comment.
We prefer strict camel casing.
| supportsInterface(interfaceID: "0x01ffc9a7") | |
| supportsInterface(interfaceId: "0x01ffc9a7") |
There was a problem hiding this comment.
I prefer too, but that's the language of the original EIP - https://github.com/ethereum/EIPs/blob/master/EIPS/eip-165.md. Of course we can do interfaceId, your call.
| const query = ` | ||
| { | ||
| account(address:"0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") { | ||
| supportsInterface(interfaceID: "0x9a20483d") |
There was a problem hiding this comment.
How about we add a a field an an enum type for known interface IDs?
There was a problem hiding this comment.
as a new grapql method (like supportsInterfaceByEnum) or just at the backend?
| test('erc721: nftToken balanceOf query #1', async () => { | ||
| const query = ` | ||
| { | ||
| nftToken(address:"0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") { |
There was a problem hiding this comment.
We don't want to pollute the global namespace. How about adding a if this plugin extends the Account type with an nftToken field? We'd need to add the token field in the core plugin schema. A query would look like this:
{
account(address: "0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") {
contract {
nftContract {
}
}
}
}
There was a problem hiding this comment.
Interesting, yeah this looks cleaner. But I'm not sure why we need the contract fields as a intermediary (for logical distinction?). For now I did this syntax:
{
account(address:"0x6EbeAf8e8E946F0716E6533A6f2cefc83f60e8Ab") {
nftToken {
balanceOf(owner: "0xD418c5d0c4a3D87a6c555B7aA41f13EF87485Ec6")
}
}
}
If I would add the contract to Account, what should it return if plugins are used? An empty object?
| entity: Entity | ||
| standard: String | ||
| operation: String | ||
| from: TokenHolder |
There was a problem hiding this comment.
This is referencing the ERC20 TokenHolder, right? I think we need to rename TokenHolder to ERC20TokenHolder, and we might need to add a field owns(tokenId: Long) that calls ownerOf on the token ID and returns true if we own it.
There was a problem hiding this comment.
Yes this makes sense. Just didn't want to touch the old code
There was a problem hiding this comment.
about the method owns, what's the proposed graphql sytnax? If it's:
account(address:"0x06012c8cf97BEaD5deAe237070F9587f8E7A266d") {
owns(tokenId: 1)
}
The account address is the address of the token owner or of the token contract?
Co-Authored-By: leonprou <leonprou@gmail.com>
…prou/ethql into erc165_erc721_cryptokitties
PR for issue #109