From 10a27b832228ca726cc8da18b4cd892424999d48 Mon Sep 17 00:00:00 2001 From: Surbhit Agrawal <82264758+surbhit14@users.noreply.github.com> Date: Tue, 29 Jul 2025 19:51:18 +0530 Subject: [PATCH] Merge pull request #448 from EigenExplorer/fix/remove-operatorAddress-from-reward-response [Fix] - Remove Operator Address from Rewards Response --- .../api/src/routes/operators/operatorController.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/api/src/routes/operators/operatorController.ts b/packages/api/src/routes/operators/operatorController.ts index c19dc16b..738b95b0 100644 --- a/packages/api/src/routes/operators/operatorController.ts +++ b/packages/api/src/routes/operators/operatorController.ts @@ -237,16 +237,18 @@ export async function getOperator(req: Request, res: Response) { const strategiesWithSharesUnderlying = withTvl ? await getStrategiesWithShareUnderlying() : [] + const rewardsMap = + withRewards || withTrailingApy + ? await calculateOperatorApyForAll([operator], withTrailingApy) + : {} + res.send({ ...operator, avsRegistrations, totalStakers: operator.totalStakers, totalAvs: operator.totalAvs, tvl: withTvl ? sharesToTVL(operator.shares, strategiesWithSharesUnderlying) : undefined, - rewards: - withRewards || withTrailingApy - ? await calculateOperatorApyForAll([operator], withTrailingApy) - : undefined, + rewards: withRewards || withTrailingApy ? rewardsMap[operator.address] : undefined, stakers: undefined, metadataUrl: undefined, isMetadataSynced: undefined,