Skip to content

Commit

Permalink
CU-86a5xqdaq-NEON3 - Swap Request - Show error toast when Pair is una…
Browse files Browse the repository at this point in the history
…vailable
  • Loading branch information
hotequil committed Dec 18, 2024
1 parent d1162f9 commit f983400
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/renderer/src/routes/pages/Swap/SwapPageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { TransactionFeeActionStep } from '@renderer/components/TransactionFeeAct
import { SWAP_NETWORK_BY_BLOCKCHAIN_AND_NETWORK_ID } from '@renderer/constants/swap'
import { AccountHelper } from '@renderer/helpers/AccountHelper'
import { NumberHelper } from '@renderer/helpers/NumberHelper'
import { ToastHelper } from '@renderer/helpers/ToastHelper'
import { UtilsHelper } from '@renderer/helpers/UtilsHelper'
import { useAccountsSelector } from '@renderer/hooks/useAccountSelector'
import { useActions } from '@renderer/hooks/useActions'
Expand Down Expand Up @@ -168,11 +169,19 @@ export const SwapPageContent = ({ account }: TProps) => {
setData({ selectAmountToUseMinMax: amountToUseMinMax })
})

swapService.eventEmitter.on('error', error => {
ToastHelper.error({ message: error, duration: 6000 })
})

swapServiceRef.current = swapService

swapService.init()
}

const removeSwapServiceListeners = () => {
swapServiceRef.current?.eventEmitter.removeAllListeners()
}

const handleSelectTokenToUse = (token: SwapServiceToken<TBlockchainServiceKey>) => {
swapServiceRef.current.setTokenToUse(token)
}
Expand Down Expand Up @@ -278,10 +287,6 @@ export const SwapPageContent = ({ account }: TProps) => {
}
}

const removeSwapServiceListeners = () => {
swapServiceRef.current?.eventEmitter.removeAllListeners()
}

useEffect(() => {
if (balanceQuery.isLoading) return

Expand Down

0 comments on commit f983400

Please sign in to comment.