diff --git a/.prettierrc.json b/.prettierrc.json index ef7e9a53..35ff4599 100644 --- a/.prettierrc.json +++ b/.prettierrc.json @@ -1,12 +1,12 @@ { - "tabWidth": 2, - "singleQuote": true, - "semi": true, - "endOfLine": "auto", - "bracketSpacing": true, - "trailingComma": "es5", "arrowParens": "always", + "bracketSpacing": true, + "endOfLine": "auto", + "printWidth": 80, + "semi": true, "singleAttributePerLine": false, - "printWidth": 120, + "singleQuote": true, + "tabWidth": 2, + "trailingComma": "es5", "useTabs": false } diff --git a/src/modules/[chain]/ibc/connStore.ts b/src/modules/[chain]/ibc/connStore.ts index 8cec9a0f..01498056 100644 --- a/src/modules/[chain]/ibc/connStore.ts +++ b/src/modules/[chain]/ibc/connStore.ts @@ -22,10 +22,14 @@ export const useIBCModule = defineStore('module-ibc', { return this.chain.chainName; }, sourceField(): string { - return this.registryConf?.chain_1?.chain_name === this.chainName ? 'chain_1' : 'chain_2'; + return this.registryConf?.chain_1?.chain_name === this.chainName + ? 'chain_1' + : 'chain_2'; }, destField(): string { - return this.registryConf?.chain_1?.chain_name === this.chainName ? 'chain_2' : 'chain_1'; + return this.registryConf?.chain_1?.chain_name === this.chainName + ? 'chain_2' + : 'chain_1'; }, registryChannels(): any { return this.registryConf.channels; @@ -48,17 +52,21 @@ export const useIBCModule = defineStore('module-ibc', { this.info = info.sort((a, b) => { // Sort by remote chain name (not equal to this.chainName) const getRemote = (x: any) => - x.chain_1.chain_name === this.chainName ? x.chain_2.chain_name : x.chain_1.chain_name; + x.chain_1.chain_name === this.chainName + ? x.chain_2.chain_name + : x.chain_1.chain_name; return getRemote(a).localeCompare(getRemote(b)); }); }); }); }, async fetchIBCUrls(): Promise { - let ibcEndpoint = 'https://api.github.com/repos/cosmos/chain-registry/contents/_IBC'; + let ibcEndpoint = + 'https://api.github.com/repos/cosmos/chain-registry/contents/_IBC'; if (this.chainName.includes('testnet')) { console.log(this.chainName); - ibcEndpoint = 'https://api.github.com/repos/cosmos/chain-registry/contents/testnets/_IBC'; + ibcEndpoint = + 'https://api.github.com/repos/cosmos/chain-registry/contents/testnets/_IBC'; } const entries = await fetch(ibcEndpoint).then((res) => res.json()); return entries.filter((x: any) => x.name.match(this.chainName)); @@ -66,9 +74,12 @@ export const useIBCModule = defineStore('module-ibc', { fetchConnection(index: number) { const res = this.info[index]; const isFirstChain = - res.chain_1.chain_name === this.chain.current?.prettyName || res.chain_1.chain_name === this.chain.chainName; + res.chain_1.chain_name === this.chain.current?.prettyName || + res.chain_1.chain_name === this.chain.chainName; - const connId = isFirstChain ? res.chain_1.connection_id : res.chain_2.connection_id; + const connId = isFirstChain + ? res.chain_1.connection_id + : res.chain_2.connection_id; this.registryConf = res; this.showConnection(connId); diff --git a/src/modules/[chain]/ibc/connection.vue b/src/modules/[chain]/ibc/connection.vue index 59695a02..ae3d8845 100644 --- a/src/modules/[chain]/ibc/connection.vue +++ b/src/modules/[chain]/ibc/connection.vue @@ -36,24 +36,44 @@ function pageload(p: number) {

{{ $t('ibc.title') }}

- {{ s.chain_1.chain_name === ibcStore.chainName ? s.chain_2.chain_name : s.chain_1.chain_name }} ⇌ - {{ s.chain_1.chain_name === ibcStore.chainName ? s.chain_1.chain_name : s.chain_2.chain_name }}{{ + s.chain_1.chain_name === ibcStore.chainName + ? s.chain_2.chain_name + : s.chain_1.chain_name + }} + ⇌ + {{ + s.chain_1.chain_name === ibcStore.chainName + ? s.chain_1.chain_name + : s.chain_2.chain_name + }}
- + -
diff --git a/src/modules/[chain]/ibc/connection/[connection_id].vue b/src/modules/[chain]/ibc/connection/[connection_id].vue index 2fa7ecff..acdca12d 100644 --- a/src/modules/[chain]/ibc/connection/[connection_id].vue +++ b/src/modules/[chain]/ibc/connection/[connection_id].vue @@ -115,10 +115,14 @@ function color(v: string) {
-
+
{{ baseStore.latest?.block?.header?.chain_id }}
-
{{ conn.client_id }} {{ props.connection_id }}
+
+ {{ conn.client_id }} {{ props.connection_id }} +
@@ -130,7 +134,9 @@ function color(v: string) {
-
+
{{ clientState.client_state?.chain_id }}
@@ -143,7 +149,10 @@ function color(v: string) {

- {{ $t('ibc.title_2') }}{{ clientState.client_state?.['@type'] }} + {{ $t('ibc.title_2') + }}{{ + clientState.client_state?.['@type'] + }}

@@ -163,15 +172,21 @@ function color(v: string) { - + - + - + @@ -194,7 +209,9 @@ function color(v: string) { @@ -202,13 +219,17 @@ function color(v: string) { - +
{{ $t('ibc.trusting_period') }}:{{ formatSeconds(clientState.client_state?.trusting_period) }} + {{ formatSeconds(clientState.client_state?.trusting_period) }} +
{{ $t('ibc.unbonding_period') }}:{{ formatSeconds(clientState.client_state?.unbonding_period) }} + {{ formatSeconds(clientState.client_state?.unbonding_period) }} +
{{ $t('ibc.max_clock_drift') }}:{{ formatSeconds(clientState.client_state?.max_clock_drift) }} + {{ formatSeconds(clientState.client_state?.max_clock_drift) }} +
{{ $t('ibc.frozen_height') }}:
{{ $t('ibc.allow_update_after_expiry') }}: - {{ clientState.client_state?.allow_update_after_expiry }} + {{ + clientState.client_state?.allow_update_after_expiry + }}
{{ $t('ibc.allow_update_after_misbehaviour') }}: - {{ clientState.client_state?.allow_update_after_misbehaviour }} + {{ + clientState.client_state?.allow_update_after_misbehaviour + }}
{{ $t('ibc.upgrade_path') }}:{{ clientState.client_state?.upgrade_path.join(', ') }} + {{ clientState.client_state?.upgrade_path.join(', ') }} +
@@ -221,7 +242,9 @@ function color(v: string) { {{ $t('ibc.txs') }} - {{ $t('ibc.channel_id') }} + + {{ $t('ibc.channel_id') }} + {{ $t('ibc.port_id') }} {{ $t('ibc.state') }} {{ $t('ibc.counterparty') }} @@ -234,27 +257,51 @@ function color(v: string) {
- -
- {{ v.channel_id }} + {{ + v.channel_id + }} {{ v.port_id }} -
- +
+ {{ v.state }}
- {{ v.counterparty?.port_id }}/{{ v.counterparty?.channel_id }} + + {{ v.counterparty?.port_id }}/{{ v.counterparty?.channel_id }} + {{ v.connection_hops.join(', ') }} {{ v.version }} {{ v.ordering }} @@ -264,7 +311,9 @@ function color(v: string) {
-

Transactions ({{ channel_id }} {{ port_id }} {{ direction }})

+

+ Transactions ({{ channel_id }} {{ port_id }} {{ direction }}) +

@@ -279,13 +328,20 @@ function color(v: string) { @@ -293,7 +349,11 @@ function color(v: string) {
{{ resp.height }}
- {{ resp.txhash }} + {{ resp.txhash }}
{{ format.messages(resp.tx.body.messages) }} - +
- +
diff --git a/src/types/ibc.ts b/src/types/ibc.ts index 9c77e0c3..c68b9d01 100644 --- a/src/types/ibc.ts +++ b/src/types/ibc.ts @@ -1,117 +1,115 @@ -import type { PaginatedResponse } from "." +import type { PaginatedResponse } from '.'; import type { IBCInfo as RegistryIBCInfo } from "@chain-registry/types" export interface IBCInfo extends RegistryIBCInfo { } -export interface DenomTrace { - path: string, - base_denom: string -} - -export interface Connection { - id: string, - client_id: string, - versions: { - identifier: string, - features: string[] - }[], - state: string, - counterparty: { - client_id: string, - connection_id: string, - prefix: { - key_prefix: string - } - }, - delay_period: string -} - -export interface Channel { - state: string, - ordering: string, - counterparty: { - port_id: string, - channel_id: string - }, - connection_hops: string[], - version: string, - port_id: string, - channel_id: string -} - -export interface ClientState { - "@type": string, - chain_id: string, - trust_level: { - numerator: string, - denominator: string - }, - trusting_period: string, - unbonding_period: string, - max_clock_drift: string, - frozen_height: { - revision_number: string, - revision_height: string - }, - latest_height: { - revision_number: string, - revision_height: string - }, - proof_specs: { - leaf_spec: { - hash: string, - prehash_key: string, - prehash_value: string, - length: string, - prefix: string - }, - inner_spec: { - child_order: number[], - child_size: number, - min_prefix_length: number, - max_prefix_length: number, - empty_child: string, - hash: string - }, - max_depth: number, - min_depth: number - }[], - upgrade_path: string[], - allow_update_after_expiry: boolean, - allow_update_after_misbehaviour: boolean -} - -export interface ClientStateWithProof { - identified_client_state: { - client_id: string, - client_state: ClientState - }, - proof: string, - proof_height: { - revision_number: string, - revision_height: string - } - -} -export interface ConnectionWithProof { - connection: Connection, - proof: string, - proof_height: { - revision_number: string, - revision_height: string - } - -} -export interface PaginatedIBCChannels extends PaginatedResponse { - channels: Channel[] -} -export interface PaginatedIBCConnections extends PaginatedResponse { - connections: Connection[] -} - export interface IBCPath { path: string, from?: string, to?: string, url?: string } + +export interface DenomTrace { + path: string; + base_denom: string; +} + +export interface Connection { + id: string; + client_id: string; + versions: { + identifier: string; + features: string[]; + }[]; + state: string; + counterparty: { + client_id: string; + connection_id: string; + prefix: { + key_prefix: string; + }; + }; + delay_period: string; +} + +export interface Channel { + state: string; + ordering: string; + counterparty: { + port_id: string; + channel_id: string; + }; + connection_hops: string[]; + version: string; + port_id: string; + channel_id: string; +} + +export interface ClientState { + '@type': string; + chain_id: string; + trust_level: { + numerator: string; + denominator: string; + }; + trusting_period: string; + unbonding_period: string; + max_clock_drift: string; + frozen_height: { + revision_number: string; + revision_height: string; + }; + latest_height: { + revision_number: string; + revision_height: string; + }; + proof_specs: { + leaf_spec: { + hash: string; + prehash_key: string; + prehash_value: string; + length: string; + prefix: string; + }; + inner_spec: { + child_order: number[]; + child_size: number; + min_prefix_length: number; + max_prefix_length: number; + empty_child: string; + hash: string; + }; + max_depth: number; + min_depth: number; + }[]; + upgrade_path: string[]; + allow_update_after_expiry: boolean; + allow_update_after_misbehaviour: boolean; +} + +export interface ClientStateWithProof { + identified_client_state: { + client_id: string; + client_state: ClientState; + }; + proof: string; + proof_height: { + revision_number: string; + revision_height: string; + }; +} +export interface ConnectionWithProof { + connection: Connection; + proof: string; + proof_height: { + revision_number: string; + revision_height: string; + }; +} +export interface PaginatedIBCChannels extends PaginatedResponse { + channels: Channel[]; +} +export interface PaginatedIBCConnections extends PaginatedResponse { + connections: Connection[]; +}