2021-02-04 19:15:23 +01:00
|
|
|
import React, { PureComponent } from 'react';
|
2022-12-22 21:07:51 +01:00
|
|
|
import { memoize } from 'lodash';
|
2021-02-04 19:15:23 +01:00
|
|
|
import PropTypes from 'prop-types';
|
2023-06-20 15:37:09 +02:00
|
|
|
import { ethErrors, serializeError } from 'eth-rpc-errors';
|
2021-10-21 21:17:03 +02:00
|
|
|
import LedgerInstructionField from '../ledger-instruction-field';
|
2023-04-25 12:47:12 +02:00
|
|
|
import {
|
|
|
|
sanitizeMessage,
|
|
|
|
getURLHostName,
|
2023-05-18 15:53:11 +02:00
|
|
|
getNetworkNameFromProviderType,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
2023-04-25 12:47:12 +02:00
|
|
|
shortenAddress,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
} from '../../../helpers/utils/util';
|
2023-07-18 15:55:37 +02:00
|
|
|
import {
|
|
|
|
MetaMetricsEventCategory,
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
MetaMetricsEventName,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
} from '../../../../shared/constants/metametrics';
|
2022-05-20 16:35:18 +02:00
|
|
|
import SiteOrigin from '../../ui/site-origin';
|
2022-11-21 18:19:49 +01:00
|
|
|
import Button from '../../ui/button';
|
|
|
|
import ContractDetailsModal from '../modals/contract-details-modal/contract-details-modal';
|
2022-11-30 19:11:36 +01:00
|
|
|
import {
|
2023-05-23 21:29:14 +02:00
|
|
|
TextAlign,
|
2023-02-02 21:15:26 +01:00
|
|
|
TextColor,
|
2023-06-27 00:50:08 +02:00
|
|
|
TextVariant,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
2023-04-25 12:47:12 +02:00
|
|
|
IconColor,
|
2023-06-27 00:50:08 +02:00
|
|
|
Display,
|
|
|
|
BlockSize,
|
2023-04-25 12:47:12 +02:00
|
|
|
BackgroundColor,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2022-11-30 19:11:36 +01:00
|
|
|
} from '../../../helpers/constants/design-system';
|
|
|
|
import NetworkAccountBalanceHeader from '../network-account-balance-header';
|
2023-01-23 20:30:43 +01:00
|
|
|
import { Numeric } from '../../../../shared/modules/Numeric';
|
2023-06-23 20:08:22 +02:00
|
|
|
import { isSuspiciousResponse } from '../../../../shared/modules/security-provider.utils';
|
2023-01-23 20:30:43 +01:00
|
|
|
import { EtherDenomination } from '../../../../shared/constants/common';
|
2023-01-31 16:29:23 +01:00
|
|
|
import ConfirmPageContainerNavigation from '../confirm-page-container/confirm-page-container-navigation';
|
2023-02-23 12:38:09 +01:00
|
|
|
import SecurityProviderBannerMessage from '../security-provider-banner-message/security-provider-banner-message';
|
2023-03-08 17:05:55 +01:00
|
|
|
import { formatCurrency } from '../../../helpers/utils/confirm-tx.util';
|
|
|
|
import { getValueFromWeiHex } from '../../../../shared/modules/conversion.utils';
|
2023-04-25 12:47:12 +02:00
|
|
|
|
2023-06-27 00:50:08 +02:00
|
|
|
import {
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
Box,
|
|
|
|
Icon,
|
|
|
|
IconName,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2023-07-20 00:32:35 +02:00
|
|
|
Text,
|
2023-06-27 00:50:08 +02:00
|
|
|
} from '../../component-library';
|
2022-11-21 18:19:49 +01:00
|
|
|
import Footer from './signature-request-footer';
|
2022-11-30 19:11:36 +01:00
|
|
|
import Message from './signature-request-message';
|
2019-11-04 13:40:46 +01:00
|
|
|
|
|
|
|
export default class SignatureRequest extends PureComponent {
|
|
|
|
static propTypes = {
|
2021-12-08 21:32:59 +01:00
|
|
|
/**
|
|
|
|
* The display content of transaction data
|
|
|
|
*/
|
2019-11-04 13:40:46 +01:00
|
|
|
txData: PropTypes.object.isRequired,
|
2021-12-08 21:32:59 +01:00
|
|
|
/**
|
|
|
|
* The display content of sender account
|
|
|
|
*/
|
2020-03-06 22:34:56 +01:00
|
|
|
fromAccount: PropTypes.shape({
|
|
|
|
address: PropTypes.string.isRequired,
|
2019-11-04 13:40:46 +01:00
|
|
|
balance: PropTypes.string,
|
|
|
|
name: PropTypes.string,
|
2020-03-06 22:34:56 +01:00
|
|
|
}).isRequired,
|
2021-12-08 21:32:59 +01:00
|
|
|
/**
|
|
|
|
* Check if the wallet is ledget wallet or not
|
|
|
|
*/
|
2021-10-21 21:17:03 +02:00
|
|
|
isLedgerWallet: PropTypes.bool,
|
2023-06-20 15:37:09 +02:00
|
|
|
|
2021-12-08 21:32:59 +01:00
|
|
|
/**
|
|
|
|
* Whether the hardware wallet requires a connection disables the sign button if true.
|
|
|
|
*/
|
2021-12-02 19:09:18 +01:00
|
|
|
hardwareWalletRequiresConnection: PropTypes.bool.isRequired,
|
2022-11-21 18:19:49 +01:00
|
|
|
/**
|
|
|
|
* Current network chainId
|
|
|
|
*/
|
|
|
|
chainId: PropTypes.string,
|
|
|
|
/**
|
|
|
|
* RPC prefs of the current network
|
|
|
|
*/
|
|
|
|
rpcPrefs: PropTypes.object,
|
2022-11-30 19:11:36 +01:00
|
|
|
nativeCurrency: PropTypes.string,
|
2023-03-02 13:40:07 +01:00
|
|
|
currentCurrency: PropTypes.string.isRequired,
|
2023-03-08 17:05:55 +01:00
|
|
|
conversionRate: PropTypes.number,
|
2023-05-02 17:53:20 +02:00
|
|
|
providerConfig: PropTypes.object,
|
2022-11-30 19:11:36 +01:00
|
|
|
subjectMetadata: PropTypes.object,
|
2023-01-31 16:29:23 +01:00
|
|
|
unapprovedMessagesCount: PropTypes.number,
|
|
|
|
clearConfirmTransaction: PropTypes.func.isRequired,
|
|
|
|
history: PropTypes.object,
|
|
|
|
mostRecentOverviewPage: PropTypes.string,
|
|
|
|
showRejectTransactionsConfirmationModal: PropTypes.func.isRequired,
|
2023-06-20 15:37:09 +02:00
|
|
|
cancelAllApprovals: PropTypes.func.isRequired,
|
|
|
|
resolvePendingApproval: PropTypes.func.isRequired,
|
|
|
|
rejectPendingApproval: PropTypes.func.isRequired,
|
|
|
|
completedTx: PropTypes.func.isRequired,
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
2023-05-24 13:41:21 +02:00
|
|
|
showCustodianDeepLink: PropTypes.func,
|
|
|
|
isNotification: PropTypes.bool,
|
2023-06-20 15:37:09 +02:00
|
|
|
mmiOnSignCallback: PropTypes.func,
|
2023-04-25 12:47:12 +02:00
|
|
|
// Used to show a warning if the signing account is not the selected account
|
|
|
|
// Largely relevant for contract wallet custodians
|
|
|
|
selectedAccount: PropTypes.object,
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-04 13:40:46 +01:00
|
|
|
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent: PropTypes.func,
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-04 13:40:46 +01:00
|
|
|
|
2022-02-15 19:39:57 +01:00
|
|
|
state = {
|
|
|
|
hasScrolledMessage: false,
|
2022-11-21 18:19:49 +01:00
|
|
|
showContractDetails: false,
|
2022-02-15 19:39:57 +01:00
|
|
|
};
|
|
|
|
|
2023-05-24 13:41:21 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
componentDidMount() {
|
|
|
|
if (this.props.txData.custodyId) {
|
|
|
|
this.props.showCustodianDeepLink({
|
|
|
|
custodyId: this.props.txData.custodyId,
|
|
|
|
fromAddress: this.props.fromAccount.address,
|
|
|
|
closeNotification: this.props.isNotification,
|
|
|
|
onDeepLinkFetched: () => undefined,
|
|
|
|
onDeepLinkShown: () => {
|
|
|
|
this.context.trackEvent({
|
2023-07-18 15:55:37 +02:00
|
|
|
category: MetaMetricsEventCategory.MMI,
|
|
|
|
event: MetaMetricsEventName.SignatureDeeplinkDisplayed,
|
2023-05-24 13:41:21 +02:00
|
|
|
});
|
|
|
|
},
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2022-02-15 19:39:57 +01:00
|
|
|
setMessageRootRef(ref) {
|
|
|
|
this.messageRootRef = ref;
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
formatWallet(wallet) {
|
|
|
|
return `${wallet.slice(0, 8)}...${wallet.slice(
|
|
|
|
wallet.length - 8,
|
|
|
|
wallet.length,
|
2021-02-04 19:15:23 +01:00
|
|
|
)}`;
|
2019-11-04 13:40:46 +01:00
|
|
|
}
|
|
|
|
|
2022-12-22 21:07:51 +01:00
|
|
|
memoizedParseMessage = memoize((data) => {
|
|
|
|
const { message, domain = {}, primaryType, types } = JSON.parse(data);
|
|
|
|
const sanitizedMessage = sanitizeMessage(message, primaryType, types);
|
2023-01-12 15:52:02 +01:00
|
|
|
return { sanitizedMessage, domain, primaryType };
|
2022-12-22 21:07:51 +01:00
|
|
|
});
|
|
|
|
|
2023-01-31 16:29:23 +01:00
|
|
|
handleCancelAll = () => {
|
|
|
|
const {
|
|
|
|
clearConfirmTransaction,
|
|
|
|
history,
|
|
|
|
mostRecentOverviewPage,
|
|
|
|
showRejectTransactionsConfirmationModal,
|
|
|
|
unapprovedMessagesCount,
|
2023-06-20 15:37:09 +02:00
|
|
|
cancelAllApprovals,
|
2023-01-31 16:29:23 +01:00
|
|
|
} = this.props;
|
|
|
|
|
|
|
|
showRejectTransactionsConfirmationModal({
|
|
|
|
unapprovedTxCount: unapprovedMessagesCount,
|
|
|
|
onSubmit: async () => {
|
2023-06-20 15:37:09 +02:00
|
|
|
await cancelAllApprovals();
|
2023-01-31 16:29:23 +01:00
|
|
|
clearConfirmTransaction();
|
|
|
|
history.push(mostRecentOverviewPage);
|
|
|
|
},
|
|
|
|
});
|
|
|
|
};
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2019-11-04 13:40:46 +01:00
|
|
|
const {
|
2023-05-18 15:53:11 +02:00
|
|
|
providerConfig,
|
2020-11-03 00:41:28 +01:00
|
|
|
txData: {
|
2021-10-12 18:40:41 +02:00
|
|
|
msgParams: { data, origin, version },
|
|
|
|
type,
|
2023-06-20 15:37:09 +02:00
|
|
|
id,
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
2022-11-30 19:11:36 +01:00
|
|
|
fromAccount: { address, balance, name },
|
2021-10-21 21:17:03 +02:00
|
|
|
isLedgerWallet,
|
|
|
|
hardwareWalletRequiresConnection,
|
2022-11-21 18:19:49 +01:00
|
|
|
chainId,
|
|
|
|
rpcPrefs,
|
2022-11-30 19:11:36 +01:00
|
|
|
txData,
|
|
|
|
subjectMetadata,
|
|
|
|
nativeCurrency,
|
2023-03-02 13:40:07 +01:00
|
|
|
currentCurrency,
|
2023-03-08 17:05:55 +01:00
|
|
|
conversionRate,
|
2023-01-31 16:29:23 +01:00
|
|
|
unapprovedMessagesCount,
|
2023-06-20 15:37:09 +02:00
|
|
|
resolvePendingApproval,
|
|
|
|
rejectPendingApproval,
|
|
|
|
completedTx,
|
2021-02-04 19:15:23 +01:00
|
|
|
} = this.props;
|
2023-03-08 17:05:55 +01:00
|
|
|
|
2023-01-31 16:29:23 +01:00
|
|
|
const { t, trackEvent } = this.context;
|
2023-01-13 20:28:52 +01:00
|
|
|
const {
|
|
|
|
sanitizedMessage,
|
|
|
|
domain: { verifyingContract },
|
|
|
|
primaryType,
|
|
|
|
} = this.memoizedParseMessage(data);
|
2023-01-31 16:29:23 +01:00
|
|
|
const rejectNText = t('rejectRequestsN', [unapprovedMessagesCount]);
|
2023-05-18 15:53:11 +02:00
|
|
|
const networkName = getNetworkNameFromProviderType(providerConfig.type);
|
|
|
|
const currentNetwork =
|
|
|
|
networkName === ''
|
|
|
|
? providerConfig.nickname || t('unknownNetwork')
|
|
|
|
: t(networkName);
|
2023-03-08 17:05:55 +01:00
|
|
|
|
|
|
|
const balanceInBaseAsset = conversionRate
|
|
|
|
? formatCurrency(
|
|
|
|
getValueFromWeiHex({
|
|
|
|
value: balance,
|
|
|
|
fromCurrency: nativeCurrency,
|
|
|
|
toCurrency: currentCurrency,
|
|
|
|
conversionRate,
|
|
|
|
numberOfDecimals: 6,
|
|
|
|
toDenomination: EtherDenomination.ETH,
|
|
|
|
}),
|
|
|
|
currentCurrency,
|
|
|
|
)
|
|
|
|
: new Numeric(balance, 16, EtherDenomination.WEI)
|
|
|
|
.toDenomination(EtherDenomination.ETH)
|
|
|
|
.round(6)
|
|
|
|
.toBase(10)
|
|
|
|
.toString();
|
|
|
|
|
2023-06-20 15:37:09 +02:00
|
|
|
const onSign = async () => {
|
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
if (this.props.mmiOnSignCallback) {
|
|
|
|
await this.props.mmiOnSignCallback(txData);
|
2023-07-06 17:10:03 +02:00
|
|
|
return;
|
2023-06-20 15:37:09 +02:00
|
|
|
}
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
|
2023-07-06 17:10:03 +02:00
|
|
|
await resolvePendingApproval(id);
|
|
|
|
completedTx(id);
|
|
|
|
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent({
|
2023-04-03 17:31:04 +02:00
|
|
|
category: MetaMetricsEventCategory.Transactions,
|
2022-03-29 15:46:24 +02:00
|
|
|
event: 'Confirm',
|
|
|
|
properties: {
|
2021-10-12 18:40:41 +02:00
|
|
|
action: 'Sign Request',
|
2022-03-29 15:46:24 +02:00
|
|
|
legacy_event: true,
|
2021-10-12 18:40:41 +02:00
|
|
|
type,
|
|
|
|
version,
|
|
|
|
},
|
|
|
|
});
|
2021-05-07 22:54:20 +02:00
|
|
|
};
|
|
|
|
|
2023-06-20 15:37:09 +02:00
|
|
|
const onCancel = async () => {
|
|
|
|
await rejectPendingApproval(
|
|
|
|
id,
|
|
|
|
serializeError(ethErrors.provider.userRejectedRequest()),
|
|
|
|
);
|
2022-03-29 15:46:24 +02:00
|
|
|
trackEvent({
|
2023-04-03 17:31:04 +02:00
|
|
|
category: MetaMetricsEventCategory.Transactions,
|
2022-03-29 15:46:24 +02:00
|
|
|
event: 'Cancel',
|
|
|
|
properties: {
|
2021-10-12 18:40:41 +02:00
|
|
|
action: 'Sign Request',
|
2022-03-29 15:46:24 +02:00
|
|
|
legacy_event: true,
|
2021-10-12 18:40:41 +02:00
|
|
|
type,
|
|
|
|
version,
|
|
|
|
},
|
|
|
|
});
|
2021-05-07 22:54:20 +02:00
|
|
|
};
|
|
|
|
|
2022-02-15 19:39:57 +01:00
|
|
|
const messageIsScrollable =
|
|
|
|
this.messageRootRef?.scrollHeight > this.messageRootRef?.clientHeight;
|
|
|
|
|
2022-11-30 19:11:36 +01:00
|
|
|
const targetSubjectMetadata = txData.msgParams.origin
|
|
|
|
? subjectMetadata?.[txData.msgParams.origin]
|
|
|
|
: null;
|
|
|
|
|
2019-11-04 13:40:46 +01:00
|
|
|
return (
|
2022-12-02 15:12:43 +01:00
|
|
|
<div className="signature-request">
|
2023-01-31 16:29:23 +01:00
|
|
|
<ConfirmPageContainerNavigation />
|
2023-03-08 17:05:55 +01:00
|
|
|
<div
|
|
|
|
className="request-signature__account"
|
|
|
|
data-testid="request-signature-account"
|
|
|
|
>
|
2022-11-30 19:11:36 +01:00
|
|
|
<NetworkAccountBalanceHeader
|
|
|
|
networkName={currentNetwork}
|
|
|
|
accountName={name}
|
|
|
|
accountBalance={balanceInBaseAsset}
|
2023-03-08 17:05:55 +01:00
|
|
|
tokenName={
|
|
|
|
conversionRate ? currentCurrency?.toUpperCase() : nativeCurrency
|
|
|
|
}
|
2022-11-30 19:11:36 +01:00
|
|
|
accountAddress={address}
|
|
|
|
/>
|
|
|
|
</div>
|
2019-11-04 13:40:46 +01:00
|
|
|
<div className="signature-request-content">
|
2023-06-23 20:08:22 +02:00
|
|
|
{isSuspiciousResponse(txData?.securityProviderResponse) && (
|
2023-02-23 12:38:09 +01:00
|
|
|
<SecurityProviderBannerMessage
|
|
|
|
securityProviderResponse={txData.securityProviderResponse}
|
|
|
|
/>
|
2023-06-23 20:08:22 +02:00
|
|
|
)}
|
2023-04-25 12:47:12 +02:00
|
|
|
|
|
|
|
{
|
2023-04-25 16:32:51 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
2023-04-25 12:47:12 +02:00
|
|
|
this.props.selectedAccount.address === address ? null : (
|
|
|
|
<Box
|
|
|
|
className="request-signature__mismatch-info"
|
2023-06-27 00:50:08 +02:00
|
|
|
display={Display.Flex}
|
|
|
|
width={BlockSize.Full}
|
2023-04-25 12:47:12 +02:00
|
|
|
padding={4}
|
|
|
|
marginBottom={4}
|
|
|
|
backgroundColor={BackgroundColor.primaryMuted}
|
|
|
|
>
|
|
|
|
<Icon
|
|
|
|
name={IconName.Info}
|
|
|
|
color={IconColor.infoDefault}
|
|
|
|
marginRight={2}
|
|
|
|
/>
|
|
|
|
<Text
|
|
|
|
variant={TextVariant.bodyXs}
|
|
|
|
color={TextColor.textDefault}
|
|
|
|
>
|
|
|
|
{this.context.t('mismatchAccount', [
|
|
|
|
shortenAddress(this.props.selectedAccount.address),
|
|
|
|
shortenAddress(address),
|
|
|
|
])}
|
|
|
|
</Text>
|
|
|
|
</Box>
|
|
|
|
)
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
|
|
|
}
|
|
|
|
|
2022-11-30 19:11:36 +01:00
|
|
|
<div className="signature-request__origin">
|
|
|
|
<SiteOrigin
|
|
|
|
siteOrigin={origin}
|
|
|
|
iconSrc={targetSubjectMetadata?.iconUrl}
|
|
|
|
iconName={getURLHostName(origin) || origin}
|
|
|
|
chip
|
|
|
|
/>
|
2019-11-04 13:40:46 +01:00
|
|
|
</div>
|
2022-11-30 19:11:36 +01:00
|
|
|
|
2023-06-27 00:50:08 +02:00
|
|
|
<Text
|
2022-11-30 19:11:36 +01:00
|
|
|
className="signature-request__content__title"
|
2023-06-27 00:50:08 +02:00
|
|
|
variant={TextVariant.headingMd}
|
|
|
|
as="h3"
|
|
|
|
marginTop={4}
|
2022-11-30 19:11:36 +01:00
|
|
|
>
|
|
|
|
{this.context.t('sigRequest')}
|
2023-06-27 00:50:08 +02:00
|
|
|
</Text>
|
|
|
|
<Text
|
2022-12-02 15:12:43 +01:00
|
|
|
className="request-signature__content__subtitle"
|
2023-06-27 00:50:08 +02:00
|
|
|
variant={TextVariant.bodySm}
|
|
|
|
as="h6"
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.textAlternative}
|
2023-05-23 21:29:14 +02:00
|
|
|
align={TextAlign.Center}
|
2022-12-02 15:12:43 +01:00
|
|
|
margin={12}
|
|
|
|
marginTop={3}
|
|
|
|
>
|
|
|
|
{this.context.t('signatureRequestGuidance')}
|
2023-06-27 00:50:08 +02:00
|
|
|
</Text>
|
2023-01-13 20:28:52 +01:00
|
|
|
{verifyingContract ? (
|
|
|
|
<div>
|
|
|
|
<Button
|
|
|
|
type="link"
|
|
|
|
onClick={() => this.setState({ showContractDetails: true })}
|
|
|
|
className="signature-request-content__verify-contract-details"
|
|
|
|
data-testid="verify-contract-details"
|
2022-11-21 18:19:49 +01:00
|
|
|
>
|
2023-06-27 00:50:08 +02:00
|
|
|
<Text
|
|
|
|
variant={TextVariant.bodySm}
|
|
|
|
as="h6"
|
2023-02-02 21:15:26 +01:00
|
|
|
color={TextColor.primaryDefault}
|
2023-01-13 20:28:52 +01:00
|
|
|
>
|
|
|
|
{this.context.t('verifyContractDetails')}
|
2023-06-27 00:50:08 +02:00
|
|
|
</Text>
|
2023-01-13 20:28:52 +01:00
|
|
|
</Button>
|
|
|
|
</div>
|
|
|
|
) : null}
|
2019-11-04 13:40:46 +01:00
|
|
|
</div>
|
2021-10-21 21:17:03 +02:00
|
|
|
{isLedgerWallet ? (
|
|
|
|
<div className="confirm-approve-content__ledger-instruction-wrapper">
|
|
|
|
<LedgerInstructionField showDataInstruction />
|
|
|
|
</div>
|
|
|
|
) : null}
|
2022-02-15 19:39:57 +01:00
|
|
|
<Message
|
2022-12-22 21:07:51 +01:00
|
|
|
data={sanitizedMessage}
|
2022-02-15 19:39:57 +01:00
|
|
|
onMessageScrolled={() => this.setState({ hasScrolledMessage: true })}
|
|
|
|
setMessageRootRef={this.setMessageRootRef.bind(this)}
|
2022-02-16 00:59:59 +01:00
|
|
|
messageRootRef={this.messageRootRef}
|
|
|
|
messageIsScrollable={messageIsScrollable}
|
2023-01-12 15:52:02 +01:00
|
|
|
primaryType={primaryType}
|
2022-02-15 19:39:57 +01:00
|
|
|
/>
|
2021-10-21 21:17:03 +02:00
|
|
|
<Footer
|
|
|
|
cancelAction={onCancel}
|
|
|
|
signAction={onSign}
|
2022-02-15 19:39:57 +01:00
|
|
|
disabled={
|
2023-05-24 13:41:21 +02:00
|
|
|
///: BEGIN:ONLY_INCLUDE_IN(build-mmi)
|
|
|
|
Boolean(this.props.txData?.custodyId) ||
|
|
|
|
///: END:ONLY_INCLUDE_IN
|
2022-02-15 19:39:57 +01:00
|
|
|
hardwareWalletRequiresConnection ||
|
|
|
|
(messageIsScrollable && !this.state.hasScrolledMessage)
|
|
|
|
}
|
2021-10-21 21:17:03 +02:00
|
|
|
/>
|
2022-11-21 18:19:49 +01:00
|
|
|
{this.state.showContractDetails && (
|
|
|
|
<ContractDetailsModal
|
2023-01-13 20:28:52 +01:00
|
|
|
toAddress={verifyingContract}
|
2022-11-21 18:19:49 +01:00
|
|
|
chainId={chainId}
|
|
|
|
rpcPrefs={rpcPrefs}
|
|
|
|
onClose={() => this.setState({ showContractDetails: false })}
|
|
|
|
isContractRequestingSignature
|
|
|
|
/>
|
|
|
|
)}
|
2023-01-31 16:29:23 +01:00
|
|
|
{unapprovedMessagesCount > 1 ? (
|
|
|
|
<Button
|
|
|
|
type="link"
|
|
|
|
className="signature-request__reject-all-button"
|
|
|
|
data-testid="signature-request-reject-all"
|
|
|
|
onClick={(e) => {
|
|
|
|
e.preventDefault();
|
|
|
|
this.handleCancelAll();
|
|
|
|
}}
|
|
|
|
>
|
|
|
|
{rejectNText}
|
|
|
|
</Button>
|
|
|
|
) : null}
|
2019-11-04 13:40:46 +01:00
|
|
|
</div>
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
2019-11-04 13:40:46 +01:00
|
|
|
}
|
|
|
|
}
|