Skip to content
This repository has been archived by the owner on May 24, 2022. It is now read-only.

Commit

Permalink
refactor: Combine into single if statement when checking if valid Eth…
Browse files Browse the repository at this point in the history
…/Etc address
  • Loading branch information
ltfschoen committed Apr 12, 2019
1 parent 2e7a89e commit b5296af
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions packages/fether-react/src/Send/TxForm/TxForm.js
Original file line number Diff line number Diff line change
Expand Up @@ -423,16 +423,12 @@ class TxForm extends Component {
};
} else if (balance && balance.lt(amountBn)) {
return { amount: `You don't have enough ${token.symbol} balance` };
} else if (
(!values.to || !isAddress(values.to)) &&
!isEtcChainId(currentChainIdBN)
) {
return { to: 'Please enter a valid Ethereum address' };
} else if (
(!values.to || isAddress(values.to)) &&
isEtcChainId(currentChainIdBN)
) {
return { to: 'Please enter a valid Ethereum Classic address' };
} else if (!values.to || !isAddress(values.to)) {
return {
to: `Please enter a valid Ethereum ${
isEtcChainId(currentChainIdBN) ? 'Classic address' : 'address'
}`
};
} else if (values.to === '0x0000000000000000000000000000000000000000') {
return {
to: `You are not permitted to send ${
Expand Down

0 comments on commit b5296af

Please sign in to comment.