Skip to content

Commit

Permalink
Merge pull request #1392 from galacticcouncil/fix-api
Browse files Browse the repository at this point in the history
Fix api errors
  • Loading branch information
vkulinich-cl authored Jun 10, 2024
2 parents 2049908 + bf8e466 commit 00aa68c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
10 changes: 5 additions & 5 deletions src/sections/pools/PoolsPage.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,20 +205,20 @@ export const usePools = () => {
)?.spotPrice

const tvlDisplay = BN(
tvls.data?.find((tvl) => tvl.asset_id === Number(assetId))?.tvl_usd ??
tvls?.data?.find((tvl) => tvl.asset_id === Number(assetId))?.tvl_usd ??
BN_NAN,
).multipliedBy(apiSpotPrice ?? 1)

const volume = BN(
volumes.data?.find((volume) => volume.asset_id.toString() === assetId)
volumes?.data?.find((volume) => volume.asset_id.toString() === assetId)
?.volume_usd ?? BN_NAN,
).multipliedBy(apiSpotPrice ?? 1)

const fee =
assets.native.id === assetId
? BN_0
: BN(
fees.data?.find((fee) => fee.asset_id.toString() === assetId)
fees?.data?.find((fee) => fee.asset_id.toString() === assetId)
?.projected_apr_perc ?? BN_NAN,
)

Expand All @@ -240,9 +240,9 @@ export const usePools = () => {
canAddLiquidity: tradability.canAddLiquidity,
canRemoveLiquidity: tradability.canRemoveLiquidity,
volume,
isVolumeLoading: volumes.isLoading,
isVolumeLoading: volumes?.isLoading,
fee,
isFeeLoading: fees.isLoading,
isFeeLoading: fees?.isLoading,
omnipoolPositions: filteredOmnipoolPositions,
miningPositions: filteredMiningPositions,
isPositions,
Expand Down
14 changes: 7 additions & 7 deletions src/sections/stats/StatsPage.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -169,12 +169,12 @@ export const useOmnipoolAssetDetails = (sortBy: "tvl" | "pol") => {
const pol = valueOfLiquidityPositions.plus(valueOfShares)

const tvl = BN(
tvls.data?.find((tvl) => tvl.asset_id === Number(omnipoolAssetId))
tvls?.data?.find((tvl) => tvl.asset_id === Number(omnipoolAssetId))
?.tvl_usd ?? BN_NAN,
)

const volume = BN(
volumes.data?.find(
volumes?.data?.find(
(volume) => volume.asset_id === Number(omnipoolAssetId),
)?.volume_usd ?? BN_NAN,
)
Expand All @@ -183,8 +183,9 @@ export const useOmnipoolAssetDetails = (sortBy: "tvl" | "pol") => {
assets.native.id === omnipoolAssetId
? BN_0
: BN(
fees.data?.find((fee) => fee.asset_id === Number(omnipoolAssetId))
?.projected_apr_perc ?? BN_NAN,
fees?.data?.find(
(fee) => fee.asset_id === Number(omnipoolAssetId),
)?.projected_apr_perc ?? BN_NAN,
)

const iconIds = assets.isStableSwap(meta) ? meta.assets : meta.id
Expand All @@ -201,16 +202,15 @@ export const useOmnipoolAssetDetails = (sortBy: "tvl" | "pol") => {
volumePol: BN(0),
price: spotPrice,
fee,
isLoadingFee: fees.isInitialLoading,
isLoadingFee: fees?.isInitialLoading,
isLoadingVolume: volumes.isInitialLoading,
}
})
return rows
}, [
apiIds.data,
assets,
fees.data,
fees.isInitialLoading,
fees,
omnipoolAssetBalances,
omnipoolAssets.data,
positions,
Expand Down

0 comments on commit 00aa68c

Please sign in to comment.