Skip to content

Commit

Permalink
Add shortnames to networks util, TransactionHeader: use networks util…
Browse files Browse the repository at this point in the history
… to display network name, update snapshot
  • Loading branch information
EtDu authored and danjm committed Apr 23, 2020
1 parent b623cef commit 6e8d98a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ exports[`TransactionHeader should render correctly 1`] = `
}
}
>
ropsten
Ropsten
</Text>
</View>
</View>
Expand Down
4 changes: 3 additions & 1 deletion app/components/UI/TransactionHeader/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { colors, fontStyles } from '../../../styles/common';
import { connect } from 'react-redux';
import WebsiteIcon from '../WebsiteIcon';
import { getHost, getUrlObj } from '../../../util/browser';
import networkList from '../../../util/networks';
import FontAwesome from 'react-native-vector-icons/FontAwesome';

const styles = StyleSheet.create({
Expand Down Expand Up @@ -115,6 +116,7 @@ class TransactionHeader extends PureComponent {
networkType
} = this.props;
const title = getHost(url);
const networkName = networkList[networkType].shortName;
return (
<View style={styles.transactionHeader}>
<WebsiteIcon style={styles.domainLogo} viewStyle={styles.assetLogo} title={title} url={url} />
Expand All @@ -124,7 +126,7 @@ class TransactionHeader extends PureComponent {
</View>
<View style={styles.networkContainer}>
{this.renderNetworkStatusIndicator()}
<Text style={styles.network}>{networkType === 'mainnet' ? 'Ethereum' : networkType}</Text>
<Text style={styles.network}>{networkName}</Text>
</View>
</View>
);
Expand Down
6 changes: 6 additions & 0 deletions app/util/networks.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,42 @@ import URL from 'url-parse';
const NetworkList = {
mainnet: {
name: 'Ethereum Main Network',
shortName: 'Ethereum',
networkId: 1,
chainId: 1,
color: '#3cc29e'
},
ropsten: {
name: 'Ropsten Test Network',
shortName: 'Ropsten',
networkId: 3,
chainId: 3,
color: '#ff4a8d'
},
kovan: {
name: 'Kovan Test Network',
shortName: 'Kovan',
networkId: 42,
chainId: 42,
color: '#7057ff'
},
rinkeby: {
name: 'Rinkeby Test Network',
shortName: 'Rinkeby',
networkId: 4,
chainId: 4,
color: '#f6c343'
},
goerli: {
name: 'Goerli Test Network',
shortName: 'Goerli',
networkId: 5,
chainId: 5,
color: '#3099f2'
},
rpc: {
name: 'Private Network',
shortName: 'Private',
color: colors.grey000
}
};
Expand Down

0 comments on commit 6e8d98a

Please sign in to comment.