diff --git a/src/libs/fetch.js b/src/libs/fetch.js index 08bf901f..7cbd9648 100644 --- a/src/libs/fetch.js +++ b/src/libs/fetch.js @@ -60,18 +60,20 @@ export default class ChainFetch { } async getLatestBlock(config = null) { - // const conf = config || this.getSelectedConfig() - // if (conf.chain_name === 'injective') { - // return ChainFetch.fetch('https://tm.injective.network', '/cosmos/base/tendermint/v1beta1/block').then(data => Block.create(commonProcess(data))) - // } + const conf = config || this.getSelectedConfig() + const ver = conf.sdk_version || '0.41' + if (ver && compareVersions(ver, '0.45') < 1) { + return this.get('/blocks/latest', config).then(data => Block.create(data)) + } return this.get('/cosmos/base/tendermint/v1beta1/blocks/latest', config).then(data => Block.create(data)) } async getBlockByHeight(height, config = null) { - // const conf = config || this.getSelectedConfig() - // if (conf.chain_name === 'injective') { - // return ChainFetch.fetch('https://tm.injective.network', `/cosmos/base/tendermint/v1beta1/block?height=${height}`).then(data => Block.create(commonProcess(data))) - // } + const conf = config || this.getSelectedConfig() + const ver = conf.sdk_version || '0.41' + if (ver && compareVersions(ver, '0.45') < 1) { + return this.get(`/blocks/${height}`, config).then(data => Block.create(data)) + } return this.get(`/cosmos/base/tendermint/v1beta1/blocks/${height}`, config).then(data => Block.create(data)) } diff --git a/src/views/components/dashboard/DashboardPriceChart2.vue b/src/views/components/dashboard/DashboardPriceChart2.vue index 01bbe3e2..ab6d9fc4 100644 --- a/src/views/components/dashboard/DashboardPriceChart2.vue +++ b/src/views/components/dashboard/DashboardPriceChart2.vue @@ -371,9 +371,11 @@ export default { return '#' }, discord() { - const discordLink = this.coinInfo.links.chat_url.filter(x => x.includes('discord')) - if (discordLink) { - return discordLink ? `${discordLink}` : '#' + if (this.coinInfo.links) { + const discordLink = this.coinInfo.links.chat_url.filter(x => x.includes('discord')) + if (discordLink) { + return discordLink ? `${discordLink}` : '#' + } } return '#' },