Improve wallet operations
This commit is contained in:
parent
fd825fd171
commit
acca0f1a0f
@ -110,12 +110,14 @@
|
|||||||
:id="'vote-veto'+p.id"
|
:id="'vote-veto'+p.id"
|
||||||
variant="danger"
|
variant="danger"
|
||||||
:value="p.tally.veto"
|
:value="p.tally.veto"
|
||||||
|
:label="`${p.tally.veto.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
<b-progress-bar
|
<b-progress-bar
|
||||||
:id="'vote-abstain'+p.id"
|
:id="'vote-abstain'+p.id"
|
||||||
variant="info"
|
variant="info"
|
||||||
:value="p.tally.abstain"
|
:value="p.tally.abstain"
|
||||||
|
:label="`${p.tally.abstain.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
</b-progress>
|
</b-progress>
|
||||||
|
@ -131,24 +131,28 @@
|
|||||||
:id="'vote-yes'+proposal.id"
|
:id="'vote-yes'+proposal.id"
|
||||||
variant="success"
|
variant="success"
|
||||||
:value="proposal.tally.yes"
|
:value="proposal.tally.yes"
|
||||||
|
:label="`${proposal.tally.yes.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
<b-progress-bar
|
<b-progress-bar
|
||||||
:id="'vote-no'+proposal.id"
|
:id="'vote-no'+proposal.id"
|
||||||
variant="warning"
|
variant="warning"
|
||||||
:value="proposal.tally.no"
|
:value="proposal.tally.no"
|
||||||
|
:label="`${proposal.tally.no.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
<b-progress-bar
|
<b-progress-bar
|
||||||
:id="'vote-veto'+proposal.id"
|
:id="'vote-veto'+proposal.id"
|
||||||
variant="danger"
|
variant="danger"
|
||||||
:value="proposal.tally.veto"
|
:value="proposal.tally.veto"
|
||||||
|
:label="`${proposal.tally.veto.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
<b-progress-bar
|
<b-progress-bar
|
||||||
:id="'vote-abstain'+proposal.id"
|
:id="'vote-abstain'+proposal.id"
|
||||||
variant="info"
|
variant="info"
|
||||||
:value="proposal.tally.abstain"
|
:value="proposal.tally.abstain"
|
||||||
|
:label="`${proposal.tally.abstain.toFixed()}%`"
|
||||||
show-progress
|
show-progress
|
||||||
/>
|
/>
|
||||||
</b-progress>
|
</b-progress>
|
||||||
|
@ -87,7 +87,8 @@
|
|||||||
</validation-provider>
|
</validation-provider>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row><b-row>
|
</b-row>
|
||||||
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Amount"
|
label="Amount"
|
||||||
@ -121,39 +122,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append>
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -193,7 +213,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -201,17 +221,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -237,7 +256,7 @@
|
|||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormSelectOption,
|
||||||
BForm, BFormRadioGroup, BFormRadio, BButton, BInputGroupAppend,
|
BForm, BFormRadioGroup, BFormRadio, BButton, BInputGroupAppend, BFormCheckbox,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
@ -262,6 +281,7 @@ export default {
|
|||||||
BFormSelectOption,
|
BFormSelectOption,
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
|
BFormCheckbox,
|
||||||
vSelect,
|
vSelect,
|
||||||
BButton,
|
BButton,
|
||||||
BInputGroupAppend,
|
BInputGroupAppend,
|
||||||
@ -297,10 +317,12 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
|
advance: false,
|
||||||
|
gas: '200000',
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -447,7 +469,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
title="Redelegate Token"
|
title="Redelegate Token"
|
||||||
hide-header-close
|
hide-header-close
|
||||||
scrollable
|
scrollable
|
||||||
|
ok-title="Send"
|
||||||
:ok-disabled="!selectedAddress"
|
:ok-disabled="!selectedAddress"
|
||||||
@hidden="resetModal"
|
@hidden="resetModal"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@ -25,13 +26,9 @@
|
|||||||
rules="required"
|
rules="required"
|
||||||
name="Delegator"
|
name="Delegator"
|
||||||
>
|
>
|
||||||
<v-select
|
<b-form-input
|
||||||
v-model="selectedAddress"
|
v-model="address"
|
||||||
:options="account"
|
readonly
|
||||||
:reduce="val => val.addr"
|
|
||||||
label="addr"
|
|
||||||
placeholder="Select an address"
|
|
||||||
@change="loadBalance()"
|
|
||||||
/>
|
/>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
</validation-provider>
|
</validation-provider>
|
||||||
@ -45,14 +42,36 @@
|
|||||||
label-for="validator"
|
label-for="validator"
|
||||||
>
|
>
|
||||||
<v-select
|
<v-select
|
||||||
v-model="selectedValidator"
|
:value="validatorAddress"
|
||||||
:options="valOptions"
|
:options="valOptions"
|
||||||
:reduce="val => val.value"
|
:reduce="val => val.value"
|
||||||
placeholder="Select a validator"
|
placeholder="Select a validator"
|
||||||
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
<b-row>
|
||||||
|
<b-col>
|
||||||
|
<b-form-group
|
||||||
|
label="Current Delegation"
|
||||||
|
label-for="Token"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
#default="{ errors }"
|
||||||
|
rules="required"
|
||||||
|
name="Token"
|
||||||
|
>
|
||||||
|
<v-select
|
||||||
|
v-model="token"
|
||||||
|
:options="tokenOptions"
|
||||||
|
:reduce="token => token.value"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
</b-row>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
@ -69,26 +88,6 @@
|
|||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
|
||||||
<b-form-group
|
|
||||||
label="Staking Token"
|
|
||||||
label-for="Token"
|
|
||||||
>
|
|
||||||
<validation-provider
|
|
||||||
#default="{ errors }"
|
|
||||||
rules="required"
|
|
||||||
name="Token"
|
|
||||||
>
|
|
||||||
<v-select
|
|
||||||
v-model="token"
|
|
||||||
:options="tokenOptions"
|
|
||||||
:reduce="token => token.value"
|
|
||||||
/>
|
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
|
||||||
</validation-provider>
|
|
||||||
</b-form-group>
|
|
||||||
</b-col>
|
|
||||||
</b-row><b-row>
|
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Amount"
|
label="Amount"
|
||||||
@ -99,13 +98,18 @@
|
|||||||
rules="required|regex:^([0-9\.]+)$"
|
rules="required|regex:^([0-9\.]+)$"
|
||||||
name="amount"
|
name="amount"
|
||||||
>
|
>
|
||||||
<b-form-input
|
<b-input-group>
|
||||||
id="Amount"
|
<b-form-input
|
||||||
v-model="amount"
|
id="Amount"
|
||||||
:state="errors.length > 0 ? false:null"
|
v-model="amount"
|
||||||
placeholder="Input a number"
|
:state="errors.length > 0 ? false:null"
|
||||||
type="number"
|
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>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
</validation-provider>
|
</validation-provider>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
@ -117,39 +121,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append>
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -168,7 +191,6 @@
|
|||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
@ -189,7 +211,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -197,17 +219,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -225,16 +246,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect,
|
||||||
BForm, BFormRadioGroup, BFormRadio,
|
BForm, BFormRadioGroup, BFormRadio, BFormCheckbox, BInputGroupAppend,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
} from '@validations'
|
} from '@validations'
|
||||||
import {
|
import {
|
||||||
formatToken, getCachedValidators, getLocalAccounts, getLocalChains, setLocalTxHistory, sign, timeIn,
|
formatToken, formatTokenDenom, setLocalTxHistory, sign, timeIn,
|
||||||
} from '@/libs/data'
|
} from '@/libs/data'
|
||||||
import chainAPI from '@/libs/fetch'
|
|
||||||
import vSelect from 'vue-select'
|
import vSelect from 'vue-select'
|
||||||
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
||||||
|
|
||||||
@ -249,10 +269,11 @@ export default {
|
|||||||
BFormInput,
|
BFormInput,
|
||||||
BFormGroup,
|
BFormGroup,
|
||||||
BFormSelect,
|
BFormSelect,
|
||||||
BFormSelectOption,
|
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
vSelect,
|
vSelect,
|
||||||
|
BFormCheckbox,
|
||||||
|
BInputGroupAppend,
|
||||||
|
|
||||||
ValidationProvider,
|
ValidationProvider,
|
||||||
ValidationObserver,
|
ValidationObserver,
|
||||||
@ -274,7 +295,6 @@ export default {
|
|||||||
selectedAddress: this.address,
|
selectedAddress: this.address,
|
||||||
availableAddress: [],
|
availableAddress: [],
|
||||||
validators: [],
|
validators: [],
|
||||||
selectedValidator: this.validatorAddress,
|
|
||||||
toValidator: null,
|
toValidator: null,
|
||||||
token: '',
|
token: '',
|
||||||
amount: null,
|
amount: null,
|
||||||
@ -285,11 +305,13 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
account: [],
|
account: [],
|
||||||
|
advance: false,
|
||||||
|
gas: '200000',
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -306,11 +328,11 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
valOptions() {
|
valOptions() {
|
||||||
return this.validators.map(x => ({ value: x.operator_address, label: x.description.moniker }))
|
return this.validators.map(x => ({ value: x.operator_address, label: `${x.description.moniker} (${Number(x.commission.rate) * 100}%)` }))
|
||||||
},
|
},
|
||||||
tokenOptions() {
|
tokenOptions() {
|
||||||
if (!this.delegations) return []
|
if (!this.delegations) return []
|
||||||
return this.delegations.filter(x => x.delegation.validator_address === this.selectedValidator).map(x => ({ value: x.balance.denom, label: formatToken(x.balance) }))
|
return this.delegations.filter(x => x.delegation.validator_address === this.validatorAddress).map(x => ({ value: x.balance.denom, label: formatToken(x.balance) }))
|
||||||
},
|
},
|
||||||
feeDenoms() {
|
feeDenoms() {
|
||||||
if (!this.balance) return []
|
if (!this.balance) return []
|
||||||
@ -321,77 +343,46 @@ export default {
|
|||||||
// console.log('address: ', this.address)
|
// console.log('address: ', this.address)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
computeAccount() {
|
printDenom() {
|
||||||
const accounts = getLocalAccounts()
|
return formatTokenDenom(this.token)
|
||||||
const chains = getLocalChains()
|
|
||||||
const values = 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)
|
|
||||||
if (!this.selectedAddress) {
|
|
||||||
this.selectedAddress = addrs[0].addr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const addr = values[i].address.find(x => x.addr === this.selectedAddress)
|
|
||||||
if (addr) {
|
|
||||||
this.selectedChain = chains[addr.chain]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.selectedChain) {
|
|
||||||
this.selectedChain = chains[this.$route.params.chain]
|
|
||||||
}
|
|
||||||
this.selectedValidator = this.validatorAddress
|
|
||||||
const reducer = (t, c) => {
|
|
||||||
if (!(t.find(x => x.addr === c.addr))) t.push(c)
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
return array.reduce(reducer, [])
|
|
||||||
},
|
},
|
||||||
loadBalance() {
|
loadBalance() {
|
||||||
this.account = this.computeAccount()
|
this.$http.getValidatorList().then(v => {
|
||||||
if (this.account && this.account.length > 0) this.selectedAddress = this.account[0].addr
|
this.validators = v
|
||||||
if (this.selectedAddress) {
|
})
|
||||||
if (!getCachedValidators(this.selectedChain.chain)) {
|
this.$http.getBankBalances(this.address).then(res => {
|
||||||
this.$http.getValidatorList().then(v => {
|
if (res && res.length > 0) {
|
||||||
this.validators = v
|
this.balance = res
|
||||||
})
|
}
|
||||||
|
})
|
||||||
|
this.$http.getLatestBlock().then(ret => {
|
||||||
|
this.chainId = ret.block.header.chain_id
|
||||||
|
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
||||||
|
if (notSynced) {
|
||||||
|
this.error = 'Client is not synced or blockchain is halted'
|
||||||
} else {
|
} else {
|
||||||
this.validators = JSON.parse(getCachedValidators(this.selectedChain.chain))
|
this.error = null
|
||||||
}
|
}
|
||||||
if (this.selectedChain) {
|
})
|
||||||
chainAPI.getBankBalance(this.selectedChain.api, this.selectedAddress).then(res => {
|
this.$http.getAuthAccount(this.address).then(ret => {
|
||||||
if (res && res.length > 0) {
|
if (ret.value.base_vesting_account) {
|
||||||
this.balance = res
|
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
|
||||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
this.sequence = ret.value.base_vesting_account.base_account.sequence
|
||||||
this.token = token.denom
|
if (!this.sequence) this.sequence = 0
|
||||||
if (token) this.feeDenom = token.denom
|
} else {
|
||||||
}
|
this.accountNumber = ret.value.account_number
|
||||||
})
|
this.sequence = ret.value.sequence ? ret.value.sequence : 0
|
||||||
}
|
}
|
||||||
this.$http.getLatestBlock(this.selectedChain).then(ret => {
|
})
|
||||||
this.chainId = ret.block.header.chain_id
|
console.log(this.validatorAddress)
|
||||||
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
this.$http.getStakingDelegations(this.address).then(res => {
|
||||||
if (notSynced) {
|
|
||||||
this.error = 'Client is not synced or blockchain is halted'
|
|
||||||
} else {
|
|
||||||
this.error = null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$http.getAuthAccount(this.selectedAddress, 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
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.$http.getStakingDelegations(this.selectedAddress).then(res => {
|
|
||||||
this.delegations = res.delegation_responses
|
this.delegations = res.delegation_responses
|
||||||
|
this.delegations.forEach(x => {
|
||||||
|
if (x.delegation.validator_address === this.validatorAddress) {
|
||||||
|
this.token = x.balance.denom
|
||||||
|
this.feeDenom = x.balance.denom
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleOk(bvModalEvt) {
|
handleOk(bvModalEvt) {
|
||||||
@ -418,8 +409,8 @@ export default {
|
|||||||
const txMsgs = [{
|
const txMsgs = [{
|
||||||
typeUrl: '/cosmos.staking.v1beta1.MsgBeginRedelegate',
|
typeUrl: '/cosmos.staking.v1beta1.MsgBeginRedelegate',
|
||||||
value: {
|
value: {
|
||||||
delegatorAddress: this.selectedAddress,
|
delegatorAddress: this.address,
|
||||||
validatorSrcAddress: this.selectedValidator,
|
validatorSrcAddress: this.validatorAddress,
|
||||||
validatorDstAddress: this.toValidator,
|
validatorDstAddress: this.toValidator,
|
||||||
amount: {
|
amount: {
|
||||||
amount: String((Number(this.amount) * 1000000).toFixed()),
|
amount: String((Number(this.amount) * 1000000).toFixed()),
|
||||||
@ -444,7 +435,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '250000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
@ -453,6 +444,8 @@ export default {
|
|||||||
chainId: this.chainId,
|
chainId: this.chainId,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(txMsgs)
|
||||||
|
|
||||||
sign(
|
sign(
|
||||||
this.wallet,
|
this.wallet,
|
||||||
this.chainId,
|
this.chainId,
|
||||||
@ -462,7 +455,7 @@ export default {
|
|||||||
this.memo,
|
this.memo,
|
||||||
signerData,
|
signerData,
|
||||||
).then(bodyBytes => {
|
).then(bodyBytes => {
|
||||||
this.$http.broadcastTx(bodyBytes, this.selectedChain).then(res => {
|
this.$http.broadcastTx(bodyBytes).then(res => {
|
||||||
setLocalTxHistory({ op: 'redelegate', hash: res.tx_response.txhash, time: new Date() })
|
setLocalTxHistory({ op: 'redelegate', hash: res.tx_response.txhash, time: new Date() })
|
||||||
this.$bvModal.hide('redelegate-window')
|
this.$bvModal.hide('redelegate-window')
|
||||||
this.$toast({
|
this.$toast({
|
||||||
|
@ -122,39 +122,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append>
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -194,7 +213,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -202,17 +221,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -231,7 +249,7 @@
|
|||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BInputGroupAppend, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BInputGroupAppend, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
|
||||||
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend,
|
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend, BFormCheckbox,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
@ -259,6 +277,7 @@ export default {
|
|||||||
BFormSelectOption,
|
BFormSelectOption,
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
|
BFormCheckbox,
|
||||||
|
|
||||||
ValidationProvider,
|
ValidationProvider,
|
||||||
ValidationObserver,
|
ValidationObserver,
|
||||||
@ -282,12 +301,14 @@ export default {
|
|||||||
recipient: null,
|
recipient: null,
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
account: [],
|
account: [],
|
||||||
IBCDenom: {},
|
IBCDenom: {},
|
||||||
|
gas: '200000',
|
||||||
|
advance: false,
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -412,7 +433,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
title="Unbond Token"
|
title="Unbond Token"
|
||||||
hide-header-close
|
hide-header-close
|
||||||
scrollable
|
scrollable
|
||||||
|
ok-title="Send"
|
||||||
:ok-disabled="!selectedAddress"
|
:ok-disabled="!selectedAddress"
|
||||||
@hidden="resetModal"
|
@hidden="resetModal"
|
||||||
@ok="handleOk"
|
@ok="handleOk"
|
||||||
@ -20,21 +21,10 @@
|
|||||||
label="Delegator"
|
label="Delegator"
|
||||||
label-for="Account"
|
label-for="Account"
|
||||||
>
|
>
|
||||||
<validation-provider
|
<b-form-input
|
||||||
#default="{ errors }"
|
v-model="address"
|
||||||
rules="required"
|
readonly
|
||||||
name="Delegator"
|
/>
|
||||||
>
|
|
||||||
<v-select
|
|
||||||
v-model="selectedAddress"
|
|
||||||
:options="account"
|
|
||||||
:reduce="val => val.addr"
|
|
||||||
label="addr"
|
|
||||||
placeholder="Select an address"
|
|
||||||
@change="loadBalance()"
|
|
||||||
/>
|
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
|
||||||
</validation-provider>
|
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
@ -49,6 +39,7 @@
|
|||||||
:options="valOptions"
|
:options="valOptions"
|
||||||
:reduce="val => val.value"
|
:reduce="val => val.value"
|
||||||
placeholder="Select a validator"
|
placeholder="Select a validator"
|
||||||
|
:disabled="true"
|
||||||
/>
|
/>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
@ -56,7 +47,7 @@
|
|||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Staking Token"
|
label="Current Delegation"
|
||||||
label-for="Token"
|
label-for="Token"
|
||||||
>
|
>
|
||||||
<validation-provider
|
<validation-provider
|
||||||
@ -73,7 +64,8 @@
|
|||||||
</validation-provider>
|
</validation-provider>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row><b-row>
|
</b-row>
|
||||||
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Amount"
|
label="Amount"
|
||||||
@ -84,13 +76,18 @@
|
|||||||
rules="required|regex:^([0-9\.]+)$"
|
rules="required|regex:^([0-9\.]+)$"
|
||||||
name="amount"
|
name="amount"
|
||||||
>
|
>
|
||||||
<b-form-input
|
<b-input-group>
|
||||||
id="Amount"
|
<b-form-input
|
||||||
v-model="amount"
|
id="Amount"
|
||||||
:state="errors.length > 0 ? false:null"
|
v-model="amount"
|
||||||
placeholder="Input a number"
|
:state="errors.length > 0 ? false:null"
|
||||||
type="number"
|
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>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
</validation-provider>
|
</validation-provider>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
@ -102,39 +99,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append>
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -153,7 +169,6 @@
|
|||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
@ -174,7 +189,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -182,17 +197,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -210,16 +224,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BInputGroupAppend,
|
||||||
BForm, BFormRadioGroup, BFormRadio,
|
BForm, BFormRadioGroup, BFormRadio, BFormCheckbox,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
} from '@validations'
|
} from '@validations'
|
||||||
import {
|
import {
|
||||||
formatToken, getCachedValidators, getLocalAccounts, getLocalChains, setLocalTxHistory, sign, timeIn,
|
formatToken, formatTokenDenom, setLocalTxHistory, sign, timeIn,
|
||||||
} from '@/libs/data'
|
} from '@/libs/data'
|
||||||
import chainAPI from '@/libs/fetch'
|
|
||||||
import vSelect from 'vue-select'
|
import vSelect from 'vue-select'
|
||||||
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
||||||
|
|
||||||
@ -234,10 +247,11 @@ export default {
|
|||||||
BFormInput,
|
BFormInput,
|
||||||
BFormGroup,
|
BFormGroup,
|
||||||
BFormSelect,
|
BFormSelect,
|
||||||
BFormSelectOption,
|
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
vSelect,
|
vSelect,
|
||||||
|
BInputGroupAppend,
|
||||||
|
BFormCheckbox,
|
||||||
|
|
||||||
ValidationProvider,
|
ValidationProvider,
|
||||||
ValidationObserver,
|
ValidationObserver,
|
||||||
@ -269,11 +283,13 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
account: [],
|
account: [],
|
||||||
|
gas: '200000',
|
||||||
|
advance: false,
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -290,7 +306,7 @@ export default {
|
|||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
valOptions() {
|
valOptions() {
|
||||||
return this.validators.map(x => ({ value: x.operator_address, label: x.description.moniker }))
|
return this.validators.map(x => ({ value: x.operator_address, label: `${x.description.moniker} (${Number(x.commission.rate) * 100}%)` }))
|
||||||
},
|
},
|
||||||
tokenOptions() {
|
tokenOptions() {
|
||||||
if (!this.delegations) return []
|
if (!this.delegations) return []
|
||||||
@ -305,77 +321,47 @@ export default {
|
|||||||
// console.log('address: ', this.address)
|
// console.log('address: ', this.address)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
computeAccount() {
|
printDenom() {
|
||||||
const accounts = getLocalAccounts()
|
return formatTokenDenom(this.token)
|
||||||
const chains = getLocalChains()
|
|
||||||
const values = 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)
|
|
||||||
if (!this.selectedAddress) {
|
|
||||||
this.selectedAddress = addrs[0].addr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
const addr = values[i].address.find(x => x.addr === this.selectedAddress)
|
|
||||||
if (addr) {
|
|
||||||
this.selectedChain = chains[addr.chain]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.selectedChain) {
|
|
||||||
this.selectedChain = chains[this.$route.params.chain]
|
|
||||||
}
|
|
||||||
this.selectedValidator = this.validatorAddress
|
|
||||||
const reducer = (t, c) => {
|
|
||||||
if (!(t.find(x => x.addr === c.addr))) t.push(c)
|
|
||||||
return t
|
|
||||||
}
|
|
||||||
return array.reduce(reducer, [])
|
|
||||||
},
|
},
|
||||||
loadBalance() {
|
loadBalance() {
|
||||||
this.account = this.computeAccount()
|
if (this.address) {
|
||||||
if (this.account && this.account.length > 0) this.selectedAddress = this.account[0].addr
|
this.$http.getValidatorList().then(v => {
|
||||||
if (this.selectedAddress) {
|
this.validators = v
|
||||||
if (!getCachedValidators(this.selectedChain.chain)) {
|
|
||||||
this.$http.getValidatorList().then(v => {
|
|
||||||
this.validators = v
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
this.validators = JSON.parse(getCachedValidators(this.selectedChain.chain))
|
|
||||||
}
|
|
||||||
if (this.selectedChain) {
|
|
||||||
chainAPI.getBankBalance(this.selectedChain.api, this.selectedAddress).then(res => {
|
|
||||||
if (res && res.length > 0) {
|
|
||||||
this.balance = res
|
|
||||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
|
||||||
this.token = token.denom
|
|
||||||
if (token) this.feeDenom = token.denom
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.$http.getLatestBlock(this.selectedChain).then(ret => {
|
|
||||||
this.chainId = ret.block.header.chain_id
|
|
||||||
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
|
||||||
if (notSynced) {
|
|
||||||
this.error = 'Client is not synced or blockchain is halted'
|
|
||||||
} else {
|
|
||||||
this.error = null
|
|
||||||
}
|
|
||||||
})
|
|
||||||
this.$http.getAuthAccount(this.selectedAddress, 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
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
this.$http.getBankBalances(this.address).then(res => {
|
||||||
|
if (res && res.length > 0) {
|
||||||
|
this.balance = res
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$http.getLatestBlock(this.selectedChain).then(ret => {
|
||||||
|
this.chainId = ret.block.header.chain_id
|
||||||
|
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
||||||
|
if (notSynced) {
|
||||||
|
this.error = 'Client is not synced or blockchain is halted'
|
||||||
|
} else {
|
||||||
|
this.error = null
|
||||||
|
}
|
||||||
|
})
|
||||||
|
this.$http.getAuthAccount(this.selectedAddress, 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
|
||||||
|
}
|
||||||
|
})
|
||||||
this.$http.getStakingDelegations(this.selectedAddress).then(res => {
|
this.$http.getStakingDelegations(this.selectedAddress).then(res => {
|
||||||
this.delegations = res.delegation_responses
|
this.delegations = res.delegation_responses
|
||||||
|
this.delegations.forEach(x => {
|
||||||
|
if (x.delegation.validator_address === this.validatorAddress) {
|
||||||
|
this.token = x.balance.denom
|
||||||
|
this.feeDenom = x.balance.denom
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleOk(bvModalEvt) {
|
handleOk(bvModalEvt) {
|
||||||
@ -427,7 +413,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -165,7 +165,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -173,17 +173,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -254,10 +253,11 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '',
|
fee: '',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
|
gas: '200000',
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -372,7 +372,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
id="withdraw-commission-window"
|
id="withdraw-commission-window"
|
||||||
centered
|
centered
|
||||||
size="md"
|
size="md"
|
||||||
title="Withdraw Commission"
|
title="Withdraw Validator Commission"
|
||||||
hide-header-close
|
hide-header-close
|
||||||
scrollable
|
scrollable
|
||||||
|
|
||||||
@ -16,22 +16,14 @@
|
|||||||
<validation-observer ref="simpleRules">
|
<validation-observer ref="simpleRules">
|
||||||
<b-form>
|
<b-form>
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col v-if="account">
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Sender"
|
label="Sender"
|
||||||
label-for="Account"
|
label-for="Account"
|
||||||
>
|
>
|
||||||
<b-input-group class="mb-25">
|
<b-input-group class="mb-25">
|
||||||
<b-input-group-prepend is-text>
|
|
||||||
<b-avatar
|
|
||||||
:src="account.logo"
|
|
||||||
size="18"
|
|
||||||
variant="light-primary"
|
|
||||||
rounded
|
|
||||||
/>
|
|
||||||
</b-input-group-prepend>
|
|
||||||
<b-form-input
|
<b-form-input
|
||||||
:value="account.addr"
|
:value="address"
|
||||||
readonly
|
readonly
|
||||||
/>
|
/>
|
||||||
</b-input-group>
|
</b-input-group>
|
||||||
@ -44,39 +36,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append name="xx">
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -95,7 +106,6 @@
|
|||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
@ -116,7 +126,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -124,17 +134,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -152,16 +161,15 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BFormInput, BFormGroup, BFormSelect, BFormCheckbox,
|
||||||
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend,
|
BForm, BFormRadioGroup, BFormRadio, BInputGroupAppend,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
} from '@validations'
|
} from '@validations'
|
||||||
import {
|
import {
|
||||||
formatToken, getLocalAccounts, getLocalChains, setLocalTxHistory, sign, timeIn,
|
formatToken, setLocalTxHistory, sign, timeIn,
|
||||||
} from '@/libs/data'
|
} from '@/libs/data'
|
||||||
import chainAPI from '@/libs/fetch'
|
|
||||||
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
import ToastificationContent from '@core/components/toastification/ToastificationContent.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
@ -172,14 +180,13 @@ export default {
|
|||||||
BCol,
|
BCol,
|
||||||
BForm,
|
BForm,
|
||||||
BInputGroup,
|
BInputGroup,
|
||||||
BInputGroupPrepend,
|
|
||||||
BFormInput,
|
BFormInput,
|
||||||
BAvatar,
|
|
||||||
BFormGroup,
|
BFormGroup,
|
||||||
BFormSelect,
|
BFormSelect,
|
||||||
BFormSelectOption,
|
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
|
BFormCheckbox,
|
||||||
|
BInputGroupAppend,
|
||||||
|
|
||||||
ValidationProvider,
|
ValidationProvider,
|
||||||
ValidationObserver,
|
ValidationObserver,
|
||||||
@ -206,10 +213,12 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
|
gas: '200000',
|
||||||
|
advance: false,
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -233,51 +242,31 @@ export default {
|
|||||||
// console.log('address: ', this.address)
|
// console.log('address: ', this.address)
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
computeAccount() {
|
|
||||||
const accounts = getLocalAccounts()
|
|
||||||
const chains = getLocalChains()
|
|
||||||
const values = Object.values(accounts)
|
|
||||||
for (let i = 0; i < values.length; i += 1) {
|
|
||||||
const addr = values[i].address.find(x => x.addr === this.address)
|
|
||||||
if (addr) {
|
|
||||||
this.selectedChain = chains[addr.chain]
|
|
||||||
return addr
|
|
||||||
}
|
|
||||||
}
|
|
||||||
this.error = 'You are not the owner of this validator'
|
|
||||||
return null
|
|
||||||
},
|
|
||||||
loadBalance() {
|
loadBalance() {
|
||||||
this.account = this.computeAccount()
|
this.$http.getBankBalances(this.address).then(res => {
|
||||||
if (this.account && this.account.length > 0) this.address = this.account[0].addr
|
if (res && res.length > 0) {
|
||||||
if (this.address) {
|
this.balance = res
|
||||||
chainAPI.getBankBalance(this.selectedChain.api, this.address).then(res => {
|
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
||||||
if (res && res.length > 0) {
|
if (token) this.feeDenom = token.denom
|
||||||
this.balance = res
|
}
|
||||||
const token = this.balance.find(i => !i.denom.startsWith('ibc'))
|
})
|
||||||
if (token) this.feeDenom = token.denom
|
this.$http.getLatestBlock().then(ret => {
|
||||||
}
|
this.chainId = ret.block.header.chain_id
|
||||||
})
|
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
||||||
this.$http.getLatestBlock(this.selectedChain).then(ret => {
|
if (notSynced) {
|
||||||
this.chainId = ret.block.header.chain_id
|
this.error = 'Client is not synced or blockchain is halted'
|
||||||
const notSynced = timeIn(ret.block.header.time, 10, 'm')
|
}
|
||||||
if (notSynced) {
|
})
|
||||||
this.error = 'Client is not synced or blockchain is halted'
|
this.$http.getAuthAccount(this.address).then(ret => {
|
||||||
}
|
if (ret.value.base_vesting_account) {
|
||||||
})
|
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
|
||||||
this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => {
|
this.sequence = ret.value.base_vesting_account.base_account.sequence
|
||||||
if (ret.value.base_vesting_account) {
|
if (!this.sequence) this.sequence = 0
|
||||||
this.accountNumber = ret.value.base_vesting_account.base_account.account_number
|
} else {
|
||||||
this.sequence = ret.value.base_vesting_account.base_account.sequence
|
this.accountNumber = ret.value.account_number
|
||||||
if (!this.sequence) this.sequence = 0
|
this.sequence = ret.value.sequence ? ret.value.sequence : 0
|
||||||
} else {
|
}
|
||||||
this.accountNumber = ret.value.account_number
|
|
||||||
this.sequence = ret.value.sequence ? ret.value.sequence : 0
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
this.$http.getStakingDelegations(this.address).then(res => {
|
|
||||||
this.delegations = res.delegation_responses
|
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
handleOk(bvModalEvt) {
|
handleOk(bvModalEvt) {
|
||||||
@ -313,16 +302,6 @@ export default {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
// this.delegations.forEach(i => {
|
|
||||||
// if ()
|
|
||||||
// txMsgs.push({
|
|
||||||
// typeUrl: '/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward',
|
|
||||||
// value: {
|
|
||||||
// delegatorAddress: this.address,
|
|
||||||
// validatorAddress: i.delegation.validator_address,
|
|
||||||
// },
|
|
||||||
// })
|
|
||||||
// })
|
|
||||||
|
|
||||||
if (txMsgs.length === 0) {
|
if (txMsgs.length === 0) {
|
||||||
this.error = 'No delegation found'
|
this.error = 'No delegation found'
|
||||||
@ -340,7 +319,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -44,39 +44,58 @@
|
|||||||
label="Fee"
|
label="Fee"
|
||||||
label-for="Fee"
|
label-for="Fee"
|
||||||
>
|
>
|
||||||
<b-input-group>
|
<validation-provider
|
||||||
<validation-provider
|
v-slot="{ errors }"
|
||||||
v-slot="{ errors }"
|
rules="required|integer"
|
||||||
rules="required|integer"
|
name="fee"
|
||||||
name="fee"
|
>
|
||||||
>
|
<b-input-group>
|
||||||
<b-form-input v-model="fee" />
|
<b-form-input v-model="fee" />
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<b-input-group-append>
|
||||||
</validation-provider>
|
<b-form-select
|
||||||
<validation-provider
|
v-model="feeDenom"
|
||||||
v-slot="{ errors }"
|
:options="feeDenoms"
|
||||||
rules="required"
|
value-field="denom"
|
||||||
name="feeDenom"
|
text-field="denom"
|
||||||
>
|
/>
|
||||||
<b-form-select
|
</b-input-group-append>
|
||||||
v-model="feeDenom"
|
</b-input-group>
|
||||||
>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
<b-form-select-option
|
</validation-provider>
|
||||||
v-for="item in feeDenoms"
|
</b-form-group>
|
||||||
:key="item.denom"
|
</b-col>
|
||||||
:value="item.denom"
|
<b-col cols="12">
|
||||||
>
|
<b-form-group>
|
||||||
{{ item.denom }}
|
<b-form-checkbox
|
||||||
</b-form-select-option>
|
v-model="advance"
|
||||||
</b-form-select>
|
name="advance"
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
value="true"
|
||||||
</validation-provider>
|
>
|
||||||
</b-input-group>
|
<small>Advance</small>
|
||||||
|
</b-form-checkbox>
|
||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
<b-row>
|
<b-row v-if="advance">
|
||||||
<b-col>
|
<b-col cols="12">
|
||||||
|
<b-form-group
|
||||||
|
label="Gas"
|
||||||
|
label-for="gas"
|
||||||
|
>
|
||||||
|
<validation-provider
|
||||||
|
v-slot="{ errors }"
|
||||||
|
name="gas"
|
||||||
|
>
|
||||||
|
<b-form-input
|
||||||
|
id="gas"
|
||||||
|
v-model="gas"
|
||||||
|
type="number"
|
||||||
|
/>
|
||||||
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
|
</validation-provider>
|
||||||
|
</b-form-group>
|
||||||
|
</b-col>
|
||||||
|
<b-col cols="12">
|
||||||
<b-form-group
|
<b-form-group
|
||||||
label="Memo"
|
label="Memo"
|
||||||
label-for="Memo"
|
label-for="Memo"
|
||||||
@ -95,7 +114,6 @@
|
|||||||
</b-form-group>
|
</b-form-group>
|
||||||
</b-col>
|
</b-col>
|
||||||
</b-row>
|
</b-row>
|
||||||
|
|
||||||
<b-row>
|
<b-row>
|
||||||
<b-col>
|
<b-col>
|
||||||
<b-form-group
|
<b-form-group
|
||||||
@ -116,7 +134,7 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="keplr"
|
value="keplr"
|
||||||
class="mb-1 mt-1"
|
class="d-none d-md-block"
|
||||||
>
|
>
|
||||||
Keplr
|
Keplr
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
@ -124,17 +142,16 @@
|
|||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerUSB"
|
value="ledgerUSB"
|
||||||
class="mb-1 mt-1"
|
|
||||||
>
|
>
|
||||||
Ledger (USB)
|
<small>Ledger(USB)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
<b-form-radio
|
<b-form-radio
|
||||||
v-model="wallet"
|
v-model="wallet"
|
||||||
name="wallet"
|
name="wallet"
|
||||||
value="ledgerBle"
|
value="ledgerBle"
|
||||||
class="mb-1 mt-1"
|
class="mr-0"
|
||||||
>
|
>
|
||||||
Ledger (Bluetooth)
|
<small>Ledger(Bluetooth)</small>
|
||||||
</b-form-radio>
|
</b-form-radio>
|
||||||
</b-form-radio-group>
|
</b-form-radio-group>
|
||||||
<small class="text-danger">{{ errors[0] }}</small>
|
<small class="text-danger">{{ errors[0] }}</small>
|
||||||
@ -152,8 +169,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
import { ValidationProvider, ValidationObserver } from 'vee-validate'
|
||||||
import {
|
import {
|
||||||
BModal, BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup, BFormSelect, BFormSelectOption,
|
BModal, BRow, BCol, BInputGroup, BFormInput, BAvatar, BFormGroup, BFormSelect,
|
||||||
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend,
|
BForm, BFormRadioGroup, BFormRadio, BInputGroupPrepend, BFormCheckbox, BInputGroupAppend,
|
||||||
} from 'bootstrap-vue'
|
} from 'bootstrap-vue'
|
||||||
import {
|
import {
|
||||||
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
required, email, url, between, alpha, integer, password, min, digits, alphaDash, length,
|
||||||
@ -177,9 +194,10 @@ export default {
|
|||||||
BAvatar,
|
BAvatar,
|
||||||
BFormGroup,
|
BFormGroup,
|
||||||
BFormSelect,
|
BFormSelect,
|
||||||
BFormSelectOption,
|
|
||||||
BFormRadioGroup,
|
BFormRadioGroup,
|
||||||
BFormRadio,
|
BFormRadio,
|
||||||
|
BFormCheckbox,
|
||||||
|
BInputGroupAppend,
|
||||||
|
|
||||||
ValidationProvider,
|
ValidationProvider,
|
||||||
ValidationObserver,
|
ValidationObserver,
|
||||||
@ -202,10 +220,12 @@ export default {
|
|||||||
memo: '',
|
memo: '',
|
||||||
fee: '800',
|
fee: '800',
|
||||||
feeDenom: '',
|
feeDenom: '',
|
||||||
wallet: 'keplr',
|
wallet: 'ledgerUSB',
|
||||||
error: null,
|
error: null,
|
||||||
sequence: 1,
|
sequence: 1,
|
||||||
accountNumber: 0,
|
accountNumber: 0,
|
||||||
|
gas: '200000',
|
||||||
|
advance: false,
|
||||||
|
|
||||||
required,
|
required,
|
||||||
password,
|
password,
|
||||||
@ -323,7 +343,7 @@ export default {
|
|||||||
denom: this.feeDenom,
|
denom: this.feeDenom,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
gas: '200000',
|
gas: this.gas,
|
||||||
}
|
}
|
||||||
|
|
||||||
const signerData = {
|
const signerData = {
|
||||||
|
@ -26,28 +26,11 @@
|
|||||||
<div class="d-flex flex-wrap">
|
<div class="d-flex flex-wrap">
|
||||||
<b-button
|
<b-button
|
||||||
v-b-modal.delegate-window
|
v-b-modal.delegate-window
|
||||||
size="sm"
|
|
||||||
variant="primary"
|
variant="primary"
|
||||||
class="mr-25 mb-25"
|
class="mr-25 mb-25"
|
||||||
>
|
>
|
||||||
Delegate
|
Delegate
|
||||||
</b-button>
|
</b-button>
|
||||||
<b-button
|
|
||||||
v-b-modal.redelegate-window
|
|
||||||
size="sm"
|
|
||||||
variant="outline-danger"
|
|
||||||
class="mr-25 mb-25"
|
|
||||||
>
|
|
||||||
Redelegate
|
|
||||||
</b-button>
|
|
||||||
<b-button
|
|
||||||
v-b-modal.unbond-window
|
|
||||||
size="sm"
|
|
||||||
variant="outline-danger"
|
|
||||||
class="mr-25 mb-25"
|
|
||||||
>
|
|
||||||
Unbond
|
|
||||||
</b-button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -280,8 +263,6 @@
|
|||||||
</b-row>
|
</b-row>
|
||||||
</template>
|
</template>
|
||||||
<operation-delegate-component :validator-address="validator.operator_address" />
|
<operation-delegate-component :validator-address="validator.operator_address" />
|
||||||
<operation-redelegate-component :validator-address="validator.operator_address" />
|
|
||||||
<operation-unbond-component :validator-address="validator.operator_address" />
|
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -298,8 +279,6 @@ import StakingAddressComponent from './StakingAddressComponent.vue'
|
|||||||
import StakingCommissionComponent from './StakingCommissionComponent.vue'
|
import StakingCommissionComponent from './StakingCommissionComponent.vue'
|
||||||
import StakingRewardComponent from './StakingRewardComponent.vue'
|
import StakingRewardComponent from './StakingRewardComponent.vue'
|
||||||
import OperationDelegateComponent from './OperationDelegateComponent.vue'
|
import OperationDelegateComponent from './OperationDelegateComponent.vue'
|
||||||
import OperationRedelegateComponent from './OperationRedelegateComponent.vue'
|
|
||||||
import OperationUnbondComponent from './OperationUnbondComponent.vue'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
@ -315,8 +294,6 @@ export default {
|
|||||||
StakingCommissionComponent,
|
StakingCommissionComponent,
|
||||||
StakingRewardComponent,
|
StakingRewardComponent,
|
||||||
OperationDelegateComponent,
|
OperationDelegateComponent,
|
||||||
OperationRedelegateComponent,
|
|
||||||
OperationUnbondComponent,
|
|
||||||
},
|
},
|
||||||
directives: {
|
directives: {
|
||||||
'b-modal': VBModal,
|
'b-modal': VBModal,
|
||||||
|
Loading…
Reference in New Issue
Block a user