0.0.1 • Published 6 months ago

monarch-agent v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Monarch SubQuery

SubQuery 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.

Developer Guide

Install dependencies

yarn install

SubQuery project layout

  • The project manifest in project.ts defines the key project configuration and mapping handler filters
  • The GraphQL Schema (schema.graphql) defines the shape of the resulting data that you are using SubQuery to index
  • The Mapping functions in src/mappings/ directory are typescript functions that handle transformation logic

Run your project

  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 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 - you should see a GraphQL playground showing with the schemas ready to query. Read the docs for more information or explore the possible service configuration for running SubQuery.

Query Agent Data

  • Query all users that have authorize a specific rebalancer
{
  query {
    users(filter: { rebalancer: { equalTo: "<REBALANCER_ADDRESS>" } }) {
        nodes {
            id
            marketCaps {
              nodes {
                marketId
                cap
              }
            }
        }
    }
}
}

Publish your project

subql publish
0.0.1

6 months ago