From 77ebefe1351bc33da31d6c25e6c7be8eda03b452 Mon Sep 17 00:00:00 2001 From: Tornado Contrib Date: Sun, 5 May 2024 11:43:30 +0000 Subject: [PATCH] Change graph limit constant idea by @Theo --- dist/index.js | 14 +++++++------- dist/index.mjs | 14 +++++++------- dist/index.umd.js | 14 +++++++------- src/graphql/index.ts | 15 ++++++++------- 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/dist/index.js b/dist/index.js index de9c5c5..8989c7c 100644 --- a/dist/index.js +++ b/dist/index.js @@ -3388,7 +3388,7 @@ var __async$a = (__this, __arguments, generator) => { }); }; const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const first = 1e3; +const GRAPHQL_LIMIT = 1e3; function queryGraph(_0) { return __async$a(this, arguments, function* ({ graphApi, @@ -3504,7 +3504,7 @@ function getRegisters({ subgraphName, query: GET_REGISTERED, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3593,7 +3593,7 @@ function getDeposits({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3690,7 +3690,7 @@ function getWithdrawals({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3819,7 +3819,7 @@ function getGraphEchoEvents({ subgraphName, query: GET_ECHO_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3908,7 +3908,7 @@ function getEncryptedNotes({ subgraphName, query: GET_ENCRYPTED_NOTES, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3993,7 +3993,7 @@ function getGovernanceEvents({ subgraphName, query: GET_GOVERNANCE_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 diff --git a/dist/index.mjs b/dist/index.mjs index 1818e18..8fb203b 100644 --- a/dist/index.mjs +++ b/dist/index.mjs @@ -3367,7 +3367,7 @@ var __async$a = (__this, __arguments, generator) => { }); }; const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const first = 1e3; +const GRAPHQL_LIMIT = 1e3; function queryGraph(_0) { return __async$a(this, arguments, function* ({ graphApi, @@ -3483,7 +3483,7 @@ function getRegisters({ subgraphName, query: GET_REGISTERED, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3572,7 +3572,7 @@ function getDeposits({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3669,7 +3669,7 @@ function getWithdrawals({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3798,7 +3798,7 @@ function getGraphEchoEvents({ subgraphName, query: GET_ECHO_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3887,7 +3887,7 @@ function getEncryptedNotes({ subgraphName, query: GET_ENCRYPTED_NOTES, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -3972,7 +3972,7 @@ function getGovernanceEvents({ subgraphName, query: GET_GOVERNANCE_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 diff --git a/dist/index.umd.js b/dist/index.umd.js index ea9d186..04f9034 100644 --- a/dist/index.umd.js +++ b/dist/index.umd.js @@ -61833,7 +61833,7 @@ var __async = (__this, __arguments, generator) => { const isEmptyArray = (arr) => !Array.isArray(arr) || !arr.length; -const first = 1e3; +const GRAPHQL_LIMIT = 1e3; function queryGraph(_0) { return __async(this, arguments, function* ({ graphApi, @@ -61949,7 +61949,7 @@ function getRegisters({ subgraphName, query: GET_REGISTERED, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -62038,7 +62038,7 @@ function getDeposits({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -62135,7 +62135,7 @@ function getWithdrawals({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -62264,7 +62264,7 @@ function getGraphEchoEvents({ subgraphName, query: GET_ECHO_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -62353,7 +62353,7 @@ function getEncryptedNotes({ subgraphName, query: GET_ENCRYPTED_NOTES, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 @@ -62438,7 +62438,7 @@ function getGovernanceEvents({ subgraphName, query: GET_GOVERNANCE_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock }, fetchDataOptions: fetchDataOptions2 diff --git a/src/graphql/index.ts b/src/graphql/index.ts index 7734fa8..e5c9454 100644 --- a/src/graphql/index.ts +++ b/src/graphql/index.ts @@ -31,7 +31,8 @@ export * from './queries'; const isEmptyArray = (arr: object) => !Array.isArray(arr) || !arr.length; -const first = 1000; +// https://thegraph.com/docs/en/developing/developer-faqs/#23-is-there-a-limit-to-how-many-objects-the-graph-can-return-per-query +const GRAPHQL_LIMIT = 1000; export type queryGraphParams = { graphApi: string; @@ -239,7 +240,7 @@ export function getRegisters({ subgraphName, query: GET_REGISTERED, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions, @@ -368,7 +369,7 @@ export function getDeposits({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions, @@ -506,7 +507,7 @@ export function getWithdrawals({ variables: { currency, amount, - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions, @@ -704,7 +705,7 @@ export function getGraphEchoEvents({ subgraphName, query: GET_ECHO_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions, @@ -830,7 +831,7 @@ export function getEncryptedNotes({ subgraphName, query: GET_ENCRYPTED_NOTES, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions, @@ -981,7 +982,7 @@ export function getGovernanceEvents({ subgraphName, query: GET_GOVERNANCE_EVENTS, variables: { - first, + first: GRAPHQL_LIMIT, fromBlock, }, fetchDataOptions,