From 6064ae50ccc72b73770b225f9d0bc24cc61d7d6f Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Thu, 28 Nov 2024 22:27:25 +0100 Subject: [PATCH 1/2] fix: only collection issuer can edit nft --- .../gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue | 6 +++++- queries/subsquid/ahk/nftById.graphql | 1 + queries/subsquid/general/nftById.graphql | 1 + queries/subsquid/ksm/nftById.graphql | 1 + queries/subsquid/rmrk/nftById.graphql | 1 + types/index.ts | 1 + 6 files changed, 10 insertions(+), 1 deletion(-) diff --git a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue index d9b944c21e..a9adaa8855 100644 --- a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue +++ b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue @@ -48,7 +48,10 @@ Delist - + Report @@ -94,6 +97,7 @@ const props = defineProps<{ const action = ref('') const isOwner = computed(() => accountId.value === props.nft?.currentOwner) +const isCollectionIssuer = computed(() => accountId.value === props.nft?.collection?.issuer) const nftId = computed(() => props.nft?.id || '') const { data } = useQuery({ diff --git a/queries/subsquid/ahk/nftById.graphql b/queries/subsquid/ahk/nftById.graphql index eac7db68b0..ca1912ae0d 100644 --- a/queries/subsquid/ahk/nftById.graphql +++ b/queries/subsquid/ahk/nftById.graphql @@ -9,6 +9,7 @@ query nftById($id: String!) { collection { id name + issuer } attributes { key: trait diff --git a/queries/subsquid/general/nftById.graphql b/queries/subsquid/general/nftById.graphql index 22e4e90e55..aff35f6cbd 100644 --- a/queries/subsquid/general/nftById.graphql +++ b/queries/subsquid/general/nftById.graphql @@ -8,6 +8,7 @@ query nftById($id: String!) { collection { id name + issuer floorPrice: nfts( where: { burned_eq: false, price_not_eq: "0" } orderBy: price_ASC diff --git a/queries/subsquid/ksm/nftById.graphql b/queries/subsquid/ksm/nftById.graphql index 9cd904eaa6..49db389018 100644 --- a/queries/subsquid/ksm/nftById.graphql +++ b/queries/subsquid/ksm/nftById.graphql @@ -20,6 +20,7 @@ query nftById($id: String!) { collection { id name + issuer } emotes { caller diff --git a/queries/subsquid/rmrk/nftById.graphql b/queries/subsquid/rmrk/nftById.graphql index 870cc69d17..cddee2c03d 100644 --- a/queries/subsquid/rmrk/nftById.graphql +++ b/queries/subsquid/rmrk/nftById.graphql @@ -8,6 +8,7 @@ query nftById($id: String!) { collection { id name + issuer } emotes { caller diff --git a/types/index.ts b/types/index.ts index a20328adbb..8c49f0d4fd 100644 --- a/types/index.ts +++ b/types/index.ts @@ -110,6 +110,7 @@ export interface TokenId { export type EntityWithId = { id: string name: string + issuer: string floor: string } From 44e74a2f3cdda40417d7e06978e5139173250d3d Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Thu, 28 Nov 2024 22:45:22 +0100 Subject: [PATCH 2/2] fix: collection current owner --- .../gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue | 4 ++-- queries/subsquid/ahk/nftById.graphql | 2 +- queries/subsquid/general/nftById.graphql | 2 +- queries/subsquid/ksm/nftById.graphql | 2 +- queries/subsquid/rmrk/nftById.graphql | 2 +- types/index.ts | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue index a9adaa8855..99f39ddb53 100644 --- a/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue +++ b/components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue @@ -49,7 +49,7 @@ @@ -97,7 +97,7 @@ const props = defineProps<{ const action = ref('') const isOwner = computed(() => accountId.value === props.nft?.currentOwner) -const isCollectionIssuer = computed(() => accountId.value === props.nft?.collection?.issuer) +const isCollectionOwner = computed(() => accountId.value === props.nft?.collection?.currentOwner) const nftId = computed(() => props.nft?.id || '') const { data } = useQuery({ diff --git a/queries/subsquid/ahk/nftById.graphql b/queries/subsquid/ahk/nftById.graphql index ca1912ae0d..09057edc03 100644 --- a/queries/subsquid/ahk/nftById.graphql +++ b/queries/subsquid/ahk/nftById.graphql @@ -9,7 +9,7 @@ query nftById($id: String!) { collection { id name - issuer + currentOwner } attributes { key: trait diff --git a/queries/subsquid/general/nftById.graphql b/queries/subsquid/general/nftById.graphql index aff35f6cbd..54f9d3b2ef 100644 --- a/queries/subsquid/general/nftById.graphql +++ b/queries/subsquid/general/nftById.graphql @@ -8,7 +8,7 @@ query nftById($id: String!) { collection { id name - issuer + currentOwner floorPrice: nfts( where: { burned_eq: false, price_not_eq: "0" } orderBy: price_ASC diff --git a/queries/subsquid/ksm/nftById.graphql b/queries/subsquid/ksm/nftById.graphql index 49db389018..75435b9c57 100644 --- a/queries/subsquid/ksm/nftById.graphql +++ b/queries/subsquid/ksm/nftById.graphql @@ -20,7 +20,7 @@ query nftById($id: String!) { collection { id name - issuer + currentOwner } emotes { caller diff --git a/queries/subsquid/rmrk/nftById.graphql b/queries/subsquid/rmrk/nftById.graphql index cddee2c03d..a7c34d9631 100644 --- a/queries/subsquid/rmrk/nftById.graphql +++ b/queries/subsquid/rmrk/nftById.graphql @@ -8,7 +8,7 @@ query nftById($id: String!) { collection { id name - issuer + currentOwner } emotes { caller diff --git a/types/index.ts b/types/index.ts index 8c49f0d4fd..81f1b02db8 100644 --- a/types/index.ts +++ b/types/index.ts @@ -110,7 +110,7 @@ export interface TokenId { export type EntityWithId = { id: string name: string - issuer: string + currentOwner: string floor: string }