diff --git a/src/views/Governance.vue b/src/views/Governance.vue index 288a0d2d..b51d339f 100644 --- a/src/views/Governance.vue +++ b/src/views/Governance.vue @@ -160,19 +160,37 @@ 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') }} + + {{ $t('btn_deposit') }}1 + {{ $t('btn_vote') }} + + {{ $t('btn_vote') }}1 + @@ -185,6 +203,11 @@ :proposal-id="selectedProposalId" :title="selectedTitle" /> + @@ -196,6 +219,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 +238,7 @@ export default { BCol, OperationVoteComponent, OperationGovDepositComponent, + OperationModal, }, directives: { 'b-modal': VBModal, @@ -225,6 +250,7 @@ export default { selectedTitle: '', proposals: [new Proposal()], max: 1, + operationModalType: '', } }, mounted() { @@ -234,7 +260,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/StakingRewardComponent.vue b/src/views/StakingRewardComponent.vue index 6ac11107..2dbdea30 100644 --- a/src/views/StakingRewardComponent.vue +++ b/src/views/StakingRewardComponent.vue @@ -6,7 +6,7 @@ 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/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 9469c13e..321f4e24 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -49,6 +49,18 @@ /> Transfer + + Transfer1 + - IBC Transfer - + IBC Transfer + + + IBC Transfer1 + 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/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 new file mode 100644 index 00000000..99b5d4ea --- /dev/null +++ b/src/views/components/OperationModal/components/IBCTransfer.vue @@ -0,0 +1,307 @@ + + + + diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index fd70b536..921636e5 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -68,6 +68,7 @@ :options="valOptions" :reduce="val => val.value" placeholder="Select a validator" + :selectable="(v) => v.value" /> @@ -147,13 +148,7 @@ export default { toValidator: null, token: '', amount: null, - balance: [], delegations: [], - feeDenom: '', - error: null, - sequence: 1, - accountNumber: 0, - account: [], required, password, @@ -170,9 +165,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,27 +202,18 @@ 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) this.delegations.forEach(x => { if (x.delegation.validator_address === this.validatorAddress) { this.token = x.balance.denom @@ -233,7 +228,9 @@ export default { format(v) { return formatToken(v) }, - + printDenom() { + return formatTokenDenom(this.token) + }, }, } 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..2882a100 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: { @@ -120,10 +119,8 @@ export default { data() { return { validators: [], - selectedValidator: this.validatorAddress, token: '', amount: null, - balance: [], delegations: [], required, @@ -167,24 +164,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 +186,9 @@ export default { }) }) }, - + printDenom() { + return formatTokenDenom(this.token) + }, }, } diff --git a/src/views/components/OperationModal/components/Vote.vue b/src/views/components/OperationModal/components/Vote.vue new file mode 100644 index 00000000..f25e0029 --- /dev/null +++ b/src/views/components/OperationModal/components/Vote.vue @@ -0,0 +1,166 @@ + + + + + diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue index f4a2e81d..331748c5 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,8 @@ diff --git a/src/views/components/OperationModal/components/WithdrawCommission.vue b/src/views/components/OperationModal/components/WithdrawCommission.vue new file mode 100644 index 00000000..487a8a65 --- /dev/null +++ b/src/views/components/OperationModal/components/WithdrawCommission.vue @@ -0,0 +1,84 @@ + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index ccb50702..d1a28649 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" @@ -40,9 +40,11 @@ @@ -155,6 +157,11 @@ 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' +import IBCTransfer from './components/IBCTransfer.vue' +import Vote from './components/Vote.vue' +import WithdrawCommission from './components/WithdrawCommission.vue' +import GovDeposit from './components/GovDeposit.vue' export default { name: 'DelegateDialogue', @@ -184,6 +191,11 @@ export default { Redelegate, Withdraw, Unbond, + Transfer, + IBCTransfer, + Vote, + WithdrawCommission, + GovDeposit, }, directives: { Ripple, @@ -201,12 +213,19 @@ export default { type: String, default: null, }, + proposalId: { + type: Number, + default: null, + }, + proposalTitle: { + type: String, + default: null, + }, }, data() { return { modalTitle: '', historyName: '', - selectedAddress: this.address, selectedValidator: null, selectedChain: null, token: '', @@ -222,7 +241,8 @@ 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, password, @@ -242,16 +262,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 (accounts && accounts[selectedWallet]) { - if (accounts[selectedWallet].address.findIndex(x => x.addr === this.address) > -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() {