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"
>
([
to: `/${urlPrefix.value}/teleport`,
vm: ['SUB'],
},
- {
- label: 'Migrate',
- to: '/migrate',
- vm: ['SUB'],
- },
])
// TODO: enable when asset hub offers are ready
diff --git a/components/common/confirmPurchaseModal/ConfirmPurchaseModal.vue b/components/common/confirmPurchaseModal/ConfirmPurchaseModal.vue
index b2afdd676a..ac4c1856d3 100644
--- a/components/common/confirmPurchaseModal/ConfirmPurchaseModal.vue
+++ b/components/common/confirmPurchaseModal/ConfirmPurchaseModal.vue
@@ -105,8 +105,6 @@ const prefrencesStore = usePreferencesStore()
const shoppingCartStore = useShoppingCartStore()
const { isLogIn } = useAuth()
const { urlPrefix } = usePrefix()
-const { isRemark } = useIsChain(urlPrefix)
-const isDisabledPurchasePrefix = isRemark
const autoteleport = ref()
const actions = computed(() => [props.action])
@@ -145,7 +143,7 @@ const total = computed(
)
const disabled = computed(
- () => !isLogIn.value || isDisabledPurchasePrefix.value,
+ () => !isLogIn.value,
)
const priceUSD = computed(() => {
diff --git a/components/common/shoppingCart/utils.ts b/components/common/shoppingCart/utils.ts
index dc5f297e23..da76199a78 100644
--- a/components/common/shoppingCart/utils.ts
+++ b/components/common/shoppingCart/utils.ts
@@ -8,8 +8,6 @@ import { chainPropListOf } from '@/utils/config/chain.config'
import { nameWithIndex } from '@/utils/nft'
export const prefixToToken = {
- ksm: 'KSM',
- rmrk: 'KSM',
ahk: 'KSM',
ahp: 'DOT',
dot: 'DOT',
diff --git a/components/create/CreateCollection.vue b/components/create/CreateCollection.vue
index 0ac05113c2..858a7a7c68 100644
--- a/components/create/CreateCollection.vue
+++ b/components/create/CreateCollection.vue
@@ -121,13 +121,6 @@
-
- {{ $t('mint.disabledRmrk') }}
-
-
menu.value !== 'ksm' && menu.value !== 'rmrk',
-)
+const menus = availablePrefixes()
const chainByPrefix = menus.find(menu => menu.value === urlPrefix.value)
const selectBlockchain = ref(chainByPrefix?.value || menus[0].value)
@@ -299,7 +289,7 @@ const currentChain = computed(() => {
return selectBlockchain.value as Prefix
})
-const { isAssetHub, isRemark } = useIsChain(currentChain)
+const { isAssetHub } = useIsChain(currentChain)
const { balance, totalCollectionDeposit, chainSymbol, chain }
= useDeposit(currentChain)
@@ -342,11 +332,6 @@ const collection = computed(() => {
collection['nftCount'] = unlimited.value ? 0 : max.value
}
- if (isRemark.value) {
- collection['symbol'] = symbol.value
- collection['nftCount'] = unlimited.value ? 0 : max.value
- }
-
return collection
})
diff --git a/components/create/CreateNft.vue b/components/create/CreateNft.vue
index e206d6522f..6cb10279c5 100644
--- a/components/create/CreateNft.vue
+++ b/components/create/CreateNft.vue
@@ -102,14 +102,6 @@
-
- {{ $t('mint.disabledRmrk') }}
-
-
-
+
{
})
// select available blockchain
-const menus = availablePrefixes().filter(
- menu => menu.value !== 'ksm' && menu.value !== 'rmrk',
-)
+const menus = availablePrefixes()
+
const chainByPrefix = computed(() =>
menus.find(menu => menu.value === urlPrefix.value),
)
@@ -406,7 +394,6 @@ watch(urlPrefix, (value) => {
// get/set current chain/prefix
const currentChain = computed(() => selectChain.value as Prefix)
-const { isRemark } = useIsChain(currentChain)
watch(currentChain, () => {
// reset some state on chain change
form.salePrice = 0
@@ -509,26 +496,16 @@ const confirm = async ({
}
}
-const needsListing = computed(
- () => isRemark.value && form.sale && form.salePrice,
-)
-
const createNft = async () => {
try {
- const minted = (await transaction(
+ (await transaction(
mintAction.value,
currentChain.value,
)) as unknown as {
createdNFTs?: Ref
}
- if (needsListing.value) {
- createdItems.value = minted?.createdNFTs?.value
- transactionStatus.value = 'list'
- }
- else {
- transactionStatus.value = 'mint'
- }
+ transactionStatus.value = 'mint'
}
catch (error) {
warningMessage(`${error}`)
@@ -561,25 +538,6 @@ const autoTeleportActions = computed(() => {
},
]
- if (needsListing.value) {
- actions.push({
- action: listAction.value,
- handler: (params: { isRetry: boolean }) => {
- if (params.isRetry) {
- return listNft()
- }
- return Promise.resolve()
- },
- prefix: currentChain.value,
- details: {
- isLoading: listIsLoading.value,
- isError: listIsError.value,
- status: listStatus.value,
- blockNumber: listBlockNumber.value,
- },
- })
- }
-
return actions
})
@@ -618,9 +576,7 @@ watchEffect(() => {
&& blockNumber.value
) {
mintedBlockNumber.value = blockNumber.value
- if (!needsListing.value) {
- transactionStatus.value = 'done'
- }
+ transactionStatus.value = 'done'
}
// if listing price is done, then redirect to detail page
diff --git a/components/gallery/GalleryItemAction/GalleryItemActionType/GalleryItemBuy.vue b/components/gallery/GalleryItemAction/GalleryItemActionType/GalleryItemBuy.vue
index be56c44dbc..67762622bb 100644
--- a/components/gallery/GalleryItemAction/GalleryItemActionType/GalleryItemBuy.vue
+++ b/components/gallery/GalleryItemAction/GalleryItemActionType/GalleryItemBuy.vue
@@ -16,13 +16,11 @@
class="button-height w-full"
variant="primary"
data-testid="item-buy"
- :disabled="isRemark"
@click="onClick"
/>
{{ $t('tabs.tabDetails.blockchain') }}
{{ urlPrefix }}
-
-
{{ $t('tabs.tabDetails.version') }}
-
{{ version }}
-
+