diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index cfc775e6..9469c13e 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -133,7 +133,7 @@ Delegate-new + />Delegate1 Withdraw Rewards + + Withdraw Rewards1 + @@ -190,7 +202,7 @@ @@ -205,6 +217,15 @@ > + + + diff --git a/src/views/components/OperationModal/components/Delegate.vue b/src/views/components/OperationModal/components/Delegate.vue index 5a07009c..a302373a 100644 --- a/src/views/components/OperationModal/components/Delegate.vue +++ b/src/views/components/OperationModal/components/Delegate.vue @@ -120,7 +120,7 @@ import { required, email, url, between, alpha, integer, password, min, digits, alphaDash, length, } from '@validations' import { - abbrAddress, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, + abbrAddress, formatToken, formatTokenDenom, getLocalAccounts, getUnitAmount, extractAccountNumberAndSequence, } from '@/libs/utils' import vSelect from 'vue-select' @@ -210,6 +210,10 @@ export default { }, }, mounted() { + this.$emit('update', { + modalTitle: 'Delegate Token', + historyName: 'delegate', + }) this.loadBalance() }, methods: { @@ -241,9 +245,13 @@ export default { }) } }) - console.log('onChange----------->') - // TODO: this.$emit() - // this.$parent.getAuthAccount(this.selectedAddress) + this.$http.getAuthAccount(this.selectedAddress).then(ret => { + const account = extractAccountNumberAndSequence(ret) + this.$emit('update', { + accountNumber: account.accountNumber, + sequence: account.sequence, + }) + }) } }, computeAccount() { diff --git a/src/views/components/OperationModal/components/Redelegate.vue b/src/views/components/OperationModal/components/Redelegate.vue index b051962d..fd70b536 100644 --- a/src/views/components/OperationModal/components/Redelegate.vue +++ b/src/views/components/OperationModal/components/Redelegate.vue @@ -118,7 +118,7 @@ import { import vSelect from 'vue-select' export default { - name: 'UnbondDialogue', + name: 'Redelegate', components: { BRow, BCol, @@ -142,17 +142,13 @@ export default { data() { return { selectedAddress: this.address, - availableAddress: [], unbundValidators: [], validators: [], toValidator: null, token: '', amount: null, - chainId: '', - selectedChain: '', balance: [], delegations: [], - memo: '', feeDenom: '', error: null, sequence: 1, @@ -198,6 +194,10 @@ export default { }, }, mounted() { + this.$emit('update', { + modalTitle: 'Redelegate Token', + historyName: 'redelegate', + }) this.loadBalance() }, methods: { @@ -222,7 +222,9 @@ export default { this.delegations.forEach(x => { if (x.delegation.validator_address === this.validatorAddress) { this.token = x.balance.denom - this.feeDenom = x.balance.denom + this.$emit('update', { + feeDenom: x.balance.denom, + }) } }) }) diff --git a/src/views/components/OperationModal/components/Unbond.vue b/src/views/components/OperationModal/components/Unbond.vue new file mode 100644 index 00000000..76c6b299 --- /dev/null +++ b/src/views/components/OperationModal/components/Unbond.vue @@ -0,0 +1,206 @@ + + + + diff --git a/src/views/components/OperationModal/components/Withdraw.vue b/src/views/components/OperationModal/components/Withdraw.vue new file mode 100644 index 00000000..f4a2e81d --- /dev/null +++ b/src/views/components/OperationModal/components/Withdraw.vue @@ -0,0 +1,140 @@ + + + diff --git a/src/views/components/OperationModal/index.vue b/src/views/components/OperationModal/index.vue index ba92867b..f4a3bf74 100644 --- a/src/views/components/OperationModal/index.vue +++ b/src/views/components/OperationModal/index.vue @@ -3,7 +3,7 @@ id="operation-modal" centered size="md" - title="Delegate Token" + :title="modalTitle" ok-title="Send" hide-header-close scrollable @@ -41,7 +41,8 @@ :is="type" ref="component" :address="address" - :validator-address="selectedValidator" + :validator-address="validatorAddress" + @update="componentUpdate" /> @@ -151,6 +152,8 @@ import ToastificationContent from '@core/components/toastification/Toastificatio import WalletInputVue from '../WalletInput.vue' import Delegate from './components/Delegate.vue' import Redelegate from './components/Redelegate.vue' +import Withdraw from './components/Withdraw.vue' +import Unbond from './components/Unbond.vue' export default { name: 'DelegateDialogue', @@ -178,6 +181,8 @@ export default { ToastificationContent, Delegate, Redelegate, + Withdraw, + Unbond, }, directives: { Ripple, @@ -198,8 +203,11 @@ export default { }, data() { return { + modalTitle: '', + historyName: '', selectedAddress: this.address, selectedValidator: null, + selectedChain: null, token: '', chainId: '', balance: [], @@ -244,7 +252,11 @@ export default { this.error = null } }) - this.getAuthAccount() + this.$http.getAuthAccount(this.selectedAddress).then(ret => { + const account = extractAccountNumberAndSequence(ret) + this.accountNumber = account.accountNumber + this.sequence = account.sequence + }) this.$http.getBankBalances(this.selectedAddress).then(res => { if (res && res.length > 0) { this.balance = res.reverse() @@ -263,12 +275,10 @@ export default { this.fee = this.$store.state.chains.selected?.min_tx_fee || '1000' this.feeDenom = this.$store.state.chains.selected?.assets[0]?.base || '' }, - getAuthAccount(address = this.selectedAddress) { - this.$http.getAuthAccount(address).then(ret => { - const account = extractAccountNumberAndSequence(ret) - console.log(account) - this.accountNumber = account.accountNumber - this.sequence = account.sequence + componentUpdate(obj) { + console.log(obj) + Object.keys(obj).forEach(key => { + this[key] = obj[key] }) }, handleOk(bvModalEvt) { @@ -288,7 +298,7 @@ export default { }, async sendTx() { const txMsgs = this.$refs.component.msg - + console.log(txMsgs) if (txMsgs.length === 0) { this.error = 'No delegation found' return '' @@ -323,10 +333,10 @@ export default { this.memo, signerData, ).then(bodyBytes => { - this.$http.broadcastTx(bodyBytes).then(res => { + this.$http.broadcastTx(bodyBytes, this.selectedChain).then(res => { setLocalTxHistory({ chain: this.$store.state.chains.selected, - op: 'delegate', + op: this.historyName, hash: res.tx_response.txhash, time: new Date(), })