Skip to content

Commit c3fd4cc

Browse files
committed
test keplr
1 parent 65297c1 commit c3fd4cc

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

components/TheHeader.vue

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,15 @@ const head = computed(() => appStore.head)
2828
const featurePreviewMode = ref(false)
2929
const isWalletAvailable = ref(false)
3030
31-
onMounted(() => {
31+
const account = ref("")
32+
33+
const getAccounts = async () => {
34+
const offlineSigner = window.getOfflineSigner("celestia")
35+
const accounts = await offlineSigner.getAccounts()
36+
if (accounts.length) account.value = accounts[0].address
37+
}
38+
39+
onMounted(async () => {
3240
featurePreviewMode.value = localStorage.featurePreview
3341
isWalletAvailable.value = !!window.keplr
3442
})
@@ -73,8 +81,10 @@ const handleNavigate = (url) => {
7381
window.location.replace(url)
7482
}
7583
76-
const handleConnect = () => {
77-
window.keplr.enable("celestia")
84+
const handleConnect = async () => {
85+
await window.keplr.enable("celestia")
86+
87+
getAccounts()
7888
}
7989
</script>
8090

@@ -154,8 +164,14 @@ const handleConnect = () => {
154164
</template>
155165
</Tooltip>
156166

157-
<Button v-if="featurePreviewMode" @click="handleConnect" type="white" size="small" :disabled="!isWalletAvailable">
158-
Connect
167+
<Button
168+
v-if="featurePreviewMode"
169+
@click="handleConnect"
170+
type="white"
171+
size="small"
172+
:disabled="!isWalletAvailable || account.length"
173+
>
174+
{{ account ? `celestia...${account.slice(-6)}` : "Connect" }}
159175
</Button>
160176
</Flex>
161177
</Flex>

0 commit comments

Comments
 (0)