From a1b6bdddf9bc1199eedd9a898d55fd7f74fc8212 Mon Sep 17 00:00:00 2001 From: Jarsen <31397967+Jarsen136@users.noreply.github.com> Date: Wed, 24 Jul 2024 23:07:00 +0200 Subject: [PATCH 1/6] refactor: Deprecation of RMRK --- .github/ISSUE_TEMPLATE/bug_minting.yml | 2 - .github/ISSUE_TEMPLATE/bug_rmrk2.yml | 102 --------- components/accounts/utils.ts | 68 ------ components/balance/MultipleBalances.vue | 5 +- components/carousel/module/CarouselInfo.vue | 2 +- .../carousel/utils/useCarouselEvents.ts | 9 +- components/collection/CollectionGrid.vue | 5 - .../common/ChooseCollectionDropdown.vue | 5 +- .../common/ConnectWallet/WalletAssetMenu.vue | 5 - .../ConfirmPurchaseModal.vue | 4 +- components/common/shoppingCart/utils.ts | 2 - components/create/CreateCollection.vue | 19 +- components/create/CreateNft.vue | 56 +---- .../GalleryItemActionType/GalleryItemBuy.vue | 3 - components/gallery/GalleryItemDescription.vue | 14 +- .../GalleryItemActivityTable.vue | 2 +- components/gallery/useGalleryItem.ts | 2 - components/items/ItemsGrid/ItemsGridImage.vue | 3 +- components/items/ItemsGrid/useItemsGrid.ts | 13 +- .../landing/topCollections/TopCollections.vue | 2 +- components/profile/ProfileDetail.vue | 14 +- components/profile/activityTab/Activity.vue | 3 - components/rmrk/Gallery/GalleryCard.vue | 4 +- components/rmrk/Gallery/Layout.vue | 2 +- components/rmrk/service/scheme.ts | 35 --- components/search/SearchBar.vue | 4 +- components/search/SearchSuggestion.vue | 31 +-- components/search/utils/collectionSearch.ts | 3 +- components/shared/BreadcrumbsFilter.vue | 5 +- components/shared/LinkResolver.vue | 4 +- .../shared/filters/modules/StatusFilter.vue | 6 +- components/stats/StatsHeader.vue | 26 --- composables/massmint/useMassMint.ts | 26 +-- .../transactionMintCollectionRmrk.ts | 61 ------ .../mintToken/transactionMintRmrk.ts | 199 ------------------ composables/transaction/transactionBuy.ts | 40 ---- composables/transaction/transactionList.ts | 37 +--- .../transaction/transactionMintCollection.ts | 11 - .../transaction/transactionMintToken.ts | 5 - composables/transaction/transactionSend.ts | 26 +-- composables/transaction/utils.ts | 4 +- composables/useChainRedirect.ts | 3 +- composables/useIdentity.ts | 2 +- composables/useIsChain.ts | 8 - composables/useMigrate.ts | 10 +- composables/useRmrkVersion.ts | 25 --- composables/useRouteSortByOptions.ts | 6 +- composables/useSearchNfts.ts | 6 +- middleware/prefix.global.ts | 33 +-- middleware/redirects.global.ts | 4 - nuxt.config.ts | 2 +- pages/series-insight.vue | 9 - queries/fragments/nftEmotes.graphql | 5 - .../ksm/collectionActivityEvents.graphql | 37 ---- queries/subsquid/ksm/latestEvents.graphql | 39 ---- .../subsquid/rmrk/allEventsByProfile.graphql | 43 ---- .../subsquid/rmrk/collectionForMint.graphql | 15 -- .../subsquid/rmrk/collectionStatsById.graphql | 21 -- tests/e2e/basic.spec.ts | 2 - tests/e2e/prefix.spec.ts | 16 -- tests/e2e/redirect.spec.ts | 14 -- tests/e2e/search.spec.ts | 2 +- tests/prefix.spec.ts | 42 ---- tests/shoppingActions.spec.ts | 16 -- utils/chain.ts | 19 +- utils/constants.ts | 9 - utils/prefix.ts | 14 +- utils/queryPathResolver.ts | 4 - utils/shoppingActions.ts | 75 ------- utils/uniquery.ts | 4 - utils/url.ts | 28 --- 71 files changed, 89 insertions(+), 1293 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE/bug_rmrk2.yml delete mode 100644 components/stats/StatsHeader.vue delete mode 100644 composables/transaction/mintCollection/transactionMintCollectionRmrk.ts delete mode 100644 composables/transaction/mintToken/transactionMintRmrk.ts delete mode 100644 composables/useRmrkVersion.ts delete mode 100644 queries/fragments/nftEmotes.graphql delete mode 100644 queries/subsquid/ksm/collectionActivityEvents.graphql delete mode 100644 queries/subsquid/ksm/latestEvents.graphql delete mode 100644 queries/subsquid/rmrk/allEventsByProfile.graphql delete mode 100644 queries/subsquid/rmrk/collectionForMint.graphql delete mode 100644 queries/subsquid/rmrk/collectionStatsById.graphql delete mode 100644 tests/prefix.spec.ts delete mode 100644 tests/shoppingActions.spec.ts diff --git a/.github/ISSUE_TEMPLATE/bug_minting.yml b/.github/ISSUE_TEMPLATE/bug_minting.yml index dd6e9d73a2..718f9f45c4 100644 --- a/.github/ISSUE_TEMPLATE/bug_minting.yml +++ b/.github/ISSUE_TEMPLATE/bug_minting.yml @@ -79,9 +79,7 @@ body: multiple: true options: - Basilisk - - Kusama - MoonBeam - - RMRK2 - type: textarea id: Screenshots attributes: diff --git a/.github/ISSUE_TEMPLATE/bug_rmrk2.yml b/.github/ISSUE_TEMPLATE/bug_rmrk2.yml deleted file mode 100644 index d5dcc00388..0000000000 --- a/.github/ISSUE_TEMPLATE/bug_rmrk2.yml +++ /dev/null @@ -1,102 +0,0 @@ -name: 🐞℞ Bug Report RMRK2 -description: Create a report to help us improve KodaDot on RMRK2 -title: 'Be descriptive and short' -labels: ['A-rmrk2', 'bug', 'p2'] -body: - - type: markdown - attributes: - value: | - Thanks for taking the time to fill out this bug report! - - type: textarea - id: what-happened - attributes: - label: What happened? - description: Tell us, what happened? - placeholder: Tell us what you seen! - validations: - required: true - - type: textarea - id: reproduce - attributes: - label: Please reproduce in steps - description: Tells us steps how to reproduce the bug behaviour - placeholder: Go to ... Click on .... See error - validations: - required: true - - type: textarea - id: expected-behavior - attributes: - label: Expected Behavior - description: A clear and concise description of what you expected to happen. - placeholder: I have expected ... - validations: - required: true - - type: dropdown - id: browsers - attributes: - label: What browsers are you seeing the problem on? - multiple: true - options: - - Chrome - - Firefox - - Safari - - Microsoft Edge - - Mobile Android Chrome - - Mobile iOS Safari - - Mobile Firefox - - type: dropdown - id: beta-yes-no - attributes: - label: At which address did you encounter bug? - multiple: true - options: - - rmrk2.kodadot.xyz - - canary.kodadot.xyz - - beta.kodadot.xyz - - kodadot.xyz - - type: dropdown - id: logged-in - attributes: - label: Are you logged in? - multiple: false - options: - - 'Yes' - - 'No' - - type: dropdown - id: wallet-selector - attributes: - label: Which wallet you are using? - multiple: true - options: - - PolkadotJS - - Talisman - - SubWallet - - type: textarea - id: Screenshots - attributes: - label: Screenshots - description: Screenshot/Video is worth more than debug logs! - placeholder: Paste from your clipboard or upload screenshots/video - validations: - required: true - - type: textarea - id: logs - attributes: - label: Relevant log output - description: Please copy and paste any relevant log output. This will be automatically formatted into code, so no need for backticks. - render: shell - - - type: textarea - id: rewardaddress - attributes: - label: Payment link for reward - description: Whenever you will be actively participating to get your bug fixed, helping elaborating and testing to get bug mitigated, you are eliglible for recieving reward. Read more how to share your address for reciving rewards https://github.com/kodadot/nft-gallery/blob/main/CONTRIBUTING.md#sharing-your-address-to-receive-reward - value: 'https://canary.kodadot.xyz/dot/transfer/?target=' - - type: checkboxes - id: terms - attributes: - label: Code of Conduct - description: By submitting this issue, you agree to follow our [Code of Conduct](https://example.com) - options: - - label: I agree to follow this project's Code of Conduct - required: true diff --git a/components/accounts/utils.ts b/components/accounts/utils.ts index c3b2e15bec..40028ddd59 100644 --- a/components/accounts/utils.ts +++ b/components/accounts/utils.ts @@ -1,13 +1,7 @@ import { encodeAddress, isAddress } from '@polkadot/util-crypto' -import { Interaction, createInteraction } from '@kodadot1/minimark/v1' -import { - Interaction as InteractionV2, - createInteraction as createInteractionV2, -} from '@kodadot1/minimark/v2' import correctFormat from '~/utils/ss58Format' import { useChainStore } from '@/stores/chain' -export type ShuffleFunction = (arr: string[]) => string[] export type ProcessFunction = (nfts: string[] | AdminNFT[]) => string[] export type SendType = { parsedAddresses: string[] @@ -17,10 +11,6 @@ export type SendType = { export type AdminNFT = { id: string, price: string } -export const toDistribute = (length: number, distribution: number): number => { - return Math.floor((length * distribution) / 100) -} - export const parseBatchAddresses = (batchAddresses: string): string[] => { const chainStore = useChainStore() const ss58Format = chainStore.getChainProperties58Format @@ -37,61 +27,3 @@ export const parseBatchAddresses = (batchAddresses: string): string[] => { return onlyValid } - -export const sendFunction = ( - parsedAddresses: string[], - distribution: number, - random?: ShuffleFunction, -): ProcessFunction => { - const randomFn = random ? random : notRandomFunction - const slice = toDistribute(parsedAddresses.length, distribution) - const subset = randomFn(Array.from(new Set(parsedAddresses))).slice(0, slice) - return (nfts: string[] | AdminNFT[]) => { - const { isV2 } = useRmrkVersion() - const lessTokensThanAdresses = nfts.length < subset.length - const final = subset.slice( - 0, - lessTokensThanAdresses ? nfts.length : undefined, - ) - return final.map((addr, index) => { - const id = justId(nfts[index]) - const recipient = String(addr) - if (isV2.value) { - return createInteractionV2({ - action: InteractionV2.SEND, - payload: { id, recipient }, - }) - } - return createInteraction(Interaction.SEND, id, recipient) - }) - } -} - -const justId = (nft: AdminNFT | string) => - typeof nft === 'object' ? nft.id : nft - -// TODO: skip if already in the list -function notRandomFunction(array: string[]): string[] { - return array -} - -export const shuffleFunction - = (seed: number[]): ShuffleFunction => - (array: string[]): string[] => - shuffle(array, seed) - -export function shuffle(array: string[], seed: number[]): string[] { - const copy = array.slice(0) - const len = seed.length - 1 - const total = array.length - 1 - - for (let i = copy.length - 1; i > 0; i--) { - const j = Math.floor(seed[i % len] * (i + 1)) % total - const temp = copy[i] - copy[i] = copy[j] - copy[j] = temp - } - return copy -} - -// api.query.babe.randomness() diff --git a/components/balance/MultipleBalances.vue b/components/balance/MultipleBalances.vue index c4c28c4316..0684106fa1 100644 --- a/components/balance/MultipleBalances.vue +++ b/components/balance/MultipleBalances.vue @@ -101,10 +101,11 @@ import type { ChainToken, ChainType } from '@/stores/identity' import { useIdentityStore } from '@/stores/identity' const displayChainOrder: ChainType[] = [ - 'polkadot', 'polkadotHub', - 'kusama', 'kusamaHub', + 'polkadot', + 'kusama', + ] const identityStore = useIdentityStore() const rampActive = ref(false) diff --git a/components/carousel/module/CarouselInfo.vue b/components/carousel/module/CarouselInfo.vue index 6b2782d96a..8889aaf310 100644 --- a/components/carousel/module/CarouselInfo.vue +++ b/components/carousel/module/CarouselInfo.vue @@ -102,5 +102,5 @@ const showPrice = computed((): boolean => { return Number(price.value) > 0 && !isCollection }) -const unitSymbol = computed(() => prefixToToken[props.item.chain || 'ksm']) +const unitSymbol = computed(() => prefixToToken[props.item.chain || 'ahp']) diff --git a/components/carousel/utils/useCarouselEvents.ts b/components/carousel/utils/useCarouselEvents.ts index 5f4034a07f..b373a68e13 100644 --- a/components/carousel/utils/useCarouselEvents.ts +++ b/components/carousel/utils/useCarouselEvents.ts @@ -7,7 +7,6 @@ import { AHK_GENERATIVE_DROPS } from '@/utils/drop' import { getDrops } from '@/services/fxart' import latestEvents from '@/queries/subsquid/general/latestEvents.graphql' -import latestEventsRmrkv2 from '@/queries/subsquid/ksm/latestEvents.graphql' interface Types { type: 'latestSales' | 'newestList' @@ -19,7 +18,7 @@ const nftEventVariables = { } const fetchLatestEvents = (chain, type, where = {}, limit = 20) => { - const query = chain === 'ksm' ? latestEventsRmrkv2 : latestEvents + const query = latestEvents return useQuery( query, @@ -158,10 +157,8 @@ const sortNfts = (data) => { } const CAROUSEL_LIMIT: Partial> = { - ahp: 11, - ahk: 11, - rmrk: 4, - ksm: 4, + ahp: 15, + ahk: 15, } export const useCarouselNftEvents = ({ type }: Types) => { diff --git a/components/collection/CollectionGrid.vue b/components/collection/CollectionGrid.vue index f1f1d706b1..0d135cb4cd 100644 --- a/components/collection/CollectionGrid.vue +++ b/components/collection/CollectionGrid.vue @@ -74,7 +74,6 @@ const slots = useSlots() const route = useRoute() const { accountId } = useAuth() const { urlPrefix, client } = usePrefix() -const { isRemark } = useIsChain(urlPrefix) const preferencesStore = usePreferencesStore() const isProfilePage = route.name === 'prefix-u-id' @@ -123,10 +122,6 @@ const getQueryVariables = (page: number) => { Object.assign(searchParams, { nftCount_not_eq: 0 }) } - if (isRemark.value) { - delete searchParams.burned_eq - } - return props.id ? { search: [searchParams], diff --git a/components/common/ChooseCollectionDropdown.vue b/components/common/ChooseCollectionDropdown.vue index 727031c72c..a4cedcabd8 100644 --- a/components/common/ChooseCollectionDropdown.vue +++ b/components/common/ChooseCollectionDropdown.vue @@ -8,7 +8,7 @@ }, ]" :no-shadow="noShadow" - :disabled="!isLogIn || isRemark" + :disabled="!isLogIn" >