Skip to content

Commit

Permalink
feat: isChain composable (#6203)
Browse files Browse the repository at this point in the history
* feat: isChain composable

* fix: computed prefix
  • Loading branch information
Jarsen136 authored Jun 14, 2023
1 parent f648630 commit 61f13de
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
3 changes: 2 additions & 1 deletion components/common/ConnectWallet/WalletAssetMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ import { NeoIcon } from '@kodadot1/brick'
import { langsFlags } from '@/utils/config/i18n'
import { useLangStore } from '@/stores/lang'
const { urlPrefix, isBasilisk } = usePrefix()
const { urlPrefix } = usePrefix()
const { isBasilisk } = useIsChain(urlPrefix)
const { toggleColorMode, isDarkMode } = useTheme()
const langStore = useLangStore()
Expand Down
3 changes: 2 additions & 1 deletion components/common/ConnectWallet/WalletAssetPortfolio.vue
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@
import { NeoButton } from '@kodadot1/brick'
import { RampInstantSDK } from '@ramp-network/ramp-instant-sdk'
const { urlPrefix, isBasilisk } = usePrefix()
const { urlPrefix } = usePrefix()
const { isBasilisk } = useIsChain(urlPrefix)
const { accountId } = useAuth()
const showRampSDK = () => {
Expand Down
20 changes: 20 additions & 0 deletions composables/useIsChain.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import type { Prefix } from '@kodadot1/static'
import type { ComputedRef } from 'vue'

export default function (prefix: ComputedRef<Prefix>) {
const isBasilisk = computed(
() => prefix.value === 'bsx' || prefix.value === 'snek'
)
const isRemark = computed(
() => prefix.value === 'rmrk' || prefix.value === 'ksm'
)
const isAssetHub = computed(
() => prefix.value === 'stmn' || prefix.value === 'stt'
)

return {
isBasilisk,
isRemark,
isAssetHub,
}
}
5 changes: 0 additions & 5 deletions composables/usePrefix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,11 @@ export default function () {
return useAssetsStore().getAssetById(String(id))
}

const isBasilisk = computed(
() => prefix.value === 'bsx' || prefix.value === 'snek'
)

return {
urlPrefix,
setUrlPrefix,
client,
tokenId,
assets,
isBasilisk,
}
}

0 comments on commit 61f13de

Please sign in to comment.