Skip to content

Commit

Permalink
watch total collateral value in debt in vault withdraw input (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
t0rbik authored Aug 1, 2024
1 parent c737004 commit 115ba81
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/components/common/input/VaultWithdrawTokenInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ export const VaultWithdrawTokenInput = ({
},
});

useWatchQuery({
queryKey: sharesBalanceQueryKey,
});

const { data: underlyingTokenCollateral } = useReadContract({
address: vault.alchemist.address,
chainId: chain.id,
Expand All @@ -64,7 +60,10 @@ export const VaultWithdrawTokenInput = ({
},
});

const { data: totalCollateralInDebtToken } = useReadContract({
const {
data: totalCollateralInDebtToken,
queryKey: totalCollateralInDebtTokenQueryKey,
} = useReadContract({
address: vault.alchemist.address,
chainId: chain.id,
abi: alchemistV2Abi,
Expand All @@ -75,6 +74,10 @@ export const VaultWithdrawTokenInput = ({
},
});

useWatchQuery({
queryKeys: [sharesBalanceQueryKey, totalCollateralInDebtTokenQueryKey],
});

const otherCoverInDebt =
totalCollateralInDebtToken !== undefined &&
collateralInDebtToken !== undefined
Expand Down

0 comments on commit 115ba81

Please sign in to comment.