aboutsummaryrefslogtreecommitdiffstats
path: root/ui/app/send-v2.js
diff options
context:
space:
mode:
authorDan <danjm.com@gmail.com>2017-10-17 23:46:36 +0800
committerChi Kei Chan <chikeichan@gmail.com>2017-10-19 11:21:46 +0800
commit4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce (patch)
treebaf26b8a648ec1a5ad4d12abbf2d5d8ddf5eb66f /ui/app/send-v2.js
parent4915aff7505db7a1f042525a366ca0e7c6da1eed (diff)
downloadtangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar.gz
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar.bz2
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar.lz
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar.xz
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.tar.zst
tangerine-wallet-browser-4f9ac1c4fe67ec4c196ce1891ecc1743552d45ce.zip
Get from and update addressBook in send-v2
Diffstat (limited to 'ui/app/send-v2.js')
-rw-r--r--ui/app/send-v2.js19
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',