Comment on page
Querying the Subgraph
Querying the subgraph using Typescript
import { ApolloClient, InMemoryCache, ApolloProvider, gql } from '@apollo/client';
const client = new ApolloClient({
uri: 'https://api.lyra.finance/subgraph/optimism/v1/api',
cache: new InMemoryCache(),
});
const query = gql`
query GetMarkets {
markets {
id
name
}
}
`
client.query({query,}).then((result) => console.log(result));
Last modified 9mo ago