+
+
(() => {
![]()
(() => {
class="size-4 text-muted-foreground m-auto"
/>
- {{ collection.metadata?.name || `Collection ${collectionId || ''}` }}
+ {{ collection?.metadata?.name || `Collection ${collectionId || ''}` }}
diff --git a/app/composables/useToken.ts b/app/composables/useToken.ts
index 061b89c7..2db2aa7b 100644
--- a/app/composables/useToken.ts
+++ b/app/composables/useToken.ts
@@ -78,6 +78,23 @@ export function useToken(props: {
collectionCreator.value = collection.value?.owner ?? null
queryPrice.value = token.value?.price ?? null
+ // When ODA collection fails, fall back to genart then on-chain for collection creator
+ if (!collectionCreator.value) {
+ const [genartOk, _, genartRes] = await t($fetch<{ data: Array<{ creator?: string }> }>('/api/genart/list', {
+ query: { collection: props.collectionId.toString() },
+ }))
+ if (genartOk && genartRes?.data?.[0]?.creator) {
+ collectionCreator.value = genartRes.data[0].creator
+ }
+ }
+ if (!collectionCreator.value) {
+ const { api } = $sdk(props.chain)
+ const collectionOnChain = await api.query.Nfts.Collection.getValue(props.collectionId).catch(() => null)
+ if (collectionOnChain?.owner) {
+ collectionCreator.value = collectionOnChain.owner.toString()
+ }
+ }
+
const tokenRarityData = rarityData?.data.token
const rarityTotalItems = normalizeRarityTotalItems(collectionData?.supply)
diff --git a/app/pages/[chain]/collection/[collection_id].vue b/app/pages/[chain]/collection/[collection_id].vue
index 87b8fedd..959906fe 100644
--- a/app/pages/[chain]/collection/[collection_id].vue
+++ b/app/pages/[chain]/collection/[collection_id].vue
@@ -2,10 +2,10 @@
import type { LocationQueryRaw } from 'vue-router'
import type { SelectedTrait } from '@/components/trait/types'
import type { AssetHubChain } from '~/plugins/sdk.client'
-import { CHAINS } from '@kodadot1/static'
import { TradeTypes } from '@/components/trade/types'
import { fetchOdaCollection } from '~/services/oda'
import { normalizeRarityTotalItems } from '~/types/rarity'
+import { chainSpec } from '~/utils/chain'
const availableTabs = ['items', 'offers', 'swaps', 'traits', 'analytics'] as const
type CollectionTab = typeof availableTabs[number]
@@ -72,12 +72,12 @@ const chain = computed(() => chainPrefix as AssetHubChain)
const { data } = await useLazyAsyncData(
`collection:${chain.value}:${collection_id}`,
async () => {
- const [collection, drops] = await Promise.all([
- fetchOdaCollection(chain.value, collection_id?.toString() ?? ''),
+ const [collectionResult, drops] = await Promise.all([
+ fetchOdaCollection(chain.value, collection_id?.toString() ?? '').catch(() => null),
$fetch('/api/genart/list', { query: { collection: collection_id?.toString() ?? '' } }),
])
- return { collection, drops }
+ return { collection: collectionResult ?? null, drops }
},
)
@@ -173,7 +173,7 @@ function handleSelectedTraitsUpdate(traits: SelectedTrait[]) {
definePageMeta({
validate: async (route) => {
const { chain } = route.params
- return typeof chain === 'string' && chain in CHAINS
+ return typeof chain === 'string' && chain in chainSpec
},
})