Commit 3bcecfd0 authored by Kenny Tran's avatar Kenny Tran Committed by GitHub

Merge pull request #104 from kennyt/check-for-web3

Check for web3 because accessing utils
parents 4fb916a7 c4ff87cd
...@@ -56,7 +56,7 @@ class CreateExchange extends Component { ...@@ -56,7 +56,7 @@ class CreateExchange extends Component {
}; };
} }
if (!web3.utils.isAddress(tokenAddress)) { if (web3 && web3.utils && !web3.utils.isAddress(tokenAddress)) {
return { return {
isValid: false, isValid: false,
errorMessage: 'Not a valid token address', errorMessage: 'Not a valid token address',
...@@ -93,7 +93,7 @@ class CreateExchange extends Component { ...@@ -93,7 +93,7 @@ class CreateExchange extends Component {
onChange = tokenAddress => { onChange = tokenAddress => {
const { selectors, account, web3 } = this.props; const { selectors, account, web3 } = this.props;
if (web3.utils.isAddress(tokenAddress)) { if (web3 && web3.utils && web3.utils.isAddress(tokenAddress)) {
const { label, decimals } = selectors().getBalance(account, tokenAddress); const { label, decimals } = selectors().getBalance(account, tokenAddress);
this.setState({ this.setState({
label, label,
...@@ -113,7 +113,7 @@ class CreateExchange extends Component { ...@@ -113,7 +113,7 @@ class CreateExchange extends Component {
const { tokenAddress } = this.state; const { tokenAddress } = this.state;
const { account, web3, factoryAddress } = this.props; const { account, web3, factoryAddress } = this.props;
if (!web3.utils.isAddress(tokenAddress)) { if (web3 && web3.utils && !web3.utils.isAddress(tokenAddress)) {
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment