This commit is contained in:
liangping 2021-11-26 08:33:25 +08:00
parent d6a0b2cbc6
commit 823a4e75c5
3 changed files with 38 additions and 10 deletions

View File

@ -38,7 +38,7 @@ export function getPairName(pool, denomTrace, type = 'base') {
const index = type === 'base' ? 0 : 1
if (pool && pool.poolAssets) {
if (pool.poolAssets[index].token.denom.startsWith('ibc')) {
return formatTokenDenom(denomTrace[pool.poolAssets[index].token.denom].base_denom)
return formatTokenDenom(denomTrace[pool.poolAssets[index].token.denom]?.base_denom) || '-'
}
return formatTokenDenom(pool.poolAssets[index].token.denom)
}

View File

@ -16,6 +16,12 @@
{{ price }} {{ target }}
</dd>
</dl>
<dl>
<dt>Fee</dt>
<dd class="d-flex justify-content-end mt-1">
{{ fee }}%
</dd>
</dl>
<b-form-group>
<label for="amount">
Amount
@ -68,7 +74,7 @@
</b-form-group>
<b-form-group>
<label>
Slippage tolerance
Slippage Tolerance
</label>
<div>
<b-form-radio
@ -140,7 +146,7 @@ import {
BFormInput, BButton, BAlert, BFormGroup, BInputGroup, BInputGroupAppend, BFormRadio,
} from 'bootstrap-vue'
import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue'
import { /* abbrAddress, */ formatTokenAmount, getLocalAccounts } from '@/libs/data'
import { /* abbrAddress, */ formatTokenAmount, getLocalAccounts, percent } from '@/libs/data'
import { getPairName } from '@/libs/osmos'
import DepositeWindow from './DepositeWindow.vue'
@ -202,15 +208,24 @@ export default {
const mode = this.type === 1 ? 0 : 1
const { denom } = this.pool.poolAssets[mode].token
let amount = 0
if (Array.isArray(this.balance)) {
console.log('balance', this.balance)
this.balance.forEach(x => {
if (x.denom === denom) {
amount = x.amount
}
})
}
return formatTokenAmount(amount, 6, denom)
}
return 0
},
fee() {
if (this.pool) {
return percent(this.pool.poolParams.swapFee)
}
return '-'
},
},
created() {
this.initialAddress()
@ -219,6 +234,16 @@ export default {
this.balance = res
}
})
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
if (ret.value.base_vesting_account) {
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
this.sequence = ret.value.base_vesting_account.base_account.sequence
if (!this.sequence) this.sequence = 0
} else {
this.accountNumber = ret.value.account_number
this.sequence = ret.value.sequence ? ret.value.sequence : 0
}
})
},
methods: {
initialAddress() {
@ -239,6 +264,9 @@ export default {
changeTotal() {
this.amount = this.total / this.price
},
submitTrade() {
},
},
}
</script>

View File

@ -24,9 +24,9 @@ export default {
width: 700,
height: 600,
colors: {
colorBack: '#283046', // '#fff',
colorBack: '#00000000', // '#fff',
colorGrid: '#333', // '#eee',
colorText: '#fff',
colorText: '#aaa',
},
}
},