import React, { useContext } from 'react';
import PropTypes from 'prop-types';
import classnames from 'classnames';
import { I18nContext } from '../../../../contexts/i18n';
export default function ViewOnEtherScanLink({
txHash,
blockExplorerUrl,
isCustomBlockExplorerUrl,
}) {
const t = useContext(I18nContext);
return (
global.platform.openTab({ url: blockExplorerUrl })}
>
{isCustomBlockExplorerUrl
? t('viewOnCustomBlockExplorer', [new URL(blockExplorerUrl).hostname])
: t('viewOnEtherscan')}
);
}
ViewOnEtherScanLink.propTypes = {
txHash: PropTypes.string,
blockExplorerUrl: PropTypes.string,
isCustomBlockExplorerUrl: PropTypes.bool,
};