Skip to content

Commit 1bfa9a7

Browse files
authored
Fix call to hyperdrive rewards server (#1783)
1 parent eedb466 commit 1bfa9a7

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

apps/hyperdrive-trading/src/ui/rewards/hooks/useClaimableRewards.ts

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,25 +54,14 @@ async function fetchHyperdriveRewardApi(
5454
baseUrl: import.meta.env.VITE_REWARDS_BASE_URL,
5555
});
5656

57-
try {
58-
const response = await rewardsApi.get.rewardsUserDetail(account);
59-
// TODO: Remove this once claimbableAmount is no longer formatted server side
60-
return response.rewards.map((r) => ({
61-
...r,
62-
chainId: rewardsFork.id,
63-
merkleType: "HyperdriveMerkle",
64-
claimableAmount: parseFixed(r.claimableAmount).bigint.toString(),
65-
}));
66-
} catch (error: any) {
67-
// This throws a 404 if the account does not have any rewards, which
68-
// is fine, just return an empty array and display no rewards
69-
if (error.error.error === "No rewards found for this address") {
70-
console.log("No rewards found for this address");
71-
return [];
72-
}
73-
// There are no other well-known errors we can catch, so re-throw
74-
throw error;
75-
}
57+
const response = await rewardsApi.get.rewardsUserDetail(account);
58+
// TODO: Remove this once claimbableAmount is no longer formatted server side
59+
return response.rewards.map((r) => ({
60+
...r,
61+
chainId: rewardsFork.id,
62+
merkleType: "HyperdriveMerkle",
63+
claimableAmount: parseFixed(r.claimableAmount).bigint.toString(),
64+
}));
7665
}
7766
/**
7867
*

0 commit comments

Comments
 (0)