1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/ui/hooks/useTransactionInfo.js

23 lines
626 B
JavaScript
Raw Normal View History

import { useSelector } from 'react-redux';
import { hexToDecimal } from '../../shared/modules/conversion.utils';
import { isEqualCaseInsensitive } from '../../shared/modules/string-utils';
export const useTransactionInfo = (txData = {}) => {
const {
allNftContracts,
selectedAddress,
provider: { chainId },
} = useSelector((state) => state.metamask);
const isNftTransfer = Boolean(
allNftContracts?.[selectedAddress]?.[hexToDecimal(chainId)]?.find(
(contract) => {
return isEqualCaseInsensitive(contract.address, txData.txParams.to);
},
),
);
return { isNftTransfer };
};