Skip to content

Commit

Permalink
Fix bug with aptos.queryIndexer example
Browse files Browse the repository at this point in the history
  • Loading branch information
kPatch authored and gregnazario committed Aug 21, 2024
1 parent 2d1cc6d commit 8e0626a
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions apps/nextra/pages/en/build/sdks/ts-sdk/fetch-data-via-sdk.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,17 @@ Many queries have a parameter named `options` to customize the results, use it t
The `Aptos` client can out of the box query both network data from [fullnodes](https://api.mainnet.aptoslabs.com/v1/spec#/) and the [Indexer](https://cloud.hasura.io/public/graphiql?endpoint=https://api.mainnet.aptoslabs.com/v1/graphql) API which contains aggregated and enriched data. If you want to use a custom query for Indexer API data, you can use `aptos.queryIndexer` like so:

```ts filename="fetch-data.ts"
const ledgerInfo = aptos.queryIndexer({
query: `query MyQuery {
ledger_infos {
chain_id
}
}`;
})
const ledgerInfo = await aptos.queryIndexer({
query: {
query: `
query MyQuery {
ledger_infos {
chain_id
}
}
`
}
})
```

## Using Generic Queries
Expand Down

0 comments on commit 8e0626a

Please sign in to comment.