@@ -84,6 +92,7 @@ import {
BRow, BCol, BCard, BButton, BPopover, BTable,
} from 'bootstrap-vue'
import { getPairName } from '@/libs/osmos'
+import { formatTokenDenom } from '@/libs/data'
import Place from './components/KlineTrade/Place.vue'
import Kline from './components/kline/index.vue'
@@ -101,13 +110,6 @@ export default {
data() {
return {
show: false,
- // pairs: [
- // { pair: 'ATOM/OSMO' },
- // { pair: 'IRIS/OSMO' },
- // { pair: 'AKT/OSMO' },
- // { pair: 'ATOM/OSMO' },
- // { pair: 'ATOM/OSMO' },
- // ],
pools: [],
current: {},
denomTrace: [],
@@ -123,28 +125,26 @@ export default {
},
pairs() {
const pairs = this.pools.map(x => {
- const x2 = {
+ const pair = x.poolAssets.map(t => {
+ if (t.token.denom.startsWith('ibc/')) {
+ return formatTokenDenom(this.denomTrace[t.token.denom] ? this.denomTrace[t.token.denom].base_denom : ' ')
+ }
+ return formatTokenDenom(t.token.denom)
+ })
+ return {
id: x.id,
- pair: x.poolAssets.map(t => {
- if (t.token.denom.startsWith('ibc/')) {
- return (this.denomTrace[t.token.denom] ? this.denomTrace[t.token.denom].base_denom : ' ')
- }
- return t.token.denom
- }),
+ pair,
+ price: this.getPrice(pair),
+ change: this.getChanges(pair),
}
- return x2
})
return pairs
},
latestPrice() {
- const p1 = this.$store.state.chains.quotes[this.base]
- const p2 = this.$store.state.chains.quotes[this.target]
- return p1 && p2 ? (p1.usd / p2.usd).toFixed(4) : '-'
+ return this.getPrice([this.base, this.target])
},
changesIn24H() {
- const p1 = this.$store.state.chains.quotes[this.base]
- const p2 = this.$store.state.chains.quotes[this.target]
- return p1 && p2 ? (p1.usd_24h_change / p2.usd_24h_change).toFixed(2) : '-'
+ return this.getChanges([this.base, this.target])
},
},
created() {
@@ -173,6 +173,16 @@ export default {
// }
},
methods: {
+ getPrice(symbol) {
+ const p1 = this.$store.state.chains.quotes[symbol[0]]
+ const p2 = this.$store.state.chains.quotes[symbol[1]]
+ return p1 && p2 ? (p1.usd / p2.usd).toFixed(4) : '-'
+ },
+ getChanges(symbol) {
+ const p1 = this.$store.state.chains.quotes[symbol[0]]
+ const p2 = this.$store.state.chains.quotes[symbol[1]]
+ return p1 && p2 ? (p1.usd_24h_change / p2.usd_24h_change).toFixed(2) : '-'
+ },
init(poolid) {
this.current = this.pools.find(p => p.id === poolid) || this.pools[0]
},
diff --git a/src/views/components/KlineTrade/DepositeWindow.vue b/src/views/components/KlineTrade/DepositeWindow.vue
index 437b8eaf..dd16ad24 100644
--- a/src/views/components/KlineTrade/DepositeWindow.vue
+++ b/src/views/components/KlineTrade/DepositeWindow.vue
@@ -12,277 +12,279 @@
@hidden="resetModal"
@ok="handleOk"
@show="loadBalance"
- >
-
-
-
- IBC Module is not enabled.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- -- Please select a token --
-
-
-
- {{ format(item) }}
-
-
- {{ errors[0] }}
-
-
-
-
-
-
-
-
+
+
+
+
+ IBC Module is not enabled.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ -- Please select a token --
+
+
+
+ {{ format(item) }}
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ printDenom() }}
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+
+
+
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+ Advance
+
+
+
+
+
+
+
+
+
-
- {{ printDenom() }}
-
-
- {{ errors[0] }}
-
-
-
-
-
-
-
- {{ errors[0] }}
+
+
+
+
+
-
- {{ errors[0] }}
-
-
-
-
-
-
-
-
-
-
-
- {{ errors[0] }}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- {{ errors[0] }}
-
-
-
-
-
-
- Advance
-
-
-
-
-
-
-
-
-
- {{ errors[0] }}
-
-
-
-
-
-
-
- {{ errors[0] }}
-
-
-
-
-
-
-
-
-
-
-
+ {{ errors[0] }}
+
+
+
+
+
+
+
+
+
+
- Keplr
-
-
- Ledger(USB)
-
-
- Ledger(Bluetooth)
-
-
- {{ errors[0] }}
-
-
-
-
-
-
- {{ error }}
-
+
+ Keplr
+
+
+ Ledger(USB)
+
+
+ Ledger(Bluetooth)
+
+
+ {{ errors[0] }}
+
+
+
+
+
+
+ {{ error }}
+