Read from the Subgraph
Read most data from the blockchain, as well as some additional higher-level fields without querying contracts themselves
Read Only: The subgraph
Most of the data from the blockchain, and additional higher level fields are readable from the subgraph (quick video).
Kovan: https://thegraph.com/explorer/subgraph/charged-particles/kovan-universe?query=Protons%20NFTs
We recommend digging into the Schema yourselves to figure out what is available to query.
Please also pay attention to some example queries we provide on the top left
Almost all the information available from the contracts is available somewhere on the subgraph, besides the current accrued interest (ie: how much my DAI at 12% APY in my ProtonNFT made me) which is currently available only by contract queryingcurrentParticleCharge(address,uint256,string,address)(uint256)
Sample Interaction using Node.js
The sample is in Typescript using ts-node
but you can use CommonJs require as well.
graphql-request
is the most minimal and simplest to use GraphQL client. It's perfect for small scripts or simple apps. But it doesn't allow you to listen for changes for this, please use something like apollo-client.
You might also need a tsconfig.json
at the root of your project with
until https://github.com/prisma-labs/graphql-request/issues/214 is resolved.
If you want access to VSCode debugger and be able to set breakpoints check Debugging so you can use debugger;
statement.
Last updated