diff --git a/.gitignore b/.gitignore index 4462d889..58f9e1fc 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,5 @@ yarn-error.log .DS_Store .env dist/ -cache/ \ No newline at end of file +cache/ +.idea/ \ No newline at end of file diff --git a/src/poolCacher.ts b/src/poolCacher.ts index 7e8a5a5a..7214c609 100644 --- a/src/poolCacher.ts +++ b/src/poolCacher.ts @@ -46,9 +46,15 @@ export class PoolCacher { * @param {GraphQLArgs} queryArgs - Optional query arguments to pass to pool data service. * @returns {boolean} True if pools fetched successfully, False if not. */ - public async fetchPools(queryArgs?: GraphQLArgs): Promise { + public async fetchPools( + queryArgs?: GraphQLArgs, + chunkSize?: number + ): Promise { try { - this.pools = await this.poolDataService.getPools(queryArgs); + this.pools = await this.poolDataService.getPools( + queryArgs, + chunkSize + ); this._finishedFetching = true; return true; } catch (err) { diff --git a/src/types.ts b/src/types.ts index a24029a8..e98c8cf6 100644 --- a/src/types.ts +++ b/src/types.ts @@ -275,7 +275,10 @@ export interface TokenPriceService { } export interface PoolDataService { - getPools(query?: GraphQLArgs): Promise; + getPools( + query?: GraphQLArgs, + chunkSize?: number + ): Promise; } export type FundManagement = { diff --git a/src/wrapper.ts b/src/wrapper.ts index 6e721e85..873d60b3 100644 --- a/src/wrapper.ts +++ b/src/wrapper.ts @@ -23,6 +23,7 @@ import { TokenPriceService, PoolDataService, SorConfig, + GraphQLArgs, } from './types'; import { Zero } from '@ethersproject/constants'; @@ -69,8 +70,11 @@ export class SOR { * fetchPools Retrieves pools information and saves to internal pools cache. * @returns {boolean} True if pools fetched successfully, False if not. */ - async fetchPools(): Promise { - return this.poolCacher.fetchPools(); + async fetchPools( + queryArgs?: GraphQLArgs, + chunkSize?: number + ): Promise { + return this.poolCacher.fetchPools(queryArgs, chunkSize); } /**