Fix ibc denom trace issue

This commit is contained in:
liangping 2022-01-10 20:46:53 +08:00
parent 221574c923
commit 15ce00fda5
2 changed files with 3 additions and 11 deletions

View File

@ -321,7 +321,8 @@ export default class ChainFetch {
async getIBCDenomTrace(hash, config = null) {
const h = hash.substring(hash.indexOf('/') + 1)
if (compareVersions(this.config.sdk_version, '0.42.6') < 0) {
const sdkVersion = config ? config.sdk_version : this.config.sdk_version
if (compareVersions(sdkVersion, '0.42.4') < 0) {
return this.get('/ibc/applications/transfer/v1beta1/denom_traces/'.concat(h), config).then(data => commonProcess(data))
}
return this.get('/ibc/apps/transfer/v1/denom_traces/'.concat(h), config).then(data => commonProcess(data))
@ -350,15 +351,6 @@ export default class ChainFetch {
return ChainFetch.fetch(baseurl, '/bank/balances/'.concat(address)).then(data => commonProcess(data))
}
static async getIBCDenomTrace(baseurl, hash) {
const h = hash.substring(hash.indexOf('/'))
return ChainFetch.fetch(baseurl, '/ibc/applications/transfer/v1beta1/denom_traces/'.concat(h)).then(data => commonProcess(data))
}
static async getIBCDenomTraceText(baseurl, hash) {
return ChainFetch.getIBCDenomTrace(baseurl, hash).then(res => res.denom_trace.base_denom)
}
async getGravityPools() {
return this.get('/cosmos/liquidity/v1beta1/pools').then(data => commonProcess(data))
}

View File

@ -583,7 +583,7 @@ export default {
this.assets = bal
bal.forEach(x => {
if (x.denom.startsWith('ibc/')) {
chainAPI.getIBCDenomTraceText(this.$http.config.api, x.denom).then(denom => {
this.$http.getIBCDenomTrace(x.denom).then(denom => {
this.$set(this.denoms, x.denom, denom)
const symbol = formatTokenDenom(denom)
if (!this.quotes[symbol] && symbol.indexOf('/') === -1) {