diff --git a/src/views/OperationDelegateComponent.vue b/src/views/OperationDelegateComponent.vue index f915996b..f5de40c7 100644 --- a/src/views/OperationDelegateComponent.vue +++ b/src/views/OperationDelegateComponent.vue @@ -357,7 +357,7 @@ export default { if (this.selectedAddress) { this.$http.getBankBalances(this.selectedAddress).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() const token = this.balance.find(i => !i.denom.startsWith('ibc')) this.token = token.denom if (token) this.feeDenom = token.denom diff --git a/src/views/OperationRedelegateComponent.vue b/src/views/OperationRedelegateComponent.vue index 7e7778d9..ce546cdb 100644 --- a/src/views/OperationRedelegateComponent.vue +++ b/src/views/OperationRedelegateComponent.vue @@ -352,7 +352,7 @@ export default { }) this.$http.getBankBalances(this.address).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() } }) this.$http.getLatestBlock().then(ret => { diff --git a/src/views/OperationTransfer2Component.vue b/src/views/OperationTransfer2Component.vue index b9fcdc68..18b8b8c2 100644 --- a/src/views/OperationTransfer2Component.vue +++ b/src/views/OperationTransfer2Component.vue @@ -51,6 +51,7 @@ > - - - + {{ errors[0] }} @@ -131,6 +132,7 @@ id="Recipient" v-model="recipient" :state="errors.length > 0 ? false:null" + :placeholder="placeholder" /> {{ errors[0] }} @@ -282,6 +284,8 @@ import { import { Cosmos } from '@cosmostation/cosmosjs' import vSelect from 'vue-select' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' +import { coin } from '@cosmjs/amino' +import dayjs from 'dayjs' export default { name: 'TransforDialogue', @@ -335,6 +339,7 @@ export default { advance: false, paths: {}, destination: {}, + channels: [], required, password, @@ -353,11 +358,23 @@ export default { feeDenoms() { return this.balance.filter(item => !item.denom.startsWith('ibc')) }, + destinationOptions() { + const options = this.channels.map(x => ({ port_id: x.port_id, channel_id: x.channel_id, label: `${x.chain_id ? x.chain_id : ''} ${x.port_id}/${x.channel_id}` })) + const query = this.paths[this.token] + return query && String(this.token).startsWith('ibc/') ? options.filter(x => x.channel_id === query.channel_id) : options + }, + placeholder() { + return 'Input a destination address' + }, }, created() { // console.log('address: ', this.address) }, methods: { + tokenChange() { + this.destination = null + this.recipient = null + }, printDenom() { return formatTokenDenom(this.IBCDenom[this.token] || this.token) }, @@ -375,12 +392,13 @@ export default { return null }, loadBalance() { + this.destination = null this.account = this.computeAccount() if (this.account && this.account.length > 0) this.address = this.account[0].addr if (this.address) { this.$http.getBankBalances(this.address, this.selectedChain).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() this.token = this.balance[0].denom this.feeDenom = this.balance.find(x => !x.denom.startsWith('ibc')).denom this.balance.filter(i => i.denom.startsWith('ibc')).forEach(x => { @@ -390,8 +408,8 @@ export default { // console.log(denom.denom_trace) const path = denom.denom_trace.path.split('/') this.paths[x.denom] = { - channel: path[1], - port: path[0], + channel_id: path[1], + port_id: path[0], } }) } @@ -425,10 +443,13 @@ export default { chans.forEach((x, i) => { this.$http.getIBCChannelClientState(x.channel_id, x.port_id, this.selectedChain).then(cs => { chans[i].chain_id = cs.identified_client_state.client_state.chain_id - // console.log(i, chans[i]) + this.$store.commit('setChannels', { chain: this.selectedChain.chain_name, channels: chans }) + this.$set(this, 'channels', chans) }) }) }) + } else { + this.channels = channels } } }, @@ -455,27 +476,25 @@ export default { cosmos.getAccounts() }, async send() { + if (!this.destination) { + this.error = 'You have to select a destination' + return + } const txMsgs = [ { typeUrl: '/ibc.applications.transfer.v1.MsgTransfer', value: { - source_port: this.paths[this.token].port, - source_channel: this.paths[this.token].channel, - token: { - amount: String((Number(this.amount) * 1000000).toFixed()), - denom: this.token, - }, + sourcePort: this.destination.port_id, + sourceChannel: this.destination.channel_id, + token: coin(Number(this.amount) * 1000000, this.token), sender: this.address, receiver: this.recipient, - // timeout_height: this.timeoutHeight ? { revision_height: '', revision_number: '' } : {}, - // timeout_timestamp: null, + timeoutHeight: { revisionHeight: '1000', revisionNumber: '1000' }, + timeoutTimestamp: String(dayjs().add(5, 'm') * 1000), }, }, ] - // console.log(txMsgs) - if (this.token) return - const txFee = { amount: [ { @@ -492,6 +511,8 @@ export default { chainId: this.chainId, } + console.log(txMsgs, txFee, signerData) + sign( this.wallet, this.chainId, diff --git a/src/views/OperationTransferComponent.vue b/src/views/OperationTransferComponent.vue index 23d8b8e0..0577574a 100644 --- a/src/views/OperationTransferComponent.vue +++ b/src/views/OperationTransferComponent.vue @@ -354,7 +354,7 @@ export default { if (this.address) { this.$http.getBankBalances(this.address, this.selectedChain).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() this.token = this.balance[0].denom this.feeDenom = this.balance.find(x => !x.denom.startsWith('ibc')).denom this.balance.filter(i => i.denom.startsWith('ibc')).forEach(x => { diff --git a/src/views/OperationUnbondComponent.vue b/src/views/OperationUnbondComponent.vue index 1c0f0178..a308f117 100644 --- a/src/views/OperationUnbondComponent.vue +++ b/src/views/OperationUnbondComponent.vue @@ -331,7 +331,7 @@ export default { } this.$http.getBankBalances(this.address).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() } }) this.$http.getLatestBlock().then(ret => { diff --git a/src/views/OperationVoteComponent.vue b/src/views/OperationVoteComponent.vue index 9b3d06b4..4bc3a457 100644 --- a/src/views/OperationVoteComponent.vue +++ b/src/views/OperationVoteComponent.vue @@ -315,7 +315,7 @@ export default { if (this.voter) { this.$http.getBankBalances(this.voter).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() const token = this.balance.find(i => !i.denom.startsWith('ibc')) if (token) this.feeDenom = token.denom } diff --git a/src/views/OperationWithdrawCommissionComponent.vue b/src/views/OperationWithdrawCommissionComponent.vue index de4ee13b..96b62feb 100644 --- a/src/views/OperationWithdrawCommissionComponent.vue +++ b/src/views/OperationWithdrawCommissionComponent.vue @@ -246,7 +246,7 @@ export default { loadBalance() { this.$http.getBankBalances(this.address).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() const token = this.balance.find(i => !i.denom.startsWith('ibc')) if (token) this.feeDenom = token.denom } diff --git a/src/views/OperationWithdrawComponent.vue b/src/views/OperationWithdrawComponent.vue index c6baf941..80757ed1 100644 --- a/src/views/OperationWithdrawComponent.vue +++ b/src/views/OperationWithdrawComponent.vue @@ -267,7 +267,7 @@ export default { if (this.address) { this.$http.getBankBalances(this.address).then(res => { if (res && res.length > 0) { - this.balance = res + this.balance = res.reverse() const token = this.balance.find(i => !i.denom.startsWith('ibc')) if (token) this.feeDenom = token.denom } diff --git a/src/views/Transaction.vue b/src/views/Transaction.vue index c74f7c70..7f684ad5 100644 --- a/src/views/Transaction.vue +++ b/src/views/Transaction.vue @@ -24,7 +24,7 @@ {{ 'status' }} - diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 619a1c71..fa8de8fc 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -175,11 +175,16 @@ + + + Account Type + {{ account.type }} + Account Number @@ -192,7 +197,12 @@ Public Key - + + + + Account Type + {{ account.type }} + Account Number @@ -231,7 +241,12 @@ - + + + + Account Type + {{ account.type }} + Account Number