Custom Subgraph queries
Subgraph schemas
Creating a custom query
import gql from 'graphql-tag'
import { GraphQLWrapper } from '@aragon/connect-thegraph'
// Construct the query
const QUERY = gql`
query {
votes(where:{
appAddress: "${VOTING_APP_ADDRESS}"
}) {
id
metadata
creator
}
}
`
// Create the GraphQL wrapper using the specific Subgraph URL
const wrapper = new GraphQLWrapper(VOTING_SUBGRAPH_URL)
// Invoke the custom query and receive data
const results = await wrapper.performQuery(QUERY)
const { votes } = results.dataSubscriptions
Last updated
Was this helpful?
