import React from 'react'; import PropTypes from 'prop-types'; import { useSelector } from 'react-redux'; import { Switch, Route } from 'react-router-dom'; import { CONFIRM_APPROVE_PATH, CONFIRM_SEND_TOKEN_PATH, CONFIRM_TRANSACTION_ROUTE, CONFIRM_TRANSFER_FROM_PATH, } from '../../helpers/constants/routes'; import { transactionFeeSelector } from '../../selectors'; import ConfirmApprove from '../confirm-approve'; import ConfirmSendToken from '../confirm-send-token'; import ConfirmTokenTransactionBase from '../confirm-token-transaction-base'; import ConfirmTransactionSwitch from '../confirm-transaction-switch'; import { useAssetDetails } from '../../hooks/useAssetDetails'; export default function ConfirmTokenTransactionSwitch({ transaction }) { const { txParams: { data, to: tokenAddress, from: userAddress } = {}, } = transaction; const { assetStandard, assetName, userBalance, tokenSymbol, decimals, tokenImage, tokenAmount, tokenId, toAddress, } = useAssetDetails(tokenAddress, userAddress, data); const { ethTransactionTotal, fiatTransactionTotal, hexTransactionTotal, hexMaximumTransactionFee, } = useSelector((state) => transactionFeeSelector(state, transaction)); return ( ( )} /> ( )} /> ( )} /> ); } ConfirmTokenTransactionSwitch.propTypes = { transaction: PropTypes.shape({ origin: PropTypes.string, txParams: PropTypes.shape({ data: PropTypes.string, to: PropTypes.string, from: PropTypes.string, }), }), };