You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Tag:
Branch:
Tree:
3a6966ac8a
develop
feature/default_network_editable
v10.22.3
${ noResults }
66 lines
2.1 KiB
66 lines
2.1 KiB
import React from 'react';
|
|||
import PropTypes from 'prop-types';
|
|||
import { useDispatch, useSelector } from 'react-redux';
|
|||
import { useHistory } from 'react-router-dom';
|
|||
import { createTokenTrackerLinkForChain } from '@metamask/etherscan-link';
|
|||
|
|||
import TransactionList from '../../../components/app/transaction-list';
|
|||
import { TokenOverview } from '../../../components/app/wallet-overview';
|
|||
import {
|
|||
getCurrentChainId,
|
|||
getSelectedIdentity,
|
|||
} from '../../../selectors/selectors';
|
|||
import { DEFAULT_ROUTE } from '../../../helpers/constants/routes';
|
|||
import { showModal } from '../../../store/actions';
|
|||
|
|||
import AssetNavigation from './asset-navigation';
|
|||
import AssetOptions from './asset-options';
|
|||
|
|||
|
export default function TokenAsset({ token }) {
|
||
const dispatch = useDispatch();
|
|||
const chainId = useSelector(getCurrentChainId);
|
|||
const selectedIdentity = useSelector(getSelectedIdentity);
|
|||
const selectedAccountName = selectedIdentity.name;
|
|||
const selectedAddress = selectedIdentity.address;
|
|||
const history = useHistory();
|
|||
|
|||
return (
|
|||
<>
|
|||
<AssetNavigation
|
|||
accountName={selectedAccountName}
|
|||
assetName={token.symbol}
|
|||
onBack={() => history.push(DEFAULT_ROUTE)}
|
|||
|
optionsButton={
|
||
<AssetOptions
|
|||
|
onRemove={() =>
|
||
dispatch(showModal({ name: 'HIDE_TOKEN_CONFIRMATION', token }))
|
|||
}
|
|||
onViewEtherscan={() => {
|
|||
const url = createTokenTrackerLinkForChain(
|
|||
token.address,
|
|||
chainId,
|
|||
selectedAddress,
|
|||
);
|
|||
global.platform.openTab({ url });
|
|||
}}
|
|||
onViewAccountDetails={() => {
|
|||
dispatch(showModal({ name: 'ACCOUNT_DETAILS' }));
|
|||
}}
|
|||
tokenSymbol={token.symbol}
|
|||
/>
|
|||
|
}
|
||
/>
|
|||
<TokenOverview className="asset__overview" token={token} />
|
|||
<TransactionList tokenAddress={token.address} />
|
|||
</>
|
|||
);
|
|||
}
|
|||
|
|||
TokenAsset.propTypes = {
|
|||
token: PropTypes.shape({
|
|||
address: PropTypes.string.isRequired,
|
|||
decimals: PropTypes.number,
|
|||
symbol: PropTypes.string,
|
|||
}).isRequired,
|
|||
};
|