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

feat: isChain composable #6203

Merged
merged 2 commits into from
Jun 14, 2023
Merged

feat: isChain composable #6203

merged 2 commits into from
Jun 14, 2023

Conversation

Jarsen136
Copy link
Contributor

@Jarsen136 Jarsen136 commented Jun 12, 2023

Thank you for your contribution to the KodaDot - One Stop Shop for Polkadot NFTs.

👇 __ Let's make a quick check before the contribution.

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Did your issue had any of the "$" label on it?

Copilot Summary

🤖 Generated by Copilot at dd93446

Refactored the chain detection logic by creating a new useIsChain composable that returns computed booleans for each chain based on the prefix. Replaced the isBasilisk variable from the usePrefix composable with the useIsChain composable in the WalletAssetMenu and WalletAssetPortfolio components.

🤖 Generated by Copilot at dd93446

To check the chain of a prefix
We use a composable suffix
useIsChain returns
Booleans that discern
If it's Basilisk, Remark, or AssetHub fix

@Jarsen136 Jarsen136 requested a review from a team as a code owner June 12, 2023 15:31
@Jarsen136 Jarsen136 requested review from roiLeo and vikiival and removed request for a team June 12, 2023 15:31
@kodabot
Copy link
Collaborator

kodabot commented Jun 12, 2023

SUCCESS @Jarsen136 PR for issue #6202 which is assigned to you. Please wait for review and don't hesitate to grab another issue in the meantime!

@netlify
Copy link

netlify bot commented Jun 12, 2023

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 5cee5ad
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/6487cc966a1ec80008cd6560
😎 Deploy Preview https://deploy-preview-6203--koda-canary.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@reviewpad
Copy link
Contributor

reviewpad bot commented Jun 12, 2023

AI-Generated Summary: This pull request introduces a new composable function called useIsChain for checking if the current chain is Basilisk, Remark, or AssetHub. The function is used to refactor WalletAssetMenu.vue and WalletAssetPortfolio.vue components by replacing the previously computed isBasilisk property in the usePrefix composable. The changes involve 4 files, including the addition of the new composable file useIsChain.ts, and the removal of the isBasilisk property from the usePrefix.ts composable. Overall, 17 insertions and 7 deletions have been made to the codebase.

@reviewpad reviewpad bot added small Pull request is small waiting-for-review labels Jun 12, 2023
Copy link
Contributor

@roiLeo roiLeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would have just kept them under usePrefix composable, and without arg

@Jarsen136
Copy link
Contributor Author

I would have just kept them under usePrefix composable, and without arg

WDYT 👀 @vikiival

Copy link
Member

@vikiival vikiival left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Otherwise lgtm

components/common/ConnectWallet/WalletAssetMenu.vue Outdated Show resolved Hide resolved
@codeclimate
Copy link

codeclimate bot commented Jun 13, 2023

Code Climate has analyzed commit 5cee5ad and detected 0 issues on this pull request.

View more on Code Climate.

Copy link
Contributor

@roiLeo roiLeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But wait we already have something like this, I don't find any advatange to have urlPrefix as a param

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

@vikiival
Copy link
Member

vikiival commented Jun 13, 2023

The point is why I described to put urlPrefix as param instead of using usePrefix is use-cases such as teleport or future create that would have chain selector.

Moreover two things

  1. if we use usePrefix inside the isChain it would mean that many components would call usePrefix twice
  2. transaction composables - we pass prefix as the parameter therefore it's simplier to use this via params
  3. Separation - there would be some cases where you don't need useIsChain composable and having it inside of usePrefix will add another n properties to compute.

Hope it makes sense now:

Screenshot 2023-06-13 at 12 12 02

@vikiival vikiival merged commit 61f13de into kodadot:main Jun 14, 2023
17 of 19 checks passed
@vikiival
Copy link
Member

pay 20 usd

@yangwao
Copy link
Member

yangwao commented Jun 14, 2023

😍 Perfect, I’ve sent the payout
💵 $20 @ 4.68 USD/DOT ~ 4.274 $DOT
🧗 16SjUbGKSdjCdWTy3NNT3JxbRVGGqD4mwkHpc6BD9U2Rp29Z
🔗 0x6260491539781faf8b3f265123421acb6e230cc9fdc40ca007709733be9204ea

🪅 Let’s grab another issue and get rewarded!
🪄 github.com/kodadot/nft-gallery/issues

@yangwao yangwao added the paid pull-request has been paid label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
paid pull-request has been paid small Pull request is small waiting-for-review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

isChain composable
7 participants