Skip to content

Commit

Permalink
change api url (#397)
Browse files Browse the repository at this point in the history
  • Loading branch information
jmzwar authored Aug 9, 2024
1 parent a4d59ba commit e0d72ee
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 3 additions & 3 deletions liquidity/lib/constants/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,11 @@ export const getSubgraphUrl = (networkName = 'optimism-mainnet') => {
export const getAprUrl = (networkId = 8453) => {
switch (networkId) {
case 8453:
return 'https://api.synthetix.io/v3/base/sc-pool-apy';
return 'https://api.synthetix.io/v3/base/sc-pool-apy-all';
case 42161:
return 'https://api.synthetix.io/v3/arbitrum/sc-pool-apy';
return 'https://api.synthetix.io/v3/arbitrum/sc-pool-apy-all';
default:
return `https://api.synthetix.io/v3/base/sc-pool-apy`;
return `https://api.synthetix.io/v3/base/sc-pool-apy-all`;
}
};

Expand Down
9 changes: 4 additions & 5 deletions liquidity/lib/useApr/useApr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@ export async function fetchApr(networkId?: number) {

const data = await response.json();

// Arbitrum has multiple collateral types
const highestAprCollateral = Array.isArray(data)
? data?.sort((a: { apr28d: number }, b: { apr28d: number }) => b.apr28d - a.apr28d)[0]
: data;
const highestAprCollateral = data?.sort(
(a: { apr28d: number }, b: { apr28d: number }) => b.apr28d - a.apr28d
)[0];

return {
combinedApr: highestAprCollateral.apr28d * 100,
cumulativePnl: isSupported ? highestAprCollateral.cumulativePnl : 0,
collateralAprs: networkId === BASE_ANDROMEDA.id ? [data] : data,
collateralAprs: data,
};
} catch (error) {
console.error(error);
Expand Down

0 comments on commit e0d72ee

Please sign in to comment.