From b8678a9baad4c43eab26cc33ff4e9fea703b16ba Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Sun, 20 Mar 2022 22:57:04 +0800 Subject: [PATCH 01/14] test --- src/views/WalletAccountDetail.vue | 18 + .../OperationModal/components/Delegate.vue | 277 ++++++++++++ src/views/components/OperationModal/index.vue | 393 ++++++++++++++++++ 3 files changed, 688 insertions(+) create mode 100644 src/views/components/OperationModal/components/Delegate.vue create mode 100644 src/views/components/OperationModal/index.vue diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 72954eef..5e67d6bd 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -123,6 +123,17 @@ Delegation
+ + Delegate-new + +
@@ -373,6 +389,7 @@ import { } from '@/libs/utils' import { sha256 } from '@cosmjs/crypto' import { toHex } from '@cosmjs/encoding' +import OperationModal from '@/views/components/OperationModal/index.vue' import ObjectFieldComponent from './ObjectFieldComponent.vue' import OperationTransferComponent from './OperationTransferComponent.vue' import OperationWithdrawComponent from './OperationWithdrawComponent.vue' @@ -412,6 +429,7 @@ export default { OperationUnbondComponent, OperationTransfer2Component, ChartComponentDoughnut, + OperationModal, }, directives: { 'b-modal': VBModal, diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue new file mode 100644 index 00000000..1e82b0bf --- /dev/null +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -0,0 +1,277 @@ + + + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue new file mode 100644 index 00000000..0120d52e --- /dev/null +++ b/src/views/components/OperationModal/index.vue @@ -0,0 +1,393 @@ + + + + From 15e6b92ece09e8b912382aa5fca288333dd11fb9 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Mon, 21 Mar 2022 23:10:30 +0800 Subject: [PATCH 02/14] redelegate --- src/views/WalletAccountDetail.vue | 21 +- .../OperationModal/components/Delegate.vue | 29 ++- .../OperationModal/components/Redelegate.vue | 240 ++++++++++++++++++ src/views/components/OperationModal/index.vue | 53 +--- 4 files changed, 282 insertions(+), 61 deletions(-) create mode 100644 src/views/components/OperationModal/components/Redelegate.vue diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 5e67d6bd..cfc775e6 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -128,6 +128,7 @@ variant="primary" size="sm" class="mr-25" + @click="setOperationModalType('Delegate')" > + + + @@ -452,6 +462,7 @@ export default { unbonding: [], quotes: {}, transactions: [], + operationModalType: '', } }, computed: { @@ -638,8 +649,12 @@ export default { this.transactions = res }) }, - selectValue(v) { + selectValue(v, type) { this.selectedValidator = v + this.setOperationModalType(type) + }, + setOperationModalType(type) { + this.operationModalType = type }, formatHash: abbrAddress, formatDenom(v) { diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 1e82b0bf..5a07009c 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -210,13 +210,20 @@ export default { }, }, mounted() { - console.log('mounted----------->') this.loadBalance() }, methods: { - printDenom() { - return formatTokenDenom(this.IBCDenom[this.token] || this.token) + loadBalance() { + this.account = this.computeAccount() + this.$http.getValidatorList().then(v => { + this.validators = v + }) + this.$http.getValidatorUnbondedList().then(v => { + this.unbundValidators = v + }) + this.onChange() }, + onChange() { if (this.selectedAddress) { this.$http.getBankBalances(this.selectedAddress).then(res => { @@ -234,7 +241,8 @@ export default { }) } }) - console.log(this.$parent) + console.log('onChange----------->') + // TODO: this.$emit() // this.$parent.getAuthAccount(this.selectedAddress) } }, @@ -254,17 +262,10 @@ export default { this.selectedValidator = this.validatorAddress return array }, - loadBalance() { - this.account = this.computeAccount() - // if (this.account && this.account.length > 0) this.selectedAddress - this.$http.getValidatorList().then(v => { - this.validators = v - }) - this.$http.getValidatorUnbondedList().then(v => { - this.unbundValidators = v - }) - this.onChange() + printDenom() { + return formatTokenDenom(this.IBCDenom[this.token] || this.token) }, + format(v) { return formatToken(v, this.IBCDenom) }, diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue new file mode 100644 index 00000000..b051962d --- /dev/null +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -0,0 +1,240 @@ + + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index 0120d52e..ba92867b 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -41,7 +41,7 @@ :is="type" ref="component" :address="address" - :validator-address.sync="selectedValidator" + :validator-address="selectedValidator" /> @@ -143,13 +143,14 @@ import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, } from '@validations' import { - abbrAddress, extractAccountNumberAndSequence, getLocalAccounts, setLocalTxHistory, sign, timeIn, + extractAccountNumberAndSequence, setLocalTxHistory, sign, timeIn, } from '@/libs/utils' import vSelect from 'vue-select' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' import WalletInputVue from '../WalletInput.vue' import Delegate from './components/Delegate.vue' +import Redelegate from './components/Redelegate.vue' export default { name: 'DelegateDialogue', @@ -176,6 +177,7 @@ export default { // eslint-disable-next-line vue/no-unused-components ToastificationContent, Delegate, + Redelegate, }, directives: { Ripple, @@ -197,26 +199,20 @@ export default { data() { return { selectedAddress: this.address, - availableAddress: [], - validators: [], - unbundValidators: [], selectedValidator: null, token: '', - amount: null, chainId: '', - selectedChain: '', balance: [], - delegations: [], IBCDenom: {}, - memo: '', - fee: '900', - feeDenom: '', - wallet: 'ledgerUSB', error: null, sequence: 1, accountNumber: 0, advance: false, + fee: '900', + feeDenom: '', + wallet: 'ledgerUSB', gas: '200000', + memo: '', required, password, @@ -237,35 +233,8 @@ export default { return this.balance.filter(item => !item.denom.startsWith('ibc')) }, }, - created() { - // console.log('address: ', this.address) - }, methods: { - computeAccount() { - const accounts = getLocalAccounts() - const values = accounts ? Object.values(accounts) : [] - let array = [] - for (let i = 0; i < values.length; i += 1) { - const addrs = values[i].address.filter(x => x.chain === this.$route.params.chain) - if (addrs && addrs.length > 0) { - array = array.concat(addrs.map(x => ({ value: x.addr, label: values[i].name.concat(' - ', abbrAddress(x.addr)) }))) - if (!this.selectedAddress) { - this.selectedAddress = addrs[0].addr - } - } - } - this.selectedValidator = this.validatorAddress - return array - }, loadBalance() { - this.account = this.computeAccount() - // if (this.account && this.account.length > 0) this.selectedAddress - this.$http.getValidatorList().then(v => { - this.validators = v - }) - this.$http.getValidatorUnbondedList().then(v => { - this.unbundValidators = v - }) this.$http.getLatestBlock().then(ret => { this.chainId = ret.block.header.chain_id const notSynced = timeIn(ret.block.header.time, 10, 'm') @@ -303,11 +272,7 @@ export default { }) }, handleOk(bvModalEvt) { - // console.log('send') - // Prevent modal from closing bvModalEvt.preventDefault() - // Trigger submit handler - // this.handleSubmit() this.$refs.simpleRules.validate().then(ok => { if (ok) { this.sendTx().then(ret => { @@ -365,7 +330,7 @@ export default { hash: res.tx_response.txhash, time: new Date(), }) - this.$bvModal.hide('delegate-window') + this.$bvModal.hide('operation-modal') this.$toast({ component: ToastificationContent, props: { From 9628a37aa7d4510845f396b3863bebea9622b9c0 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Tue, 22 Mar 2022 22:56:32 +0800 Subject: [PATCH 03/14] fix --- src/views/WalletAccountDetail.vue | 25 ++- .../OperationModal/components/Delegate.vue | 16 +- .../OperationModal/components/Redelegate.vue | 14 +- .../OperationModal/components/Unbond.vue | 206 ++++++++++++++++++ .../OperationModal/components/Withdraw.vue | 140 ++++++++++++ src/views/components/OperationModal/index.vue | 34 ++- 6 files changed, 411 insertions(+), 24 deletions(-) create mode 100644 src/views/components/OperationModal/components/Unbond.vue create mode 100644 src/views/components/OperationModal/components/Withdraw.vue diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index cfc775e6..9469c13e 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -133,7 +133,7 @@ Delegate-new + />Delegate1 Withdraw Rewards + + Withdraw Rewards1 +
@@ -190,7 +202,7 @@ @@ -205,6 +217,15 @@ > + + + diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 5a07009c..a302373a 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -120,7 +120,7 @@ import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, } from '@validations' import { - abbrAddress, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, + abbrAddress, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, extractAccountNumberAndSequence, } from '@/libs/utils' import vSelect from 'vue-select' @@ -210,6 +210,10 @@ export default { }, }, mounted() { + this.$emit('update', { + modalTitle: 'Delegate Token', + historyName: 'delegate', + }) this.loadBalance() }, methods: { @@ -241,9 +245,13 @@ export default { }) } }) - console.log('onChange----------->') - // TODO: this.$emit() - // this.$parent.getAuthAccount(this.selectedAddress) + this.$http.getAuthAccount(this.selectedAddress).then(ret => { + const account = extractAccountNumberAndSequence(ret) + this.$emit('update', { + accountNumber: account.accountNumber, + sequence: account.sequence, + }) + }) } }, computeAccount() { diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index b051962d..fd70b536 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -118,7 +118,7 @@ import { import vSelect from 'vue-select' export default { - name: 'UnbondDialogue', + name: 'Redelegate', components: { BRow, BCol, @@ -142,17 +142,13 @@ export default { data() { return { selectedAddress: this.address, - availableAddress: [], unbundValidators: [], validators: [], toValidator: null, token: '', amount: null, - chainId: '', - selectedChain: '', balance: [], delegations: [], - memo: '', feeDenom: '', error: null, sequence: 1, @@ -198,6 +194,10 @@ export default { }, }, mounted() { + this.$emit('update', { + modalTitle: 'Redelegate Token', + historyName: 'redelegate', + }) this.loadBalance() }, methods: { @@ -222,7 +222,9 @@ export default { this.delegations.forEach(x => { if (x.delegation.validator_address === this.validatorAddress) { this.token = x.balance.denom - this.feeDenom = x.balance.denom + this.$emit('update', { + feeDenom: x.balance.denom, + }) } }) }) diff --git a/src/views/components/OperationModal/components/Unbond.vue b/src/views/components/OperationModal/components/Unbond.vue new file mode 100644 index 00000000..76c6b299 --- /dev/null +++ b/src/views/components/OperationModal/components/Unbond.vue @@ -0,0 +1,206 @@ + + + + diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue new file mode 100644 index 00000000..f4a2e81d --- /dev/null +++ b/src/views/components/OperationModal/components/Withdraw.vue @@ -0,0 +1,140 @@ + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index ba92867b..f4a3bf74 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -3,7 +3,7 @@ id="operation-modal" centered size="md" - title="Delegate Token" + :title="modalTitle" ok-title="Send" hide-header-close scrollable @@ -41,7 +41,8 @@ :is="type" ref="component" :address="address" - :validator-address="selectedValidator" + :validator-address="validatorAddress" + @update="componentUpdate" /> @@ -151,6 +152,8 @@ import ToastificationContent from '@core/components/toastification/Toastificatio import WalletInputVue from '../WalletInput.vue' import Delegate from './components/Delegate.vue' import Redelegate from './components/Redelegate.vue' +import Withdraw from './components/Withdraw.vue' +import Unbond from './components/Unbond.vue' export default { name: 'DelegateDialogue', @@ -178,6 +181,8 @@ export default { ToastificationContent, Delegate, Redelegate, + Withdraw, + Unbond, }, directives: { Ripple, @@ -198,8 +203,11 @@ export default { }, data() { return { + modalTitle: '', + historyName: '', selectedAddress: this.address, selectedValidator: null, + selectedChain: null, token: '', chainId: '', balance: [], @@ -244,7 +252,11 @@ export default { this.error = null } }) - this.getAuthAccount() + this.$http.getAuthAccount(this.selectedAddress).then(ret => { + const account = extractAccountNumberAndSequence(ret) + this.accountNumber = account.accountNumber + this.sequence = account.sequence + }) this.$http.getBankBalances(this.selectedAddress).then(res => { if (res && res.length > 0) { this.balance = res.reverse() @@ -263,12 +275,10 @@ export default { this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000' this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || '' }, - getAuthAccount(address = this.selectedAddress) { - this.$http.getAuthAccount(address).then(ret => { - const account = extractAccountNumberAndSequence(ret) - console.log(account) - this.accountNumber = account.accountNumber - this.sequence = account.sequence + componentUpdate(obj) { + console.log(obj) + Object.keys(obj).forEach(key => { + this[key] = obj[key] }) }, handleOk(bvModalEvt) { @@ -288,7 +298,7 @@ export default { }, async sendTx() { const txMsgs = this.$refs.component.msg - + console.log(txMsgs) if (txMsgs.length === 0) { this.error = 'No delegation found' return '' @@ -323,10 +333,10 @@ export default { this.memo, signerData, ).then(bodyBytes => { - this.$http.broadcastTx(bodyBytes).then(res => { + this.$http.broadcastTx(bodyBytes, this.selectedChain).then(res => { setLocalTxHistory({ chain: this.$store.state.chains.selected, - op: 'delegate', + op: this.historyName, hash: res.tx_response.txhash, time: new Date(), }) From 3e6dccff7789edb890ea8fcb00f652a43d6b2b7b Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 28 Mar 2022 14:29:32 +0800 Subject: [PATCH 04/14] Done delegate --- .../OperationModal/components/Delegate.vue | 139 +++++++----------- src/views/components/OperationModal/index.vue | 32 ++-- 2 files changed, 70 insertions(+), 101 deletions(-) diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index a302373a..2c4d718a 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -1,28 +1,5 @@ @@ -98,6 +111,7 @@ import { import { sha256 } from '@cosmjs/crypto' import { toHex } from '@cosmjs/encoding' import { formatToken, numberWithCommas } from '@/libs/utils' +import OperationModal from '@/views/components/OperationModal/index.vue' import OperationWithdrawCommissionComponent from './OperationWithdrawCommissionComponent.vue' export default { @@ -112,6 +126,7 @@ export default { BMediaAside, BAvatar, OperationWithdrawCommissionComponent, + OperationModal, }, props: { data: { diff --git a/src/views/components/OperationModal/components/GovDeposit.vue b/src/views/components/OperationModal/components/GovDeposit.vue new file mode 100644 index 00000000..8bdf23eb --- /dev/null +++ b/src/views/components/OperationModal/components/GovDeposit.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/src/views/components/OperationModal/components/IBCTransfer.vue b/src/views/components/OperationModal/components/IBCTransfer.vue index 2bdbe433..99b5d4ea 100644 --- a/src/views/components/OperationModal/components/IBCTransfer.vue +++ b/src/views/components/OperationModal/components/IBCTransfer.vue @@ -177,7 +177,6 @@ export default { token: '', amount: null, recipient: null, - error: null, IBCDenom: {}, paths: {}, destination: {}, diff --git a/src/views/components/OperationModal/components/Unbond.vue b/src/views/components/OperationModal/components/Unbond.vue index bf00902d..2882a100 100644 --- a/src/views/components/OperationModal/components/Unbond.vue +++ b/src/views/components/OperationModal/components/Unbond.vue @@ -119,7 +119,6 @@ export default { data() { return { validators: [], - selectedValidator: this.validatorAddress, token: '', amount: null, delegations: [], diff --git a/src/views/components/OperationModal/components/Vote.vue b/src/views/components/OperationModal/components/Vote.vue index 2f45c0af..f25e0029 100644 --- a/src/views/components/OperationModal/components/Vote.vue +++ b/src/views/components/OperationModal/components/Vote.vue @@ -16,14 +16,11 @@ rules="required" name="Voter" > - - {{ errors[0] }} Please import an account first! + {{ errors[0] }} @@ -34,41 +31,48 @@ label="Option" label-for="option" > -
+ +
- - Yes - - - No - - - No With Veto - - - Abstain - -
+ + Yes + + + No + + + No With Veto + + + Abstain + +
+ {{ errors[0] }} +
@@ -78,15 +82,14 @@ diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index af0b1af0..d1a28649 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -40,7 +40,7 @@ Date: Sun, 3 Apr 2022 23:54:53 +0800 Subject: [PATCH 11/14] add transaction result --- .../OperationModal/TransactionResult.vue | 153 ++++++++++++++++++ src/views/components/OperationModal/index.vue | 29 +++- 2 files changed, 179 insertions(+), 3 deletions(-) create mode 100644 src/views/components/OperationModal/TransactionResult.vue diff --git a/src/views/components/OperationModal/TransactionResult.vue b/src/views/components/OperationModal/TransactionResult.vue new file mode 100644 index 00000000..46a88a86 --- /dev/null +++ b/src/views/components/OperationModal/TransactionResult.vue @@ -0,0 +1,153 @@ + + + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index d1a28649..c195f7ce 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -5,8 +5,10 @@ size="md" :title="modalTitle" :ok-title="actionName" - hide-header-close scrollable + :hide-header-close="!showResult" + :hide-footer="showResult" + modal-class="custom-transaction-modal" :ok-disabled="isOwner" @hidden="resetModal" @ok="handleOk" @@ -35,7 +37,10 @@ - + + {{ error }} - {{ error }} + + + + toggle + @@ -162,6 +172,7 @@ import IBCTransfer from './components/IBCTransfer.vue' import Vote from './components/Vote.vue' import WithdrawCommission from './components/WithdrawCommission.vue' import GovDeposit from './components/GovDeposit.vue' +import TransactionResult from './TransactionResult.vue' export default { name: 'DelegateDialogue', @@ -196,6 +207,7 @@ export default { Vote, WithdrawCommission, GovDeposit, + TransactionResult, }, directives: { Ripple, @@ -243,6 +255,7 @@ export default { memo: '', blockingMsg: this.address ? 'You are not the owner' : 'No available account found.', actionName: 'Send', + showResult: false, required, password, @@ -402,4 +415,14 @@ export default { From 0993394e1ca0090311fd06a7246e7766f078ece9 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 4 Apr 2022 16:59:02 +0800 Subject: [PATCH 12/14] add timestamp --- src/libs/fetch.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/libs/fetch.js b/src/libs/fetch.js index bc17ec8f..83457768 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -60,7 +60,7 @@ export default class ChainFetch { if (conf.chain_name === 'injective') { return ChainFetch.fetch('https://tm.injective.network', '/block').then(data => Block.create(commonProcess(data))) } - return this.get('/blocks/latest', config).then(data => Block.create(data)) + return this.get(`/blocks/latest?${new Date().getTime()}`, config).then(data => Block.create(data)) } async getBlockByHeight(height, config = null) { @@ -386,6 +386,19 @@ export default class ChainFetch { return ChainFetch.fetchCoinMarketCap(`/quote/${symbol}`) } + // Simulate Execution of tx + async simulate(tx, config = null) { + return this.post('/cosmos/tx/v1beta1/simulate', tx, config).then(res => { + if (res.code && res.code !== 0) { + throw new Error(res.message) + } + if (res.tx_response && res.tx_response.code !== 0) { + throw new Error(res.tx_response.raw_log) + } + return res + }) + } + // Tx Submit async broadcastTx(bodyBytes, config = null) { const txString = toBase64(TxRaw.encode(bodyBytes).finish()) From 4864ccf37f1bdf3a3fa2485fd6a7efb64aa3c015 Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Mon, 4 Apr 2022 16:59:23 +0800 Subject: [PATCH 13/14] update tx boxes --- src/views/Governance.vue | 22 +----- src/views/Staking.vue | 19 +---- src/views/StakingRewardComponent.vue | 10 +-- src/views/WalletAccountDetail.vue | 75 ++---------------- .../OperationModal/TransactionResult.vue | 76 ++++++++++++++++--- src/views/components/OperationModal/index.vue | 65 ++++++++-------- 6 files changed, 108 insertions(+), 159 deletions(-) diff --git a/src/views/Governance.vue b/src/views/Governance.vue index b51d339f..cc58556a 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -157,40 +157,22 @@ {{ $t('btn_deposit') }} - - {{ $t('btn_deposit') }}1 - {{ $t('btn_vote') }} - - {{ $t('btn_vote') }}1 - diff --git a/src/views/Staking.vue b/src/views/Staking.vue index a644a2b6..257b899f 100644 --- a/src/views/Staking.vue +++ b/src/views/Staking.vue @@ -246,23 +246,6 @@ export default { }, data() { return { - keys: [ - 'bitsongvaloper1jxv0u20scum4trha72c7ltfgfqef6nscl86wxa', - 'akashvaloper1vgstlgtsx4w80gphwgre0fcvc04lcnaelukvll', - 'certikvaloper1jxv0u20scum4trha72c7ltfgfqef6nsczkvcu7', - 'cosmosvaloper1jxv0u20scum4trha72c7ltfgfqef6nsch7q6cu', - 'iva16plp8cmfkjssp222taq6pv6mkm8c5pa9lcktta', - 'junovaloper1jxv0u20scum4trha72c7ltfgfqef6nscm9pmg2', - 'kavavaloper1xftqdxvq0xkv2mu8c5y0jrsc578tak4m9u0s44', - 'kivaloper1jxv0u20scum4trha72c7ltfgfqef6nschqtan9', - 'osmovaloper1jxv0u20scum4trha72c7ltfgfqef6nscqx0u46', - 'persistencevaloper1jxv0u20scum4trha72c7ltfgfqef6nsc4zjpnj', - 'starsvaloper1jxv0u20scum4trha72c7ltfgfqef6nscdghxyx', - 'digvaloper1jxv0u20scum4trha72c7ltfgfqef6nsc4s577p', - 'bcnavaloper1jxv0u20scum4trha72c7ltfgfqef6nsc384wxf', - 'pbvaloper1jxv0u20scum4trha72c7ltfgfqef6nsc5nn6cf', - 'rizonvaloper1jxv0u20scum4trha72c7ltfgfqef6nsczn2l68', - ], islive: true, validator_address: null, mintInflation: 0, @@ -313,7 +296,7 @@ export default { }, computed: { pingVals() { - return this.list.filter(x => this.keys.includes(x.operator_address)) + return this.list.filter(x => x.description.identity === '6783E9F948541962') }, list() { return this.validators.map(x => { diff --git a/src/views/StakingRewardComponent.vue b/src/views/StakingRewardComponent.vue index 2dbdea30..0d79d94f 100644 --- a/src/views/StakingRewardComponent.vue +++ b/src/views/StakingRewardComponent.vue @@ -75,21 +75,13 @@
- - Withdraw Commission - - Withdraw Commission1 + Withdraw Commission Assets
- - Transfer - Transfer1 - - - IBC Transfer + />Transfer - IBC Transfer1 + IBC Transfer
@@ -152,34 +131,12 @@ size="sm" class="mr-25" @click="setOperationModalType('Delegate')" - > - Delegate1 - - Delegate - - Withdraw Rewards - Withdraw Rewards1 + /> Withdraw Rewards @@ -205,45 +162,27 @@ size="sm" > - - - - - - diff --git a/src/views/components/OperationModal/TransactionResult.vue b/src/views/components/OperationModal/TransactionResult.vue index 46a88a86..b3499815 100644 --- a/src/views/components/OperationModal/TransactionResult.vue +++ b/src/views/components/OperationModal/TransactionResult.vue @@ -1,10 +1,10 @@ @@ -99,11 +91,7 @@ import { formatToken, getCachedValidators, getLocalAccounts, getLocalChains, tokenFormatter, } from '@/libs/utils' import FeatherIcon from '@/@core/components/feather-icon/FeatherIcon.vue' - -import OperationWithdrawComponent from './OperationWithdrawComponent.vue' -import OperationUnbondComponent from './OperationUnbondComponent.vue' -import OperationDelegateComponent from './OperationDelegateComponent.vue' -import OperationRedelegateComponent from './OperationRedelegateComponent.vue' +import OperationModal from '@/views/components/OperationModal/index.vue' export default { components: { @@ -113,11 +101,7 @@ export default { BTable, BCard, FeatherIcon, - - OperationWithdrawComponent, - OperationDelegateComponent, - OperationRedelegateComponent, - OperationUnbondComponent, + OperationModal, }, directives: { 'b-tooltip': VBTooltip, @@ -153,6 +137,7 @@ export default { accounts: [], delegations: [], rewards: {}, + operationModalType: '', } }, computed: { @@ -200,7 +185,8 @@ export default { this.init() }, methods: { - selectValue(v) { + selectValue(type, v) { + this.operationModalType = type this.address = v.delegator_address this.selectedValidator = v.validator.validator return v diff --git a/src/views/components/OperationModal/TransactionResult.vue b/src/views/components/OperationModal/TransactionResult.vue index b3499815..31fb8266 100644 --- a/src/views/components/OperationModal/TransactionResult.vue +++ b/src/views/components/OperationModal/TransactionResult.vue @@ -137,6 +137,7 @@ export default { if (res.code === 0) { this.succeed = true clearInterval(this.timer) + window.location.reload() } else if (res.code !== 3) { // code 3 is tx unconfirmed(not founded). this.error = res.raw_log console.log('error:', this.error) diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index bc4138c2..f806d552 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -151,7 +151,7 @@ export default { availableAddress: [], validators: [], unbundValidators: [], - selectedValidator: null, + selectedValidator: this.validatorAddress, token: '', amount: null, selectedChain: '', diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index 28805e26..279d860a 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -1,6 +1,6 @@