Skip to content

Data Sources

Mireya edited this page Oct 22, 2019 · 2 revisions

Data Sources

Currently, the DAO fetches data from three sources: dao-server, info-server, and GraphQL.

New endpoints should be implemented in GraphQL since this is the de facto standard for data fetching in the DAO. Legacy endpoints that are still in use are fetched from the dao-server and info-server. Each has its own redux store to keep the data separate and easy to handle.

dao-server (legacy endpoints)

Data fetched from the dao-server include non-blockchain-related data such as proposal likes, comments, etc. See here to view the redux store for it.

A special case is created for comments data. These are fetched directly and are not stored in the redux. The relevant code for this can be found in src/api/comments.js and src/api/users.js.

info-server (legacy endpoints)

Data fetched from the info-server include blockchain-related data such as address details, proposal details, etc. See here to view the redux store for it.

gov-ui (UI Redux Store)

A separate redux store has been created to handle UI data such as setting the language and toggling alerts and menus. See here to view the redux store for it.

GraphQL

New endpoints are implemented in GraphQL to consolidate the data from dao-server and info-server in one place. We suggest installing apollo in your browser to help you with development. The schema docs for dao-server queries should be available via apollo once you load a participant wallet.

For info-server queries, you can run the info-server system and view the schema in http://localhost:3001/api. After signing your wallet, you will need to add the challenge response in the HTTP HEADERS to view the schema. For example,

{
  "address": "0x519774B813Dd6dE58554219F16C6Aa8350b8eC99",
  "challenge_id": "3",
  "message": "I am proving ownership of this address, to be used in DigixDAO Governance Platform. (5a5dfeea052f10a8fb75665b069511d7)",
  "signature": "0x0e0864b2951a26c01c82431a911666a3a813356b9965dfb7e252056ca1b3b09001969e989908dc58504ccca8dec76f7493c733a2842599c27521981339dfb9711c"
}

You can view the implementation for using GraphQL queries here.

Clone this wiki locally