Skip to content

Commit

Permalink
Use async
Browse files Browse the repository at this point in the history
  • Loading branch information
slipo committed Dec 6, 2017
1 parent 21e56d6 commit aa7535d
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions app/components/Modals/SendModal/ConfirmDisplay.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import Button from '../../Button'
import Loader from '../../Loader'
import { formatBalance } from '../../../core/formatters'
import { openExplorerAddress } from '../../../core/explorer'
import asyncWrap from '../../../core/asyncHelper'

import styles from './SendModal.scss'

Expand All @@ -30,20 +31,19 @@ class ConfirmDisplay extends React.Component<Props, State> {
addressCheckedMessage: ''
}

checkTransactionHistory = (net, address) => {
api.neonDB.getTransactionHistory(net, address).then((transactions) => {
this.setState({ addressChecked: true })
async checkTransactionHistory (net: NetworkType, address: string) {
const [err, transactions] = await asyncWrap(api.neonDB.getTransactionHistory(net, address))

if (!transactions || !transactions.length) {
this.setState({
addressCheckedMessage: 'Warning: recipient address has no activity in its transaction history. Please be sure the address is correct before sending.'
})
}
}).catch((e) => {
this.setState({
addressChecked: true,
addressCheckedMessage: 'Warning: there was an error verifying the recipient address has activity in its transaction history.'
})
let message = ''
if (err) {
message = 'Warning: there was an error verifying the recipient address has activity in its transaction history.'
} else if (!transactions || !transactions.length) {
message = 'Warning: recipient address has no activity in its transaction history. Please be sure the address is correct before sending.'
}

this.setState({
addressChecked: true,
addressCheckedMessage: message
})
}

Expand Down

0 comments on commit aa7535d

Please sign in to comment.