Skip to content
This repository has been archived by the owner on Mar 23, 2023. It is now read-only.

Commit

Permalink
fix: network modal missing version (#1469)
Browse files Browse the repository at this point in the history
* fix: network modal missing version

* chore: remove debug

* chore: move message to locale file
  • Loading branch information
alexbarnsley authored Dec 5, 2019
1 parent 21b3a96 commit 09ec623
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 1 deletion.
24 changes: 23 additions & 1 deletion src/renderer/components/Network/NetworkModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,7 @@

<script>
import { numeric, required, requiredIf } from 'vuelidate/lib/validators'
import { NETWORKS } from '@config'
import { InputText, InputToggle } from '@/components/Input'
import { ModalLoader, ModalWindow } from '@/components/Modal'
import ClientService from '@/services/client'
Expand Down Expand Up @@ -346,7 +347,28 @@ export default {
this.form.nethash = this.network.nethash
this.form.token = this.network.token
this.form.symbol = this.network.symbol
this.form.version = this.network.version.toString()
// Temporary block to patch networks missing "version" - address prefix
if (this.network.version) {
this.form.version = this.network.version.toString()
} else {
const networkConfig = NETWORKS.find(network => network.id === this.network.id)
if (networkConfig) {
this.form.version = networkConfig.version.toString()
} else {
try {
ClientService.fetchNetworkConfig(this.form.server)
.then(network => {
this.form.version = network.version.toString()
this.$error(this.$t('MODAL_NETWORK.ADDRESS_VERSION_MISSING'))
})
} catch (error) {
this.form.version = '0'
}
}
}
this.form.explorer = this.network.explorer || ''
this.form.epoch = this.network.constants.epoch
Expand Down
1 change: 1 addition & 0 deletions src/renderer/i18n/locales/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ export default {
WIF: 'WIF',
SLIP44: 'Slip44',
ACTIVE_DELEGATES: 'Active Delegates',
ADDRESS_VERSION_MISSING: 'Address Version was missing - please check your wallets',
MARKET_TICKER: 'Market Ticker (Optional)',
FAILED_FETCH: 'Failed to fetch network information',
NETWORK_IN_USE: 'This network is in use by one or more profiles and cannot be removed',
Expand Down

0 comments on commit 09ec623

Please sign in to comment.