2023-03-23 19:21:33 +01:00
|
|
|
import { useSelector } from 'react-redux';
|
2023-05-02 14:36:24 +02:00
|
|
|
import { getProviderConfig } from '../ducks/metamask/metamask';
|
2023-03-23 19:21:33 +01:00
|
|
|
|
|
|
|
import { isEqualCaseInsensitive } from '../../shared/modules/string-utils';
|
|
|
|
|
|
|
|
export const useTransactionInfo = (txData = {}) => {
|
2023-05-02 14:36:24 +02:00
|
|
|
const { allNftContracts, selectedAddress } = useSelector(
|
|
|
|
(state) => state.metamask,
|
|
|
|
);
|
|
|
|
const { chainId } = useSelector(getProviderConfig);
|
2023-03-23 19:21:33 +01:00
|
|
|
|
|
|
|
const isNftTransfer = Boolean(
|
2023-06-09 22:48:48 +02:00
|
|
|
allNftContracts?.[selectedAddress]?.[chainId]?.find((contract) => {
|
|
|
|
return isEqualCaseInsensitive(contract.address, txData.txParams.to);
|
|
|
|
}),
|
2023-03-23 19:21:33 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
return { isNftTransfer };
|
|
|
|
};
|