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

refactor: remove minimark #11448

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

refactor: remove minimark #11448

wants to merge 6 commits into from

Conversation

preschian
Copy link
Member

@preschian preschian commented Feb 26, 2025

Thank you for your contribution to the Koda - Generative Art Marketplace.

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

PR Type

  • Bugfix
  • Feature
  • Refactoring

Context

Summary by CodeRabbit

  • New Features

    • Introduced a new Interaction enum for structured handling of various interaction types.
    • Added types for AbstractCreatedNFT and CreatedNFT, along with a new function toNFTId for NFT data management.
  • Refactor

    • Streamlined interaction handling across components and utilities, improving robustness in collection and NFT creation flows.
    • Enhanced data consistency by ensuring default values for transaction identifiers and image previews.
  • Chores

    • Removed an outdated external dependency and cleaned up redundant code for optimized performance.

Copy link

coderabbitai bot commented Feb 26, 2025

Walkthrough

This update refactors numerous components, composables, and utilities to change the source of the Interaction entity from an external package (@kodadot1/minimark/v1) to a local module (@/utils/shoppingActions). In addition, specific create and transaction components received minor logic enhancements such as fallback handling and removal of unused variables. Other adjustments include dependency removals from the build configuration and updates to utility functions and type definitions, resulting in a more self-contained and streamlined codebase.

Changes

File(s) Change Summary
components/collection/{HeroButtonDeleteNfts.vue, activity/Activity.vue, ActivityChart.vue, activity/events/{Events.vue, eventRow/common.ts}},
components/common/{ItemBurnModal.vue, ItemTransferModal.vue, autoTeleport/utils.ts, listingCart/ListingCartModal.vue},
components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue,
components/migrate/steps/SignLoader3.vue,
components/profile/{ProfileDetail.vue, activityTab/{Activity.vue, History.vue}},
composables/{autoTeleport/utils.ts, collectionActivity/{helpers.ts, types.ts}, massmint/{massMintHelpers.ts, useMassMint.ts}, transaction/{transactionList.ts, transactionSend.ts, utils.ts}, useTransaction.ts},
utils/{historyEvent.ts, transactionExecutor.ts}
Updated import statements: Replaced @kodadot1/minimark/v1 (and related enum imports) with @/utils/shoppingActions for the Interaction entity across multiple components and composables.
components/create/{CreateCollection.vue, CreateNft.vue} Create Components Enhancements: Updated Interaction import; added fallback for txHash and image prop; removed unused state (symbol); and replaced import for toNFTId with a local version.
composables/transaction/transactionBurn.ts Removed transaction handling for URL prefixes "rmrk" and "ksm", eliminated obsolete createInteraction functions, and updated the Interaction import.
composables/transaction/types.ts Replaced the Interaction type import from @kodadot1/minimark/v1 with a new import from @/utils/shoppingActions, adding the ShoppingActions type.
{nuxt.config.ts, package.json} Removed references and dependency entries for @kodadot1/minimark from the optimization config and project dependencies.
utils/{cachingStrategy.ts, format/balance.ts} Removed the import of isEmpty and external trimAll; added a local trimAll function in balance.ts.
utils/nft.ts Introduced new types (AbstractCreatedNFT, CreatedNFT) and a toNFTId function for constructing an NFT identifier.
utils/shoppingActions.ts Added a new Interaction enum and updated the ShoppingActions type, replacing the external dependency with a local implementation.
composables/transaction/transactionUpdateCollection.ts Removed a commented TODO note regarding the addition of a banner field (no functional changes).

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant TX_Burn as execBurnCollection
    participant CollectionService
    User->>TX_Burn: Initiate burn transaction (with specific URL prefix)
    alt Prefix is "ahk" or "ahp"
        TX_Burn->>CollectionService: Retrieve collection data
        TX_Burn->>TX_Burn: Construct witness argument
    else Other prefixes (e.g. "rmrk", "ksm")
        TX_Burn->>TX_Burn: Skip removed interaction handling
    end
    TX_Burn->>User: Return transaction result
Loading

Possibly related PRs

  • refactor: deprecate ktheme usages (3) #11426: Involves a similar update, replacing the Interaction import from @kodadot1/minimark/v1 with a local module, showing a direct code-level shift in sourcing interaction definitions.

Suggested reviewers

  • Jarsen136
  • hassnian

Poem

In my burrow of code I hop along,
Cleaning up imports and tuning the song.
The old paths fade like yesterday's dew,
New local enums shine bright and true.
I twitch my nose at bugs that dare roam—
A rabbit’s code is always right at home!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between fc49e01 and 6cea232.

📒 Files selected for processing (1)
  • composables/autoTeleport/utils.ts (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • composables/autoTeleport/utils.ts
⏰ Context from checks skipped due to timeout of 90000ms (19)
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: Redirect rules
  • GitHub Check: Header rules
  • GitHub Check: Pages changed
  • GitHub Check: shard (10, 10)
  • GitHub Check: shard (9, 10)
  • GitHub Check: shard (8, 10)
  • GitHub Check: shard (7, 10)
  • GitHub Check: shard (6, 10)
  • GitHub Check: shard (5, 10)
  • GitHub Check: shard (4, 10)
  • GitHub Check: shard (3, 10)
  • GitHub Check: build
  • GitHub Check: shard (2, 10)
  • GitHub Check: build-cf
  • GitHub Check: shard (1, 10)
  • GitHub Check: Cloudflare Pages: koda-art-prod

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for polkadot ready!

Name Link
🔨 Latest commit 6cea232
🔍 Latest deploy log https://app.netlify.com/sites/polkadot/deploys/67befddc06567100089ad3a1
😎 Deploy Preview https://deploy-preview-11448--polkadot.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 configuration.

@preschian preschian changed the title Refactor--remove-minimark refactor: remove minimark Feb 26, 2025
Copy link

netlify bot commented Feb 26, 2025

Deploy Preview for koda-canary ready!

Name Link
🔨 Latest commit 6cea232
🔍 Latest deploy log https://app.netlify.com/sites/koda-canary/deploys/67befddc0c1cd70008af7d24
😎 Deploy Preview https://deploy-preview-11448--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 configuration.

Copy link

socket-security bot commented Feb 26, 2025

🚨 Potential security issues detected. Learn more about Socket for GitHub ↗︎

To accept the risk, merge this PR and you will not be notified again.

Alert Package NoteSourceCI
Obfuscated code npm/@polkadot/[email protected] ⚠︎
Obfuscated code npm/@polkadot/[email protected] ⚠︎
Obfuscated code npm/@polkadot/[email protected] ⚠︎

View full report↗︎

Next steps

What is obfuscated code?

Obfuscated files are intentionally packed to hide their behavior. This could be a sign of malware.

Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Take a deeper look at the dependency

Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support [AT] socket [DOT] dev.

Remove the package

If you happen to install a dependency that Socket reports as Known Malware you should immediately remove it and select a different dependency. For other alert types, you may may wish to investigate alternative packages or consider if there are other ways to mitigate the specific risk posed by the dependency.

Mark a package as acceptable risk

To ignore an alert, reply with a comment starting with @SocketSecurity ignore followed by a space separated list of ecosystem/package-name@version specifiers. e.g. @SocketSecurity ignore npm/[email protected] or ignore all packages with @SocketSecurity ignore-all

Copy link

cloudflare-workers-and-pages bot commented Feb 26, 2025

Deploying koda-art-prod with  Cloudflare Pages  Cloudflare Pages

Latest commit: 6cea232
Status: ✅  Deploy successful!
Preview URL: https://a3116206.kodaart-production.pages.dev
Branch Preview URL: https://refactor--remove-minimark.kodaart-production.pages.dev

View logs

@preschian preschian marked this pull request as ready for review February 26, 2025 11:30
@preschian preschian requested a review from a team as a code owner February 26, 2025 11:30
@preschian preschian requested review from Jarsen136 and hassnian and removed request for a team February 26, 2025 11:30
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🔭 Outside diff range comments (1)
composables/useTransaction.ts (1)

215-215: 🛠️ Refactor suggestion

Consider handling potential null API instance.

The non-null assertion (api!) could lead to runtime errors if the API instance is null.

Apply this diff to add a null check:

-  execCancelSwap(item as ActionCancelSwap, api!, executeTransaction),
+  execCancelSwap(item as ActionCancelSwap, api ?? throwError('API instance is required'), executeTransaction),

Add this helper function at the top of the file:

function throwError(message: string): never {
  throw new Error(message)
}
🧹 Nitpick comments (1)
composables/transaction/types.ts (1)

6-6: LGTM: Import change improves code organization.

The change not only aligns with the dependency removal but also improves code organization by:

  1. Moving to a local source for Interaction
  2. Introducing ShoppingActions type for shopping-specific operations
  3. Maintaining clear separation of concerns between general interactions and shopping actions
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 0c5ee64 and fc49e01.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (36)
  • components/collection/HeroButtonDeleteNfts.vue (1 hunks)
  • components/collection/activity/Activity.vue (1 hunks)
  • components/collection/activity/ActivityChart.vue (1 hunks)
  • components/collection/activity/events/Events.vue (1 hunks)
  • components/collection/activity/events/eventRow/common.ts (1 hunks)
  • components/common/ItemBurnModal.vue (1 hunks)
  • components/common/ItemTransferModal.vue (1 hunks)
  • components/common/autoTeleport/utils.ts (1 hunks)
  • components/common/listingCart/ListingCartModal.vue (1 hunks)
  • components/create/CreateCollection.vue (2 hunks)
  • components/create/CreateNft.vue (3 hunks)
  • components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue (1 hunks)
  • components/migrate/steps/SignLoader3.vue (1 hunks)
  • components/profile/ProfileDetail.vue (1 hunks)
  • components/profile/activityTab/Activity.vue (1 hunks)
  • components/profile/activityTab/History.vue (1 hunks)
  • composables/autoTeleport/utils.ts (1 hunks)
  • composables/collectionActivity/helpers.ts (1 hunks)
  • composables/collectionActivity/types.ts (1 hunks)
  • composables/massmint/massMintHelpers.ts (1 hunks)
  • composables/massmint/useMassMint.ts (1 hunks)
  • composables/transaction/transactionBurn.ts (1 hunks)
  • composables/transaction/transactionList.ts (1 hunks)
  • composables/transaction/transactionSend.ts (1 hunks)
  • composables/transaction/transactionUpdateCollection.ts (0 hunks)
  • composables/transaction/types.ts (1 hunks)
  • composables/transaction/utils.ts (1 hunks)
  • composables/useTransaction.ts (1 hunks)
  • nuxt.config.ts (0 hunks)
  • package.json (0 hunks)
  • utils/cachingStrategy.ts (0 hunks)
  • utils/format/balance.ts (1 hunks)
  • utils/historyEvent.ts (1 hunks)
  • utils/nft.ts (1 hunks)
  • utils/shoppingActions.ts (1 hunks)
  • utils/transactionExecutor.ts (1 hunks)
💤 Files with no reviewable changes (4)
  • composables/transaction/transactionUpdateCollection.ts
  • package.json
  • nuxt.config.ts
  • utils/cachingStrategy.ts
✅ Files skipped from review due to trivial changes (8)
  • utils/historyEvent.ts
  • components/common/autoTeleport/utils.ts
  • utils/transactionExecutor.ts
  • composables/transaction/transactionList.ts
  • composables/transaction/transactionSend.ts
  • composables/massmint/massMintHelpers.ts
  • composables/transaction/utils.ts
  • composables/collectionActivity/types.ts
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Cloudflare Pages: koda-art-prod
🔇 Additional comments (27)
components/migrate/steps/SignLoader3.vue (1)

86-86: Import path updated correctly.

The import path for the Interaction enum has been updated from an external package to a local utility file, which aligns with the PR objective of removing minimark dependencies.

utils/format/balance.ts (1)

5-5: Good addition of the local trimAll function.

The function properly handles optional input with a fallback to empty string and correctly removes all whitespace characters. This local implementation replaces the previously imported function from the minimark package, making the codebase more self-contained.

components/profile/ProfileDetail.vue (1)

467-467: Import path correctly updated.

The import statement for Interaction has been successfully modified to use the local utility file instead of the external minimark package, consistent with the refactoring goal.

components/profile/activityTab/Activity.vue (1)

54-54: Import path updated with alias preserved.

The import statement for Interaction (aliased as InteractionEnum) has been properly updated to use the local utility module while maintaining the same alias, ensuring no changes to the component's functionality.

components/collection/activity/events/eventRow/common.ts (1)

1-1: LGTM! Import refactored correctly.

The import statement has been successfully updated to use the local module, maintaining consistency with the codebase-wide refactoring effort to remove the minimark dependency.

composables/massmint/useMassMint.ts (1)

5-5: LGTM! Import refactored correctly.

The import statement has been successfully updated to use the local module, maintaining the MINTNFT interaction type functionality.

components/profile/activityTab/History.vue (1)

85-85: LGTM! Import refactored correctly.

The import statement has been successfully updated to use the local module, maintaining all interaction type functionality used throughout the component.

components/common/ItemBurnModal.vue (1)

31-31: LGTM! Import refactored correctly.

The import statement has been successfully updated to use the local module, maintaining the CONSUME interaction type functionality.

composables/collectionActivity/helpers.ts (1)

9-9: LGTM! Import change aligns with refactoring goal.

The change from @kodadot1/minimark/v1 to @/utils/shoppingActions is consistent with the PR's objective to remove the minimark dependency. The usage of Interaction throughout the file remains valid.

components/collection/activity/Activity.vue (1)

58-58: LGTM! Import change aligns with refactoring goal.

The change from @kodadot1/minimark/v1 to @/utils/shoppingActions is consistent with the PR's objective to remove the minimark dependency. The usage of Interaction in the component remains valid.

components/collection/activity/events/Events.vue (1)

52-52: LGTM! Import change aligns with refactoring goal.

The change from @kodadot1/minimark/v1 to @/utils/shoppingActions is consistent with the PR's objective to remove the minimark dependency. The usage of Interaction in the component remains valid.

components/collection/activity/ActivityChart.vue (1)

32-32: LGTM: Import change aligns with dependency removal.

The change to import Interaction from local utils is consistent with the refactoring goal of removing the minimark dependency.

components/common/ItemTransferModal.vue (1)

49-49: LGTM: Import change aligns with dependency removal.

The change to import Interaction from local utils is consistent with the refactoring goal of removing the minimark dependency.

components/gallery/GalleryItemButton/GalleryItemMoreActionBtn.vue (1)

61-61: LGTM: Import change aligns with dependency removal.

The change to import Interaction from local utils is consistent with the refactoring goal of removing the minimark dependency.

components/common/listingCart/ListingCartModal.vue (1)

100-100: Update import source to local module. Looks good!

This change correctly updates the import source of the Interaction enum from the external package @kodadot1/minimark/v1 to the local module @/utils/shoppingActions, aligning with the PR's goal of removing the minimark dependency.

components/collection/HeroButtonDeleteNfts.vue (1)

16-16: Import path updated correctly.

The Interaction enum import has been properly updated to use the local implementation from @/utils/shoppingActions instead of the external minimark package.

utils/nft.ts (2)

4-15: Well-defined type interfaces for NFT creation.

These type definitions provide a clear structure for NFT-related data, with AbstractCreatedNFT containing the essential required properties and CreatedNFT extending it with additional fields.


24-31: Good implementation of NFT ID generator with proper error handling.

The toNFTId function includes appropriate validation for required fields and throws a descriptive error when necessary. The formatting of the NFT ID follows a consistent pattern that includes all essential identifying information.

utils/shoppingActions.ts (2)

1-23: Excellent implementation of the Interaction enum.

This local implementation of the Interaction enum properly replaces the previously imported enum from the minimark package. The comprehensive set of interaction types covers all necessary actions and maintains compatibility with the rest of the codebase.


38-44: Good composition of shopping actions types.

The ShoppingActions type and object correctly incorporate the newly defined Interaction enum along with the existing OfferActions and SwapActions enums, ensuring a seamless integration with the existing codebase.

composables/useTransaction.ts (1)

50-50: LGTM! Import refactored from external package to local module.

The change aligns with the PR objective of removing the minimark dependency by moving the Interaction type to a local module.

composables/transaction/transactionBurn.ts (1)

4-4: LGTM! Import refactored consistently with other files.

The change aligns with the PR objective of removing the minimark dependency.

components/create/CreateNft.vue (3)

302-303: LGTM! Imports refactored consistently.

The changes align with the PR objective of removing the minimark dependency.


30-30: LGTM! Added fallback for image prop.

The empty string fallback prevents potential undefined/null issues.


494-497: LGTM! Simplified transaction call.

Removed unnecessary type assertion, making the code cleaner.

components/create/CreateCollection.vue (2)

208-208: LGTM! Import refactored consistently.

The change aligns with the PR objective of removing the minimark dependency.


191-191: LGTM! Added fallback for txHash prop.

The empty string fallback prevents potential undefined/null issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

minimark should be removed from nft-gallery
2 participants