From a592e0ed1611a928f72ce925f2ad94a3b05b4b91 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Tue, 29 Mar 2022 23:25:32 +0800 Subject: [PATCH 1/6] fix --- .../OperationModal/components/Delegate.vue | 9 ---- .../OperationModal/components/Withdraw.vue | 53 ++----------------- 2 files changed, 5 insertions(+), 57 deletions(-) diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 2c4d718a..bc4138c2 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -11,15 +11,7 @@ rules="required" name="Delegator" > - @@ -176,7 +168,6 @@ export default { digits, length, alphaDash, - account: [], } }, computed: { diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue index f4a2e81d..666d3bea 100644 --- a/src/views/components/OperationModal/components/Withdraw.vue +++ b/src/views/components/OperationModal/components/Withdraw.vue @@ -7,16 +7,8 @@ label-for="Account" > - - - @@ -28,15 +20,11 @@ From f99f0093b9b35aa817ae3d9ae33a176112525df3 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Wed, 30 Mar 2022 21:50:49 +0800 Subject: [PATCH 2/6] fix redelegate --- .../OperationModal/components/Redelegate.vue | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index fd70b536..0795f5cb 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -147,13 +147,7 @@ export default { toValidator: null, token: '', amount: null, - balance: [], delegations: [], - feeDenom: '', - error: null, - sequence: 1, - accountNumber: 0, - account: [], required, password, @@ -170,9 +164,18 @@ export default { }, computed: { valOptions() { + let options = [] const vals = this.validators.map(x => ({ value: x.operator_address, label: `${x.description.moniker} (${Number(x.commission.rate) * 100}%)` })) + if (vals.length > 0) { + options.push({ value: null, label: '=== ACTIVE VALIDATORS ===' }) + options = options.concat(vals) + } const unbunded = this.unbundValidators.map(x => ({ value: x.operator_address, label: `* ${x.description.moniker} (${Number(x.commission.rate) * 100}%)` })) - return vals.concat(unbunded) + if (unbunded.length > 0) { + options.push({ value: null, label: '=== INACTIVE VALIDATORS ===', disabled: true }) + options = options.concat(unbunded) + } + return options }, tokenOptions() { if (!this.delegations) return [] @@ -198,24 +201,16 @@ export default { modalTitle: 'Redelegate Token', historyName: 'redelegate', }) - this.loadBalance() + this.loadData() }, methods: { - printDenom() { - return formatTokenDenom(this.token) - }, - loadBalance() { + loadData() { this.$http.getValidatorList().then(v => { this.validators = v }) this.$http.getValidatorUnbondedList().then(v => { this.unbundValidators = v }) - this.$http.getBankBalances(this.address).then(res => { - if (res && res.length > 0) { - this.balance = res.reverse() - } - }) this.$http.getStakingDelegations(this.address).then(res => { this.delegations = res.delegation_responses console.log(res) @@ -233,7 +228,9 @@ export default { format(v) { return formatToken(v) }, - + printDenom() { + return formatTokenDenom(this.token) + }, }, } From 3d44d1d9f93f3d13a0cd14be518cd5194c61928f Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Wed, 30 Mar 2022 23:11:24 +0800 Subject: [PATCH 3/6] fix --- src/views/WalletAccountDetail.vue | 12 ++ .../OperationModal/components/Redelegate.vue | 2 +- .../OperationModal/components/Transfer.vue | 204 ++++++++++++++++++ .../OperationModal/components/Unbond.vue | 18 +- src/views/components/OperationModal/index.vue | 2 + 5 files changed, 224 insertions(+), 14 deletions(-) create mode 100644 src/views/components/OperationModal/components/Transfer.vue diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 9469c13e..b0ad742f 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -49,6 +49,18 @@ /> Transfer + + Transfer1 + @@ -213,7 +214,6 @@ export default { }) this.$http.getStakingDelegations(this.address).then(res => { this.delegations = res.delegation_responses - console.log(res) this.delegations.forEach(x => { if (x.delegation.validator_address === this.validatorAddress) { this.token = x.balance.denom diff --git a/src/views/components/OperationModal/components/Transfer.vue b/src/views/components/OperationModal/components/Transfer.vue new file mode 100644 index 00000000..53bc5d4c --- /dev/null +++ b/src/views/components/OperationModal/components/Transfer.vue @@ -0,0 +1,204 @@ + + + diff --git a/src/views/components/OperationModal/components/Unbond.vue b/src/views/components/OperationModal/components/Unbond.vue index 76c6b299..bf00902d 100644 --- a/src/views/components/OperationModal/components/Unbond.vue +++ b/src/views/components/OperationModal/components/Unbond.vue @@ -105,7 +105,6 @@ export default { vSelect, BInputGroupAppend, ValidationProvider, - }, props: { validatorAddress: { @@ -123,7 +122,6 @@ export default { selectedValidator: this.validatorAddress, token: '', amount: null, - balance: [], delegations: [], required, @@ -167,24 +165,16 @@ export default { modalTitle: 'Unbond Token', historyName: 'unbond', }) - this.loadBalance() + this.loadData() }, methods: { - printDenom() { - return formatTokenDenom(this.token) - }, - loadBalance() { + loadData() { if (this.address) { this.$http.getValidatorList().then(v => { this.validators = v }) } - this.$http.getBankBalances(this.address).then(res => { - if (res && res.length > 0) { - this.balance = res.reverse() - } - }) this.$http.getStakingDelegations(this.address).then(res => { this.delegations = res.delegation_responses this.delegations.forEach(x => { @@ -197,7 +187,9 @@ export default { }) }) }, - + printDenom() { + return formatTokenDenom(this.token) + }, }, } diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index ccb50702..22d5ef1c 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -155,6 +155,7 @@ import Delegate from './components/Delegate.vue' import Redelegate from './components/Redelegate.vue' import Withdraw from './components/Withdraw.vue' import Unbond from './components/Unbond.vue' +import Transfer from './components/Transfer.vue' export default { name: 'DelegateDialogue', @@ -184,6 +185,7 @@ export default { Redelegate, Withdraw, Unbond, + Transfer, }, directives: { Ripple, From d5c0f266661936bcd70652cf56b99ba01c43dded Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Thu, 31 Mar 2022 23:01:58 +0800 Subject: [PATCH 4/6] fix --- src/views/Governance.vue | 24 +- src/views/WalletAccountDetail.vue | 15 +- .../OperationModal/components/IBCTransfer.vue | 308 ++++++++++++++++++ .../OperationModal/components/Vote.vue | 194 +++++++++++ .../OperationModal/components/Withdraw.vue | 1 - src/views/components/OperationModal/index.vue | 25 +- 6 files changed, 559 insertions(+), 8 deletions(-) create mode 100644 src/views/components/OperationModal/components/IBCTransfer.vue create mode 100644 src/views/components/OperationModal/components/Vote.vue diff --git a/src/views/Governance.vue b/src/views/Governance.vue index 288a0d2d..7e7d3c25 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -160,7 +160,7 @@ v-b-modal.deposit-window variant="primary" class="btn float-right mg-2" - @click="selectProposal(p.id, p.title)" + @click="selectProposal('GovDeposit',p.id, p.title)" > {{ $t('btn_deposit') }} @@ -169,10 +169,19 @@ v-b-modal.vote-window variant="primary" class="btn float-right mg-2" - @click="selectProposal(p.id, p.title)" + @click="selectProposal('Vote',p.id, p.title)" > {{ $t('btn_vote') }} + + {{ $t('btn_vote') }}1 + @@ -185,6 +194,11 @@ :proposal-id="selectedProposalId" :title="selectedTitle" /> + @@ -196,6 +210,7 @@ import Ripple from 'vue-ripple-directive' import { Proposal } from '@/libs/data' import { percent, tokenFormatter } from '@/libs/utils' import dayjs from 'dayjs' +import OperationModal from '@/views/components/OperationModal/index.vue' import OperationVoteComponent from './OperationVoteComponent.vue' import OperationGovDepositComponent from './OperationGovDepositComponent.vue' @@ -214,6 +229,7 @@ export default { BCol, OperationVoteComponent, OperationGovDepositComponent, + OperationModal, }, directives: { 'b-modal': VBModal, @@ -225,6 +241,7 @@ export default { selectedTitle: '', proposals: [new Proposal()], max: 1, + operationModalType: '', } }, mounted() { @@ -234,7 +251,8 @@ export default { percent: v => percent(v), formatDate: v => dayjs(v).format('YYYY-MM-DD'), formatToken: v => tokenFormatter(v, {}), - selectProposal(pid, title) { + selectProposal(modal, pid, title) { + this.operationModalType = modal this.selectedProposalId = Number(pid) this.selectedTitle = title }, diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index b0ad742f..321f4e24 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -69,8 +69,19 @@ icon="SendIcon" class="d-md-none" /> - IBC Transfer - + IBC Transfer + + + IBC Transfer1 + diff --git a/src/views/components/OperationModal/components/IBCTransfer.vue b/src/views/components/OperationModal/components/IBCTransfer.vue new file mode 100644 index 00000000..2bdbe433 --- /dev/null +++ b/src/views/components/OperationModal/components/IBCTransfer.vue @@ -0,0 +1,308 @@ + + + + diff --git a/src/views/components/OperationModal/components/Vote.vue b/src/views/components/OperationModal/components/Vote.vue new file mode 100644 index 00000000..2f45c0af --- /dev/null +++ b/src/views/components/OperationModal/components/Vote.vue @@ -0,0 +1,194 @@ + + + + + diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue index 666d3bea..5fd99991 100644 --- a/src/views/components/OperationModal/components/Withdraw.vue +++ b/src/views/components/OperationModal/components/Withdraw.vue @@ -44,7 +44,6 @@ export default { data() { return { account: [], - selectedChain: '', balance: [], delegations: [], feeDenom: '', diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index 22d5ef1c..ef276136 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -4,7 +4,7 @@ centered size="md" :title="modalTitle" - ok-title="Send" + :ok-title="actionName" hide-header-close scrollable :ok-disabled="isOwner" @@ -43,6 +43,8 @@ :address="address" :validator-address="validatorAddress" :balance="balance" + :proposal-id="proposalId" + :proposal-title="proposalTitle" @update="componentUpdate" /> @@ -156,6 +158,8 @@ import Redelegate from './components/Redelegate.vue' import Withdraw from './components/Withdraw.vue' import Unbond from './components/Unbond.vue' import Transfer from './components/Transfer.vue' +import IBCTransfer from './components/IBCTransfer.vue' +import Vote from './components/Vote.vue' export default { name: 'DelegateDialogue', @@ -186,6 +190,8 @@ export default { Withdraw, Unbond, Transfer, + IBCTransfer, + Vote, }, directives: { Ripple, @@ -203,6 +209,14 @@ export default { type: String, default: null, }, + proposalId: { + type: Number, + default: null, + }, + proposalTitle: { + type: String, + default: null, + }, }, data() { return { @@ -225,6 +239,7 @@ export default { gas: '200000', memo: '', blockingMsg: 'No available account found.', + actionName: 'Send', required, password, @@ -247,8 +262,14 @@ export default { isOwner() { const accounts = getLocalAccounts() const selectedWallet = this.$store.state.chains.defaultWallet + if (!this.address) { + const chain = this.$store.state.chains.selected.chain_name + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + this.selectedAddress = accounts[selectedWallet].address.find(x => x.chain === chain) + } + if (accounts && accounts[selectedWallet]) { - if (accounts[selectedWallet].address.findIndex(x => x.addr === this.address) > -1) { + if (accounts[selectedWallet].address.findIndex(x => x.addr === this.selectedAddress) > -1) { return false } } From ae9bf25abf2a9abd73a77b67d0c9672eb82c66ec Mon Sep 17 00:00:00 2001 From: liangping <18786721@qq.com> Date: Thu, 31 Mar 2022 23:39:47 +0800 Subject: [PATCH 5/6] select the default address --- src/views/components/OperationModal/index.vue | 26 +++++++++++-------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index ef276136..af0b1af0 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -222,7 +222,6 @@ export default { return { modalTitle: '', historyName: '', - selectedAddress: this.address, selectedValidator: null, selectedChain: null, token: '', @@ -238,7 +237,7 @@ export default { wallet: 'ledgerUSB', gas: '200000', memo: '', - blockingMsg: 'No available account found.', + blockingMsg: this.address ? 'You are not the owner' : 'No available account found.', actionName: 'Send', required, @@ -259,22 +258,27 @@ export default { if (!this.balance) return [] return this.balance.filter(item => !item.denom.startsWith('ibc')) }, - isOwner() { + accounts() { const accounts = getLocalAccounts() const selectedWallet = this.$store.state.chains.defaultWallet - if (!this.address) { - const chain = this.$store.state.chains.selected.chain_name - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - this.selectedAddress = accounts[selectedWallet].address.find(x => x.chain === chain) - } - - if (accounts && accounts[selectedWallet]) { - if (accounts[selectedWallet].address.findIndex(x => x.addr === this.selectedAddress) > -1) { + return accounts[selectedWallet] + }, + isOwner() { + if (this.accounts) { + if (this.accounts.address.findIndex(x => x.addr === this.selectedAddress) > -1) { return false } } return true }, + selectedAddress() { + if (this.address) { + return this.address + } + const chain = this.$store.state.chains.selected.chain_name + const selectedAddress = this.accounts.address.find(x => x.chain === chain) + return selectedAddress?.addr + }, }, methods: { initialize() { From 7c93f6f7c794f55304efd3b93a1aae8c4f5724b6 Mon Sep 17 00:00:00 2001 From: donne1226 <503124742@qq.com> Date: Fri, 1 Apr 2022 23:28:42 +0800 Subject: [PATCH 6/6] fix all --- src/views/Governance.vue | 9 + src/views/StakingRewardComponent.vue | 17 +- .../OperationModal/components/GovDeposit.vue | 194 ++++++++++++++++++ .../OperationModal/components/IBCTransfer.vue | 1 - .../OperationModal/components/Unbond.vue | 1 - .../OperationModal/components/Vote.vue | 136 +++++------- .../OperationModal/components/Withdraw.vue | 16 -- .../components/WithdrawCommission.vue | 84 ++++++++ src/views/components/OperationModal/index.vue | 6 +- 9 files changed, 362 insertions(+), 102 deletions(-) create mode 100644 src/views/components/OperationModal/components/GovDeposit.vue create mode 100644 src/views/components/OperationModal/components/WithdrawCommission.vue diff --git a/src/views/Governance.vue b/src/views/Governance.vue index 7e7d3c25..b51d339f 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -164,6 +164,15 @@ > {{ $t('btn_deposit') }} + + {{ $t('btn_deposit') }}1 + Outstanding Rewards Withdraw Commission + + Withdraw Commission1 + + @@ -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 @@