Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/lunes-platform/explorer-backend-subql


https://github.com/lunes-platform/explorer-backend-subql

Last synced: 3 days ago
JSON representation

Awesome Lists containing this project

README

        

# SubQuery - Project for Lunes

[SubQuery](https://subquery.network) is a fast, flexible, and reliable open-source data indexer that provides you with custom APIs for your web3 project across all of our supported networks. To learn about how to get started with SubQuery, [visit our docs](https://academy.subquery.network).

## Run your project

_If you get stuck, find out how to get help below._

The simplest way to run your project is by running `yarn dev` or `npm run-script dev`. This does all of the following:

1. `yarn codegen` - Generates types from the GraphQL schema definition and contract ABIs and saves them in the `/src/types` directory. This must be done after each change to the `schema.graphql` file or the contract ABIs
2. `yarn build` - Builds and packages the SubQuery project into the `/dist` directory
3. `docker-compose pull && docker-compose up` - Runs a Docker container with an indexer, PostgeSQL DB, and a query service. This requires [Docker to be installed](https://docs.docker.com/engine/install) and running locally. The configuration for this container is set from your `docker-compose.yml`

You can observe the three services start, and once all are running (it may take a few minutes on your first start), please open your browser and head to [http://localhost:3000](http://localhost:3000) - you should see a GraphQL playground showing with the schemas ready to query. [Read the docs for more information](https://academy.subquery.network/run_publish/run.html) or [explore the possible service configuration for running SubQuery](https://academy.subquery.network/run_publish/references.html).

## Query your project

For this project, you can try to query with the following GraphQL code to get a taste of how it works.

```graphql
{
query {
transfers(first: 5, orderBy: BLOCK_NUMBER_DESC) {
totalCount
nodes {
id
date
blockNumber
toId
fromId
amount
}
}
accounts(first: 5, orderBy: SENT_TRANSFERS_COUNT_DESC) {
nodes {
id
sentTransfers(first: 5, orderBy: BLOCK_NUMBER_DESC) {
totalCount
nodes {
id
toId
amount
}
}
lastTransferBlock
}
}
}
}
```