From 823a4e75c580f30ed3c856c7f9b32b282808e27a Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Fri, 26 Nov 2021 08:33:25 +0800 Subject: [PATCH] add fee --- src/libs/osmos.js | 2 +- src/views/components/KlineTrade/PlaceForm.vue | 42 +++++++++++++++---- src/views/components/tvjs/index.vue | 4 +- 3 files changed, 38 insertions(+), 10 deletions(-) diff --git a/src/libs/osmos.js b/src/libs/osmos.js index 4d76e2d6..f75f8300 100644 --- a/src/libs/osmos.js +++ b/src/libs/osmos.js @@ -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) } diff --git a/src/views/components/KlineTrade/PlaceForm.vue b/src/views/components/KlineTrade/PlaceForm.vue index e82b370c..9172bd2b 100644 --- a/src/views/components/KlineTrade/PlaceForm.vue +++ b/src/views/components/KlineTrade/PlaceForm.vue @@ -16,6 +16,12 @@ {{ price }} {{ target }} +
+
Fee
+
+ {{ fee }}% +
+
{ - if (x.denom === denom) { - amount = x.amount - } - }) + 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() { + + }, }, } diff --git a/src/views/components/tvjs/index.vue b/src/views/components/tvjs/index.vue index c355e682..58d507ac 100644 --- a/src/views/components/tvjs/index.vue +++ b/src/views/components/tvjs/index.vue @@ -24,9 +24,9 @@ export default { width: 700, height: 600, colors: { - colorBack: '#283046', // '#fff', + colorBack: '#00000000', // '#fff', colorGrid: '#333', // '#eee', - colorText: '#fff', + colorText: '#aaa', }, } },