Skip to content

Commit 8c75f7d

Browse files
authored
Merge pull request #152 from celenium-io/dev
IBC
2 parents 1bf9b3d + 01268dc commit 8c75f7d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

52 files changed

+3937
-18
lines changed

assets/icons.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{
2+
"ibc": "M18.5 3a2.5 2.5 0 1 1-.912 4.828l-4.556 4.555a5.48 5.48 0 0 1 .936 3.714l2.624.787a2.5 2.5 0 1 1-.575 1.916l-2.623-.788a5.5 5.5 0 0 1-10.39-2.29L3 15.5l.004-.221a5.5 5.5 0 0 1 2.984-4.673L5.2 7.982a2.5 2.5 0 0 1-2.194-2.304L3 5.5l.005-.164a2.5 2.5 0 1 1 4.111 2.071l.787 2.625a5.48 5.48 0 0 1 3.714.936l4.555-4.556a2.5 2.5 0 0 1-.167-.748L16 5.5l.005-.164A2.5 2.5 0 0 1 18.5 3",
23
"explorable": "M8.393 2.67C7.883 3.172 7.423 3.76 7.026 4.401C5.795 6.381 5 9.067 5 12.001C5 14.946 5.847 17.633 7.1 19.607C7.50413 20.2519 7.98276 20.847 8.526 21.38C6.61034 20.6703 4.95799 19.3909 3.79127 17.7139C2.62455 16.037 1.99942 14.0429 2 12C2 7.75 4.653 4.117 8.393 2.67ZM11 3.236V20.735C10.29 20.381 9.505 19.665 8.788 18.535C7.745 16.892 7 14.578 7 12C7 9.41 7.705 7.096 8.724 5.457C9.385 4.394 10.121 3.693 10.824 3.322L11 3.236ZM15.607 2.67C17.4898 3.39815 19.1082 4.67909 20.2492 6.34437C21.3903 8.00965 22.0006 9.98129 22 12C22 16.251 19.347 19.883 15.607 21.33C16.117 20.828 16.577 20.24 16.974 19.6C18.205 17.618 19 14.932 19 12C19 9.068 18.205 6.381 16.974 4.401C16.5878 3.7727 16.129 3.19104 15.607 2.67ZM13 3.236C13.755 3.579 14.56 4.306 15.276 5.457C16.295 7.097 17 9.411 17 12C17 14.589 16.295 16.904 15.276 18.543C14.615 19.606 13.879 20.307 13.176 20.679L13 20.765V3.235V3.236Z",
34
"zap": "M 13.398 1.083 C 13.805 1.26 14.047 1.684 13.992 2.124 L 13.132 9 L 19.328 9 C 19.568 9 19.813 9 20.012 9.018 C 20.201 9.035 20.562 9.08 20.875 9.333 C 21.234 9.623 21.439 10.062 21.432 10.523 C 21.426 10.925 21.23 11.232 21.122 11.387 C 21.008 11.552 20.852 11.74 20.698 11.925 L 11.768 22.64 C 11.484 22.98 11.009 23.093 10.602 22.916 C 10.195 22.74 9.953 22.316 10.008 21.876 L 10.868 15 L 4.671 15 C 4.431 15 4.186 15 3.987 14.982 C 3.798 14.965 3.437 14.92 3.124 14.667 C 2.765 14.377 2.56 13.938 2.567 13.477 C 2.573 13.075 2.769 12.768 2.877 12.613 C 2.991 12.448 3.147 12.26 3.301 12.075 L 3.324 12.048 L 12.232 1.36 C 12.516 1.019 12.991 0.906 13.398 1.083 Z",
45
"moon": "M9.06693 2.41209C9.23841 2.03292 9.15714 1.58718 8.86288 1.29292C8.56862 0.998664 8.12289 0.917397 7.74371 1.08887C3.76893 2.88642 1 6.88764 1 11.5377C1 17.8682 6.13185 23 12.4623 23C17.1124 23 21.1136 20.2311 22.9112 16.2563C23.0826 15.8771 23.0014 15.4314 22.7071 15.1371C22.4128 14.8429 21.9671 14.7616 21.5879 14.9331C20.4015 15.4697 19.0838 15.7689 17.6935 15.7689C12.4676 15.7689 8.23116 11.5325 8.23116 6.30656C8.23116 4.91628 8.53036 3.59857 9.06693 2.41209Z",
@@ -130,6 +131,7 @@
130131
"stop-circle": "M 2 12 C 2 6.477 6.477 2 12 2 C 17.523 2 22 6.477 22 12 C 22 17.523 17.523 22 12 22 C 6.477 22 2 17.523 2 12 Z M 8.586 8.586 C 8 9.172 8 10.114 8 12 C 8 13.886 8 14.828 8.586 15.414 C 9.172 16 10.114 16 12 16 C 13.886 16 14.828 16 15.414 15.414 C 16 14.828 16 13.886 16 12 C 16 10.114 16 9.172 15.414 8.586 C 14.828 8 13.886 8 12 8 C 10.114 8 9.172 8 8.586 8.586 Z",
131132
"play-circle": "M 2 12 C 2 6.477 6.477 2 12 2 C 17.523 2 22 6.477 22 12 C 22 17.523 17.523 22 12 22 C 6.477 22 2 17.523 2 12 Z M 10.694 15.846 L 15.414 13.059 C 16.195 12.597 16.195 11.403 15.414 10.941 L 10.694 8.154 C 9.934 7.706 9 8.29 9 9.214 L 9 14.787 C 9 15.71 9.934 16.294 10.694 15.846 Z",
132133
"alt-arrow-down": "M12.3698 15.835L18.7998 9.205C19.2008 8.79 18.9578 8 18.4298 8H5.56982C5.04182 8 4.79882 8.79 5.19982 9.205L11.6298 15.835C11.8428 16.055 12.1568 16.055 12.3698 15.835Z",
134+
"arrow-down-circle": "M17 3.34C18.5083 4.21085 19.7629 5.46053 20.6398 6.9653C21.5167 8.47007 21.9854 10.1778 21.9994 11.9193C22.0135 13.6609 21.5725 15.376 20.72 16.8947C19.8676 18.4134 18.6332 19.6832 17.1392 20.5783C15.6452 21.4734 13.9434 21.9628 12.2021 21.9981C10.4608 22.0333 8.74055 21.6132 7.21156 20.7792C5.68256 19.9453 4.39787 18.7265 3.48467 17.2435C2.57146 15.7605 2.06141 14.0647 2.005 12.324L2 12L2.005 11.676C2.061 9.94899 2.56355 8.26596 3.46364 6.79099C4.36373 5.31602 5.63065 4.09945 7.14089 3.25988C8.65113 2.42031 10.3531 1.9864 12.081 2.00044C13.8089 2.01448 15.5036 2.476 17 3.34ZM12 7C11.7348 7 11.4804 7.10536 11.2929 7.29289C11.1054 7.48043 11 7.73478 11 8V13.585L8.707 11.293L8.613 11.21C8.41201 11.0546 8.1594 10.9815 7.90648 11.0056C7.65355 11.0297 7.41928 11.1492 7.25125 11.3397C7.08322 11.5303 6.99402 11.7777 7.00177 12.0316C7.00953 12.2856 7.11365 12.527 7.293 12.707L11.293 16.707C11.3197 16.7337 11.351 16.7613 11.387 16.79L11.479 16.854L11.577 16.906L11.658 16.94L11.771 16.974L11.883 16.994L12 17L12.115 16.993L12.229 16.973L12.371 16.929L12.484 16.875L12.595 16.804C12.6347 16.7745 12.6721 16.7421 12.707 16.707L16.707 12.707L16.79 12.613C16.9454 12.412 17.0185 12.1594 16.9944 11.9065C16.9703 11.6536 16.8508 11.4193 16.6603 11.2512C16.4697 11.0832 16.2223 10.994 15.9684 11.0018C15.7144 11.0095 15.473 11.1137 15.293 11.293L13 13.584V8L12.993 7.883C12.9643 7.63975 12.8474 7.41547 12.6644 7.25271C12.4813 7.08996 12.2449 7.00003 12 7Z",
133135
"arrow-left": "M12.7071 5.70711C13.0976 5.31658 13.0976 4.68342 12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289L4.29289 11.2929C3.90237 11.6834 3.90237 12.3166 4.29289 12.7071L11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071C13.0976 19.3166 13.0976 18.6834 12.7071 18.2929L7.41421 13H19C19.5523 13 20 12.5523 20 12C20 11.4477 19.5523 11 19 11H7.41421L12.7071 5.70711Z",
134136
"arrow-left-stop": "M4 3C4 2.44772 3.55229 2 3 2C2.44772 2 2 2.44772 2 3V21C2 21.5523 2.44772 22 3 22C3.55228 22 4 21.5523 4 21V3ZM14.7071 5.70711L9.41421 11H21C21.5523 11 22 11.4477 22 12C22 12.5523 21.5523 13 21 13H9.41421L14.7071 18.2929C15.0976 18.6834 15.0976 19.3166 14.7071 19.7071C14.3166 20.0976 13.6834 20.0976 13.2929 19.7071L6.29289 12.7071C5.90237 12.3166 5.90237 11.6834 6.29289 11.2929L13.2929 4.29289C13.6834 3.90237 14.3166 3.90237 14.7071 4.29289C15.0976 4.68342 15.0976 5.31658 14.7071 5.70711Z",
135137
"arrow-right": "M12.7071 4.29289C12.3166 3.90237 11.6834 3.90237 11.2929 4.29289C10.9024 4.68342 10.9024 5.31658 11.2929 5.70711L16.5858 11H5C4.44772 11 4 11.4477 4 12C4 12.5523 4.44772 13 5 13H16.5858L11.2929 18.2929C10.9024 18.6834 10.9024 19.3166 11.2929 19.7071C11.6834 20.0976 12.3166 20.0976 12.7071 19.7071L19.7071 12.7071C20.0976 12.3166 20.0976 11.6834 19.7071 11.2929L12.7071 4.29289Z",

components/LeftSidebar.vue

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,23 @@ const modularLinks = reactive([
126126
},
127127
],
128128
},
129+
{
130+
icon: "ibc",
131+
name: "IBC",
132+
path: "/ibc",
133+
children: [
134+
{
135+
name: "Transfers",
136+
path: "/ibc/transfers",
137+
show: true,
138+
},
139+
{
140+
name: "Chains",
141+
path: "/ibc/chains",
142+
show: true,
143+
},
144+
],
145+
},
129146
{
130147
icon: "namespace",
131148
name: "Namespaces",

components/cmd/CommandMenu.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,15 @@ const rawNavigationActions = [
238238
router.push("/rollups")
239239
},
240240
},
241+
{
242+
type: "callback",
243+
icon: "arrow-narrow-right",
244+
title: "Go to IBC",
245+
runText: "Open IBC",
246+
callback: () => {
247+
router.push("/ibc")
248+
},
249+
},
241250
{
242251
type: "callback",
243252
icon: "arrow-narrow-right",

components/modals/IBCClientModal.vue

Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<script setup>
2+
/** Vendor */
3+
import { DateTime } from "luxon"
4+
5+
/** UI */
6+
import Modal from "@/components/ui/Modal.vue"
7+
import Button from "@/components/ui/Button.vue"
8+
import Tooltip from "@/components/ui/Tooltip.vue"
9+
10+
/** Components */
11+
import ConnectionCard from "@/components/modules/ibc/ConnectionCard"
12+
13+
/** Services */
14+
import { comma } from "@/services/utils"
15+
import { IbcChainName } from "@/services/constants/ibc"
16+
17+
/** API */
18+
import { fetchIbcConnections } from "@/services/api/ibc"
19+
20+
/** Stores */
21+
import { useAppStore } from "@/store/app.store"
22+
import { useCacheStore } from "@/store/cache.store"
23+
const appStore = useAppStore()
24+
const cacheStore = useCacheStore()
25+
26+
const emit = defineEmits(["onClose"])
27+
const props = defineProps({
28+
show: Boolean,
29+
})
30+
31+
const client = computed(() => cacheStore.current.client)
32+
33+
const connections = ref([])
34+
35+
const getConnections = async () => {
36+
connections.value = await fetchIbcConnections({ client_id: client.value.id })
37+
}
38+
39+
watch(
40+
() => props.show,
41+
async () => {
42+
if (props.show) {
43+
await getConnections()
44+
} else {
45+
connections.value = []
46+
}
47+
},
48+
)
49+
50+
const handleNavigate = (target) => {
51+
emit("onClose")
52+
navigateTo(target)
53+
}
54+
</script>
55+
56+
<template>
57+
<Modal :show="show" @onClose="emit('onClose')" width="500" disable-trap>
58+
<Flex align="center" direction="column" gap="16">
59+
<Flex wide align="center" gap="6">
60+
<Icon name="address" size="14" color="primary" />
61+
<Text size="14" weight="600" color="primary">IBC Client</Text>
62+
</Flex>
63+
64+
<Flex wide gap="8" :class="$style.card">
65+
<Icon name="address" size="16" color="secondary" :class="$style.icon" />
66+
67+
<Flex direction="column" gap="4">
68+
<Text size="12" weight="600" color="primary">
69+
{{ client.id }}
70+
</Text>
71+
<Text size="12" weight="600" color="tertiary" mono>
72+
{{ client.type }}
73+
</Text>
74+
</Flex>
75+
</Flex>
76+
77+
<Flex wide direction="column" gap="16" :class="$style.card">
78+
<Text size="12" weight="600" color="secondary">Details</Text>
79+
80+
<Flex align="center" justify="between">
81+
<Text size="12" weight="600" color="tertiary">Chain</Text>
82+
<Text size="12" weight="600" color="primary">
83+
{{ IbcChainName[client.chain_id] ? IbcChainName[client.chain_id] : "Unknown Chain" }}
84+
<Text color="tertiary" mono>({{ client.chain_id }})</Text>
85+
</Text>
86+
</Flex>
87+
88+
<Flex align="center" justify="between">
89+
<Text size="12" weight="600" color="tertiary">Updated at</Text>
90+
91+
<Tooltip position="end">
92+
<Text size="12" weight="600" color="primary">
93+
{{ DateTime.fromISO(client.updated_at).toRelative() }}
94+
</Text>
95+
96+
<template #content> {{ DateTime.fromISO(client.updated_at).setLocale("en").toFormat("LLL d, t") }}</template>
97+
</Tooltip>
98+
</Flex>
99+
100+
<Flex align="center" justify="between">
101+
<Text size="12" weight="600" color="tertiary">Created at</Text>
102+
103+
<Tooltip position="end">
104+
<Text size="12" weight="600" color="primary">
105+
{{ DateTime.fromISO(client.created_at).toRelative() }}
106+
</Text>
107+
108+
<template #content> {{ DateTime.fromISO(client.created_at).setLocale("en").toFormat("LLL d, t") }}</template>
109+
</Tooltip>
110+
</Flex>
111+
112+
<Flex align="center" justify="between">
113+
<Text size="12" weight="600" color="tertiary">Height</Text>
114+
<Text @click="handleNavigate(`/block/${client.height}`)" size="12" weight="600" color="primary" class="clickable">
115+
{{ comma(client.height) }}
116+
</Text>
117+
</Flex>
118+
119+
<Flex align="center" justify="between">
120+
<Text size="12" weight="600" color="tertiary">Created by</Text>
121+
122+
<Flex @click="handleNavigate(`/address/${client.creator.hash}`)" align="center" gap="6" class="clickable">
123+
<Text size="12" weight="600" color="primary" mono>celestia</Text>
124+
<Flex align="center" gap="4">
125+
<div v-for="dot in 3" class="dot" />
126+
</Flex>
127+
<Text size="12" weight="600" color="primary" mono>
128+
{{ client.creator.hash.slice(-4) }}
129+
</Text>
130+
</Flex>
131+
</Flex>
132+
133+
<Flex align="center" justify="between">
134+
<Text size="12" weight="600" color="tertiary">Known connections</Text>
135+
<Text size="12" weight="600" color="primary">
136+
{{ client.connection_count }}
137+
</Text>
138+
</Flex>
139+
</Flex>
140+
141+
<Flex wide direction="column" gap="8">
142+
<Text size="12" weight="600" color="secondary">Client connections</Text>
143+
<ConnectionCard v-for="connection in connections" :connection @onClose="emit('onClose')" />
144+
</Flex>
145+
146+
<Flex wide direction="column" gap="8">
147+
<Button @click="emit('onClose')" wide type="tertiary" size="small">Close</Button>
148+
</Flex>
149+
</Flex>
150+
</Modal>
151+
</template>
152+
153+
<style module>
154+
.card {
155+
border-radius: 8px;
156+
background: var(--op-5);
157+
158+
padding: 8px 12px 8px 8px;
159+
}
160+
161+
.address_text {
162+
flex: 1;
163+
}
164+
165+
.icon {
166+
border-radius: 50px;
167+
border: 2px solid var(--op-5);
168+
box-sizing: content-box;
169+
170+
padding: 2px;
171+
}
172+
</style>

0 commit comments

Comments
 (0)