Skip to content

Commit 88f2def

Browse files
committed
fix chain order in ibc
1 parent 8cdc7c2 commit 88f2def

File tree

1 file changed

+10
-11
lines changed

1 file changed

+10
-11
lines changed

src/modules/[chain]/ibc/connStore.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ export const useIBCModule = defineStore('module-ibc', {
2929
},
3030
isFirstChain(): boolean {
3131
return (
32-
this.registryConf?.chain_1?.chain_name === this.chain.current?.prettyName ||
33-
this.registryConf?.chain_1?.chain_name === this.chain.chainName
32+
this.registryConf.chain_1.chain_name === this.chain.current?.prettyName ||
33+
this.registryConf.chain_1.chain_name === this.chain.chainName
3434
);
3535
},
3636
sourceField(): string {
@@ -56,13 +56,15 @@ export const useIBCModule = defineStore('module-ibc', {
5656
client.urls.push(element.download_url);
5757
}
5858
});
59-
6059
client.fetchUrls().then(() => {
6160
const info = client.getChainIbcData(this.chainName);
6261
this.info = info.sort((a, b) => {
6362
// Sort by remote chain name (not equal to this.chainName)
6463
const getRemote = (x: any) =>
65-
x.chain_1.chain_name === this.isFirstChain ? x.chain_2.chain_name : x.chain_1.chain_name;
64+
x?.chain_1?.chain_name === this.chain.current?.prettyName ||
65+
x?.chain_1?.chain_name === this.chain.chainName
66+
? x.chain_2.chain_name
67+
: x.chain_1.chain_name;
6668
return getRemote(a).localeCompare(getRemote(b));
6769
});
6870
});
@@ -86,13 +88,10 @@ export const useIBCModule = defineStore('module-ibc', {
8688
return entries;
8789
},
8890
fetchConnection(index: number) {
89-
const res = this.info[index];
90-
const resIsFirstChain =
91-
res.chain_1.chain_name === this.chain.current?.prettyName || res.chain_1.chain_name === this.chain.chainName;
92-
93-
const connId = resIsFirstChain ? res.chain_1.connection_id : res.chain_2.connection_id;
94-
95-
this.registryConf = res;
91+
this.registryConf = this.info[index];
92+
const connId = this.isFirstChain
93+
? this.registryConf.chain_1.connection_id
94+
: this.registryConf.chain_2.connection_id;
9695
this.showConnection(connId);
9796
},
9897
showConnection(connId?: string | number) {

0 commit comments

Comments
 (0)