Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: No properties displayed #5382

Merged
merged 3 commits into from
Mar 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion components/gallery/GalleryItemDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,15 @@ const properties = computed(() => {
)
}

return nftMetadata.value?.attributes
const attributes = (nftMetadata.value?.attributes ||
nftMetadata.value?.meta.attributes ||
[]) as Array<{ trait_type: string; value: string; key?: string }>
return attributes.map((attr) => {
return {
trait_type: attr.trait_type || attr.key,
value: attr.value,
}
})
})

const propertiesTabDisabled = computed(() => {
Expand Down
13 changes: 10 additions & 3 deletions composables/transaction/mintToken/constructMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,18 @@ import { uploadDirectWhenMultiple } from '@/utils/directUpload'
import { preheatFileFromIPFS } from '@/utils/ipfs'
import { ActionMintToken } from '../types'

export async function constructMeta(item: ActionMintToken): Promise<string> {
export async function constructMeta(
item: ActionMintToken,
options?: {
enableCarbonOffset?: boolean
}
): Promise<string> {
const pinningStore = usePinningStore()
const preferencesStore = usePreferencesStore()
const { accountId } = useAuth()
const { $consola } = useNuxtApp()
const { file, name, description, secondFile, tags, nsfw } = item.token

const { enableCarbonOffset = false } = options || {}
if (!file) {
throw new ReferenceError('No file found!')
}
Expand All @@ -41,7 +46,9 @@ export async function constructMeta(item: ActionMintToken): Promise<string> {
const attributes = [
...(tags || []),
...nsfwAttribute(nsfw),
...offsetAttribute(preferencesStore.getHasCarbonOffset),
...(enableCarbonOffset
? offsetAttribute(preferencesStore.getHasCarbonOffset)
: []),
]

const meta = createMetadata(
Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/mintToken/transactionMintRmrk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export async function execMintRmrk(
.token.selectedCollection as MintedCollectionKusama
const { edition, name, postfix } = item.token

const metadata = await constructMeta(item)
const metadata = await constructMeta(item, { enableCarbonOffset: true })

const mint = createMultipleNFT(
edition,
Expand Down