diff options
author | Dan Finlay <dan@danfinlay.com> | 2017-03-01 16:23:49 +0800 |
---|---|---|
committer | Dan Finlay <dan@danfinlay.com> | 2017-03-01 16:26:36 +0800 |
commit | 69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f (patch) | |
tree | fd30756b5a4d24f6484fa174de6f729dc41a1005 /ui/app/send.js | |
parent | 6f598570d879f8bb3e42724f7a4f303b5071cb49 (diff) | |
download | tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar.gz tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar.bz2 tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar.lz tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar.xz tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.tar.zst tangerine-wallet-browser-69d4aafc3e8fd62875e5da2c2c6c7b3bdac5bf9f.zip |
Add ens recognition to send form input
Attempts to lookup `.eth` addresses on ENS.
Is currently failing.
I've written an isolation example of the problem here:
https://github.com/flyswatter/ens-test
Diffstat (limited to 'ui/app/send.js')
-rw-r--r-- | ui/app/send.js | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/ui/app/send.js b/ui/app/send.js index 581e3afa0..a281a5fcf 100644 --- a/ui/app/send.js +++ b/ui/app/send.js @@ -9,6 +9,7 @@ const numericBalance = require('./util').numericBalance const addressSummary = require('./util').addressSummary const isHex = require('./util').isHex const EthBalance = require('./components/eth-balance') +const EnsInput = require('./components/ens-input') const ethUtil = require('ethereumjs-util') module.exports = connect(mapStateToProps)(SendTransactionScreen) @@ -18,6 +19,7 @@ function mapStateToProps (state) { accounts: state.metamask.accounts, identities: state.metamask.identities, warning: state.appState.warning, + network: state.metamask.network, } result.error = result.warning && result.warning.split('.')[0] @@ -41,6 +43,7 @@ SendTransactionScreen.prototype.render = function () { var address = state.address var account = state.account var identity = state.identity + var network = state.network return ( @@ -145,12 +148,11 @@ SendTransactionScreen.prototype.render = function () { // 'to' field h('section.flex-row.flex-center', [ - h('input.large-input', { + h(EnsInput, { name: 'address', placeholder: 'Recipient Address', - dataset: { - persistentFormId: 'recipient-address', - }, + onChange: this.recipientDidChange.bind(this), + network, }), ]), @@ -220,8 +222,13 @@ SendTransactionScreen.prototype.back = function () { this.props.dispatch(actions.backToAccountDetail(address)) } +SendTransactionScreen.prototype.recipientDidChange = function (recipient) { + this.setState({ recipient }) +} + SendTransactionScreen.prototype.onSubmit = function () { - const recipient = document.querySelector('input[name="address"]').value + const state = this.state || {} + const recipient = state.recipient || document.querySelector('input[name="address"]').value const input = document.querySelector('input[name="amount"]').value const value = util.normalizeEthStringToWei(input) const txData = document.querySelector('input[name="txData"]').value |