diff --git a/app/components/UI/TransactionEditor/index.js b/app/components/UI/TransactionEditor/index.js index 60fa324dd50..00130c0fd7d 100644 --- a/app/components/UI/TransactionEditor/index.js +++ b/app/components/UI/TransactionEditor/index.js @@ -86,7 +86,11 @@ class TransactionEditor extends PureComponent { /** * Action that sets transaction attributes from object to a transaction */ - setTransactionObject: PropTypes.func.isRequired + setTransactionObject: PropTypes.func.isRequired, + /** + * Whether was prompted from approval + */ + promptedFromApproval: PropTypes.bool }; state = { @@ -480,8 +484,11 @@ class TransactionEditor extends PureComponent { validateToAddress = () => { let error; const { - transaction: { to } + transaction: { to }, + promptedFromApproval } = this.props; + // If it comes from a dapp it could be a contract deployment + if (promptedFromApproval && !to) return error; !to && (error = strings('transaction.required')); !to && this.state.toFocused && (error = strings('transaction.required')); to && !isValidAddress(to) && (error = strings('transaction.invalid_address')); diff --git a/app/components/UI/TransactionReview/index.js b/app/components/UI/TransactionReview/index.js index a1b5fb1ca9c..033f0684944 100644 --- a/app/components/UI/TransactionReview/index.js +++ b/app/components/UI/TransactionReview/index.js @@ -18,6 +18,7 @@ import Analytics from '../../../core/Analytics'; import ANALYTICS_EVENT_OPTS from '../../../util/analytics'; import contractMap from 'eth-contract-metadata'; import AssetIcon from '../AssetIcon'; +import FontAwesome from 'react-native-vector-icons/FontAwesome'; const FONT_SIZE = PixelRatio.get() < 2 ? 12 : 16; const styles = StyleSheet.create({ @@ -208,16 +209,22 @@ class TransactionReview extends PureComponent { ); - } else { + } else if (to) { child = ( {renderAccountName(to, identities)} ); + } else { + child = ( + + {strings('transactions.to_contract')} + + ); } return ( - + {to ? : } {child} ); diff --git a/app/components/Views/Approval/__snapshots__/index.test.js.snap b/app/components/Views/Approval/__snapshots__/index.test.js.snap index 34dcffa34bc..8236fb52619 100644 --- a/app/components/Views/Approval/__snapshots__/index.test.js.snap +++ b/app/components/Views/Approval/__snapshots__/index.test.js.snap @@ -15,6 +15,7 @@ exports[`Approval should render correctly 1`] = ` onCancel={[Function]} onConfirm={[Function]} onModeChange={[Function]} + promptedFromApproval={true} transaction={ Object { "assetType": undefined, diff --git a/app/components/Views/Approval/index.js b/app/components/Views/Approval/index.js index c21f9c588fb..bb88484d9de 100644 --- a/app/components/Views/Approval/index.js +++ b/app/components/Views/Approval/index.js @@ -8,12 +8,12 @@ import { getTransactionOptionsTitle } from '../../UI/Navbar'; import { colors } from '../../../styles/common'; import { newTransaction } from '../../../actions/transaction'; import { connect } from 'react-redux'; -import { toChecksumAddress } from 'ethereumjs-util'; import TransactionsNotificationManager from '../../../core/TransactionsNotificationManager'; import Analytics from '../../../core/Analytics'; import ANALYTICS_EVENT_OPTS from '../../../util/analytics'; import { getTransactionReviewActionKey } from '../../../util/transactions'; import { strings } from '../../../../locales/i18n'; +import { safeToChecksumAddress } from '../../../util/address'; const REVIEW = 'review'; const EDIT = 'edit'; @@ -212,7 +212,7 @@ class Approval extends PureComponent { gas: BNToHex(transaction.gas), gasPrice: BNToHex(transaction.gasPrice), value: BNToHex(transaction.value), - to: toChecksumAddress(transaction.to) + to: safeToChecksumAddress(transaction.to) }); /** @@ -243,6 +243,7 @@ class Approval extends PureComponent { return (