Skip to content

Commit

Permalink
restrict network names to latin characters
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveMieskoski committed Aug 21, 2019
1 parent b621a15 commit f534c49
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 13 deletions.
33 changes: 21 additions & 12 deletions src/layouts/InterfaceLayout/InterfaceLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -472,19 +472,25 @@ export default {
}
});
},
checkAndSetNetwork(id) {
if (this.network.type.chainID.toString() !== `${id}`) {
Object.keys(networkTypes).some(net => {
if (
networkTypes[net].chainID.toString() === `${id}` &&
this.Networks[net]
) {
this.$store.dispatch('switchNetwork', this.Networks[net][0]);
return true;
}
});
}
},
matchMetamaskNetwork() {
this.web3.eth.net.getId().then(id => {
this.checkAndSetNetwork(id);
});
window.ethereum.on('networkChanged', netId => {
if (this.network.type.chainID.toString() !== netId) {
Object.keys(networkTypes).some(net => {
if (
networkTypes[net].chainID.toString() === netId &&
this.Networks[net]
) {
this.$store.dispatch('switchNetwork', this.Networks[net][0]);
return true;
}
});
}
this.checkAndSetNetwork(netId);
});
},
setupOnlineEnvironment: web3Utils._.debounce(function() {
Expand All @@ -498,7 +504,10 @@ export default {
if (this.online) {
if (this.account.address !== null) {
if (this.account.identifier === WEB3_TYPE) {
if (window.web3.currentProvider.isMetamask) {
if (
window.web3.currentProvider.isMetaMask ||
window.web3.currentProvider.isMew
) {
this.checkMetamaskAddrChange();
this.matchMetamaskNetwork();
} else {
Expand Down
2 changes: 1 addition & 1 deletion src/networks/types/GOERLI.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { GOERLI } from '../tlds';
import goerli from '@/assets/images/icons/network.svg';

export default {
name: 'GöETH',
name: 'GOERLI',
name_long: 'Goerli',
homePage: 'https://github.com/goerli/testnet',
blockExplorerTX: 'https://blockscout.com/eth/goerli/tx/[[txHash]]',
Expand Down

1 comment on commit f534c49

@mew-bot
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please sign in to comment.