Subgraph to query Doodles NFT tokens along with the traits and owners.
Try it out here
Example query:
{
tokens(first: 5) {
id
tokenID
tokenURI
image
name
description
face
hair
body
background
head
piercing
updatedAtTimestamp
owner {
id
}
}
}
Filtering
{
tokens(
where: {
face_contains: "mustache"
}
) {
face
name
tokenID
owner {
id
}
}
}
Full text search
{
doodleSearch(
text: "'mustache'"
) {
id
name
description
}
}
This project is an example of how you can build and deploy Graph Protocol APIs for NFT projects.
This subgraph indexes data from doodles smart contract transactions and makes them queryable.
This API enables advanced querying capabilities like full text search, relationships between tokens and users, filtering, sorting, and pagination.
To deploy this API, follow these steps:
- Clone this repo, change into the directory, and install the dependencies:
git clone [email protected]:jinsley8/doodles-subgraph-api.git
cd doodles-subgraph-api
npm install
-
Visit The Graph hosted service dashboard, create a profile, and create a new subgraph by clicking Add Subgraph.
-
Install The Graph CLI:
npm install -g @graphprotocol/graph-cli
- Authenticate the your CLI environment with the Access Token from your account dashboard:
graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>
-
Replace
username/apiname
inpackage.json
with your username and apiname, for example:jinsley8/doodles-api
-
Deploy the subgraph
yarn deploy