1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00
metamask-extension/ui/hooks/useTransactionInfo.js
2023-06-09 15:48:48 -05:00

20 lines
614 B
JavaScript

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