diff --git a/app/_locales/en/messages.json b/app/_locales/en/messages.json index cb4496c6d..7494f39df 100644 --- a/app/_locales/en/messages.json +++ b/app/_locales/en/messages.json @@ -406,6 +406,13 @@ "message": "Transak supports debit card and bank transfers (depending on location) in 59+ countries. $1 deposits into your MetaMask account.", "description": "$1 represents the cypto symbol to be purchased" }, + "buyEth": { + "message": "Buy ETH" + }, + "buyOther": { + "message": "Buy $1 or deposit from another account.", + "description": "$1 is a token symbol" + }, "buyWithWyre": { "message": "Buy ETH with Wyre" }, @@ -1480,6 +1487,10 @@ "insufficientBalance": { "message": "Insufficient balance." }, + "insufficientCurrency": { + "message": "You do not have enough $1 in your account to pay for transaction fees on $2 network.", + "description": "$1 is currency, $2 is network" + }, "insufficientFunds": { "message": "Insufficient funds." }, @@ -2223,6 +2234,9 @@ "or": { "message": "or" }, + "orDeposit": { + "message": "or deposit from another account." + }, "origin": { "message": "Origin" }, diff --git a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js index 665d1924f..54dcb6d62 100644 --- a/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js +++ b/ui/components/app/confirm-page-container/confirm-page-container-content/confirm-page-container-content.component.js @@ -2,9 +2,16 @@ import React, { Component } from 'react'; import PropTypes from 'prop-types'; import classnames from 'classnames'; import { Tabs, Tab } from '../../../ui/tabs'; -import ErrorMessage from '../../../ui/error-message'; +import Button from '../../../ui/button'; import ActionableMessage from '../../../ui/actionable-message/actionable-message'; import { PageContainerFooter } from '../../../ui/page-container'; +import ErrorMessage from '../../../ui/error-message'; +import { INSUFFICIENT_FUNDS_ERROR_KEY } from '../../../../helpers/constants/error-keys'; +import Typography from '../../../ui/typography'; +import { TYPOGRAPHY } from '../../../../helpers/constants/design-system'; +import { TRANSACTION_TYPES } from '../../../../../shared/constants/transaction'; +import { MAINNET_CHAIN_ID } from '../../../../../shared/constants/network'; + import { ConfirmPageContainerSummary, ConfirmPageContainerWarning } from '.'; export default class ConfirmPageContainerContent extends Component { @@ -44,6 +51,10 @@ export default class ConfirmPageContainerContent extends Component { hideTitle: PropTypes.bool, supportsEIP1559V2: PropTypes.bool, hasTopBorder: PropTypes.bool, + currentTransaction: PropTypes.string, + nativeCurrency: PropTypes.string, + networkName: PropTypes.string, + showBuyModal: PropTypes.func, }; renderContent() { @@ -113,6 +124,10 @@ export default class ConfirmPageContainerContent extends Component { hideUserAcknowledgedGasMissing, supportsEIP1559V2, hasTopBorder, + currentTransaction, + nativeCurrency, + networkName, + showBuyModal, } = this.props; const primaryAction = hideUserAcknowledgedGasMissing @@ -121,6 +136,14 @@ export default class ConfirmPageContainerContent extends Component { label: this.context.t('tryAnywayOption'), onClick: setUserAcknowledgedGasMissing, }; + const { t } = this.context; + + const showInsuffienctFundsError = + supportsEIP1559V2 && + !hasSimulationError && + (errorKey || errorMessage) && + errorKey === INSUFFICIENT_FUNDS_ERROR_KEY && + currentTransaction.type === TRANSACTION_TYPES.SIMPLE_SEND; return (
)} @@ -160,11 +183,53 @@ export default class ConfirmPageContainerContent extends Component { {this.renderContent()} {!supportsEIP1559V2 && !hasSimulationError && - (errorKey || errorMessage) && ( + (errorKey || errorMessage) && + currentTransaction.type !== TRANSACTION_TYPES.SIMPLE_SEND && (