From 6bdc2eeeb6743b37b3dece00361f8e44f44ac702 Mon Sep 17 00:00:00 2001 From: roiLeo Date: Mon, 13 Nov 2023 16:09:51 +0100 Subject: [PATCH 01/85] =?UTF-8?q?=F0=9F=9A=A7=20wip:=20customize=20collect?= =?UTF-8?q?ion?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/collection/CustomizeModal.vue | 63 +++++++++++++++++++ .../HeroButtonCustomizeCollection.vue | 48 ++++++++++++++ components/collection/HeroButtons.vue | 12 ++-- composables/transaction/types.ts | 1 + pnpm-lock.yaml | 2 +- .../general/collectionByIdMinimal.graphql | 1 + 6 files changed, 119 insertions(+), 8 deletions(-) create mode 100644 components/collection/CustomizeModal.vue create mode 100644 components/collection/HeroButtonCustomizeCollection.vue diff --git a/components/collection/CustomizeModal.vue b/components/collection/CustomizeModal.vue new file mode 100644 index 0000000000..c03e9ed550 --- /dev/null +++ b/components/collection/CustomizeModal.vue @@ -0,0 +1,63 @@ + + + + + diff --git a/components/collection/HeroButtonCustomizeCollection.vue b/components/collection/HeroButtonCustomizeCollection.vue new file mode 100644 index 0000000000..2aca241755 --- /dev/null +++ b/components/collection/HeroButtonCustomizeCollection.vue @@ -0,0 +1,48 @@ + + + diff --git a/components/collection/HeroButtons.vue b/components/collection/HeroButtons.vue index be00e802ff..881082267e 100644 --- a/components/collection/HeroButtons.vue +++ b/components/collection/HeroButtons.vue @@ -63,11 +63,10 @@
- - - + + +
{{ $i18n.t('moreActions.reportCollection') }} @@ -96,8 +95,6 @@ import { NeoModal, } from '@kodadot1/brick' import { useCollectionMinimal } from '@/components/collection/utils/useCollectionDetails' -import HeroButtonDeleteCollection from './HeroButtonDeleteCollection.vue' -import HeroButtonDeleteNfts from './HeroButtonDeleteNfts.vue' const route = useRoute() const { isCurrentOwner } = useAuth() @@ -114,6 +111,7 @@ const { collection } = useCollectionMinimal({ collectionId: collectionId.value, }) const collectionIssuer = computed(() => collection.value?.issuer) +const collectionNftCount = computed(() => collection.value?.nftCount) const { twitter } = useIdentity({ address: collectionIssuer, diff --git a/composables/transaction/types.ts b/composables/transaction/types.ts index 2525ee686e..c1d856d55e 100644 --- a/composables/transaction/types.ts +++ b/composables/transaction/types.ts @@ -180,6 +180,7 @@ export interface ActionMintCollection { export enum Collections { DELETE = 'delete', + SET_MAX_SUPPLY = 'setCollectionMaxSupply', } export type ActionsInteractions = Interaction | ShoppingActions | Collections diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 65794c6461..c05acea267 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.0' +lockfileVersion: '6.1' settings: autoInstallPeers: false diff --git a/queries/subsquid/general/collectionByIdMinimal.graphql b/queries/subsquid/general/collectionByIdMinimal.graphql index 3c45c88c22..970e7afe89 100644 --- a/queries/subsquid/general/collectionByIdMinimal.graphql +++ b/queries/subsquid/general/collectionByIdMinimal.graphql @@ -10,6 +10,7 @@ query collectionByIdMinimal($id: String!) { name type } + nftCount metadata name currentOwner From 733304a4b9c373591c7e4477598499e78094a97d Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Thu, 23 Nov 2023 17:03:57 +0700 Subject: [PATCH 02/85] fix: show migrate waiting --- components/migrate/landing/content/Waiting.vue | 15 +-------------- locales/en.json | 4 +--- 2 files changed, 2 insertions(+), 17 deletions(-) diff --git a/components/migrate/landing/content/Waiting.vue b/components/migrate/landing/content/Waiting.vue index 9d913a2f2f..3a73283e09 100644 --- a/components/migrate/landing/content/Waiting.vue +++ b/components/migrate/landing/content/Waiting.vue @@ -1,6 +1,6 @@ diff --git a/locales/en.json b/locales/en.json index d583347be1..b46173a270 100644 --- a/locales/en.json +++ b/locales/en.json @@ -1477,8 +1477,6 @@ "cta": "Migrate Items", "own": "You Own {0} From This Collection" }, - "migrationNotPossible": "Migration Not Possible:", - "migrationNotPossibleLabel": "Migration Is Not Possible For Following Collections That You Own:", "homeButton": "Migration Homepage", "review": "Review", "reviewCtaUncheck": "Acknowledge Before Proceeding", @@ -1523,7 +1521,7 @@ "finalizingItems": "Finalizing {0} Items" } }, - "transactionSteps" : { + "transactionSteps": { "completed": "Completed", "error": "Failed to Sign", "loading": "Transaction in Progress", From 2b367566ad4e105db644031f13982e1e5615eefd Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Thu, 23 Nov 2023 17:06:28 +0700 Subject: [PATCH 03/85] Add 'Migrate' menu item to WalletAssetMenu.vue --- components/common/ConnectWallet/WalletAssetMenu.vue | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/components/common/ConnectWallet/WalletAssetMenu.vue b/components/common/ConnectWallet/WalletAssetMenu.vue index 85415e2888..6dd8e72f54 100644 --- a/components/common/ConnectWallet/WalletAssetMenu.vue +++ b/components/common/ConnectWallet/WalletAssetMenu.vue @@ -83,6 +83,10 @@ const menus = ref([ label: 'Onchain Identity', to: '/identity', }, + { + label: 'Migrate', + to: '/migrate', + }, ]) watchEffect(() => { From f27b3bcee122987258a92f450d154ac16701b998 Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Thu, 23 Nov 2023 17:43:16 +0700 Subject: [PATCH 04/85] Fix image rendering issue in Ready and Waiting components --- components/migrate/landing/content/Ready.vue | 15 ++++++++++-- .../migrate/landing/content/Waiting.vue | 23 +++++++++++++++---- 2 files changed, 31 insertions(+), 7 deletions(-) diff --git a/components/migrate/landing/content/Ready.vue b/components/migrate/landing/content/Ready.vue index 322b3786d6..83465d5ecf 100644 --- a/components/migrate/landing/content/Ready.vue +++ b/components/migrate/landing/content/Ready.vue @@ -18,12 +18,12 @@
@@ -68,4 +68,15 @@ defineProps<{ }>() const { collections } = await useCollectionReady() + +const { urlPrefix } = usePrefix() +const entities = reactive({}) +watchEffect(() => { + collections.value.forEach(async (collection) => { + entities[collection.id] = await getNftMetadata( + collection as unknown as MinimalNFT, + urlPrefix.value, + ) + }) +}) diff --git a/components/migrate/landing/content/Waiting.vue b/components/migrate/landing/content/Waiting.vue index 3a73283e09..b4e0abd17f 100644 --- a/components/migrate/landing/content/Waiting.vue +++ b/components/migrate/landing/content/Waiting.vue @@ -17,22 +17,22 @@

{{ collection.name }}

-

+

@@ -45,7 +45,9 @@ ">

- + {{ $t('migrate.waiting.cta') }}
@@ -97,4 +99,15 @@ const collections = computed(() => { return [] }) + +const { urlPrefix } = usePrefix() +const entities = reactive({}) +watchEffect(() => { + collections.value.forEach(async (collection) => { + entities[collection.id] = await getNftMetadata( + collection as unknown as MinimalNFT, + urlPrefix.value, + ) + }) +}) From 9ad25474f7cd051acd7d279572512f4d647c09b2 Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Thu, 23 Nov 2023 18:37:19 +0700 Subject: [PATCH 05/85] Fix migration button visibility --- components/migrate/landing/content/Waiting.vue | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/components/migrate/landing/content/Waiting.vue b/components/migrate/landing/content/Waiting.vue index b4e0abd17f..6dc55980c9 100644 --- a/components/migrate/landing/content/Waiting.vue +++ b/components/migrate/landing/content/Waiting.vue @@ -44,13 +44,14 @@ $t('migrate.waiting.own', [collection.nfts?.length]) ">

-
+ +
From 0ab18e7c693e957fbf576ba01d1744d6e8b582f3 Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Mon, 27 Nov 2023 18:16:17 +0700 Subject: [PATCH 06/85] check migrated button --- .../migrate/landing/content/Waiting.vue | 28 +++++++++++++------ components/migrate/steps/SignLoader1.vue | 14 +++++----- .../general/collectionMigrateWaiting.graphql | 1 + 3 files changed, 28 insertions(+), 15 deletions(-) diff --git a/components/migrate/landing/content/Waiting.vue b/components/migrate/landing/content/Waiting.vue index 6dc55980c9..aea8c8211a 100644 --- a/components/migrate/landing/content/Waiting.vue +++ b/components/migrate/landing/content/Waiting.vue @@ -27,12 +27,15 @@

{{ collection.name }}

- + +

@@ -44,14 +47,13 @@ $t('migrate.waiting.own', [collection.nfts?.length]) ">

- - + @@ -60,8 +62,9 @@ diff --git a/components/migrate/steps/SignLoader1.vue b/components/migrate/steps/SignLoader1.vue index 54ff2d89f4..140e1826c2 100644 --- a/components/migrate/steps/SignLoader1.vue +++ b/components/migrate/steps/SignLoader1.vue @@ -102,12 +102,12 @@ const fromCollection = collections.value.find( (collection) => collection.id === route.query.collectionId, ) -const deleteRelocations = async () => { - const relocationsId = `${from}-${fromAccountId}` - return await waifuApi(`/relocations/${relocationsId}`, { - method: 'DELETE', - }) -} +// const deleteRelocations = async () => { +// const relocationsId = `${from}-${fromAccountId}` +// return await waifuApi(`/relocations/${relocationsId}`, { +// method: 'DELETE', +// }) +// } const startStep1 = async () => { step1Iterations.value -= 1 @@ -124,7 +124,7 @@ const startStep1 = async () => { issuer: fromAccountId, // accountId.value } - await deleteRelocations() + // await deleteRelocations() if (nextId.value && fromCollection?.metadata) { const createArgs = createArgsForNftPallet(accountId.value) diff --git a/queries/subsquid/general/collectionMigrateWaiting.graphql b/queries/subsquid/general/collectionMigrateWaiting.graphql index 5187bb973b..fd15a29b94 100644 --- a/queries/subsquid/general/collectionMigrateWaiting.graphql +++ b/queries/subsquid/general/collectionMigrateWaiting.graphql @@ -4,6 +4,7 @@ query collectionByAccount($account: String!) { ) { id name + currentOwner nfts(where: { currentOwner_eq: $account }) { id } From 9bd87d73cf839893b515202a94b8e3606fe4ac2e Mon Sep 17 00:00:00 2001 From: Preschian Febryantara Date: Tue, 28 Nov 2023 15:48:45 +0700 Subject: [PATCH 07/85] fix: migrate empty item --- components/migrate/landing/content/Ready.vue | 2 +- components/migrate/steps/Index.vue | 16 +------- components/migrate/steps/Review.vue | 18 +-------- components/migrate/steps/SignLoader1.vue | 22 ++++++---- components/migrate/steps/SignLoader2.vue | 2 +- components/migrate/steps/SignLoader3.vue | 42 +++++++++++++------- 6 files changed, 47 insertions(+), 55 deletions(-) diff --git a/components/migrate/landing/content/Ready.vue b/components/migrate/landing/content/Ready.vue index 83465d5ecf..ee394b653f 100644 --- a/components/migrate/landing/content/Ready.vue +++ b/components/migrate/landing/content/Ready.vue @@ -14,7 +14,7 @@ v-for="collection in collections" :key="collection.id" class="collection-card" - :class="{ 'collection-card-empty': !collection.nftsOwned?.length }"> + :class="{ 'collection-card-empty': !collection.nfts?.length }">
+ class="rounded-full border border-k-shade is-flex is-justify-content-start is-flex-grow-1 pl-3"> { } }) - - diff --git a/components/migrate/steps/Review.vue b/components/migrate/steps/Review.vue index 156b6bf02e..493135f632 100644 --- a/components/migrate/steps/Review.vue +++ b/components/migrate/steps/Review.vue @@ -25,7 +25,7 @@

{{ collection?.nftsOwned?.length }}/{{ collection?.nfts?.length }}

-
+

{{ $t('migrate.reviewNotes') }}

@@ -176,7 +176,7 @@ :label="checkBalances.label" variant="k-accent" :disabled="checkBalances.disabled" - class="mt-4 btn-submit is-capitalized" + class="mt-4 h-14 is-capitalized" expanded @click="toSign()" />
@@ -289,17 +289,3 @@ const toSign = () => { }) } - - diff --git a/components/migrate/steps/SignLoader1.vue b/components/migrate/steps/SignLoader1.vue index 140e1826c2..66e6edfa13 100644 --- a/components/migrate/steps/SignLoader1.vue +++ b/components/migrate/steps/SignLoader1.vue @@ -84,6 +84,7 @@ const router = useRouter() const to = route.query.destination as Prefix const from = route.query.source as Prefix const fromAccountId = route.query.accountId?.toString() +const itemCount = route.query.itemCount?.toString() const api = await apiInstance.value const { steps, updateSteps } = inject('steps') as { @@ -155,18 +156,25 @@ const startStep1 = async () => { const validationStep1 = async () => { step1Iterations.value -= 1 + router.push({ + query: { + ...route.query, + nextCollectionId: nextId.value, + }, + }) + try { await waifuApi('/relocations', { method: 'POST', body: relocationsBody.value, }) - updateSteps('step2') - router.push({ - query: { - ...route.query, - nextCollectionId: nextId.value, - }, - }) + + // skip step2 if no items + if (itemCount === '0') { + updateSteps('step3-burn') + } else { + updateSteps('step2') + } } catch (error) { $consola.log(error) } diff --git a/components/migrate/steps/SignLoader2.vue b/components/migrate/steps/SignLoader2.vue index 2f55758a64..d287daa30e 100644 --- a/components/migrate/steps/SignLoader2.vue +++ b/components/migrate/steps/SignLoader2.vue @@ -1,5 +1,5 @@