diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 3cf022ba..eb305eea 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -222,6 +222,11 @@ const chainAPI = class ChainFetch { return ret } + async getUrl(url) { + this.getSelectedConfig() + return fetch(url).then(res => res.json()) + } + static fetch(host, url) { const ret = fetch(host + url).then(response => response.json()) return ret @@ -267,13 +272,18 @@ const chainAPI = class ChainFetch { return this.get('/ibc/applications/transfer/v1beta1/denom_traces/'.concat(h), config).then(data => commonProcess(data)) } - async getIBCChannels(key = null, config = null) { + async getIBCChannels(config = null, key = null) { if (key) { return this.get('/ibc/core/channel/v1beta1/channels?pagination.key='.concat(key), config).then(data => commonProcess(data)) } return this.get('/ibc/core/channel/v1beta1/channels', config).then(data => commonProcess(data)) } - // /cosmos/staking/v1beta1/delegations/{delegator_addr} + + // eslint-disable-next-line camelcase + async getIBCChannelClientState(channel_id, port_id, config = null) { + // eslint-disable-next-line camelcase + return this.get(`/ibc/core/channel/v1beta1/channels/${channel_id}/ports/${port_id}/client_state`, config).then(data => commonProcess(data)) + } static async getBankBalance(baseurl, address) { return ChainFetch.fetch(baseurl, '/bank/balances/'.concat(address)).then(data => commonProcess(data)) diff --git a/src/store/chains/index.js b/src/store/chains/index.js index e43cbddc..09f191c7 100644 --- a/src/store/chains/index.js +++ b/src/store/chains/index.js @@ -47,6 +47,7 @@ export default { selected, avatars: {}, height: 0, + ibcChannels: {}, }, getters: { getchains: state => state.chains, @@ -65,6 +66,9 @@ export default { setHeight(state, height) { state.chains.height = height }, + setChannels(state, { chain, channels }) { + state.chains.ibcChannels[chain] = channels + }, }, actions: {}, } diff --git a/src/views/GovernanceProposalView.vue b/src/views/GovernanceProposalView.vue index 560d1a74..77f57d74 100644 --- a/src/views/GovernanceProposalView.vue +++ b/src/views/GovernanceProposalView.vue @@ -208,7 +208,7 @@ diff --git a/src/views/OperationTransfer2Component.vue b/src/views/OperationTransfer2Component.vue new file mode 100644 index 00000000..b9fcdc68 --- /dev/null +++ b/src/views/OperationTransfer2Component.vue @@ -0,0 +1,530 @@ + + + + diff --git a/src/views/OperationTransferComponent.vue b/src/views/OperationTransferComponent.vue index 86ab3e66..23d8b8e0 100644 --- a/src/views/OperationTransferComponent.vue +++ b/src/views/OperationTransferComponent.vue @@ -359,7 +359,7 @@ export default { this.feeDenom = this.balance.find(x => !x.denom.startsWith('ibc')).denom this.balance.filter(i => i.denom.startsWith('ibc')).forEach(x => { if (!this.IBCDenom[x.denom]) { - this.$http.getIBCDenomTrace(x.denom).then(denom => { + this.$http.getIBCDenomTrace(x.denom, this.selectedChain).then(denom => { this.IBCDenom[x.denom] = denom.denom_trace.base_denom }) } diff --git a/src/views/OperationWithdrawComponent.vue b/src/views/OperationWithdrawComponent.vue index a7d3e3e0..c6baf941 100644 --- a/src/views/OperationWithdrawComponent.vue +++ b/src/views/OperationWithdrawComponent.vue @@ -178,7 +178,6 @@ import { import { formatToken, getLocalAccounts, getLocalChains, sign, timeIn, setLocalTxHistory, } from '@/libs/data' -import chainAPI from '@/libs/fetch' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' export default { @@ -266,14 +265,14 @@ export default { this.account = this.computeAccount() if (this.account && this.account.length > 0) this.address = this.account[0].addr if (this.address) { - chainAPI.getBankBalance(this.selectedChain.api, this.address).then(res => { + this.$http.getBankBalances(this.address).then(res => { if (res && res.length > 0) { this.balance = res const token = this.balance.find(i => !i.denom.startsWith('ibc')) if (token) this.feeDenom = token.denom } }) - this.$http.getLatestBlock(this.selectedChain).then(ret => { + this.$http.getLatestBlock().then(ret => { this.chainId = ret.block.header.chain_id const notSynced = timeIn(ret.block.header.time, 10, 'm') if (notSynced) { @@ -282,7 +281,7 @@ export default { this.error = null } }) - this.$http.getAuthAccount(this.address, this.selectedChain).then(ret => { + 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.sequence = ret.value.base_vesting_account.base_account.sequence diff --git a/src/views/WalletAccountDetail.vue b/src/views/WalletAccountDetail.vue index 4d4e1d3e..619a1c71 100644 --- a/src/views/WalletAccountDetail.vue +++ b/src/views/WalletAccountDetail.vue @@ -256,6 +256,10 @@ End Time {{ formatTime(account.value.base_vesting_account.end_time) }} + @@ -392,10 +396,10 @@ export default { }, computed: { accountTitle() { - if (this.account) { + if (this.account && this.account.type) { return this.account.type.substring(this.account.type.indexOf('/') + 1) } - return '' + return 'Profile' }, assetTable() { let total = [] diff --git a/src/views/WalletAccounts.vue b/src/views/WalletAccounts.vue index f0bc5c77..ca8ec113 100644 --- a/src/views/WalletAccounts.vue +++ b/src/views/WalletAccounts.vue @@ -52,6 +52,13 @@ > Transfer + + IBC Transfer + + @@ -139,6 +147,7 @@ import { } from '@/libs/data' import ToastificationContent from '@core/components/toastification/ToastificationContent.vue' import OperationTransferComponent from './OperationTransferComponent.vue' +import OperationTransfer2Component from './OperationTransfer2Component.vue' export default { components: { @@ -157,6 +166,7 @@ export default { OperationTransferComponent, // eslint-disable-next-line vue/no-unused-components ToastificationContent, + OperationTransfer2Component, }, directives: { 'b-modal': VBModal,