|
@@ -1,6 +1,7 @@
|
|
import { useApolloClient } from '@apollo/client'
|
|
import { useApolloClient } from '@apollo/client'
|
|
import BN from 'bn.js'
|
|
import BN from 'bn.js'
|
|
import { useCallback } from 'react'
|
|
import { useCallback } from 'react'
|
|
|
|
+import { useNavigate } from 'react-router'
|
|
|
|
|
|
import { MetaprotocolTransactionResultFieldsFragment } from '@/api/queries/__generated__/fragments.generated'
|
|
import { MetaprotocolTransactionResultFieldsFragment } from '@/api/queries/__generated__/fragments.generated'
|
|
import {
|
|
import {
|
|
@@ -8,6 +9,7 @@ import {
|
|
GetMetaprotocolTransactionStatusEventsQuery,
|
|
GetMetaprotocolTransactionStatusEventsQuery,
|
|
GetMetaprotocolTransactionStatusEventsQueryVariables,
|
|
GetMetaprotocolTransactionStatusEventsQueryVariables,
|
|
} from '@/api/queries/__generated__/transactionEvents.generated'
|
|
} from '@/api/queries/__generated__/transactionEvents.generated'
|
|
|
|
+import { absoluteRoutes } from '@/config/routes'
|
|
import { ErrorCode, JoystreamLibError, JoystreamLibErrorType } from '@/joystream-lib/errors'
|
|
import { ErrorCode, JoystreamLibError, JoystreamLibErrorType } from '@/joystream-lib/errors'
|
|
import { ExtrinsicResult, ExtrinsicStatus, ExtrinsicStatusCallbackFn } from '@/joystream-lib/types'
|
|
import { ExtrinsicResult, ExtrinsicStatus, ExtrinsicStatusCallbackFn } from '@/joystream-lib/types'
|
|
import { useSubscribeAccountBalance } from '@/providers/joystream/joystream.hooks'
|
|
import { useSubscribeAccountBalance } from '@/providers/joystream/joystream.hooks'
|
|
@@ -53,6 +55,7 @@ export const useTransaction = (): HandleTransactionFn => {
|
|
(state) => state.actions
|
|
(state) => state.actions
|
|
)
|
|
)
|
|
const userWalletName = useUserStore((state) => state.wallet?.title)
|
|
const userWalletName = useUserStore((state) => state.wallet?.title)
|
|
|
|
+ const navigate = useNavigate()
|
|
|
|
|
|
const [openOngoingTransactionModal, closeOngoingTransactionModal] = useConfirmationModal()
|
|
const [openOngoingTransactionModal, closeOngoingTransactionModal] = useConfirmationModal()
|
|
const nodeConnectionStatus = useConnectionStatusStore((state) => state.nodeConnectionStatus)
|
|
const nodeConnectionStatus = useConnectionStatusStore((state) => state.nodeConnectionStatus)
|
|
@@ -233,6 +236,20 @@ export const useTransaction = (): HandleTransactionFn => {
|
|
return false
|
|
return false
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (errorName === 'ChannelExcludedError') {
|
|
|
|
+ removeTransaction(transactionId)
|
|
|
|
+ displaySnackbar({
|
|
|
|
+ title: 'Something went wrong',
|
|
|
|
+ description:
|
|
|
|
+ "The channel you're using either doesn't exist, was deleted by creator, has been moderated by the DAO content curation team, or not included to be viewed by the application operators. Choose different channel. If you need support, reach out to our community on Discord.",
|
|
|
|
+ iconType: 'error',
|
|
|
|
+ timeout: MINIMIZED_SIGN_CANCELLED_SNACKBAR_TIMEOUT,
|
|
|
|
+ })
|
|
|
|
+
|
|
|
|
+ navigate(absoluteRoutes.viewer.index())
|
|
|
|
+ return false
|
|
|
|
+ }
|
|
|
|
+
|
|
if (errorName === 'SignCancelledError') {
|
|
if (errorName === 'SignCancelledError') {
|
|
ConsoleLogger.warn('Sign cancelled')
|
|
ConsoleLogger.warn('Sign cancelled')
|
|
removeTransaction(transactionId)
|
|
removeTransaction(transactionId)
|
|
@@ -289,6 +306,7 @@ export const useTransaction = (): HandleTransactionFn => {
|
|
closeOngoingTransactionModal,
|
|
closeOngoingTransactionModal,
|
|
displaySnackbar,
|
|
displaySnackbar,
|
|
getMetaprotocolTxStatus,
|
|
getMetaprotocolTxStatus,
|
|
|
|
+ navigate,
|
|
nodeConnectionStatus,
|
|
nodeConnectionStatus,
|
|
openOngoingTransactionModal,
|
|
openOngoingTransactionModal,
|
|
removeTransaction,
|
|
removeTransaction,
|