mirror of
https://github.com/cerc-io/mars-interface.git
synced 2025-01-03 10:06:48 +00:00
Merge pull request #8 from mars-protocol/hotfix/apr-tooltips
hotfix: apr tooltips
This commit is contained in:
commit
4ebd3e9453
@ -27,7 +27,7 @@ export const Apr = ({ data }: Props) => {
|
|||||||
color: asset.color,
|
color: asset.color,
|
||||||
symbol: asset.symbol,
|
symbol: asset.symbol,
|
||||||
apr: asset.apy,
|
apr: asset.apy,
|
||||||
subtitle: key === 0 ? t('incentives.depositRewards') : t('incentives.incentiveApr'),
|
subtitle: key === 0 ? t('incentives.interestApr') : t('incentives.depositRewards'),
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
return items
|
return items
|
||||||
|
@ -73,7 +73,7 @@ export const useDepositColumns = () => {
|
|||||||
columnHelper.accessor('apy', {
|
columnHelper.accessor('apy', {
|
||||||
enableSorting: enableSorting,
|
enableSorting: enableSorting,
|
||||||
header: () => (
|
header: () => (
|
||||||
<TextTooltip text={t('common.apy')} tooltip={t('redbank.tooltips.deposit.apy')} />
|
<TextTooltip text={t('common.apr')} tooltip={t('redbank.tooltips.deposit.apy')} />
|
||||||
),
|
),
|
||||||
cell: (info) => (
|
cell: (info) => (
|
||||||
<TextTooltip
|
<TextTooltip
|
||||||
|
@ -5,7 +5,6 @@ export { useDepositAndDebt } from './useDepositAndDebt'
|
|||||||
export { useEditPosition } from './useEditPosition'
|
export { useEditPosition } from './useEditPosition'
|
||||||
export { useEstimateFarmFee } from './useEstimateFarmFee'
|
export { useEstimateFarmFee } from './useEstimateFarmFee'
|
||||||
export { useEstimateFee } from './useEstimateFee'
|
export { useEstimateFee } from './useEstimateFee'
|
||||||
export { useMarketDeposits } from './useMarketDeposits'
|
|
||||||
export { useMarsOracle } from './useMarsOracle'
|
export { useMarsOracle } from './useMarsOracle'
|
||||||
export { useProvideLiquidity } from './useProvideLiquidity'
|
export { useProvideLiquidity } from './useProvideLiquidity'
|
||||||
export { useRedBank } from './useRedBank'
|
export { useRedBank } from './useRedBank'
|
||||||
|
@ -1,49 +0,0 @@
|
|||||||
import { useQuery } from '@tanstack/react-query'
|
|
||||||
import { getMarketDepositsQuery } from 'functions/queries'
|
|
||||||
import { gql, request } from 'graphql-request'
|
|
||||||
import { useEffect } from 'react'
|
|
||||||
import useStore from 'store'
|
|
||||||
import { QUERY_KEYS } from 'types/enums/queryKeys'
|
|
||||||
|
|
||||||
export interface MarketDepositsData {
|
|
||||||
mdwasmkey: {
|
|
||||||
OSMODeposits: string
|
|
||||||
ATOMDeposits: string
|
|
||||||
JUNODeposits: string
|
|
||||||
axlUSDCDeposits: string
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const useMarketDeposits = () => {
|
|
||||||
const hiveUrl = useStore((s) => s.networkConfig?.hiveUrl)
|
|
||||||
const whitelistedAssets = useStore((s) => s.whitelistedAssets)
|
|
||||||
const redBankAddress = useStore((s) => s.networkConfig?.contracts.redBank) || ''
|
|
||||||
const marketInfo = useStore((s) => s.marketInfo)
|
|
||||||
const processMarketDepositsQuery = useStore((s) => s.processMarketDepositsQuery)
|
|
||||||
|
|
||||||
const { refetch } = useQuery<MarketDepositsData>(
|
|
||||||
[QUERY_KEYS.MARKET_DEPOSITS],
|
|
||||||
async () => {
|
|
||||||
return await request(
|
|
||||||
hiveUrl!,
|
|
||||||
gql`
|
|
||||||
${getMarketDepositsQuery(redBankAddress, whitelistedAssets, marketInfo)}
|
|
||||||
`,
|
|
||||||
)
|
|
||||||
},
|
|
||||||
{
|
|
||||||
enabled: !!hiveUrl && !!whitelistedAssets.length && !!redBankAddress && !!marketInfo.length,
|
|
||||||
refetchInterval: 120000,
|
|
||||||
onSuccess: processMarketDepositsQuery,
|
|
||||||
},
|
|
||||||
)
|
|
||||||
|
|
||||||
// ! Workaround:
|
|
||||||
// Invalidating this query in RB action somehow resolves to Zustand with outdated marketInfo data
|
|
||||||
// It does not retrigger, and therefore a useEffect is placed here to manually rerun when the
|
|
||||||
// marketInfo actually updates.
|
|
||||||
useEffect(() => {
|
|
||||||
if (!marketInfo.length) return
|
|
||||||
refetch()
|
|
||||||
}, [marketInfo, refetch])
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user