From d202fea17186476cface084158bf50aed3fbef4c Mon Sep 17 00:00:00 2001 From: Bradley Suira Date: Sat, 23 Jan 2021 14:34:03 -0500 Subject: [PATCH] fix rsk label map in settings screen --- package-lock.json | 2 +- package.json | 2 +- src/components/AssetDropdown.vue | 18 +++++++++--------- src/manifest.json | 2 +- src/views/Settings.vue | 25 ++++++++++++++----------- src/views/Swap.vue | 18 ++++++++++++------ 6 files changed, 38 insertions(+), 29 deletions(-) diff --git a/package-lock.json b/package-lock.json index 49d13d7e9..6f33813ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "liquality-wallet", - "version": "0.13.2", + "version": "0.13.3", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 34aa5c3a3..3ef0ead59 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "liquality-wallet", - "version": "0.13.2", + "version": "0.13.3", "private": true, "license": "MIT", "author": "Liquality ", diff --git a/src/components/AssetDropdown.vue b/src/components/AssetDropdown.vue index 538c25a3e..c1630cddd 100644 --- a/src/components/AssetDropdown.vue +++ b/src/components/AssetDropdown.vue @@ -6,11 +6,11 @@
- {{ selected }} + {{ selected.label }}
@@ -32,16 +32,16 @@ -
  • +
  • @@ -86,14 +86,14 @@ export default { }, computed: { items () { - return this.assets.filter(a => a !== this.selected) + return this.assets.filter(a => a.name !== this.selected.name) } }, watch: { search (newSearch, oldSearch) { if (newSearch && newSearch !== oldSearch) { this.filteredItems = this.items.filter( - a => a.toUpperCase().includes(newSearch.toUpperCase()) + a => a.name.toUpperCase().includes(newSearch.toUpperCase()) ) } else { this.filteredItems = [...this.items] @@ -103,7 +103,7 @@ export default { if (newAssets && newAssets !== oldAssets) { if (this.search) { this.filteredItems = this.items.filter( - a => a.toUpperCase().includes(this.search.toUpperCase()) + a => a.name.toUpperCase().includes(this.search.toUpperCase()) ) } else { this.filteredItems = [...this.items] @@ -117,7 +117,7 @@ export default { selectItem (asset) { this.$emit('asset-changed', asset) this.dropdownOpen = false - this.filteredItems = this.assets.filter(a => a !== asset) + this.filteredItems = this.assets.filter(a => a.name !== asset.name) }, toogle () { this.dropdownOpen = !this.dropdownOpen diff --git a/src/manifest.json b/src/manifest.json index 82ba22c04..4f0dffa51 100644 --- a/src/manifest.json +++ b/src/manifest.json @@ -1,6 +1,6 @@ { "manifest_version": 2, - "version": "0.13.2", + "version": "0.13.3", "name": "Liquality Wallet", "description": "Secure multi-crypto wallet with built-in Atomic Swaps!", "homepage_url": "https://liquality.io", diff --git a/src/views/Settings.vue b/src/views/Settings.vue index 28615e221..657b0870f 100644 --- a/src/views/Settings.vue +++ b/src/views/Settings.vue @@ -18,7 +18,7 @@
    @@ -46,13 +46,17 @@ export default { ...mapState(['activeNetwork', 'activeWalletId', 'injectEthereum', 'injectEthereumAsset']), ethereumAssets () { return Object.keys(cryptoassets) - .filter(isEthereumChain).map(a => { - if (a === 'RBTC') { - return 'RSK' - } - return a + .filter(isEthereumChain) + .map(asset => { + const label = this.getLabel(asset) + return { name: asset, label } }) }, + selectedAsset () { + const label = this.getLabel(this.injectEthereumAsset) + const name = this.injectEthereumAsset === 'RSK' ? 'RBTC' : this.injectEthereumAsset + return { name, label } + }, appVersion () { return version } @@ -64,11 +68,10 @@ export default { else this.disableEthereumInjection() }, updateInjectEthereumAsset (asset) { - // Update back to RBTC as asset - if (asset === 'RSK') { - asset = 'RBTC' - } - this.setEthereumInjectionAsset({ asset }) + this.setEthereumInjectionAsset({ asset: asset.name }) + }, + getLabel (asset) { + return asset === 'RBTC' ? 'RSK' : asset } } } diff --git a/src/views/Swap.vue b/src/views/Swap.vue index 1b25d0bf0..8e79c7f9a 100644 --- a/src/views/Swap.vue +++ b/src/views/Swap.vue @@ -26,8 +26,8 @@
    - @@ -112,8 +112,8 @@
    - @@ -678,6 +678,12 @@ export default { prettyFiatBalance(this.totalFees[this.toAssetChain], this.fiatRates[this.toAssetChain]) ) return amount.toFormat(2) + }, + assetList () { + return this.assets.map(a => ({ name: a, label: a })) + }, + toAssetList () { + return this.toAssets.map(a => ({ name: a, label: a })) } }, methods: { @@ -712,7 +718,7 @@ export default { } }, setToAsset (val) { - this.toAsset = val + this.toAsset = val.name if (this.amountOption === 'max') { this.sendAmount = this.max } else { @@ -722,7 +728,7 @@ export default { this.resetFees() }, setAsset (val) { - this.asset = val + this.asset = val.name this.toAsset = Object.keys(this.selectedMarket)[0] this.sendAmount = this.min this.resetFees()