2023-03-23 19:21:33 +01:00
|
|
|
import { useSelector } from 'react-redux';
|
2023-03-30 18:37:29 +02:00
|
|
|
import { hexToDecimal } from '../../shared/modules/conversion.utils';
|
2023-03-23 19:21:33 +01:00
|
|
|
|
|
|
|
import { isEqualCaseInsensitive } from '../../shared/modules/string-utils';
|
|
|
|
|
|
|
|
export const useTransactionInfo = (txData = {}) => {
|
|
|
|
const {
|
|
|
|
allNftContracts,
|
|
|
|
selectedAddress,
|
|
|
|
provider: { chainId },
|
|
|
|
} = useSelector((state) => state.metamask);
|
|
|
|
|
|
|
|
const isNftTransfer = Boolean(
|
2023-03-30 18:37:29 +02:00
|
|
|
allNftContracts?.[selectedAddress]?.[hexToDecimal(chainId)]?.find(
|
|
|
|
(contract) => {
|
|
|
|
return isEqualCaseInsensitive(contract.address, txData.txParams.to);
|
|
|
|
},
|
|
|
|
),
|
2023-03-23 19:21:33 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
return { isNftTransfer };
|
|
|
|
};
|