Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Custom Subgraph Query

Requirements

Our examples are only for Rawrshak's Content and Exchange subgraphs. A developer can create custom queries for our subgraphs.

A developer can also retrofit this tutorial for any GraphQL source or any subgraph.

Tutorial

1. Create a folder for custom graphql queries

2. Inside that folder, create a "Resources" folder and a "Scripts" folder

3. In the Resources folder, create a text file that contains the GraphQL query

Filename: GetAssetName.txt

query GetAssetName {{
    asset ( id: "{0}-{1}" ) {{
        name
    }}
}}

Notes:

  • GraphQL query syntax "{" and "}" must be replaced with "{{" and "}}"

  • Query parameters are indexed. {0} and {1} indicate the first parameter and second parameter for the query.

4. Create Query Script

Notes:

  • This script should inherit from QueryBase

  • queryWithArgs format string should match the number of inputs in the GetAssetName.txt

  • Subgraph object is in the Rawrshak SDK. If pointing to a different subgraph, replace this with the correct subgraph source uri

  • The ReturnData object should match the serializable json object returned by the query

  • Please check out the Content and Exchange Pages for more info

5. Use the Custom Query

To use the query:

Last updated