Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn user when address being sent to has no transaction history #397

Merged
merged 3 commits into from
Dec 6, 2017

Conversation

slipo
Copy link
Contributor

@slipo slipo commented Dec 5, 2017

What current issue(s) from Trello/Github does this address?
#271

How did you solve this problem?
Check NeonDB tx history for recipient address transactions. If there are none, show warning

How did you make sure your solution works?
Check the UI sending to fresh throwaway address.

screen shot 2017-12-05 at 9 53 26 am

  • Unit tests written?

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.6%) to 40.226% when pulling 21e56d6 on slipo:no-tx-warning into 77b14d9 on CityOfZion:dev.

}

checkTransactionHistory = (net, address) => {
api.neonDB.getTransactionHistory(net, address).then((transactions) => {
Copy link
Collaborator

@evgenyboxer evgenyboxer Dec 5, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe you can do something like: (taken from transactions.js)

  let message = ''

  const [err, transactions] = await asyncWrap(api.neonDB.getTransactionHistory(net, address))
  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
  })

This way you setState only once + use the async/await.
Also - (net: NetworkType, address: string)

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.7%) to 40.119% when pulling aa7535d on slipo:no-tx-warning into 77b14d9 on CityOfZion:dev.

@dvdschwrtz-zz dvdschwrtz-zz merged commit 69afb12 into CityOfZion:dev Dec 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants