Skip to content

Commit

Permalink
queryApi notes
Browse files Browse the repository at this point in the history
  • Loading branch information
bucanero committed Jul 12, 2023
1 parent 369a0de commit 65172c6
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 6 deletions.
14 changes: 11 additions & 3 deletions docs/bos/community/indexers.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ With QueryAPI you can quickly create your own indexer by:
* Specifying the schema for your own custom hosted database and write to it with your indexer function;
* Retrieving that data through a GraphQL API.

:::info

NEAR QueryAPI is currently under development. Users who want to test-drive this solution need to be added to the allowlist before creating or forking QueryAPI indexers.

You can request access through [this link](https://near.org/dev-queryapi.dataplatform.near/widget/NearQueryApi).

:::

### How it Works

This works by:
Expand All @@ -22,13 +30,13 @@ You can access the [NEAR QueryAPI by following this link](https://near.org/datap

This should take you to a dashboard that looks like this:

![QueryAPI Dashboard](./assets/QAPIScreen.png)
![QueryAPI Dashboard](/docs/assets/QAPIScreen.png)

## Creating an Indexer

Clicking on "Create New Indexer" will redirect you in-browser to a Component code editor that looks like this:

![QueryAPI Indexer Dashboard](./assets/QAPIScreen2.png)
![QueryAPI Indexer Dashboard](/docs/assets/QAPIScreen2.png)

This is the interface through which you can create a new Indexer. On here you can specify:

Expand Down Expand Up @@ -83,7 +91,7 @@ await context.graphql(`

Creating these queries within strings can be very difficult, especially considering that the table names vary depending on your indexer name and account ID. An easier way to do this would be by visiting the GraphQL Playground site and creating the queries there. You can then copy and paste them into your `indexingLogic.js` file as shown below:

![Alt Text](./assets/QAPIScreen.gif)
![Alt Text](/docs/assets/QAPIScreen.gif)

:::

Expand Down
14 changes: 13 additions & 1 deletion docs/bos/tutorial/indexer-tutorials/feed-indexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,13 @@ title: BOS Feed Indexer
sidebar_label: BOS Feed Indexer
---

This indexer can be found by [following this link](https://near.org/#/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=roshaan.near/feed-indexer&view=editor-window).
:::info

NEAR QueryAPI is currently under development. Users who want to test-drive this solution need to be added to the allowlist before creating or forking QueryAPI indexers.

You can request access through [this link](https://near.org/dev-queryapi.dataplatform.near/widget/NearQueryApi).

:::

## Running `feed-indexer`

Expand All @@ -16,6 +22,12 @@ The indexer `indexingLogic.js` is comprised of functions that help handle, trans

A schema is also specified for the tables in which data from relevant transactions is to be persisted, this can be found in the `schema.sql` tab.

:::tip

This indexer can be found by [following this link](https://near.org/#/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=roshaan.near/feed-indexer&view=editor-window).

:::

## Schema Definition

:::note
Expand Down
14 changes: 13 additions & 1 deletion docs/bos/tutorial/indexer-tutorials/hype-indexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ title: Hype Indexer
sidebar_label: Hype Indexer
---

This indexer can be found by [following this link](https://near.org/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=somepublicaddress.near/hypeindexer&view=indexer-status).
:::info

NEAR QueryAPI is currently under development. Users who want to test-drive this solution need to be added to the allowlist before creating or forking QueryAPI indexers.

You can request access through [this link](https://near.org/dev-queryapi.dataplatform.near/widget/NearQueryApi).

:::

## Overview

This indexer creates a new row in a pre-defined `posts` or `comments` table created by the user in the GraphQL database for every new post or comment found on the blockchain that contains either "PEPE" or "DOGE" in the contents. This is a simple example that shows how to specify two tables, filter blockchain transaction data for a specific type of transaction and its contents, and save the data to the database.

:::tip

This indexer can be found by [following this link](https://near.org/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=somepublicaddress.near/hypeindexer&view=indexer-status).

:::

## Defining the Database Schema

The first step to creating an indexer is to define the database schema. This is done by editing the `schema.sql` file in the code editor. The schema for this indexer looks like this:
Expand Down
14 changes: 13 additions & 1 deletion docs/bos/tutorial/indexer-tutorials/posts-indexer.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,24 @@ title: Posts Indexer
sidebar_label: Posts Indexer
---

This indexer can be found by [following this link](https://near.org/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=somepublicaddress.near/postsexample&view=indexer-status).
:::info

NEAR QueryAPI is currently under development. Users who want to test-drive this solution need to be added to the allowlist before creating or forking QueryAPI indexers.

You can request access through [this link](https://near.org/dev-queryapi.dataplatform.near/widget/NearQueryApi).

:::

## Overview

This indexer creates a new row in a pre-defined `posts` table created by the user in the GraphQL database for every new post found on the blockchain. This is a simple example that shows how to specify a single table, filter blockchain transaction data for a specific type of transaction, and save the data to the database.

:::tip

This indexer can be found by [following this link](https://near.org/dataplatform.near/widget/QueryApi.App?selectedIndexerPath=somepublicaddress.near/postsexample&view=indexer-status).

:::

## Defining the Database Schema

The first step to creating an indexer is to define the database schema. This is done by editing the `schema.sql` file in the code editor. The schema for this indexer looks like this:
Expand Down
File renamed without changes
File renamed without changes
File renamed without changes

0 comments on commit 65172c6

Please sign in to comment.