/Subquery_3_3

Primary LanguageTypeScript

What is SubQuery?

SubQuery powers the next generation of Polkadot dApps by allowing developers to extract, transform and query blockchain data in real time using GraphQL. In addition to this, SubQuery provides production quality hosting infrastructure to run these projects in.

SubQuery Example - Account transfers Reverse Lookup

This subquery example adds a reverse lookup field on Account.myToAddress meaning that it is accessible from the Account entity but is just a reference or pointer back to Transfer.to.

Getting Started

1. Clone the entire subql-example repository

git clone https://github.com/subquery/tutorials-account-transfer-reverse-lookups.git

2. Install dependencies

cd <folder>
yarn

3. Generate types

yarn codegen

4. Build the project

yarn build

5. Start Docker

docker-compose pull & docker-compose up

6. Run locally

Open http://localhost:3000/ on your browser

7. Example query to run

query{
  accounts(first:5){
    nodes{
      id
      myToAddress{
        nodes{
          id
          amount
        }
      }
    }
  }
}