Skip to content

Commit

Permalink
Merge pull request #470 from oraichain/fix/lp-pool-details
Browse files Browse the repository at this point in the history
Fix/lp pool details
  • Loading branch information
haunv3 authored Dec 4, 2023
2 parents b408851 + 7ac30fa commit 60091fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
3 changes: 2 additions & 1 deletion src/pages/Pools/PoolDetail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const PoolDetail: React.FC = () => {
const { refetchPairAmountInfo, refetchLpTokenInfoData } = useGetPairInfo(poolDetailData);
const queryClient = useQueryClient();

const { lpBalanceInfoData } = useGetLpBalance(poolDetailData);
const { lpBalanceInfoData, refetchLpBalanceInfoData } = useGetLpBalance(poolDetailData);
const lpTokenBalance = BigInt(lpBalanceInfoData?.balance || '0');

const refetchAllLpPools = async () => {
Expand All @@ -48,6 +48,7 @@ const PoolDetail: React.FC = () => {
(amountLpInUsdt = 0) => {
refetchPairAmountInfo();
refetchLpTokenInfoData();
refetchLpBalanceInfoData();
refetchAllLpPools();
loadTokenAmounts({ oraiAddress: address });

Expand Down
6 changes: 3 additions & 3 deletions src/pages/Pools/hooks/useGetLpBalance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { PoolDetail } from 'types/pool';
export const useGetLpBalance = ({ info: pairInfoData }: PoolDetail) => {
const [address] = useConfigReducer('address');

const { data: lpBalanceInfoData } = useQuery(
['liquidity-token', pairInfoData],
const { data: lpBalanceInfoData, refetch: refetchLpBalanceInfoData } = useQuery(
['liquidity-token', address, pairInfoData],
() => {
return fetchLpBalance(address, pairInfoData.liquidityAddr);
},
Expand All @@ -17,5 +17,5 @@ export const useGetLpBalance = ({ info: pairInfoData }: PoolDetail) => {
}
);

return { lpBalanceInfoData };
return { lpBalanceInfoData, refetchLpBalanceInfoData };
};

0 comments on commit 60091fd

Please sign in to comment.