2018-11-21 19:51:34 +01:00
|
|
|
import ethUtil from 'ethereumjs-util'
|
2018-06-23 08:52:45 +02:00
|
|
|
import React, { Component } from 'react'
|
|
|
|
import PropTypes from 'prop-types'
|
2019-03-25 17:19:23 +01:00
|
|
|
import { ENVIRONMENT_TYPE_NOTIFICATION } from '../../../../app/scripts/lib/enums'
|
|
|
|
import { getEnvironmentType } from '../../../../app/scripts/lib/util'
|
2020-11-03 00:41:28 +01:00
|
|
|
import ConfirmPageContainer, {
|
|
|
|
ConfirmDetailRow,
|
|
|
|
} from '../../components/app/confirm-page-container'
|
2019-04-17 21:15:13 +02:00
|
|
|
import { isBalanceSufficient } from '../send/send.utils'
|
2020-06-01 19:54:32 +02:00
|
|
|
import { CONFIRM_TRANSACTION_ROUTE } from '../../helpers/constants/routes'
|
2018-07-06 20:58:41 +02:00
|
|
|
import {
|
|
|
|
INSUFFICIENT_FUNDS_ERROR_KEY,
|
|
|
|
TRANSACTION_ERROR_KEY,
|
2019-05-23 15:56:40 +02:00
|
|
|
GAS_LIMIT_TOO_LOW_ERROR_KEY,
|
2019-03-22 00:03:30 +01:00
|
|
|
} from '../../helpers/constants/error-keys'
|
|
|
|
import UserPreferencedCurrencyDisplay from '../../components/app/user-preferenced-currency-display'
|
|
|
|
import { PRIMARY, SECONDARY } from '../../helpers/constants/common'
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
2019-10-23 14:23:15 +02:00
|
|
|
import { hexToDecimal } from '../../helpers/utils/conversions.util'
|
2019-03-22 00:03:30 +01:00
|
|
|
import AdvancedGasInputs from '../../components/app/gas-customization/advanced-gas-inputs'
|
2019-09-27 06:30:36 +02:00
|
|
|
import TextField from '../../components/ui/text-field'
|
2020-11-07 08:38:12 +01:00
|
|
|
import {
|
|
|
|
TRANSACTION_CATEGORIES,
|
|
|
|
TRANSACTION_STATUSES,
|
|
|
|
} from '../../../../shared/constants/transaction'
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
export default class ConfirmTransactionBase extends Component {
|
|
|
|
static contextTypes = {
|
|
|
|
t: PropTypes.func,
|
2019-03-05 16:45:01 +01:00
|
|
|
metricsEvent: PropTypes.func,
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
static propTypes = {
|
2018-07-06 20:58:41 +02:00
|
|
|
// react-router props
|
2018-06-23 08:52:45 +02:00
|
|
|
history: PropTypes.object,
|
|
|
|
// Redux props
|
2018-07-06 20:58:41 +02:00
|
|
|
balance: PropTypes.string,
|
|
|
|
cancelTransaction: PropTypes.func,
|
2018-09-20 02:48:28 +02:00
|
|
|
cancelAllTransactions: PropTypes.func,
|
2018-07-06 20:58:41 +02:00
|
|
|
clearConfirmTransaction: PropTypes.func,
|
|
|
|
conversionRate: PropTypes.number,
|
|
|
|
fromAddress: PropTypes.string,
|
|
|
|
fromName: PropTypes.string,
|
2018-10-17 01:03:29 +02:00
|
|
|
hexTransactionAmount: PropTypes.string,
|
|
|
|
hexTransactionFee: PropTypes.string,
|
|
|
|
hexTransactionTotal: PropTypes.string,
|
2018-07-06 20:58:41 +02:00
|
|
|
isTxReprice: PropTypes.bool,
|
|
|
|
methodData: PropTypes.object,
|
|
|
|
nonce: PropTypes.string,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField: PropTypes.bool,
|
|
|
|
customNonceValue: PropTypes.string,
|
|
|
|
updateCustomNonce: PropTypes.func,
|
2018-08-30 04:13:25 +02:00
|
|
|
assetImage: PropTypes.string,
|
2018-06-23 08:52:45 +02:00
|
|
|
sendTransaction: PropTypes.func,
|
|
|
|
showCustomizeGasModal: PropTypes.func,
|
|
|
|
showTransactionConfirmedModal: PropTypes.func,
|
2018-09-24 07:07:19 +02:00
|
|
|
showRejectTransactionsConfirmationModal: PropTypes.func,
|
2018-07-06 20:58:41 +02:00
|
|
|
toAddress: PropTypes.string,
|
|
|
|
tokenData: PropTypes.object,
|
|
|
|
tokenProps: PropTypes.object,
|
|
|
|
toName: PropTypes.string,
|
2019-11-01 18:54:00 +01:00
|
|
|
toEns: PropTypes.string,
|
2019-08-08 20:45:30 +02:00
|
|
|
toNickname: PropTypes.string,
|
2018-07-06 20:58:41 +02:00
|
|
|
transactionStatus: PropTypes.string,
|
|
|
|
txData: PropTypes.object,
|
2018-09-20 02:48:28 +02:00
|
|
|
unapprovedTxCount: PropTypes.number,
|
2018-11-13 18:19:12 +01:00
|
|
|
currentNetworkUnapprovedTxs: PropTypes.object,
|
2019-02-08 14:50:25 +01:00
|
|
|
updateGasAndCalculate: PropTypes.func,
|
|
|
|
customGas: PropTypes.object,
|
2018-06-23 08:52:45 +02:00
|
|
|
// Component props
|
2019-04-08 16:02:51 +02:00
|
|
|
actionKey: PropTypes.string,
|
2018-06-23 08:52:45 +02:00
|
|
|
contentComponent: PropTypes.node,
|
2018-07-06 20:58:41 +02:00
|
|
|
dataComponent: PropTypes.node,
|
|
|
|
detailsComponent: PropTypes.node,
|
|
|
|
errorKey: PropTypes.string,
|
2018-06-23 08:52:45 +02:00
|
|
|
errorMessage: PropTypes.string,
|
2020-11-03 00:41:28 +01:00
|
|
|
primaryTotalTextOverride: PropTypes.oneOfType([
|
|
|
|
PropTypes.string,
|
|
|
|
PropTypes.node,
|
|
|
|
]),
|
2018-10-17 01:03:29 +02:00
|
|
|
secondaryTotalTextOverride: PropTypes.string,
|
2018-07-06 20:58:41 +02:00
|
|
|
hideData: PropTypes.bool,
|
|
|
|
hideDetails: PropTypes.bool,
|
|
|
|
hideSubtitle: PropTypes.bool,
|
2018-06-23 08:52:45 +02:00
|
|
|
identiconAddress: PropTypes.string,
|
2018-07-06 20:58:41 +02:00
|
|
|
onCancel: PropTypes.func,
|
2018-06-23 08:52:45 +02:00
|
|
|
onEdit: PropTypes.func,
|
|
|
|
onEditGas: PropTypes.func,
|
|
|
|
onSubmit: PropTypes.func,
|
2019-03-05 16:45:01 +01:00
|
|
|
setMetaMetricsSendCount: PropTypes.func,
|
|
|
|
metaMetricsSendCount: PropTypes.number,
|
2018-07-06 20:58:41 +02:00
|
|
|
subtitle: PropTypes.string,
|
2018-10-17 01:03:29 +02:00
|
|
|
subtitleComponent: PropTypes.node,
|
2018-07-06 20:58:41 +02:00
|
|
|
summaryComponent: PropTypes.node,
|
|
|
|
title: PropTypes.string,
|
2018-10-17 01:03:29 +02:00
|
|
|
titleComponent: PropTypes.node,
|
2018-07-06 20:58:41 +02:00
|
|
|
valid: PropTypes.bool,
|
|
|
|
warning: PropTypes.string,
|
2019-02-06 01:24:28 +01:00
|
|
|
advancedInlineGasShown: PropTypes.bool,
|
|
|
|
insufficientBalance: PropTypes.bool,
|
2019-02-26 19:30:41 +01:00
|
|
|
hideFiatConversion: PropTypes.bool,
|
2019-06-18 14:17:14 +02:00
|
|
|
transactionCategory: PropTypes.string,
|
2019-09-27 06:30:36 +02:00
|
|
|
getNextNonce: PropTypes.func,
|
|
|
|
nextNonce: PropTypes.number,
|
2019-11-01 18:54:00 +01:00
|
|
|
tryReverseResolveAddress: PropTypes.func.isRequired,
|
2019-11-05 16:13:48 +01:00
|
|
|
hideSenderToRecipient: PropTypes.bool,
|
|
|
|
showAccountInHeader: PropTypes.bool,
|
2020-06-01 19:54:32 +02:00
|
|
|
mostRecentOverviewPage: PropTypes.string.isRequired,
|
2020-08-19 16:03:15 +02:00
|
|
|
isMainnet: PropTypes.bool,
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
|
2018-08-03 23:44:57 +02:00
|
|
|
state = {
|
|
|
|
submitting: false,
|
2018-08-28 21:18:57 +02:00
|
|
|
submitError: null,
|
2019-09-27 06:30:36 +02:00
|
|
|
submitWarning: '',
|
2018-08-03 23:44:57 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
componentDidUpdate(prevProps) {
|
2018-06-23 08:52:45 +02:00
|
|
|
const {
|
|
|
|
transactionStatus,
|
|
|
|
showTransactionConfirmedModal,
|
|
|
|
history,
|
|
|
|
clearConfirmTransaction,
|
2020-06-01 19:54:32 +02:00
|
|
|
mostRecentOverviewPage,
|
2019-09-27 06:30:36 +02:00
|
|
|
nextNonce,
|
|
|
|
customNonceValue,
|
2020-03-12 14:50:37 +01:00
|
|
|
toAddress,
|
|
|
|
tryReverseResolveAddress,
|
2018-06-23 08:52:45 +02:00
|
|
|
} = this.props
|
2020-03-12 14:50:37 +01:00
|
|
|
const {
|
|
|
|
customNonceValue: prevCustomNonceValue,
|
|
|
|
nextNonce: prevNextNonce,
|
|
|
|
toAddress: prevToAddress,
|
|
|
|
transactionStatus: prevTxStatus,
|
|
|
|
} = prevProps
|
2019-04-27 11:29:55 +02:00
|
|
|
const statusUpdated = transactionStatus !== prevTxStatus
|
2020-11-03 00:41:28 +01:00
|
|
|
const txDroppedOrConfirmed =
|
2020-11-03 23:57:51 +01:00
|
|
|
transactionStatus === TRANSACTION_STATUSES.DROPPED ||
|
|
|
|
transactionStatus === TRANSACTION_STATUSES.CONFIRMED
|
2020-11-03 00:41:28 +01:00
|
|
|
|
|
|
|
if (
|
|
|
|
nextNonce !== prevNextNonce ||
|
|
|
|
customNonceValue !== prevCustomNonceValue
|
|
|
|
) {
|
2019-09-27 06:30:36 +02:00
|
|
|
if (customNonceValue > nextNonce) {
|
2020-11-03 00:41:28 +01:00
|
|
|
this.setState({
|
|
|
|
submitWarning: this.context.t('nextNonceWarning', [nextNonce]),
|
|
|
|
})
|
2019-09-27 06:30:36 +02:00
|
|
|
} else {
|
|
|
|
this.setState({ submitWarning: '' })
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-04-27 11:29:55 +02:00
|
|
|
if (statusUpdated && txDroppedOrConfirmed) {
|
2018-06-23 08:52:45 +02:00
|
|
|
showTransactionConfirmedModal({
|
2018-09-17 19:34:29 +02:00
|
|
|
onSubmit: () => {
|
2018-06-23 08:52:45 +02:00
|
|
|
clearConfirmTransaction()
|
2020-06-01 19:54:32 +02:00
|
|
|
history.push(mostRecentOverviewPage)
|
2018-06-23 08:52:45 +02:00
|
|
|
},
|
|
|
|
})
|
2020-03-12 14:50:37 +01:00
|
|
|
}
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2020-03-12 14:50:37 +01:00
|
|
|
if (toAddress && toAddress !== prevToAddress) {
|
|
|
|
tryReverseResolveAddress(toAddress)
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
getErrorKey() {
|
2018-06-23 08:52:45 +02:00
|
|
|
const {
|
|
|
|
balance,
|
|
|
|
conversionRate,
|
2018-10-17 01:03:29 +02:00
|
|
|
hexTransactionFee,
|
2020-11-03 00:41:28 +01:00
|
|
|
txData: { simulationFails, txParams: { value: amount } = {} } = {},
|
2019-05-23 15:56:40 +02:00
|
|
|
customGas,
|
2018-06-23 08:52:45 +02:00
|
|
|
} = this.props
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
const insufficientBalance =
|
|
|
|
balance &&
|
|
|
|
!isBalanceSufficient({
|
|
|
|
amount,
|
|
|
|
gasTotal: hexTransactionFee || '0x0',
|
|
|
|
balance,
|
|
|
|
conversionRate,
|
|
|
|
})
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
if (insufficientBalance) {
|
|
|
|
return {
|
|
|
|
valid: false,
|
2018-07-06 20:58:41 +02:00
|
|
|
errorKey: INSUFFICIENT_FUNDS_ERROR_KEY,
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
Use `AdvancedGasInputs` in `AdvancedTabContent` (#7186)
* Use `AdvancedGasInputs` in `AdvancedTabContent`
The `AdvancedGasInputs` component was originally extracted from the
`AdvancedTabContent` component, duplicating much of the rendering
logic. They have since evolved separately, with bugs being fixed in one
place but not the other.
The inputs and outputs expected weren't exactly the same, as the
`AdvancedGasInputs` component converts the input custom gas price and
limit, and it converts them both in the setter methods as well.
The `GasModalPageContainer` had to be adjusted to avoid converting
these values multiple times.
Both components dealt with input debouncing separately, both in less
than ideal ways. `AdvancedTabContent` didn't debounce either field, but
it did debounce the check for whether the gas limit field was below the
minimum value. So if a less-than-minimum value was set, it would be
propogated upwards and could be saved if the user clicked 'Save'
quickly enough. After a second delay it would snap back to the minimum
value. The `AdvancedGasInputs` component debounced both fields, but
it would replace any gas limit below the minimum with the minimum
value. This led to a problem where a brief pause during typing would
reset the field to 21000.
The `AdvancedGasInputs` approach was chosen, except that it was
updated to no longer change the gas limit if it was below the minimum.
Instead it displays an error. Parent components were checked to ensure
they would detect the error case of the gas limit being set too low,
and prevent the form submission in those cases. Of the three parents,
one had already dealt with it correctly, one needed to convert the
gas limit from hex first, and another needed the gas limit check added.
Closes #6872
* Cleanup send components
Empty README files have been removed, and a mistake in the index file
for the send page has been corrected. The Gas Slider component class
name was updated as well; it looks like it was originally created from
`AdvancedTabContent`, so it still had that class name.
2019-10-23 14:23:15 +02:00
|
|
|
if (hexToDecimal(customGas.gasLimit) < 21000) {
|
2019-05-23 15:56:40 +02:00
|
|
|
return {
|
|
|
|
valid: false,
|
|
|
|
errorKey: GAS_LIMIT_TOO_LOW_ERROR_KEY,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
if (simulationFails) {
|
|
|
|
return {
|
2018-08-09 01:55:25 +02:00
|
|
|
valid: true,
|
2020-11-03 00:41:28 +01:00
|
|
|
errorKey: simulationFails.errorKey
|
|
|
|
? simulationFails.errorKey
|
|
|
|
: TRANSACTION_ERROR_KEY,
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return {
|
|
|
|
valid: true,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleEditGas() {
|
|
|
|
const {
|
|
|
|
onEditGas,
|
|
|
|
showCustomizeGasModal,
|
|
|
|
actionKey,
|
|
|
|
txData: { origin },
|
|
|
|
methodData = {},
|
|
|
|
} = this.props
|
2019-03-05 16:45:01 +01:00
|
|
|
|
|
|
|
this.context.metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'User clicks "Edit" on gas',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
recipientKnown: null,
|
2020-11-03 00:41:28 +01:00
|
|
|
functionType:
|
2020-11-07 08:38:12 +01:00
|
|
|
actionKey ||
|
|
|
|
getMethodName(methodData.name) ||
|
|
|
|
TRANSACTION_CATEGORIES.CONTRACT_INTERACTION,
|
2019-03-05 16:45:01 +01:00
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
2018-06-23 08:52:45 +02:00
|
|
|
|
|
|
|
if (onEditGas) {
|
|
|
|
onEditGas()
|
|
|
|
} else {
|
2018-07-06 20:58:41 +02:00
|
|
|
showCustomizeGasModal()
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderDetails() {
|
2018-06-23 08:52:45 +02:00
|
|
|
const {
|
|
|
|
detailsComponent,
|
2018-10-17 01:03:29 +02:00
|
|
|
primaryTotalTextOverride,
|
|
|
|
secondaryTotalTextOverride,
|
|
|
|
hexTransactionFee,
|
|
|
|
hexTransactionTotal,
|
2018-06-23 08:52:45 +02:00
|
|
|
hideDetails,
|
2019-09-27 06:30:36 +02:00
|
|
|
useNonceField,
|
|
|
|
customNonceValue,
|
|
|
|
updateCustomNonce,
|
2019-02-06 01:24:28 +01:00
|
|
|
advancedInlineGasShown,
|
2019-02-08 14:50:25 +01:00
|
|
|
customGas,
|
2019-02-06 01:24:28 +01:00
|
|
|
insufficientBalance,
|
2019-02-08 14:50:25 +01:00
|
|
|
updateGasAndCalculate,
|
2019-02-26 19:30:41 +01:00
|
|
|
hideFiatConversion,
|
2019-09-27 06:30:36 +02:00
|
|
|
nextNonce,
|
|
|
|
getNextNonce,
|
2020-08-19 16:03:15 +02:00
|
|
|
isMainnet,
|
2018-06-23 08:52:45 +02:00
|
|
|
} = this.props
|
|
|
|
|
|
|
|
if (hideDetails) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2020-08-19 16:03:15 +02:00
|
|
|
const notMainnetOrTest = !(isMainnet || process.env.IN_TEST)
|
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
return (
|
|
|
|
detailsComponent || (
|
|
|
|
<div className="confirm-page-container-content__details">
|
|
|
|
<div className="confirm-page-container-content__gas-fee">
|
|
|
|
<ConfirmDetailRow
|
|
|
|
label="Gas Fee"
|
2018-10-17 01:03:29 +02:00
|
|
|
value={hexTransactionFee}
|
2020-08-19 16:03:15 +02:00
|
|
|
headerText={notMainnetOrTest ? '' : 'Edit'}
|
2020-11-03 00:41:28 +01:00
|
|
|
headerTextClassName={
|
|
|
|
notMainnetOrTest ? '' : 'confirm-detail-row__header-text--edit'
|
|
|
|
}
|
|
|
|
onHeaderClick={
|
|
|
|
notMainnetOrTest ? null : () => this.handleEditGas()
|
|
|
|
}
|
|
|
|
secondaryText={
|
|
|
|
hideFiatConversion
|
|
|
|
? this.context.t('noConversionRateAvailable')
|
|
|
|
: ''
|
|
|
|
}
|
2018-06-23 08:52:45 +02:00
|
|
|
/>
|
2020-11-03 00:41:28 +01:00
|
|
|
{advancedInlineGasShown || notMainnetOrTest ? (
|
|
|
|
<AdvancedGasInputs
|
|
|
|
updateCustomGasPrice={(newGasPrice) =>
|
|
|
|
updateGasAndCalculate({ ...customGas, gasPrice: newGasPrice })
|
|
|
|
}
|
|
|
|
updateCustomGasLimit={(newGasLimit) =>
|
|
|
|
updateGasAndCalculate({ ...customGas, gasLimit: newGasLimit })
|
|
|
|
}
|
|
|
|
customGasPrice={customGas.gasPrice}
|
|
|
|
customGasLimit={customGas.gasLimit}
|
|
|
|
insufficientBalance={insufficientBalance}
|
|
|
|
customPriceIsSafe
|
|
|
|
isSpeedUp={false}
|
|
|
|
/>
|
|
|
|
) : null}
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
2020-11-03 00:41:28 +01:00
|
|
|
<div
|
|
|
|
className={
|
|
|
|
useNonceField ? 'confirm-page-container-content__gas-fee' : null
|
|
|
|
}
|
|
|
|
>
|
2018-06-23 08:52:45 +02:00
|
|
|
<ConfirmDetailRow
|
|
|
|
label="Total"
|
2018-10-17 01:03:29 +02:00
|
|
|
value={hexTransactionTotal}
|
|
|
|
primaryText={primaryTotalTextOverride}
|
2020-11-03 00:41:28 +01:00
|
|
|
secondaryText={
|
|
|
|
hideFiatConversion
|
|
|
|
? this.context.t('noConversionRateAvailable')
|
|
|
|
: secondaryTotalTextOverride
|
|
|
|
}
|
2018-06-23 08:52:45 +02:00
|
|
|
headerText="Amount + Gas Fee"
|
|
|
|
headerTextClassName="confirm-detail-row__header-text--total"
|
2018-10-17 01:03:29 +02:00
|
|
|
primaryValueTextColor="#2f9ae0"
|
2018-06-23 08:52:45 +02:00
|
|
|
/>
|
|
|
|
</div>
|
2019-12-03 17:35:44 +01:00
|
|
|
{useNonceField ? (
|
|
|
|
<div>
|
|
|
|
<div className="confirm-detail-row">
|
|
|
|
<div className="confirm-detail-row__label">
|
2020-11-03 00:41:28 +01:00
|
|
|
{this.context.t('nonceFieldHeading')}
|
2019-12-03 17:35:44 +01:00
|
|
|
</div>
|
|
|
|
<div className="custom-nonce-input">
|
|
|
|
<TextField
|
|
|
|
type="number"
|
|
|
|
min="0"
|
2020-11-03 00:41:28 +01:00
|
|
|
placeholder={
|
|
|
|
typeof nextNonce === 'number'
|
|
|
|
? nextNonce.toString()
|
|
|
|
: null
|
|
|
|
}
|
2019-12-03 17:35:44 +01:00
|
|
|
onChange={({ target: { value } }) => {
|
|
|
|
if (!value.length || Number(value) < 0) {
|
|
|
|
updateCustomNonce('')
|
|
|
|
} else {
|
|
|
|
updateCustomNonce(String(Math.floor(value)))
|
|
|
|
}
|
|
|
|
getNextNonce()
|
|
|
|
}}
|
|
|
|
fullWidth
|
|
|
|
margin="dense"
|
2020-11-03 00:41:28 +01:00
|
|
|
value={customNonceValue || ''}
|
2019-12-03 17:35:44 +01:00
|
|
|
/>
|
|
|
|
</div>
|
2019-09-27 06:30:36 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2019-12-03 17:35:44 +01:00
|
|
|
) : null}
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
|
|
|
)
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderData(functionType) {
|
2018-06-23 08:52:45 +02:00
|
|
|
const { t } = this.context
|
|
|
|
const {
|
2020-11-03 00:41:28 +01:00
|
|
|
txData: { txParams: { data } = {} } = {},
|
|
|
|
methodData: { params } = {},
|
2018-06-23 08:52:45 +02:00
|
|
|
hideData,
|
|
|
|
dataComponent,
|
|
|
|
} = this.props
|
|
|
|
|
|
|
|
if (hideData) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
return (
|
|
|
|
dataComponent || (
|
|
|
|
<div className="confirm-page-container-content__data">
|
|
|
|
<div className="confirm-page-container-content__data-box-label">
|
|
|
|
{`${t('functionType')}:`}
|
|
|
|
<span className="confirm-page-container-content__function-type">
|
|
|
|
{functionType}
|
|
|
|
</span>
|
|
|
|
</div>
|
|
|
|
{params && (
|
2018-07-14 22:47:07 +02:00
|
|
|
<div className="confirm-page-container-content__data-box">
|
|
|
|
<div className="confirm-page-container-content__data-field-label">
|
2020-11-03 00:41:28 +01:00
|
|
|
{`${t('parameters')}:`}
|
2018-07-14 22:47:07 +02:00
|
|
|
</div>
|
|
|
|
<div>
|
2020-11-03 00:41:28 +01:00
|
|
|
<pre>{JSON.stringify(params, null, 2)}</pre>
|
2018-07-14 22:47:07 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-11-03 00:41:28 +01:00
|
|
|
)}
|
|
|
|
<div className="confirm-page-container-content__data-box-label">
|
|
|
|
{`${t('hexData')}: ${ethUtil.toBuffer(data).length} bytes`}
|
|
|
|
</div>
|
|
|
|
<div className="confirm-page-container-content__data-box">{data}</div>
|
2018-06-23 08:52:45 +02:00
|
|
|
</div>
|
2020-11-03 00:41:28 +01:00
|
|
|
)
|
2018-06-23 08:52:45 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleEdit() {
|
|
|
|
const {
|
|
|
|
txData,
|
|
|
|
tokenData,
|
|
|
|
tokenProps,
|
|
|
|
onEdit,
|
|
|
|
actionKey,
|
|
|
|
txData: { origin },
|
|
|
|
methodData = {},
|
|
|
|
} = this.props
|
2019-03-05 16:45:01 +01:00
|
|
|
|
|
|
|
this.context.metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'Edit Transaction',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
recipientKnown: null,
|
2020-11-03 00:41:28 +01:00
|
|
|
functionType:
|
2020-11-07 08:38:12 +01:00
|
|
|
actionKey ||
|
|
|
|
getMethodName(methodData.name) ||
|
|
|
|
TRANSACTION_CATEGORIES.CONTRACT_INTERACTION,
|
2019-03-05 16:45:01 +01:00
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
onEdit({ txData, tokenData, tokenProps })
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleCancelAll() {
|
2018-09-24 07:07:19 +02:00
|
|
|
const {
|
|
|
|
cancelAllTransactions,
|
|
|
|
clearConfirmTransaction,
|
|
|
|
history,
|
2020-06-01 19:54:32 +02:00
|
|
|
mostRecentOverviewPage,
|
2018-09-24 07:07:19 +02:00
|
|
|
showRejectTransactionsConfirmationModal,
|
|
|
|
unapprovedTxCount,
|
|
|
|
} = this.props
|
2018-09-20 02:48:28 +02:00
|
|
|
|
2018-09-24 07:07:19 +02:00
|
|
|
showRejectTransactionsConfirmationModal({
|
|
|
|
unapprovedTxCount,
|
2019-11-04 19:03:57 +01:00
|
|
|
onSubmit: async () => {
|
|
|
|
this._removeBeforeUnload()
|
2018-09-24 07:07:19 +02:00
|
|
|
await cancelAllTransactions()
|
2018-09-20 02:48:28 +02:00
|
|
|
clearConfirmTransaction()
|
2020-06-01 19:54:32 +02:00
|
|
|
history.push(mostRecentOverviewPage)
|
2018-09-24 07:07:19 +02:00
|
|
|
},
|
|
|
|
})
|
2018-09-20 02:48:28 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleCancel() {
|
2019-03-05 16:45:01 +01:00
|
|
|
const { metricsEvent } = this.context
|
2019-09-27 06:30:36 +02:00
|
|
|
const {
|
|
|
|
onCancel,
|
|
|
|
txData,
|
|
|
|
cancelTransaction,
|
|
|
|
history,
|
2020-06-01 19:54:32 +02:00
|
|
|
mostRecentOverviewPage,
|
2019-09-27 06:30:36 +02:00
|
|
|
clearConfirmTransaction,
|
|
|
|
actionKey,
|
|
|
|
txData: { origin },
|
|
|
|
methodData = {},
|
|
|
|
updateCustomNonce,
|
|
|
|
} = this.props
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2019-11-04 19:03:57 +01:00
|
|
|
this._removeBeforeUnload()
|
2019-09-24 23:08:38 +02:00
|
|
|
metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'Cancel',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
recipientKnown: null,
|
2020-11-03 00:41:28 +01:00
|
|
|
functionType:
|
2020-11-07 08:38:12 +01:00
|
|
|
actionKey ||
|
|
|
|
getMethodName(methodData.name) ||
|
|
|
|
TRANSACTION_CATEGORIES.CONTRACT_INTERACTION,
|
2019-09-24 23:08:38 +02:00
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
2019-09-27 06:30:36 +02:00
|
|
|
updateCustomNonce('')
|
2018-06-23 08:52:45 +02:00
|
|
|
if (onCancel) {
|
|
|
|
onCancel(txData)
|
|
|
|
} else {
|
2020-11-03 00:41:28 +01:00
|
|
|
cancelTransaction(txData).then(() => {
|
|
|
|
clearConfirmTransaction()
|
|
|
|
history.push(mostRecentOverviewPage)
|
|
|
|
})
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleSubmit() {
|
2019-03-05 16:45:01 +01:00
|
|
|
const { metricsEvent } = this.context
|
2019-09-27 06:30:36 +02:00
|
|
|
const {
|
|
|
|
txData: { origin },
|
|
|
|
sendTransaction,
|
|
|
|
clearConfirmTransaction,
|
|
|
|
txData,
|
|
|
|
history,
|
|
|
|
onSubmit,
|
|
|
|
actionKey,
|
2020-06-01 19:54:32 +02:00
|
|
|
mostRecentOverviewPage,
|
2019-09-27 06:30:36 +02:00
|
|
|
metaMetricsSendCount = 0,
|
|
|
|
setMetaMetricsSendCount,
|
|
|
|
methodData = {},
|
|
|
|
updateCustomNonce,
|
|
|
|
} = this.props
|
2018-08-03 23:44:57 +02:00
|
|
|
const { submitting } = this.state
|
|
|
|
|
|
|
|
if (submitting) {
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
this.setState(
|
|
|
|
{
|
|
|
|
submitting: true,
|
|
|
|
submitError: null,
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
this._removeBeforeUnload()
|
|
|
|
metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'Transaction Completed',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
recipientKnown: null,
|
|
|
|
functionType:
|
|
|
|
actionKey ||
|
|
|
|
getMethodName(methodData.name) ||
|
2020-11-07 08:38:12 +01:00
|
|
|
TRANSACTION_CATEGORIES.CONTRACT_INTERACTION,
|
2020-11-03 00:41:28 +01:00
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
2019-03-05 16:45:01 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
setMetaMetricsSendCount(metaMetricsSendCount + 1).then(() => {
|
2019-03-05 16:45:01 +01:00
|
|
|
if (onSubmit) {
|
2020-11-03 00:41:28 +01:00
|
|
|
Promise.resolve(onSubmit(txData)).then(() => {
|
|
|
|
this.setState({
|
|
|
|
submitting: false,
|
2019-03-05 16:45:01 +01:00
|
|
|
})
|
2020-11-03 00:41:28 +01:00
|
|
|
updateCustomNonce('')
|
|
|
|
})
|
2019-03-05 16:45:01 +01:00
|
|
|
} else {
|
|
|
|
sendTransaction(txData)
|
|
|
|
.then(() => {
|
|
|
|
clearConfirmTransaction()
|
2020-11-03 00:41:28 +01:00
|
|
|
this.setState(
|
|
|
|
{
|
|
|
|
submitting: false,
|
|
|
|
},
|
|
|
|
() => {
|
|
|
|
history.push(mostRecentOverviewPage)
|
|
|
|
updateCustomNonce('')
|
|
|
|
},
|
|
|
|
)
|
2019-03-05 16:45:01 +01:00
|
|
|
})
|
2020-02-15 21:34:12 +01:00
|
|
|
.catch((error) => {
|
2019-03-05 16:45:01 +01:00
|
|
|
this.setState({
|
|
|
|
submitting: false,
|
|
|
|
submitError: error.message,
|
|
|
|
})
|
2019-10-02 20:12:04 +02:00
|
|
|
updateCustomNonce('')
|
2019-03-05 16:45:01 +01:00
|
|
|
})
|
|
|
|
}
|
|
|
|
})
|
2020-11-03 00:41:28 +01:00
|
|
|
},
|
|
|
|
)
|
2018-06-23 08:52:45 +02:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderTitleComponent() {
|
2018-10-17 01:03:29 +02:00
|
|
|
const { title, titleComponent, hexTransactionAmount } = this.props
|
|
|
|
|
|
|
|
// Title string passed in by props takes priority
|
|
|
|
if (title) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
return (
|
|
|
|
titleComponent || (
|
|
|
|
<UserPreferencedCurrencyDisplay
|
|
|
|
value={hexTransactionAmount}
|
|
|
|
type={PRIMARY}
|
|
|
|
showEthLogo
|
|
|
|
ethLogoHeight="26"
|
|
|
|
hideLabel
|
|
|
|
/>
|
|
|
|
)
|
2018-10-17 01:03:29 +02:00
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
renderSubtitleComponent() {
|
2018-10-17 01:03:29 +02:00
|
|
|
const { subtitle, subtitleComponent, hexTransactionAmount } = this.props
|
|
|
|
|
|
|
|
// Subtitle string passed in by props takes priority
|
|
|
|
if (subtitle) {
|
|
|
|
return null
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
return (
|
|
|
|
subtitleComponent || (
|
|
|
|
<UserPreferencedCurrencyDisplay
|
|
|
|
value={hexTransactionAmount}
|
|
|
|
type={SECONDARY}
|
|
|
|
showEthLogo
|
|
|
|
hideLabel
|
|
|
|
/>
|
|
|
|
)
|
2018-10-17 01:03:29 +02:00
|
|
|
)
|
|
|
|
}
|
2018-11-17 01:54:55 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
handleNextTx(txId) {
|
2018-11-13 18:19:12 +01:00
|
|
|
const { history, clearConfirmTransaction } = this.props
|
2019-06-18 14:17:14 +02:00
|
|
|
|
2018-11-13 18:19:12 +01:00
|
|
|
if (txId) {
|
|
|
|
clearConfirmTransaction()
|
|
|
|
history.push(`${CONFIRM_TRANSACTION_ROUTE}/${txId}`)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
getNavigateTxData() {
|
2018-11-13 18:19:12 +01:00
|
|
|
const { currentNetworkUnapprovedTxs, txData: { id } = {} } = this.props
|
2020-01-10 15:34:02 +01:00
|
|
|
const enumUnapprovedTxs = Object.keys(currentNetworkUnapprovedTxs)
|
2019-06-18 14:17:14 +02:00
|
|
|
const currentPosition = enumUnapprovedTxs.indexOf(id ? id.toString() : '')
|
2018-11-13 18:19:12 +01:00
|
|
|
|
|
|
|
return {
|
|
|
|
totalTx: enumUnapprovedTxs.length,
|
|
|
|
positionOfCurrentTx: currentPosition + 1,
|
|
|
|
nextTxId: enumUnapprovedTxs[currentPosition + 1],
|
|
|
|
prevTxId: enumUnapprovedTxs[currentPosition - 1],
|
|
|
|
showNavigation: enumUnapprovedTxs.length > 1,
|
|
|
|
firstTx: enumUnapprovedTxs[0],
|
|
|
|
lastTx: enumUnapprovedTxs[enumUnapprovedTxs.length - 1],
|
|
|
|
ofText: this.context.t('ofTextNofM'),
|
|
|
|
requestsWaitingText: this.context.t('requestsAwaitingAcknowledgement'),
|
|
|
|
}
|
|
|
|
}
|
2018-10-17 01:03:29 +02:00
|
|
|
|
2019-11-04 19:03:57 +01:00
|
|
|
_beforeUnload = () => {
|
|
|
|
const { txData: { origin, id } = {}, cancelTransaction } = this.props
|
|
|
|
const { metricsEvent } = this.context
|
|
|
|
metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'Cancel Tx Via Notification Close',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
|
|
|
cancelTransaction({ id })
|
|
|
|
}
|
|
|
|
|
|
|
|
_removeBeforeUnload = () => {
|
2020-01-24 20:12:58 +01:00
|
|
|
if (getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION) {
|
2019-11-04 19:03:57 +01:00
|
|
|
window.removeEventListener('beforeunload', this._beforeUnload)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
componentDidMount() {
|
|
|
|
const {
|
|
|
|
toAddress,
|
|
|
|
txData: { origin } = {},
|
|
|
|
getNextNonce,
|
|
|
|
tryReverseResolveAddress,
|
|
|
|
} = this.props
|
2019-03-05 16:45:01 +01:00
|
|
|
const { metricsEvent } = this.context
|
|
|
|
metricsEvent({
|
|
|
|
eventOpts: {
|
|
|
|
category: 'Transactions',
|
|
|
|
action: 'Confirm Screen',
|
|
|
|
name: 'Confirm: Started',
|
|
|
|
},
|
|
|
|
customVariables: {
|
|
|
|
origin,
|
|
|
|
},
|
|
|
|
})
|
2019-03-25 17:19:23 +01:00
|
|
|
|
2020-01-24 20:12:58 +01:00
|
|
|
if (getEnvironmentType() === ENVIRONMENT_TYPE_NOTIFICATION) {
|
2019-11-04 19:03:57 +01:00
|
|
|
window.addEventListener('beforeunload', this._beforeUnload)
|
2019-03-25 17:19:23 +01:00
|
|
|
}
|
2019-09-27 06:30:36 +02:00
|
|
|
|
|
|
|
getNextNonce()
|
2020-03-12 14:50:37 +01:00
|
|
|
if (toAddress) {
|
|
|
|
tryReverseResolveAddress(toAddress)
|
|
|
|
}
|
2019-03-05 16:45:01 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
componentWillUnmount() {
|
2019-11-04 19:03:57 +01:00
|
|
|
this._removeBeforeUnload()
|
2019-10-31 17:27:22 +01:00
|
|
|
}
|
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
render() {
|
2020-03-19 05:03:20 +01:00
|
|
|
const { t } = this.context
|
2018-06-23 08:52:45 +02:00
|
|
|
const {
|
|
|
|
isTxReprice,
|
|
|
|
fromName,
|
|
|
|
fromAddress,
|
|
|
|
toName,
|
|
|
|
toAddress,
|
2019-11-01 18:54:00 +01:00
|
|
|
toEns,
|
2019-08-08 20:45:30 +02:00
|
|
|
toNickname,
|
2018-06-28 20:23:31 +02:00
|
|
|
methodData,
|
2018-08-03 23:44:57 +02:00
|
|
|
valid: propsValid = true,
|
2018-07-06 20:58:41 +02:00
|
|
|
errorMessage,
|
|
|
|
errorKey: propsErrorKey,
|
2018-06-23 08:52:45 +02:00
|
|
|
title,
|
|
|
|
subtitle,
|
|
|
|
hideSubtitle,
|
|
|
|
identiconAddress,
|
|
|
|
summaryComponent,
|
|
|
|
contentComponent,
|
|
|
|
onEdit,
|
|
|
|
nonce,
|
2019-09-27 06:30:36 +02:00
|
|
|
customNonceValue,
|
2018-08-30 04:13:25 +02:00
|
|
|
assetImage,
|
2018-06-23 08:52:45 +02:00
|
|
|
warning,
|
2018-09-20 02:48:28 +02:00
|
|
|
unapprovedTxCount,
|
2019-06-18 14:17:14 +02:00
|
|
|
transactionCategory,
|
2019-11-05 16:13:48 +01:00
|
|
|
hideSenderToRecipient,
|
|
|
|
showAccountInHeader,
|
2018-06-23 08:52:45 +02:00
|
|
|
} = this.props
|
2019-09-27 06:30:36 +02:00
|
|
|
const { submitting, submitError, submitWarning } = this.state
|
2018-06-23 08:52:45 +02:00
|
|
|
|
2018-06-28 20:23:31 +02:00
|
|
|
const { name } = methodData
|
2018-07-06 20:58:41 +02:00
|
|
|
const { valid, errorKey } = this.getErrorKey()
|
2020-11-03 00:41:28 +01:00
|
|
|
const {
|
|
|
|
totalTx,
|
|
|
|
positionOfCurrentTx,
|
|
|
|
nextTxId,
|
|
|
|
prevTxId,
|
|
|
|
showNavigation,
|
|
|
|
firstTx,
|
|
|
|
lastTx,
|
|
|
|
ofText,
|
|
|
|
requestsWaitingText,
|
|
|
|
} = this.getNavigateTxData()
|
2020-03-19 05:03:20 +01:00
|
|
|
|
|
|
|
let functionType = getMethodName(name)
|
|
|
|
if (!functionType) {
|
2020-03-23 15:54:57 +01:00
|
|
|
if (transactionCategory) {
|
|
|
|
functionType = t(transactionCategory) || transactionCategory
|
|
|
|
} else {
|
|
|
|
functionType = t('contractInteraction')
|
|
|
|
}
|
2020-03-19 05:03:20 +01:00
|
|
|
}
|
|
|
|
|
2018-06-23 08:52:45 +02:00
|
|
|
return (
|
|
|
|
<ConfirmPageContainer
|
|
|
|
fromName={fromName}
|
|
|
|
fromAddress={fromAddress}
|
2019-11-05 16:13:48 +01:00
|
|
|
showAccountInHeader={showAccountInHeader}
|
2018-06-23 08:52:45 +02:00
|
|
|
toName={toName}
|
|
|
|
toAddress={toAddress}
|
2019-11-01 18:54:00 +01:00
|
|
|
toEns={toEns}
|
2019-08-08 20:45:30 +02:00
|
|
|
toNickname={toNickname}
|
2018-06-23 08:52:45 +02:00
|
|
|
showEdit={onEdit && !isTxReprice}
|
2020-03-19 05:03:20 +01:00
|
|
|
action={functionType}
|
2018-10-17 01:03:29 +02:00
|
|
|
title={title}
|
|
|
|
titleComponent={this.renderTitleComponent()}
|
|
|
|
subtitle={subtitle}
|
|
|
|
subtitleComponent={this.renderSubtitleComponent()}
|
2018-06-23 08:52:45 +02:00
|
|
|
hideSubtitle={hideSubtitle}
|
|
|
|
summaryComponent={summaryComponent}
|
|
|
|
detailsComponent={this.renderDetails()}
|
2020-03-19 05:03:20 +01:00
|
|
|
dataComponent={this.renderData(functionType)}
|
2018-06-23 08:52:45 +02:00
|
|
|
contentComponent={contentComponent}
|
2019-09-27 06:30:36 +02:00
|
|
|
nonce={customNonceValue || nonce}
|
2018-09-20 02:48:28 +02:00
|
|
|
unapprovedTxCount={unapprovedTxCount}
|
2018-08-30 04:13:25 +02:00
|
|
|
assetImage={assetImage}
|
2018-06-23 08:52:45 +02:00
|
|
|
identiconAddress={identiconAddress}
|
2018-08-28 21:18:57 +02:00
|
|
|
errorMessage={errorMessage || submitError}
|
2018-07-06 20:58:41 +02:00
|
|
|
errorKey={propsErrorKey || errorKey}
|
2019-09-27 06:30:36 +02:00
|
|
|
warning={warning || submitWarning}
|
2018-11-13 18:19:12 +01:00
|
|
|
totalTx={totalTx}
|
|
|
|
positionOfCurrentTx={positionOfCurrentTx}
|
|
|
|
nextTxId={nextTxId}
|
|
|
|
prevTxId={prevTxId}
|
|
|
|
showNavigation={showNavigation}
|
|
|
|
onNextTx={(txId) => this.handleNextTx(txId)}
|
|
|
|
firstTx={firstTx}
|
|
|
|
lastTx={lastTx}
|
|
|
|
ofText={ofText}
|
|
|
|
requestsWaitingText={requestsWaitingText}
|
2018-08-03 23:44:57 +02:00
|
|
|
disabled={!propsValid || !valid || submitting}
|
2018-06-23 08:52:45 +02:00
|
|
|
onEdit={() => this.handleEdit()}
|
2018-09-20 02:48:28 +02:00
|
|
|
onCancelAll={() => this.handleCancelAll()}
|
2018-06-23 08:52:45 +02:00
|
|
|
onCancel={() => this.handleCancel()}
|
|
|
|
onSubmit={() => this.handleSubmit()}
|
2019-11-05 16:13:48 +01:00
|
|
|
hideSenderToRecipient={hideSenderToRecipient}
|
2018-06-23 08:52:45 +02:00
|
|
|
/>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
}
|
2019-02-19 06:36:12 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
export function getMethodName(camelCase) {
|
2019-02-19 06:36:12 +01:00
|
|
|
if (!camelCase || typeof camelCase !== 'string') {
|
|
|
|
return ''
|
|
|
|
}
|
|
|
|
|
|
|
|
return camelCase
|
2020-11-03 00:41:28 +01:00
|
|
|
.replace(/([a-z])([A-Z])/gu, '$1 $2')
|
|
|
|
.replace(/([A-Z])([a-z])/gu, ' $1$2')
|
|
|
|
.replace(/ +/gu, ' ')
|
2019-02-19 06:36:12 +01:00
|
|
|
}
|