Skip to content

Commit

Permalink
Merge pull request #5602 from kodadot/5535-final-prefix
Browse files Browse the repository at this point in the history
5535 final prefix
  • Loading branch information
vikiival committed Apr 11, 2023
2 parents 5943df0 + eb3af71 commit ca014b9
Show file tree
Hide file tree
Showing 42 changed files with 311 additions and 164 deletions.
8 changes: 4 additions & 4 deletions components/carousel/utils/useCarousel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const nftEventVariables = {
},
}

const disableChainsOnProduction = ['snek', 'rmrk2']
const disableChainsOnProduction = ['snek', 'ksm']

const useChainEvents = (chain, type) => {
if (isProduction && disableChainsOnProduction.includes(chain)) {
Expand Down Expand Up @@ -74,7 +74,7 @@ export const useCarouselNftEvents = ({ type }: Types) => {
const { data: dataBsx } = useChainEvents('bsx', type)
const { data: dataRmrk } = useChainEvents('rmrk', type)
const { data: dataSnek } = useChainEvents('snek', type)
const { data: dataRmrk2 } = useChainEvents('rmrk2', type)
const { data: dataRmrk2 } = useChainEvents('ksm', type)

const nfts = ref<CarouselNFT[]>([])

Expand All @@ -84,7 +84,7 @@ export const useCarouselNftEvents = ({ type }: Types) => {
const rmrkNfts = await flattenNFT(dataRmrk.value, 'rmrk')
const snekNfts = await flattenNFT(dataSnek.value, 'snek')
const bsxNfts = await flattenNFT(dataBsx.value, 'bsx')
const rmrk2Nfts = await flattenNFT(dataRmrk2.value, 'rmrk2')
const rmrk2Nfts = await flattenNFT(dataRmrk2.value, 'ksm')

const data = [...rmrkNfts, ...bsxNfts, ...snekNfts, ...rmrk2Nfts]

Expand Down Expand Up @@ -143,7 +143,7 @@ export const useCarouselRelated = ({ collectionId }) => {
const { urlPrefix } = usePrefix()
const { data } = useGraphql({
queryName: 'collectionEntityById',
queryPrefix: urlPrefix.value === 'rmrk2' ? 'chain-rmrk2' : 'subsquid',
queryPrefix: urlPrefix.value === 'ksm' ? 'chain-ksm' : 'subsquid',
variables: {
id: collectionId,
nftId: $route.params.id,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ const label = computed(() =>
)
const balance = computed<string>(() => {
if (['rmrk', 'rmrk2'].includes(urlPrefix.value)) {
if (['rmrk', 'ksm'].includes(urlPrefix.value)) {
return $store.getters.getAuthBalance
}
return $store.getters.getTokenBalanceOf(getKusamaAssetId(urlPrefix.value))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const root = ref<Vue<Record<string, string>>>()
const connected = computed(() => Boolean(accountId.value))
const balance = computed<string>(() => {
if (urlPrefix.value == 'rmrk' || urlPrefix.value == 'rmrk2') {
if (urlPrefix.value == 'rmrk' || urlPrefix.value == 'ksm') {
return $store.getters.getAuthBalance
}
return $store.getters.getTokenBalanceOf(tokenId.value)
Expand Down
2 changes: 1 addition & 1 deletion components/gallery/GalleryItemDescription.vue
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ const activeTab = ref('0')
const properties = computed(() => {
// we have different format between rmrk2 and the other chains
if (urlPrefix.value === 'rmrk2') {
if (urlPrefix.value === 'ksm') {
return Object.entries(nftMetadata.value?.properties || {}).map(
([key, value]) => {
return {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const { decimals, unit } = useChain()
const { urlPrefix, tokenId, assets } = usePrefix()
const interaction =
urlPrefix.value === 'rmrk2'
urlPrefix.value === 'ksm'
? dprops.interactions.filter((i) => i !== 'MINTNFT' && i !== 'CONSUME')
: dprops.interactions
Expand Down Expand Up @@ -146,7 +146,7 @@ watchEffect(() => {
const formatPrice = (price) => {
const { symbol } = assets(tokenId.value)
const tokenSymbol = ['rmrk', 'rmrk2'].includes(urlPrefix.value)
const tokenSymbol = ['rmrk', 'ksm'].includes(urlPrefix.value)
? unit.value
: symbol
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
:disabled-tooltip="$t('tabs.offersDisabled')">
<GalleryItemOffers
v-if="
!['rmrk', 'rmrk2'].includes(urlPrefix) &&
!['rmrk', 'ksm'].includes(urlPrefix) &&
nft?.collection.id &&
nft?.id &&
nft.currentOwner
Expand Down
2 changes: 1 addition & 1 deletion components/gallery/useGalleryItem.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const useGalleryItem = () => {

const queryPath = {
rmrk: 'chain-rmrk',
rmrk2: 'chain-rmrk2',
ksm: 'chain-ksm',
}

const { urlPrefix } = usePrefix()
Expand Down
4 changes: 2 additions & 2 deletions components/identity/module/IdentityLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<script lang="ts" setup>
import { GenericAccountId } from '@polkadot/types/generic/AccountId'
import { getExplorer } from '@kodadot1/static'
import type { BackwardPrefix } from '@kodadot1/static'
import type { Prefix } from '@kodadot1/static'
type Address = string | GenericAccountId | undefined
Expand All @@ -37,7 +37,7 @@ const { $buefy } = useNuxtApp()
const { urlPrefix } = usePrefix()
const explorerLink = computed(() =>
getExplorer(urlPrefix.value as BackwardPrefix, String(props.address))
getExplorer(urlPrefix.value as Prefix, String(props.address))
)
const toast = (message: string) => {
Expand Down
2 changes: 1 addition & 1 deletion components/items/ItemsGrid/useItemsGrid.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export function useFetchSearch({
}
isFetchingData.value = true

const queryPath = client.value === 'rmrk2' ? 'chain-rmrk2' : client.value
const queryPath = client.value === 'ksm' ? 'chain-ksm' : client.value
const query = await resolveQueryPath(queryPath, 'nftListWithSearch')
const result = await $apollo.query({
query: query.default,
Expand Down
4 changes: 2 additions & 2 deletions components/landing/LandingPage.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
</section>

<!-- top collections -->
<section v-if="showCarousel && urlPrefix !== 'rmrk2'" class="py-6 instance">
<section v-if="showCarousel && urlPrefix !== 'ksm'" class="py-6 instance">
<div class="container is-fluid">
<LazyTopCollections class="my-5" />
</div>
Expand Down Expand Up @@ -43,7 +43,7 @@ const { urlPrefix } = usePrefix()
const showCarousel = computed(() => {
return (
urlPrefix.value === 'rmrk' ||
urlPrefix.value === 'rmrk2' ||
urlPrefix.value === 'ksm' ||
urlPrefix.value === 'snek' ||
urlPrefix.value === 'bsx'
)
Expand Down
2 changes: 1 addition & 1 deletion components/massmint/useMassMint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const useMassMint = () => {
const { urlPrefix } = usePrefix()
const queryPath = {
rmrk: 'chain-rmrk',
rmrk2: 'chain-rmrk2',
ksm: 'chain-ksm',
}

const doFetch = async () => {
Expand Down
2 changes: 1 addition & 1 deletion components/navbar/NavbarExploreOptions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const { availableChains } = useChain()
const filteredChains = computed(() => {
return availableChains?.value.filter((chain) => {
return ['rmrk2', 'bsx', 'rmrk'].includes(chain.value)
return ['ksm', 'bsx', 'rmrk'].includes(chain.value)
})
})
Expand Down
2 changes: 1 addition & 1 deletion components/navbar/ProfileDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<b-dropdown-item has-link aria-role="menuitem">
<nuxt-link to="/settings">{{ $t('settings') }}</nuxt-link>
</b-dropdown-item>
<template v-if="chain === 'rmrk' || chain === 'rmrk2'">
<template v-if="chain === 'rmrk' || chain === 'ksm'">
<b-dropdown-item has-link aria-role="menuitem">
<a @click="showRampSDK">
{{ $t('credit') }}
Expand Down
4 changes: 2 additions & 2 deletions components/navbar/StatsDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</b-dropdown-item>
</b-dropdown>
<b-dropdown
v-if="chain === 'rmrk' || chain === 'rmrk2'"
v-if="chain === 'rmrk' || chain === 'ksm'"
data-cy="stats"
:triggers="['click']">
<template #trigger>
Expand Down Expand Up @@ -74,7 +74,7 @@
{{ $t('series.label') }}
</b-navbar-item>
</template>
<template v-if="chain === 'rmrk' || chain === 'rmrk2'">
<template v-if="chain === 'rmrk' || chain === 'ksm'">
<b-navbar-item data-cy="spotlight" to="/spotlight" tag="nuxt-link">
{{ $t('spotlight.page') }}
</b-navbar-item>
Expand Down
2 changes: 1 addition & 1 deletion composables/collectionActivity/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {

export const mintInteraction = () => {
const { urlPrefix } = usePrefix()
return urlPrefix.value === 'rmrk2' ? Interaction.MINT : Interaction.MINTNFT
return urlPrefix.value === 'ksm' ? Interaction.MINT : Interaction.MINTNFT
}

const flipperInitialValue = {
Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/mintCollection/constructMeta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ const createAttributes = (item: ActionMintCollection) => {
display_type: null,
}))
}
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
return []
}

Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionBurn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export function execBurnTx(item: ActionConsume, api, executeTransaction) {
})
}

if (item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'ksm') {
executeTransaction({
cb: api.tx.system.remark,
arg: [createInteraction('BURN' as any, '2.0.0', item.nftId, '')],
Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionBuy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ function execBuyBasilisk(item: ActionBuy, api, executeTransaction) {
}

export function execBuyTx(item: ActionBuy, api, executeTransaction) {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
execBuyRmrk(item, api, executeTransaction)
}

Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export function execListTx(item: ActionList, api, executeTransaction) {
return
}

if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
const version = item.urlPrefix === 'rmrk' ? '1.0.0' : '2.0.0'
executeTransaction({
cb: api.tx.system.remark,
Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionMintCollection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export function execMintCollection(
api,
executeTransaction
) {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
return execMintCollectionRmrk(item, api, executeTransaction)
}

Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionMintToken.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { execMintBasilisk } from './mintToken/transactionMintBasilisk'
import { ActionMintToken } from './types'

export function execMintToken(item: ActionMintToken, api, executeTransaction) {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
return execMintRmrk(item, api, executeTransaction)
}

Expand Down
2 changes: 1 addition & 1 deletion composables/transaction/transactionSend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export function execSendTx(item: ActionSend, api, executeTransaction) {
return
}

if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'rmrk2') {
if (item.urlPrefix === 'rmrk' || item.urlPrefix === 'ksm') {
execSendRmrk(item, api, executeTransaction)
}

Expand Down
2 changes: 1 addition & 1 deletion composables/useChain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default function () {
const availableChains = computed(() => availablePrefixes())

const chainSymbol = computed(() => {
return ['rmrk', 'rmrk2'].includes(urlPrefix.value) ? unit.value : symbol
return ['rmrk', 'ksm'].includes(urlPrefix.value) ? unit.value : symbol
})

return {
Expand Down
2 changes: 1 addition & 1 deletion composables/useNft.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export async function getNftMetadata(nft: NFTWithMetadata, prefix: string) {
}

// if it's rmrk2, we need to check `resources` field
if (prefix === 'rmrk2' && nft.resources?.length) {
if (prefix === 'ksm' && nft.resources?.length) {
return await getRmrk2Resources(nft)
}

Expand Down
16 changes: 2 additions & 14 deletions libs/static/src/chains.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { NAMES } from './names'
import type {
BackwardPrefix,
ChainProperties,
Config,
Option,
Prefix,
} from './types'
import type { ChainProperties, Config, Option, Prefix } from './types'

export const toChainProperty = (
ss58Format: number,
Expand Down Expand Up @@ -64,12 +58,6 @@ export const chainList = (): Option[] => {
return chainPrefixes.map((prefix) => ({
info: chainInfo[prefix],
text: NAMES[prefix],
value: prefix === 'ksm' ? 'rmrk2' : prefix,
value: prefix,
}))
}

// TODO: our url prefix still rmrk2
// e.g: https://kodadot.xyz/rmrk2/explore/items
export const rmrk2ToKsm = (prefix: BackwardPrefix): Prefix => {
return prefix === 'rmrk2' ? 'ksm' : prefix
}
7 changes: 3 additions & 4 deletions libs/static/src/names.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { BackwardPrefix } from './types'
import { Prefix } from './types'

export const NAMES: Record<BackwardPrefix, string> = {
export const NAMES: Record<Prefix, string> = {
bsx: 'Basilisk',
glmr: 'Moonbeam [Beta]',
rmrk2: 'RMRK 2.0 [Beta]',
rmrk: 'Kusama',
ksm: 'Kusama',
ksm: 'RMRK 2.0 [Beta]',
movr: 'Moonriver [Beta]',
snek: 'Snek [Rococo]',
}
11 changes: 5 additions & 6 deletions libs/static/src/services.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { rmrk2ToKsm } from './chains'
import type { BackwardPrefix, Prefix } from './types'
import type { Prefix } from './types'

export const SERVICES: Record<string, string> = {
directUpload: 'https://direct-upload.w.kodadot.xyz/',
Expand All @@ -19,10 +18,10 @@ export const EXPLORERS: Record<Prefix, string> = {
glmr: 'https://moonbeam.subscan.io/account/',
}

export const hasExplorer = (prefix: BackwardPrefix): boolean => {
return EXPLORERS[rmrk2ToKsm(prefix)] !== undefined
export const hasExplorer = (prefix: Prefix): boolean => {
return EXPLORERS[prefix] !== undefined
}

export const getExplorer = (prefix: BackwardPrefix, id: string) => {
return EXPLORERS[rmrk2ToKsm(prefix)] + id
export const getExplorer = (prefix: Prefix, id: string) => {
return EXPLORERS[prefix] + id
}
2 changes: 0 additions & 2 deletions libs/static/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ export type Prefix = 'bsx' | 'glmr' | 'rmrk' | 'movr' | 'ksm' | 'snek'
// | 'statemine'
// | 'westmint'

export type BackwardPrefix = Prefix | 'rmrk2'

export type Squid = 'rubick' | 'snekk' | 'click' | 'antick' | 'marck'

export type Config<T = boolean> = Record<Prefix, T>
Expand Down
4 changes: 2 additions & 2 deletions middleware/prefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ export const rmrk2ChainPrefixesInHostname = ['rmrk2', 'rmrk']

export default function ({ store, route }): void {
const prefix = route.params.prefix || route.path.split('/')[1]
const chains = ['rmrk2', ...chainPrefixes]
const chains = [...chainPrefixes]
const isAnyChainPrefixInPath = chains.some((prefix) =>
route.path.includes(prefix)
)
Expand All @@ -29,7 +29,7 @@ export default function ({ store, route }): void {
'_self'
)
} else if (store.getters.currentUrlPrefix !== rmrk2ChainPrefixInHostname) {
store.dispatch('setUrlPrefix', 'rmrk2')
store.dispatch('setUrlPrefix', 'ksm')
}
} else if (
store.getters.currentUrlPrefix !== prefix &&
Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
"@kodadot1/minimark": "^0.0.1-rc.10",
"@kodadot1/static": "workspace:*",
"@kodadot1/sub-api": "0.1.1-alpha.5",
"@kodadot1/vuex-options": "0.0.6-rc.0",
"@kodadot1/vuex-options": "0.1.0-rc.0",
"@nuxtjs/apollo": "^4.0.1-rc.5",
"@nuxtjs/i18n": "^7.3.1",
"@nuxtjs/sentry": "^7.1.11",
Expand Down Expand Up @@ -164,7 +164,6 @@
"husky": "^7.0.4",
"jsdom": "^19.0.0",
"lint-staged": "^12.5.0",
"netlify-lambda": "^2.0.16",
"prettier": "^2.8.7",
"raw-loader": "^4.0.2",
"sass": "^1.61.0",
Expand Down
Loading

0 comments on commit ca014b9

Please sign in to comment.