1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/ui/hooks/useTransactionInfo.js
Alex Donesky da06901f79
Fix #18199 : Add fallbacks for confirmation title on NFT transfers (#18269)
* add fallbacks for confirmation title on nft transfers

* Add token name and id

* fix

* fix test

---------

Co-authored-by: David Walsh <davidwalsh83@gmail.com>
2023-03-30 14:07:29 -02:30

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 };
};