Skip to content

Commit

Permalink
remove hardcoded pairs count and add factory query to fetch the pairs…
Browse files Browse the repository at this point in the history
… count
  • Loading branch information
cfaur09 committed Feb 7, 2025
1 parent 1a6c3a6 commit 4b594f0
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/endpoints/mex/mex.settings.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ export class MexSettingsService {
}

public async getSettingsRaw(): Promise<MexSettings | null> {
const pairLimitCount = await this.getPairLimitCount();

const query = gql`
query {
filteredPairs(pagination: {first: 500}, filters: {state: ["Active"]}) {
filteredPairs(pagination: {first: ${pairLimitCount}}, filters: {state: ["Active"]}) {
edges {
node {
address
Expand Down Expand Up @@ -165,4 +167,20 @@ export class MexSettingsService {
getWegldId(): string | undefined {
return this.wegldId;
}

private async getPairLimitCount(): Promise<number> {
const pairsLimit = gql`
query PairCount {
factory {
pairCount
}
}`;

const response = await this.graphQlService.getExchangeServiceData(pairsLimit);
if (!response) {
return 500;
}

return response.factory.pairCount;
}
}

0 comments on commit 4b594f0

Please sign in to comment.