diff --git a/ui/components/app/selected-account/selected-account.component.js b/ui/components/app/selected-account/selected-account.component.js
index 3dab4e12a..78d48c7c5 100644
--- a/ui/components/app/selected-account/selected-account.component.js
+++ b/ui/components/app/selected-account/selected-account.component.js
@@ -6,6 +6,11 @@ import { shortenAddress } from '../../../helpers/utils/util';
import Tooltip from '../../ui/tooltip';
import { toChecksumHexAddress } from '../../../../shared/modules/hexstring-utils';
import { SECOND } from '../../../../shared/constants/time';
+///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+import { getEnvironmentType } from '../../../../app/scripts/lib/util';
+import { ENVIRONMENT_TYPE_POPUP } from '../../../../shared/constants/app';
+import CustodyLabels from '../../institutional/custody-labels/custody-labels';
+///: END:ONLY_INCLUDE_IN
import { Icon, IconName, IconSize } from '../../component-library';
import { IconColor } from '../../../helpers/constants/design-system';
@@ -20,6 +25,12 @@ class SelectedAccount extends Component {
static propTypes = {
selectedIdentity: PropTypes.object.isRequired,
+ ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+ accountType: PropTypes.string,
+ accountDetails: PropTypes.object,
+ provider: PropTypes.object,
+ isCustodianSupportedChain: PropTypes.bool,
+ ///: END:ONLY_INCLUDE_IN
};
componentDidMount() {
@@ -35,21 +46,57 @@ class SelectedAccount extends Component {
render() {
const { t } = this.context;
- const { selectedIdentity } = this.props;
+ const {
+ selectedIdentity,
+ ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+ accountType,
+ accountDetails,
+ provider,
+ isCustodianSupportedChain,
+ ///: END:ONLY_INCLUDE_IN
+ } = this.props;
+
const checksummedAddress = toChecksumHexAddress(selectedIdentity.address);
+ let title = this.state.copied
+ ? t('copiedExclamation')
+ : t('copyToClipboard');
+
+ let showAccountCopyIcon = true;
+
+ ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+ const custodyLabels = accountDetails
+ ? accountDetails[toChecksumHexAddress(selectedIdentity.address)]?.labels
+ : {};
+ const showCustodyLabels =
+ getEnvironmentType() !== ENVIRONMENT_TYPE_POPUP &&
+ accountType === 'custody' &&
+ custodyLabels;
+
+ const tooltipText = this.state.copied
+ ? t('copiedExclamation')
+ : t('copyToClipboard');
+
+ title = isCustodianSupportedChain
+ ? tooltipText
+ : t('custodyWrongChain', [provider.nickname || provider.type]);
+
+ showAccountCopyIcon = isCustodianSupportedChain;
+ ///: END:ONLY_INCLUDE_IN
+
return (
+ {
+ ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+ showCustodyLabels &&
+ ///: END:ONLY_INCLUDE_IN
+ }
{shortenAddress(checksummedAddress)}
+ {showAccountCopyIcon && (
+
+
+
+ )}
{
return {
selectedIdentity: getSelectedIdentity(state),
+ ///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
+ accountType: getAccountType(state),
+ accountDetails: getCustodyAccountDetails(state),
+ provider: getProviderConfig(state),
+ isCustodianSupportedChain: getIsCustodianSupportedChain(state),
+ ///: END:ONLY_INCLUDE_IN
};
};