Skip to content

Commit

Permalink
fix: isError condition
Browse files Browse the repository at this point in the history
  • Loading branch information
Argeare5 committed Mar 9, 2023
1 parent 27a833d commit 179e60b
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/hooks/useLastTxLocalStatus.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { useEffect, useState } from 'react';

import { selectLastTxByTypeAndPayload } from '../web3/store/transactionsSelectors';
import { BaseTx, ITransactionsState } from '../web3/store/transactionsSlice';
import {
BaseTx,
isGelatoBaseTx,
ITransactionsState,
} from '../web3/store/transactionsSlice';

interface LastTxStatusesParams<T extends BaseTx> {
state: ITransactionsState<T>;
Expand Down Expand Up @@ -33,8 +37,9 @@ export const useLastTxLocalStatus = <T extends BaseTx>({
const txChainId = tx && tx.chainId;
const txWalletType = tx && tx.walletType;
const isError =
(tx && !tx.pending && tx && (tx.status === 2 || tx.status === 0)) ||
!!error;
tx && isGelatoBaseTx(tx)
? !tx.pending && (tx.status === 2 || tx.status === 0 || !!error)
: (tx && !tx.pending && (tx.status === 2 || tx.status === 0)) || !!error;

useEffect(() => {
if (txPending || isError) {
Expand Down

0 comments on commit 179e60b

Please sign in to comment.