mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 03:20:23 +01:00
da06901f79
* add fallbacks for confirmation title on nft transfers * Add token name and id * fix * fix test --------- Co-authored-by: David Walsh <davidwalsh83@gmail.com>
23 lines
626 B
JavaScript
23 lines
626 B
JavaScript
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 };
|
|
};
|