Skip to content

Commit

Permalink
Merge pull request #4992 from thematters/fix/balance-refresh-usdt
Browse files Browse the repository at this point in the history
feat(vault): refresh balance after USDT withdrawal
  • Loading branch information
gitwoz authored Dec 16, 2024
2 parents 2be7aa2 + ed65d8b commit 7d9f01a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
14 changes: 12 additions & 2 deletions src/components/Dialogs/WithdrawVaultUSDTDialog/Confirming.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,14 @@ import { FormattedMessage } from 'react-intl'

import { OPEN_WITHDRAW_VAULT_USDT_DIALOG, PATHS } from '~/common/enums'
import { formatAmount, truncate } from '~/common/utils'
import { Dialog, Spinner, toast, useRoute, ViewerContext } from '~/components'
import {
Dialog,
Spinner,
toast,
useRoute,
useVaultBalanceUSDT,
ViewerContext,
} from '~/components'
import {
TransactionState,
WithdrawVaultUsdtMutation,
Expand Down Expand Up @@ -47,9 +54,10 @@ const WITHDRAW_VAULT_USDT_POLLING = gql`
`

const Confirming: React.FC<ConfirmingProps> = ({ amount, closeDialog }) => {
const { router } = useRoute()
const viewer = useContext(ViewerContext)
const address = viewer.info.ethAddress!
const { router } = useRoute()
const { refetch: refetchVaultBalanceUSDT } = useVaultBalanceUSDT()

const [withdraw] = useMutation<WithdrawVaultUsdtMutation>(WITHDRAW_VAULT_USDT)
const [txId, setTxId] = useState<string | null>(null)
Expand Down Expand Up @@ -103,6 +111,8 @@ const Confirming: React.FC<ConfirmingProps> = ({ amount, closeDialog }) => {
],
})

refetchVaultBalanceUSDT()

closeDialog()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const WithdrewLockedTokensNotice = ({
data-test-id={TEST_ID.NOTICE_WITHDREW_LOCKED_TOKENS}
>
<section className={styles.contentWrap}>
<a href={link}>
<a href={link} target={isFailed ? undefined : '_blank'}>
{isFailed ? (
<FormattedMessage
defaultMessage="Claim {amount} USDT failed. Click here to retry or contact [email protected]"
Expand Down

0 comments on commit 7d9f01a

Please sign in to comment.