From 68150d9e24fbe2ad059edca5374cc1e4b2057ba8 Mon Sep 17 00:00:00 2001 From: mtyszczak Date: Mon, 24 Nov 2025 15:03:37 +0100 Subject: [PATCH 1/2] Add dotenv option to decide if tokens menu should be publicly visible --- .env.example | 3 ++ nuxt.config.ts | 1 + src/components/navigation/AppSidebar.vue | 54 ++++++++++++------------ 3 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.env.example b/.env.example index 8abb5e1..b7525ca 100644 --- a/.env.example +++ b/.env.example @@ -3,6 +3,9 @@ NUXT_PUBLIC_SNAP_ORIGIN= ## Uncomment this if you want to use a specific version of the Snap runtime: # NUXT_PUBLIC_SNAP_VERSION= +## Uncomment this if you want to show HTM in the menu +# NUXT_PUBLIC_SHOW_HTM_IN_MENU=true + # Custom Tokens API Configuration # Set this to your ctokens-api server URL # Example for local development: http://localhost:3000/ctokens-api diff --git a/nuxt.config.ts b/nuxt.config.ts index 1e7b51a..3fef0e1 100644 --- a/nuxt.config.ts +++ b/nuxt.config.ts @@ -54,6 +54,7 @@ export default defineNuxtConfig({ }, runtimeConfig: { public: { + showHtmInMenu: false, commitHash: getCommitHash(), ctokensApiUrl: 'https://htm.fqdn.pl:10081', hiveNodeEndpoint: 'https://api.hive.blog', diff --git a/src/components/navigation/AppSidebar.vue b/src/components/navigation/AppSidebar.vue index 2937675..da93666 100644 --- a/src/components/navigation/AppSidebar.vue +++ b/src/components/navigation/AppSidebar.vue @@ -11,7 +11,7 @@ import { useWalletStore } from '@/stores/wallet.store'; import { getWax } from '@/stores/wax.store'; import { toastError } from '@/utils/parse-error'; -const { public: { commitHash, snapOrigin, snapVersion } } = useRuntimeConfig(); +const { public: { commitHash, snapOrigin, snapVersion, showHtmInMenu } } = useRuntimeConfig(); const props = defineProps({ forceTokenView: { @@ -30,6 +30,31 @@ const walletStore = useWalletStore(); const isL1BasedView = computed(() => walletStore.hasWallet && !walletStore.isL2Wallet); const hasHTMWallet = computed(() => !!tokensStore.wallet); +const tokenItems: Array<{ title: string; url: string; icon: string; badge?: string; visible?: Ref; disabled?: Ref }> = [ + { + title: 'My HTM Account', + url: '/tokens/my-balance', + icon: mdiWallet, + visible: hasHTMWallet + }, + { + title: 'Tokens List', + url: '/tokens/list', + icon: mdiAccountGroup + }, + { + title: 'My Token Definitions', + url: '/tokens/my-tokens', + icon: mdiViewList, + visible: hasHTMWallet + }, + { + title: 'Register HTM Account', + url: '/tokens/register-account', + icon: mdiAccountPlusOutline + } +]; + const tokensGroups: { title?: string; items: Array<{ title: string; url: string; icon: string; badge?: string; visible?: Ref; disabled?: Ref }> }[] = [{ items: [{ title: 'Back to Hive Bridge', @@ -39,30 +64,7 @@ const tokensGroups: { title?: string; items: Array<{ title: string; url: string; }, { title: 'Tokens', - items: [ - { - title: 'My HTM Account', - url: '/tokens/my-balance', - icon: mdiWallet, - visible: hasHTMWallet - }, - { - title: 'Tokens List', - url: '/tokens/list', - icon: mdiAccountGroup - }, - { - title: 'My Token Definitions', - url: '/tokens/my-tokens', - icon: mdiViewList, - visible: hasHTMWallet - }, - { - title: 'Register HTM Account', - url: '/tokens/register-account', - icon: mdiAccountPlusOutline - } - ] + items: tokenItems }]; const mainGroups: { title: string; items: Array<{ title: string; url: string; icon: string; badge?: string; visible?: Ref; disabled?: Ref }> }[] = [{ @@ -93,7 +95,7 @@ const mainGroups: { title: string; items: Array<{ title: string; url: string; ic ] }, { title: 'Tokens', - items: [ + items: showHtmInMenu ? tokenItems : [ { title: 'My tokens', url: '#', -- GitLab From 47d6924c334428503f15b08fea4416f4bb37b695 Mon Sep 17 00:00:00 2001 From: mtyszczak Date: Mon, 24 Nov 2025 15:23:11 +0100 Subject: [PATCH 2/2] Show chain id in the app sidebar footer --- src/components/navigation/AppSidebar.vue | 18 ++++++++++++++++++ src/stores/wax.store.ts | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/components/navigation/AppSidebar.vue b/src/components/navigation/AppSidebar.vue index da93666..da762dc 100644 --- a/src/components/navigation/AppSidebar.vue +++ b/src/components/navigation/AppSidebar.vue @@ -6,6 +6,7 @@ import { useRouter } from 'vue-router'; import { Button } from '@/components/ui/button'; import { Separator } from '@/components/ui/separator'; import { Sidebar, SidebarContent, SidebarHeader, SidebarFooter, SidebarGroup, SidebarGroupContent, SidebarGroupLabel, SidebarMenu, SidebarMenuButton, SidebarMenuItem , useSidebar } from '@/components/ui/sidebar'; +import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'; import { useTokensStore } from '@/stores/tokens.store'; import { useWalletStore } from '@/stores/wallet.store'; import { getWax } from '@/stores/wax.store'; @@ -30,6 +31,8 @@ const walletStore = useWalletStore(); const isL1BasedView = computed(() => walletStore.hasWallet && !walletStore.isL2Wallet); const hasHTMWallet = computed(() => !!tokensStore.wallet); +const chainId = ref(''); + const tokenItems: Array<{ title: string; url: string; icon: string; badge?: string; visible?: Ref; disabled?: Ref }> = [ { title: 'My HTM Account', @@ -155,6 +158,8 @@ onMounted(async () => { try { const wax = await getWax(); + /* eslint-disable-next-line @typescript-eslint/no-explicit-any */ + chainId.value = (wax as any).chainId; // XXX: Wait for wax update to expose chainId properly waxVersion.value = wax.getVersion(); } catch(error) { toastError('Failed to get WAX instance:', error); @@ -244,6 +249,19 @@ onMounted(async () => {
@hiveio/wax@{{ waxVersion }}
{{ metamaskVersion }}
Commit Hash: {{ commitHash.substring(0, 7) }}
+ + + +
Chain ID: {{ chainId.substring(0, 10) }}…
+
+ +
Full Chain ID: {{ chainId }}
+
+
+
diff --git a/src/stores/wax.store.ts b/src/stores/wax.store.ts index 4e89d6f..93495f3 100644 --- a/src/stores/wax.store.ts +++ b/src/stores/wax.store.ts @@ -1,4 +1,4 @@ -import type { NaiAsset, TWaxRestExtended, TWaxExtended, asset } from '@hiveio/wax'; +import { type NaiAsset, type TWaxRestExtended, type TWaxExtended, type asset, DEFAULT_WAX_OPTIONS } from '@hiveio/wax'; import CTokensApi from '@/utils/wallet/ctokens/api'; @@ -149,7 +149,7 @@ export const getWax = async () => { if (!chain) { const { public: { hiveNodeEndpoint, hiveChainId, ctokensApiUrl } } = useRuntimeConfig(); - const chainId = typeof hiveChainId === 'number' || hiveChainId.length > 0 ? String(hiveChainId) : undefined; + const chainId = typeof hiveChainId === 'number' || hiveChainId.length > 0 ? String(hiveChainId).padEnd(64, '0') : DEFAULT_WAX_OPTIONS.chainId; const apiEndpoint = hiveNodeEndpoint.length > 0 ? hiveNodeEndpoint : undefined; chain = (await (await import('@hiveio/wax')).createHiveChain({ apiEndpoint, chainId })).extend().extendRest(CTokensApi); -- GitLab