fix all
This commit is contained in:
parent
ae9bf25abf
commit
7c93f6f7c7
@ -164,6 +164,15 @@
|
||||
>
|
||||
{{ $t('btn_deposit') }}
|
||||
</b-button>
|
||||
<b-button
|
||||
v-if="p.status===1"
|
||||
v-b-modal.operation-modal
|
||||
variant="primary"
|
||||
class="btn float-right mg-2"
|
||||
@click="selectProposal('GovDeposit',p.id, p.title)"
|
||||
>
|
||||
{{ $t('btn_deposit') }}1
|
||||
</b-button>
|
||||
<b-button
|
||||
v-if="p.status===2"
|
||||
v-b-modal.vote-window
|
||||
|
@ -6,7 +6,7 @@
|
||||
<b-card-header>
|
||||
<b-card-title>Outstanding Rewards</b-card-title>
|
||||
<feather-icon
|
||||
v-b-modal.withdraw-commission-window
|
||||
v-b-modal.operation-modal
|
||||
icon="MoreVerticalIcon"
|
||||
size="18"
|
||||
class="cursor-pointer"
|
||||
@ -83,11 +83,24 @@
|
||||
>
|
||||
Withdraw Commission
|
||||
</b-button>
|
||||
<b-button
|
||||
v-b-modal.operation-modal
|
||||
block
|
||||
size="sm"
|
||||
variant="primary"
|
||||
>
|
||||
Withdraw Commission1
|
||||
</b-button>
|
||||
</b-card-body>
|
||||
<operation-withdraw-commission-component
|
||||
:validator-address="validator"
|
||||
:address="address"
|
||||
/>
|
||||
<operation-modal
|
||||
type="WithdrawCommission"
|
||||
:address="address"
|
||||
:validator-address="validator"
|
||||
/>
|
||||
</b-card>
|
||||
</template>
|
||||
|
||||
@ -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: {
|
||||
|
194
src/views/components/OperationModal/components/GovDeposit.vue
Normal file
194
src/views/components/OperationModal/components/GovDeposit.vue
Normal file
@ -0,0 +1,194 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<h4>{{ proposalId }}. {{ proposalTitle }}</h4>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-form-group
|
||||
label="Depositor"
|
||||
label-for="Voter"
|
||||
>
|
||||
<validation-provider
|
||||
#default="{ errors }"
|
||||
rules="required"
|
||||
name="Voter"
|
||||
>
|
||||
<b-form-input
|
||||
v-model="address"
|
||||
readonly
|
||||
/>
|
||||
<small class="text-danger">{{ errors[0] }}</small>
|
||||
</validation-provider>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-form-group
|
||||
label="Available Token"
|
||||
label-for="Token"
|
||||
>
|
||||
<validation-provider
|
||||
#default="{ errors }"
|
||||
rules="required"
|
||||
name="Token"
|
||||
>
|
||||
<b-form-select
|
||||
v-model="token"
|
||||
>
|
||||
<b-form-select-option
|
||||
v-for="item in balanceOptions"
|
||||
:key="item.denom"
|
||||
:value="item.denom"
|
||||
>
|
||||
{{ format(item) }}
|
||||
</b-form-select-option>
|
||||
</b-form-select>
|
||||
<small class="text-danger">{{ errors[0] }}</small>
|
||||
</validation-provider>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-form-group
|
||||
label="Amount"
|
||||
label-for="Amount"
|
||||
>
|
||||
<validation-provider
|
||||
v-slot="{ errors }"
|
||||
rules="required|regex:^([0-9\.]+)$"
|
||||
name="amount"
|
||||
>
|
||||
<b-input-group class="mb-25">
|
||||
<b-form-input
|
||||
id="Amount"
|
||||
v-model="amount"
|
||||
:state="errors.length > 0 ? false:null"
|
||||
placeholder="Input a number"
|
||||
type="number"
|
||||
/>
|
||||
<b-input-group-append is-text>
|
||||
{{ printDenom() }}
|
||||
</b-input-group-append>
|
||||
</b-input-group>
|
||||
<small class="text-danger">{{ errors[0] }}</small>
|
||||
</validation-provider>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { ValidationProvider } from 'vee-validate'
|
||||
import {
|
||||
BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect,
|
||||
BInputGroupAppend, BFormSelectOption,
|
||||
} from 'bootstrap-vue'
|
||||
import {
|
||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||
} from '@validations'
|
||||
import {
|
||||
formatToken, formatTokenDenom, getUnitAmount,
|
||||
} from '@/libs/utils'
|
||||
|
||||
export default {
|
||||
name: 'DepositDialogue',
|
||||
components: {
|
||||
BRow,
|
||||
BCol,
|
||||
BInputGroup,
|
||||
BFormInput,
|
||||
BFormGroup,
|
||||
BFormSelect,
|
||||
BInputGroupAppend,
|
||||
BFormSelectOption,
|
||||
ValidationProvider,
|
||||
},
|
||||
props: {
|
||||
proposalId: {
|
||||
type: Number,
|
||||
required: true,
|
||||
},
|
||||
proposalTitle: {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
balance: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
address: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
token: null,
|
||||
amount: '',
|
||||
|
||||
required,
|
||||
password,
|
||||
email,
|
||||
min,
|
||||
integer,
|
||||
url,
|
||||
alpha,
|
||||
between,
|
||||
digits,
|
||||
length,
|
||||
alphaDash,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
msg() {
|
||||
return [{
|
||||
typeUrl: '/cosmos.gov.v1beta1.MsgDeposit',
|
||||
value: {
|
||||
depositor: this.address,
|
||||
proposalId: String(this.proposalId),
|
||||
amount: [
|
||||
{
|
||||
amount: getUnitAmount(this.amount, this.token),
|
||||
denom: this.token,
|
||||
},
|
||||
],
|
||||
},
|
||||
}]
|
||||
},
|
||||
balanceOptions() {
|
||||
return this.setupBalance()
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$emit('update', {
|
||||
modalTitle: 'Deposit',
|
||||
historyName: 'deposit',
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
printDenom() {
|
||||
return formatTokenDenom(this.token)
|
||||
},
|
||||
format(v) {
|
||||
return formatToken(v)
|
||||
},
|
||||
setupBalance() {
|
||||
if (this.balance && this.balance.length > 0) {
|
||||
this.token = this.balance[0].denom
|
||||
return this.balance
|
||||
}
|
||||
return []
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss">
|
||||
@import '@core/scss/vue/libs/vue-select.scss';
|
||||
</style>
|
@ -177,7 +177,6 @@ export default {
|
||||
token: '',
|
||||
amount: null,
|
||||
recipient: null,
|
||||
error: null,
|
||||
IBCDenom: {},
|
||||
paths: {},
|
||||
destination: {},
|
||||
|
@ -119,7 +119,6 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
validators: [],
|
||||
selectedValidator: this.validatorAddress,
|
||||
token: '',
|
||||
amount: null,
|
||||
delegations: [],
|
||||
|
@ -16,14 +16,11 @@
|
||||
rules="required"
|
||||
name="Voter"
|
||||
>
|
||||
<b-form-select
|
||||
v-model="voter"
|
||||
:options="accounts"
|
||||
text-field="label"
|
||||
placeholder="Select an address"
|
||||
@change="onChange"
|
||||
<b-form-input
|
||||
v-model="address"
|
||||
readonly
|
||||
/>
|
||||
<small class="text-danger">{{ errors[0] }} <strong v-if="!accounts || accounts.length === 0">Please import an account first!</strong> </small>
|
||||
<small class="text-danger">{{ errors[0] }}</small>
|
||||
</validation-provider>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
@ -34,41 +31,48 @@
|
||||
label="Option"
|
||||
label-for="option"
|
||||
>
|
||||
<div class="demo-inline-spacing">
|
||||
<validation-provider
|
||||
#default="{ errors }"
|
||||
rules="required"
|
||||
name="option"
|
||||
>
|
||||
<div class="demo-inline-spacing">
|
||||
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="1"
|
||||
class="custom-control-success"
|
||||
>
|
||||
Yes
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="3"
|
||||
class="custom-control-warning"
|
||||
>
|
||||
No
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="4"
|
||||
class="custom-control-danger"
|
||||
>
|
||||
No With Veto
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="2"
|
||||
class="custom-control-secondary"
|
||||
>
|
||||
Abstain
|
||||
</b-form-radio>
|
||||
</div>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="1"
|
||||
class="custom-control-success"
|
||||
>
|
||||
Yes
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="3"
|
||||
class="custom-control-warning"
|
||||
>
|
||||
No
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="4"
|
||||
class="custom-control-danger"
|
||||
>
|
||||
No With Veto
|
||||
</b-form-radio>
|
||||
<b-form-radio
|
||||
v-model="option"
|
||||
name="option"
|
||||
value="2"
|
||||
class="custom-control-secondary"
|
||||
>
|
||||
Abstain
|
||||
</b-form-radio>
|
||||
</div>
|
||||
<small class="text-danger">{{ errors[0] }}</small>
|
||||
</validation-provider>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
@ -78,15 +82,14 @@
|
||||
<script>
|
||||
import { ValidationProvider } from 'vee-validate'
|
||||
import {
|
||||
BRow, BCol, BFormGroup, BFormSelect,
|
||||
BRow, BCol, BFormGroup, BFormInput,
|
||||
BFormRadio,
|
||||
} from 'bootstrap-vue'
|
||||
import {
|
||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||
} from '@validations'
|
||||
import {
|
||||
abbrAddress,
|
||||
formatToken, getLocalAccounts,
|
||||
formatToken,
|
||||
} from '@/libs/utils'
|
||||
|
||||
export default {
|
||||
@ -95,9 +98,9 @@ export default {
|
||||
BRow,
|
||||
BCol,
|
||||
BFormGroup,
|
||||
BFormSelect,
|
||||
BFormRadio,
|
||||
ValidationProvider,
|
||||
BFormInput,
|
||||
},
|
||||
props: {
|
||||
proposalId: {
|
||||
@ -108,14 +111,14 @@ export default {
|
||||
type: String,
|
||||
required: true,
|
||||
},
|
||||
address: {
|
||||
type: String,
|
||||
default: null,
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
accounts: [],
|
||||
voter: null,
|
||||
option: null,
|
||||
balance: [],
|
||||
feeDenom: '',
|
||||
|
||||
required,
|
||||
password,
|
||||
@ -135,7 +138,7 @@ export default {
|
||||
return [{
|
||||
typeUrl: '/cosmos.gov.v1beta1.MsgVote',
|
||||
value: {
|
||||
voter: this.voter,
|
||||
voter: this.address,
|
||||
proposalId: this.proposalId,
|
||||
option: Number(this.option),
|
||||
},
|
||||
@ -147,40 +150,9 @@ export default {
|
||||
modalTitle: 'Vote',
|
||||
historyName: 'vote',
|
||||
})
|
||||
this.loadData()
|
||||
},
|
||||
methods: {
|
||||
computeAccount() {
|
||||
let array = []
|
||||
const accounts = getLocalAccounts()
|
||||
if (accounts) {
|
||||
const values = Object.values(accounts)
|
||||
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)) })))
|
||||
}
|
||||
}
|
||||
}
|
||||
return array
|
||||
},
|
||||
onChange() {
|
||||
if (this.voter) {
|
||||
this.$http.getBankBalances(this.voter).then(res => {
|
||||
if (res && res.length > 0) {
|
||||
this.balance = res.reverse()
|
||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
||||
if (token) this.feeDenom = token.denom
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
loadData() {
|
||||
this.accounts = this.computeAccount()
|
||||
// eslint-disable-next-line prefer-destructuring
|
||||
if (this.accounts && this.accounts.length > 0) this.voter = this.accounts[0].value
|
||||
this.onChange()
|
||||
},
|
||||
|
||||
format(v) {
|
||||
return formatToken(v)
|
||||
},
|
||||
|
@ -22,9 +22,6 @@
|
||||
import {
|
||||
BRow, BCol, BInputGroup, BFormInput, BFormGroup,
|
||||
} from 'bootstrap-vue'
|
||||
import {
|
||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||
} from '@validations'
|
||||
|
||||
export default {
|
||||
name: 'WithdrawDialogue',
|
||||
@ -47,18 +44,6 @@ export default {
|
||||
balance: [],
|
||||
delegations: [],
|
||||
feeDenom: '',
|
||||
|
||||
required,
|
||||
password,
|
||||
email,
|
||||
min,
|
||||
integer,
|
||||
url,
|
||||
alpha,
|
||||
between,
|
||||
digits,
|
||||
length,
|
||||
alphaDash,
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
@ -87,7 +72,6 @@ export default {
|
||||
methods: {
|
||||
loadData() {
|
||||
this.$http.getStakingDelegations(this.address).then(res => {
|
||||
console.log(res)
|
||||
this.delegations = res.delegation_responses
|
||||
})
|
||||
},
|
||||
|
@ -0,0 +1,84 @@
|
||||
<template>
|
||||
<div>
|
||||
<b-row>
|
||||
<b-col>
|
||||
<b-form-group
|
||||
label="Sender"
|
||||
label-for="Account"
|
||||
>
|
||||
<b-input-group class="mb-25">
|
||||
<b-form-input
|
||||
:value="address"
|
||||
readonly
|
||||
/>
|
||||
</b-input-group>
|
||||
</b-form-group>
|
||||
</b-col>
|
||||
</b-row>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {
|
||||
BRow,
|
||||
BCol,
|
||||
BInputGroup,
|
||||
BFormInput,
|
||||
BFormGroup,
|
||||
} from 'bootstrap-vue'
|
||||
|
||||
export default {
|
||||
name: 'WithdrawCommissionDialogue',
|
||||
components: {
|
||||
BRow,
|
||||
BCol,
|
||||
BInputGroup,
|
||||
BFormInput,
|
||||
BFormGroup,
|
||||
|
||||
},
|
||||
props: {
|
||||
address: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
validatorAddress: {
|
||||
type: String,
|
||||
default: '',
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
msg() {
|
||||
return [
|
||||
{
|
||||
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
|
||||
value: {
|
||||
delegatorAddress: this.address,
|
||||
validatorAddress: this.validatorAddress,
|
||||
},
|
||||
},
|
||||
{
|
||||
typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission',
|
||||
value: {
|
||||
validatorAddress: this.validatorAddress,
|
||||
},
|
||||
},
|
||||
]
|
||||
},
|
||||
},
|
||||
mounted() {
|
||||
this.$emit('update', {
|
||||
modalTitle: 'Withdraw Validator Commission',
|
||||
historyName: 'withdraw',
|
||||
})
|
||||
},
|
||||
methods: {
|
||||
|
||||
},
|
||||
}
|
||||
</script>
|
@ -40,7 +40,7 @@
|
||||
<component
|
||||
:is="type"
|
||||
ref="component"
|
||||
:address="address"
|
||||
:address="selectedAddress"
|
||||
:validator-address="validatorAddress"
|
||||
:balance="balance"
|
||||
:proposal-id="proposalId"
|
||||
@ -160,6 +160,8 @@ 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',
|
||||
@ -192,6 +194,8 @@ export default {
|
||||
Transfer,
|
||||
IBCTransfer,
|
||||
Vote,
|
||||
WithdrawCommission,
|
||||
GovDeposit,
|
||||
},
|
||||
directives: {
|
||||
Ripple,
|
||||
|
Loading…
Reference in New Issue
Block a user