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

refactor: Deprecation of RMRK #10686

Merged
merged 15 commits into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
2 changes: 0 additions & 2 deletions .github/ISSUE_TEMPLATE/bug_minting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,7 @@ body:
multiple: true
options:
- Basilisk
- Kusama
- MoonBeam
- RMRK2
- type: textarea
id: Screenshots
attributes:
Expand Down
102 changes: 0 additions & 102 deletions .github/ISSUE_TEMPLATE/bug_rmrk2.yml

This file was deleted.

68 changes: 0 additions & 68 deletions components/accounts/utils.ts
Original file line number Diff line number Diff line change
@@ -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[]
Expand All @@ -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
Expand All @@ -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()
5 changes: 3 additions & 2 deletions components/balance/MultipleBalances.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion components/carousel/module/CarouselInfo.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'])
</script>
9 changes: 3 additions & 6 deletions components/carousel/utils/useCarouselEvents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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,
Jarsen136 marked this conversation as resolved.
Show resolved Hide resolved
Expand Down Expand Up @@ -158,10 +157,8 @@ const sortNfts = (data) => {
}

const CAROUSEL_LIMIT: Partial<Record<Prefix, number>> = {
ahp: 11,
ahk: 11,
rmrk: 4,
ksm: 4,
ahp: 15,
ahk: 15,
}

export const useCarouselNftEvents = ({ type }: Types) => {
Expand Down
5 changes: 0 additions & 5 deletions components/collection/CollectionGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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],
Expand Down
5 changes: 1 addition & 4 deletions components/common/ChooseCollectionDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
},
]"
:no-shadow="noShadow"
:disabled="!isLogIn || isRemark"
:disabled="!isLogIn"
>
<template #trigger="{ active }">
<NeoButton
Expand Down Expand Up @@ -99,9 +99,6 @@ const props = defineProps({
preselected: { type: String, default: undefined },
})

const { urlPrefix } = usePrefix()
const { isRemark } = useIsChain(urlPrefix)

const { isLogIn, accountId } = useAuth()

const { collectionsEntites } = useCollectionForMint()
Expand Down
5 changes: 0 additions & 5 deletions components/common/ConnectWallet/WalletAssetMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ const menus = ref<{ label: string, to: string, vm: ChainVM[] }[]>([
to: `/${urlPrefix.value}/teleport`,
vm: ['SUB'],
},
{
label: 'Migrate',
to: '/migrate',
vm: ['SUB'],
},
])

// TODO: enable when asset hub offers are ready
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand Down Expand Up @@ -145,7 +143,7 @@ const total = computed(
)

const disabled = computed(
() => !isLogIn.value || isDisabledPurchasePrefix.value,
() => !isLogIn.value,
)

const priceUSD = computed(() => {
Expand Down
2 changes: 0 additions & 2 deletions components/common/shoppingCart/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
19 changes: 2 additions & 17 deletions components/create/CreateCollection.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,6 @@
</div>
</NeoField>

<InfoBox
v-if="isRemark"
variant="warning"
>
<div>{{ $t('mint.disabledRmrk') }}</div>
</InfoBox>

<!-- royalty -->
<NeoField v-if="isAssetHub">
<RoyaltyForm
Expand Down Expand Up @@ -161,7 +154,6 @@
<NeoButton
class="text-base"
expanded
:disabled="isRemark"
:label="submitButtonLabel"
native-type="submit"
size="medium"
Expand Down Expand Up @@ -276,9 +268,7 @@ const royalty = ref({
address: accountId.value,
})

const menus = availablePrefixes().filter(
menu => 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)
Expand All @@ -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)

Expand Down Expand Up @@ -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
})

Expand Down
Loading
Loading