As a developer, having clean and reliable data to work with is a godsend. Thankfully the blockchain has such reliable data. Though what is the easiest way you query this data?
For Hex, it is by using the subgraph: https://thegraph.com/explorer/subgraph/codeakk/hex
Using the link above gives you a nice interface to interact with the data, but what if you wanted to collect the data yourself for a project? Below I have listed a few resources, including some of my own that will surely give you a boost for any projects/goals you’ll want to accomplish.
Subgraph Documentation: https://thegraph.com/docs/graphql-api
The API url for queries is: https://api.thegraph.com/subgraphs/name/codeakk/hex
Here is a great article explaining 4 different ways to call this API: https://www.apollographql.com/blog/graphql/examples/4-simple-ways-to-call-a-graphql-api/
Here are some python scripts I use for my website, BackupHex.com: https://github.com/Codeakk/Hex-Subgraph-Query-Scripts
You will see 3 scripts:
- endStakesDue.py — This finds expiring stakes (older than 14 days).
- endStakesNotDue.py — Grabs all open stakes which aren’t due.
- lobbyEnterExit.py — Discovers lobby enters which have not been exited/claimed with the value in HEX that exiting would yield.
These scripts use a python graphQL library, https://github.com/graphql-python/gql, as a GraphQL implementation.
If you would like to message me directly for any questions: https://t.me/Codeak