Skip to content

Commit

Permalink
Merge branch 'main' into issue-10952
Browse files Browse the repository at this point in the history
  • Loading branch information
vikiival authored Sep 19, 2024
2 parents 93d3ec1 + 15317ef commit 76aba7a
Show file tree
Hide file tree
Showing 77 changed files with 334 additions and 1,614 deletions.
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 @@ -102,10 +102,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()
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>
11 changes: 3 additions & 8 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,10 +18,8 @@ const nftEventVariables = {
}

const fetchLatestEvents = (chain, type, where = {}, limit = 20) => {
const query = chain === 'ksm' ? latestEventsRmrkv2 : latestEvents

return useQuery(
query,
latestEvents,
{
limit,
orderBy: 'timestamp_DESC',
Expand Down Expand Up @@ -158,10 +155,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
7 changes: 1 addition & 6 deletions components/common/ConnectWallet/WalletAssetMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@
import { NeoDropdown, NeoDropdownItem, NeoIcon } from '@kodadot1/brick'
import type { Prefix } from '@kodadot1/static'
import { langsFlags, setUserLocale } from '@/utils/config/i18n'
import { transferVisible, teleportVisible, migrateVisible } from '@/utils/config/permission.config'
import { transferVisible, teleportVisible } from '@/utils/config/permission.config'
const { urlPrefix } = usePrefix()
// const { isAssetHub } = useIsChain(urlPrefix)
Expand All @@ -99,11 +99,6 @@ const menus = ref<{ label: string, to: string, check: (v: Prefix) => boolean }[]
to: `/${urlPrefix.value}/teleport`,
check: teleportVisible,
},
{
label: 'Migrate',
to: '/migrate',
check: migrateVisible,
},
])
// 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 @@ -9,8 +9,6 @@ import { nameWithIndex } from '@/utils/nft'
import type { MakingOfferItem } from '@/components/offer/types'

export const prefixToToken = {
ksm: 'KSM',
rmrk: 'KSM',
ahk: 'KSM',
ahp: 'DOT',
dot: 'DOT',
Expand Down
19 changes: 3 additions & 16 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 @@ -279,8 +271,8 @@ const royalty = ref({
const menus = availablePrefixes().filter(
(menu) => {
const { isRemark, isEvm } = useIsChain(computed(() => menu.value as Prefix))
return !isRemark.value && !isEvm.value
const { isEvm } = useIsChain(computed(() => menu.value as Prefix))
return !isEvm.value
})
const chainByPrefix = menus.find(menu => menu.value === urlPrefix.value)
Expand All @@ -302,7 +294,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 @@ -351,11 +343,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

0 comments on commit 76aba7a

Please sign in to comment.