Docs
GraphQL

GraphQL

You can use the graph to query orders with GraphQL. Use the RWTP subgraph to query orders.

Use the GraphQL Playground

Example Query

Use the following query to grab orders. This subgraph attempts to parse common metadata fields like "title", "priceSuggested", "sellersStakeSuggested", and "buyersCostSuggested".

# https://api.thegraph.com/subgraphs/name/jacobpedd/rwtp
{
  orders {
    address
    title
    maker
    priceSuggested
    sellersStakeSuggested
    buyersCostSuggested
  }
}

Example with graphql-request

Install graphql-request and graphql.

yarn add graphql-request graphql

Then, query the subgraph.

import { request, gql } from 'graphql-request';

const query = gql`
  {
    orders {
      address
      title
      maker
      priceSuggested
      sellersStakeSuggested
      buyersCostSuggested
    }
  }
`;

const URL = 'https://api.thegraph.com/subgraphs/name/jacobpedd/rwtp';

request(URL, query).then((data) => console.log(data));