{
tokens {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
}
}
{
tokenSearch (text: "Orange") {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
}
}
{
tokens(
where: {
collection: "Mutant Ape Yacht Club"
}
) {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
}
}
{
tokens(
where: {
owner: "0x9056d15c49b19df52ffad1e6c11627f035c0c960"
}
) {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
}
}
{
tokens {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
owner {
id
tokens {
id
}
}
}
}
{
tokens(
orderBy: updatedAtTimestamp
orderDirection: desc
) {
id
tokenID
contentURI
collection
eyes
background
hat
mouth
clothes
fur
earring
}
}
This project can also serve as a useful reference for how to query IPFS from within a subgraph mapping template, using methods like ipfs.cat
from the graph-ts
library and how to manage the data once it comes back from IPFS:
let data = ipfs.cat(ipfshash)
let value = json.fromBytes(data!).toObject()
let attributes = value.get('attributes').toArray()
for (let i = 0; i < attributes.length; i++) {
let item = attributes[i].toObject()
// do stuff
}