Skip to content

Commit

Permalink
update guides for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
a-zorina authored and ilyar committed Jul 30, 2023
1 parent bdb8ef5 commit a16b5bb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/develop/graphql-pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ While it might seem more convenient and simple, this is a sub-optimal practice.

[GraphQL Blockchain API](https://docs.evercloud.dev/reference/graphql-api/blockchain) was developed for this exact reason - to provide a reliable way of blockchain data pagination and prevent any potential data inconsistencies regardless of network load.

**Note**: With [GraphQL API 1.0](https://docs.evercloud.dev/reference/breaking-changes/migration-guides/graphql-api-1.0-migration) update by default Blockchain API provides only data for the past 7 days. For use cases where earlier data is needed make sure to use the 'archive: true' flag in blockchain query filters, as shown in the samples below. Do not however use it, if archive data isn't required, as it will generate unnecessary load.

**Note**: Query Collections are a supported instrument and will remain so. However, they are intended and optimized primarily for tasks that are not critically dependent on data completeness, such as analytics.

## Blocks Pagination with Blockchain API
Expand All @@ -28,6 +30,7 @@ query {
end: 2670661
}
workchain: 0
archive: true
) {
edges {
node {
Expand Down Expand Up @@ -115,6 +118,7 @@ query {
after: "52899360053806ff11d"
first: 10
workchain: 0
archive: true
) {
edges {
node {
Expand Down Expand Up @@ -205,6 +209,7 @@ query {
end: 2670661
}
workchain: 0
archive: true
) {
edges {
node {
Expand Down Expand Up @@ -278,6 +283,7 @@ query {
after: "528be5b005381da811c00"
first: 10
workchain: 0
archive: true
) {
edges {
node {
Expand Down
3 changes: 3 additions & 0 deletions src/develop/recipes/backend-integration.md
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,8 @@ In these samples JS SDK is used. [Bindings](https://docs.everos.dev/ever-sdk/#co

The [pagination](https://github.com/tonlabs/sdk-samples/tree/master/demo/paginate-transactions) sample queries and displays transactions in workchain 0 (workchain where simple transfers happen, -1 workchain is masterchain where you can find service transactions and validator transactions) from the beginning. We can get all the transaction and filter by account addresses on the backend side.

**Note**: By default the Blockchain API queries, such as the one used here provide only data from the past 7 days. To retrieve older data, make sure to use the `archive: true` flag, as shown in the sample:

```typescript
async function main(client: TonClient) {
// In this example, we want the query to return 2 items per page.
Expand All @@ -595,6 +597,7 @@ The [pagination](https://github.com/tonlabs/sdk-samples/tree/master/demo/paginat
blockchain {
transactions(
workchain: 0
archive: true
first: $count
after: $cursor
) {
Expand Down

0 comments on commit a16b5bb

Please sign in to comment.