Skip to content

Commit

Permalink
Merge branch 'main' of github.com:kodadot/nft-gallery into fix--get-t…
Browse files Browse the repository at this point in the history
…oken-metadata-from-onchain
  • Loading branch information
preschian committed Sep 30, 2024
2 parents 7fd63e2 + ad25fdd commit f0ffd27
Show file tree
Hide file tree
Showing 140 changed files with 4,853 additions and 4,992 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.

2 changes: 1 addition & 1 deletion .github/diagram.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 4 additions & 2 deletions components/Navbar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
</nuxt-link>

<MobileExpandableSection
v-if="isExplorerVisible"
v-slot="{ onCloseMobileSubMenu }"
class="lg:!hidden"
:title="$t('explore')"
Expand All @@ -130,6 +131,7 @@
/>
</MobileExpandableSection>
<NavbarExploreDropdown
v-if="isExplorerVisible"
class="navbar-explore custom-navbar-item max-lg:!hidden"
data-testid="explore"
/>
Expand Down Expand Up @@ -259,10 +261,9 @@ import NavbarChainOptions from '@/components/navbar/NavbarChainOptions.vue'
import NavbarExploreOptions from '@/components/navbar/NavbarExploreOptions.vue'
import Search from '@/components/search/Search.vue'
import ConnectWalletButton from '@/components/shared/ConnectWalletButton.vue'
import { explorerVisible, createVisible } from '@/utils/config/permission.config'
import { useIdentityStore } from '@/stores/identity'
import { getChainNameByPrefix } from '@/utils/chain'
import { createVisible } from '@/utils/config/permission.config'
const { neoModal } = useProgrammatic()
const openMobileSearchBar = ref(false)
Expand All @@ -280,6 +281,7 @@ const mobilSearchRef = ref<{ focusInput: () => void } | null>(null)
const account = computed(() => identityStore.getAuthAddress)
const isCreateVisible = computed(() => createVisible(urlPrefix.value))
const isExplorerVisible = computed(() => explorerVisible(urlPrefix.value))
const logoSrc = computed(() => {
const variant = isTouch ? 'Koda' : 'Koda_Beta'
Expand Down
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/CarouselAgnostic.vue
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ const syncSlider = (s) => {
updateSliderArrows(s)
}
const updateConfig = () => slider.value?.update(props.config)
const updateConfig = () => nextTick().then(() => slider.value?.update(props.config))
if (props.config) {
watch(
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: 5 additions & 0 deletions components/codeChecker/CodeChecker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,11 @@ const onFileSelected = async (file: File) => {
const { indexFile, sketchFile, entries }
= await extractAssetsFromZip(file)
if (!indexFile) {
errorMessage.value = `Index file not found: Please make sure that “index.html” is in the root directory`
return
}
if (!sketchFile) {
errorMessage.value = `Sketch file not found: ${config.sketchFile}`
return
Expand Down
2 changes: 1 addition & 1 deletion components/codeChecker/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ const categorizeFiles = async (
const adjustedPath = path.replace(commonPrefix, '')
const content = await file.text()

if (path.endsWith('index.html')) {
if (path === 'index.html') {
htmlFiles.push({ path: adjustedPath, content })
}
else if (path.endsWith('.js') && !path.includes(config.p5)) {
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
4 changes: 2 additions & 2 deletions components/collection/activity/ActivityChart.vue
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<template>
<PriceChart
v-if="events.length > 0"
v-model:hideOutliers="hideOutliers"
v-model:applySmoothing="applySmoothing"
v-model:hide-outliers="hideOutliers"
v-model:apply-smoothing="applySmoothing"
:price-chart-data="chartData"
chart-height="350px"
data-testid="collection-activity-chart"
Expand Down
2 changes: 1 addition & 1 deletion components/collection/drop/GenerativePreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
</div>
<CollectionUnlockableSlider
v-if="drop.max"
v-if="drop.max && !isUnlimited"
class="text-neutral-5 dark:text-neutral-9"
:value="drop.minted / drop.max"
/>
Expand Down
1 change: 1 addition & 0 deletions components/collection/drop/ItemsGrid.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
:search="itemsGridSearch"
:grid-size="'medium'"
collection-popover-hide
hide-listing
show-timestamp
:reset-search-query-params="['sort']"
/>
Expand Down
3 changes: 2 additions & 1 deletion components/collection/drop/MintStepper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@
<script lang="ts" setup>
import { NeoStepper } from '@kodadot1/brick'
import useHolderOfCollection from '@/composables/drop/useHolderOfCollection'
import { hasBatchMint } from '@/composables/transaction/evm/utils'
const { availableNfts } = useHolderOfCollection()
const { amountToMint, drop } = storeToRefs(useDropStore())
const { isEvm } = useIsChain(usePrefix().urlPrefix)
const show = computed(() => drop.value.type !== 'free' && !isEvm.value)
const show = computed(() => isEvm.value ? hasBatchMint(drop.value?.abi || []) : drop.value.type !== 'free')
const isHolder = computed(() => drop.value.type === 'holder')
const availableNftsAmount = computed(() => availableNfts.serialNumbers.length)
Expand Down
Loading

0 comments on commit f0ffd27

Please sign in to comment.