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

Use mintbasev2.near instead of mintbase2.near #527

Merged
merged 2 commits into from
Jul 29, 2024
Merged

Use mintbasev2.near instead of mintbase2.near #527

merged 2 commits into from
Jul 29, 2024

Conversation

rubenmarcus
Copy link
Member

@rubenmarcus rubenmarcus commented Jul 29, 2024

PR Type

enhancement, documentation


Description

  • Replaced hardcoded contract addresses with dynamic values from mbjs.keys.mbContractV2 in mock data and tests.
  • Updated @mintbase-js/sdk dependency to version 0.6.0-beta-prerelease.1.
  • Updated example usage in README to reflect new contract address dynamic.mintbasev2.near.

Changes walkthrough 📝

Relevant files
Enhancement
dynamicNftMetadata.mock.ts
Use dynamic contract addresses in mock data                           

packages/data/src/api/dynamicNftMetadata/dynamicNftMetadata.mock.ts

  • Replaced hardcoded contract addresses with dynamic values from
    mbjs.keys.mbContractV2.
  • Updated metadataId and contractAddress fields accordingly.
  • +9/-7     
    dynamicNftMetadata.test.ts
    Use dynamic contract address in tests                                       

    packages/data/src/api/dynamicNftMetadata/dynamicNftMetadata.test.ts

  • Replaced hardcoded contract address with dynamic value from
    mbjs.keys.mbContractV2.
  • +3/-3     
    Dependencies
    package.json
    Update @mintbase-js/sdk dependency version                             

    packages/data/package.json

  • Updated @mintbase-js/sdk dependency to version
    0.6.0-beta-prerelease.1.
  • +1/-1     
    Documentation
    README.md
    Update example usage with new contract address                     

    packages/data/src/api/dynamicNftMetadata/README.md

  • Updated example usage to reflect new contract address
    dynamic.mintbasev2.near.
  • +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    @mintbase-codium-pr-agent mintbase-codium-pr-agent bot added documentation Improvements or additions to documentation enhancement New feature or request labels Jul 29, 2024
    @mintbase-codium-pr-agent
    Copy link

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No key issues to review

    @mintbase-codium-pr-agent
    Copy link

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Validate or provide a fallback for critical variables to prevent runtime errors

    Ensure that the mbjs.keys.mbContractV2 is properly validated or has a fallback since
    it's critical for constructing metadataId and contractAddress.

    packages/data/src/api/dynamicNftMetadata/dynamicNftMetadata.mock.ts [6-8]

    -metadataId: `dynamic.${mbjs.keys.mbContractV2}:deadbeef2`,
    -contractAddress: `dynamic.${mbjs.keys.mbContractV2}`,
    +const contractKey = mbjs.keys.mbContractV2 || 'defaultContractKey';
    +metadataId: `dynamic.${contractKey}:deadbeef2`,
    +contractAddress: `dynamic.${contractKey}`,
     
    Suggestion importance[1-10]: 9

    Why: Validating or providing a fallback for critical variables prevents potential runtime errors, which is crucial for robust code.

    9
    Best practice
    Use a constant for repeated string literals to enhance maintainability and reduce errors

    Consider using a constant for the domain prefix 'dynamic.' to ensure consistency and
    reduce the risk of typos in multiple uses.

    packages/data/src/api/dynamicNftMetadata/dynamicNftMetadata.mock.ts [6-8]

    -metadataId: `dynamic.${mbjs.keys.mbContractV2}:deadbeef2`,
    -contractAddress: `dynamic.${mbjs.keys.mbContractV2}`,
    +const DOMAIN_PREFIX = 'dynamic.';
    +metadataId: `${DOMAIN_PREFIX}${mbjs.keys.mbContractV2}:deadbeef2`,
    +contractAddress: `${DOMAIN_PREFIX}${mbjs.keys.mbContractV2}`,
     
    Suggestion importance[1-10]: 8

    Why: Using a constant for repeated string literals enhances maintainability and reduces the risk of typos, which is a best practice in coding.

    8
    Maintainability
    Use a more flexible version specifier for dependencies to ease future updates

    Locking the version of '@mintbase-js/sdk' to a specific pre-release might cause
    issues with future updates. Consider using a more flexible versioning strategy.

    packages/data/package.json [24]

    -"@mintbase-js/sdk": "=0.6.0-beta-prerelease.1",
    +"@mintbase-js/sdk": "^0.6.0-beta",
     
    Suggestion importance[1-10]: 8

    Why: Using a more flexible version specifier for dependencies allows for easier future updates and reduces the risk of compatibility issues.

    8
    Maintain consistency in string construction for readability and maintainability

    Use template literals consistently for contractAddress to maintain code consistency
    and readability.

    packages/data/src/api/dynamicNftMetadata/dynamicNftMetadata.test.ts [21]

    -contractAddress: 'dynamic.mintbasev2.near',
    +contractAddress: `dynamic.${mbjs.keys.mbContractV2}`,
     
    Suggestion importance[1-10]: 7

    Why: Maintaining consistency in string construction improves code readability and maintainability, which is important for collaborative development.

    7

    @rubenmarcus rubenmarcus merged commit f5c10f4 into beta Jul 29, 2024
    2 checks passed
    Copy link
    Member

    @sainthiago sainthiago left a comment

    Choose a reason for hiding this comment

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

    🧙‍♀️

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    documentation Improvements or additions to documentation enhancement New feature or request Review effort [1-5]: 2
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants