Skip to content

Commit

Permalink
Merge pull request #1416 from multiversx/SERVICES-2532-expose-extra-f…
Browse files Browse the repository at this point in the history
…ields-on-pair-model

[SERVICES-2532] Expose extra fields on pair model
  • Loading branch information
claudiulataretu authored Aug 7, 2024
2 parents 0dfc367 + f020a3d commit b5b426f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/modules/pair/models/pair.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,12 @@ export class PairModel {
@Field(() => PairRewardTokensModel, { nullable: true })
rewardTokens: PairRewardTokensModel;

@Field({ nullable: true })
farmAddress: string;

@Field({ nullable: true })
stakingProxyAddress: string;

constructor(init?: Partial<PairModel>) {
Object.assign(this, init);
}
Expand Down
12 changes: 12 additions & 0 deletions src/modules/pair/pair.resolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,18 @@ export class PairResolver {
return new PairRewardTokensModel({ address: parent.address });
}

@ResolveField()
async farmAddress(@Parent() parent: PairModel): Promise<string> {
return await this.pairCompute.getPairFarmAddress(parent.address);
}

@ResolveField()
async stakingProxyAddress(@Parent() parent: PairModel): Promise<string> {
return await this.pairCompute.getPairStakingProxyAddress(
parent.address,
);
}

@Query(() => String)
async getAmountOut(
@Args('pairAddress') pairAddress: string,
Expand Down

0 comments on commit b5b426f

Please sign in to comment.