Skip to content

Commit

Permalink
fix getGyroPools chains query param
Browse files Browse the repository at this point in the history
  • Loading branch information
gmbronco committed Feb 1, 2024
1 parent 2c2812d commit 3b35eda
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
4 changes: 2 additions & 2 deletions modules/pool/lib/pool-gql-loader.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,9 +131,9 @@ export class PoolGqlLoaderService {
return pools.map((pool) => this.mapPoolToGqlPool(pool)) as GqlPoolLinear[];
}

public async getGyroPools(): Promise<GqlPoolGyro[]> {
public async getGyroPools(chains: Chain[]): Promise<GqlPoolGyro[]> {
const pools = await prisma.prismaPool.findMany({
where: { type: { in: ['GYRO', 'GYRO3', 'GYROE'] }, chain: networkContext.chain },
where: { type: { in: ['GYRO', 'GYRO3', 'GYROE'] }, chain: { in: chains } },
orderBy: { dynamicData: { totalLiquidity: 'desc' } },
include: prismaPoolWithExpandedNesting.include,
});
Expand Down
13 changes: 9 additions & 4 deletions modules/pool/pool.resolvers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,21 @@ const balancerResolvers: Resolvers = {
}
return poolService.getGqlLinearPools(chains);
},
poolGetGyroPools: async () => {
return poolService.getGqlGyroPools();
poolGetGyroPools: async (parent, { chains }, context) => {
const currentChain = headerChain();
if (!chains && currentChain) {
chains = [currentChain];
} else if (!chains) {
throw new Error('poolGetGyroPools error: Provide "chains" param');
}
return poolService.getGqlGyroPools(chains);
},

poolGetFxPools: async (parent, { chains }) => {
const currentChain = headerChain();
if (!chains && currentChain) {
chains = [currentChain];
} else if (!chains) {
throw new Error('poolGetLinearPools error: Provide "chains" param');
throw new Error('poolGetFxPools error: Provide "chains" param');
}
return poolService.getGqlFxPools(chains);
},
Expand Down
4 changes: 2 additions & 2 deletions modules/pool/pool.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ export class PoolService {
return this.poolGqlLoaderService.getLinearPools(chains);
}

public async getGqlGyroPools(): Promise<GqlPoolGyro[]> {
return this.poolGqlLoaderService.getGyroPools();
public async getGqlGyroPools(chains: Chain[]): Promise<GqlPoolGyro[]> {
return this.poolGqlLoaderService.getGyroPools(chains);
}

public async getGqlFxPools(chains: Chain[]): Promise<GqlPoolFx[]> {
Expand Down

0 comments on commit 3b35eda

Please sign in to comment.