diff options
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r-- | ui/app/send-v2.js | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/ui/app/send-v2.js b/ui/app/send-v2.js index 9f91af0e1..c41ba9758 100644 --- a/ui/app/send-v2.js +++ b/ui/app/send-v2.js @@ -122,7 +122,7 @@ SendTransactionScreen.prototype.renderHeader = function () { SendTransactionScreen.prototype.renderFromRow = function () { const { - accounts, + fromAccounts, conversionRate, selectedAccount, setSelectedAddress, @@ -136,7 +136,7 @@ SendTransactionScreen.prototype.renderFromRow = function () { h(FromDropdown, { dropdownOpen, - accounts, + accounts: fromAccounts, selectedAccount, onSelect: address => setSelectedAddress(address), openDropdown: () => this.setState({ dropdownOpen: true }), @@ -157,7 +157,7 @@ SendTransactionScreen.prototype.handleToChange = function (event) { } SendTransactionScreen.prototype.renderToRow = function () { - const { accounts } = this.props + const { toAccounts } = this.props const { to } = this.state return h('div.send-v2__form-row', [ @@ -166,7 +166,7 @@ SendTransactionScreen.prototype.renderToRow = function () { h(ToAutoComplete, { to, - accounts, + accounts: toAccounts, onChange: this.handleToChange, }), @@ -302,6 +302,14 @@ SendTransactionScreen.prototype.render = function () { ) } +SendTransactionScreen.prototype.addToAddressBookIfNew = function (newAddress) { + const { toAccounts, addToAddressBook } = this.props + if (!toAccounts.find(({ address }) => newAddress === address)) { + // TODO: nickname, i.e. addToAddressBook(recipient, nickname) + addToAddressBook(newAddress) + } +} + SendTransactionScreen.prototype.onSubmit = function (event) { event.preventDefault() const { @@ -315,8 +323,11 @@ SendTransactionScreen.prototype.onSubmit = function (event) { signTx, selectedToken, selectedAccount: { address: from }, + toAccounts, } = this.props + this.addToAddressBookIfNew(to) + const txParams = { from, value: '0', |