Skip to content

jinsley8/doodles-subgraph-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Doodles Subgraph API

Subgraph to query Doodles NFT tokens along with the traits and owners.

How to use the API

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

How to deploy the API

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:

  1. Clone this repo, change into the directory, and install the dependencies:
git clone git@github.com:jinsley8/doodles-subgraph-api.git

cd doodles-subgraph-api

npm install
  1. Visit The Graph hosted service dashboard, create a profile, and create a new subgraph by clicking Add Subgraph.

  2. Install The Graph CLI:

npm install -g @graphprotocol/graph-cli
  1. Authenticate the your CLI environment with the Access Token from your account dashboard:
graph auth https://api.thegraph.com/deploy/ <ACCESS_TOKEN>
  1. Replace username/apiname in package.json with your username and apiname, for example: jinsley8/doodles-api

  2. Deploy the subgraph

yarn deploy

About

Subgraph to query Doodles NFT tokens along with the traits and owners.

Topics

Resources

Stars

Watchers

Forks