/bitcoinpunks

BitcoinPunks Graph API

Primary LanguageTypeScript

Cryptocoven subgraph

Cryptocoven subgraph

How to use the API

Try it out here

Example query:

{
  tokens(first: 5) {
    id
    tokenID
    tokenURI
    externalURL
    image 
    name 
    description
    type 
    sun 
    moon 
    rising 
    updatedAtTimestamp 
    owner {
      id 
    }
  }
}

Filtering

{
  tokens(
    where: {
      sun_contains: "capricorn"
    }
  ) {
    sun 
    name
  }
}

Full text search

{
  covenSearch(
    text: "'CRUSH PEARLS IN YOUR FISTS'"
  ) {
    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 Cryptocoven 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:dabit3/cryptocoven-api.git

cd cryptocoven-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: dabit3/cryptocovenapi

  2. Deploy the subgraph

yarn deploy