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

Parse token ID for Rally mints into mint template #55

Closed
wants to merge 3 commits into from

Conversation

agans
Copy link
Contributor

@agans agans commented Sep 30, 2024

User description

Mint Ingestor:

Functionality Supported

  • Ingesting from URL: Yes / No
  • Ingesting from Contract address: Yes / No
  • Supported Networks: Base / Ethereum / Arbitrum / Zora / Polygon / Others..

Before you submit

  • Ensure your generated MintTemplate works 😄
  • Ensure that your code is restricted to a single folder in src/ingestors
  • Ensure that all required assets are included (e.g. ABIs)
  • Ensure ABIs are trimmed to include only methods (1) used in the ingestor or (2) required to mint
  • Ensure that all exported methods are prefixed with the name of your ingestor e.g. myMintingPlatformGetContractDetails
  • Ensure that a test exists for generating a MintTemplate that will always succeed
  • Ensure that your code accesses no external resources except those passed in the resources object

PR Type

enhancement


Description

  • Enhanced the RodeoIngestor class by parsing the tokenId into an integer and handling cases where it is not a number.
  • Updated the minting process to use the parsed tokenId for setting the mint output contract.
  • Added a new subproject commit reference in scripts/floornfts.

Changes walkthrough 📝

Relevant files
Enhancement
index.ts
Parse and validate token ID for minting process                   

src/ingestors/rodeo/index.ts

  • Imported parse from 'path'.
  • Parsed tokenId to an integer and handled NaN cases.
  • Updated setMintOutputContract to use parsed tokenId.
  • +3/-0     
    Miscellaneous
    floornfts
    Add subproject commit reference                                                   

    scripts/floornfts

    • Added a new subproject commit reference.
    +1/-0     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    CI Failure Feedback 🧐

    Action: build

    Failed stage: Run actions/checkout@v3 [❌]

    Failure summary:

    The action failed due to an issue with Git submodules:

  • The error "fatal: No url found for submodule path 'scripts/***nfts' in .gitmodules" indicates that
    there is a missing URL configuration for a submodule in the .gitmodules file.
  • This caused the Git command to fail with exit code 128, preventing further execution of the action.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    427:  Switched to a new branch 'alicia/parse-out-rally-token-ids'
    428:  branch 'alicia/parse-out-rally-token-ids' set up to track 'origin/alicia/parse-out-rally-token-ids'.
    429:  ##[endgroup]
    430:  [command]/usr/bin/git log -1 --format='%H'
    431:  '094ea965ca588cb065b6ab5be651ab6216b76a81'
    432:  ##[group]Removing auth
    433:  [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    434:  [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
    435:  ##[error]fatal: No url found for submodule path 'scripts/***nfts' in .gitmodules
    436:  ##[error]The process '/usr/bin/git' failed with exit code 128
    ...
    
    438:  [command]/usr/bin/git version
    439:  git version 2.46.1
    440:  Temporarily overriding HOME='/home/runner/work/_temp/23fba840-952d-4d36-b49a-0d209c5a0878' before making global git config changes
    441:  Adding repository directory to the temporary git global config as a safe directory
    442:  [command]/usr/bin/git config --global --add safe.directory /home/runner/work/mobile-minting/mobile-minting
    443:  [command]/usr/bin/git config --local --name-only --get-regexp core\.sshCommand
    444:  [command]/usr/bin/git submodule foreach --recursive sh -c "git config --local --name-only --get-regexp 'core\.sshCommand' && git config --local --unset-all 'core.sshCommand' || :"
    445:  fatal: No url found for submodule path 'scripts/***nfts' in .gitmodules
    446:  ##[warning]The process '/usr/bin/git' failed with exit code 128
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Potential Bug
    The tokenId is parsed to an integer, but there's no handling for negative numbers or very large numbers that might exceed the safe integer range.

    Unused Import
    The parse function is imported from 'path' but not used in the code, which may lead to confusion and unnecessary imports.

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Best practice
    Remove unused import to improve code cleanliness

    The parse function from the 'path' module is imported but not used in the code.
    Consider removing this unused import to keep the codebase clean and avoid potential
    confusion.

    src/ingestors/rodeo/index.ts [10]

    -import { parse } from 'path';
    +// Remove this line
    • Apply this suggestion
    Suggestion importance[1-10]: 9

    Why: The suggestion correctly identifies an unused import, which should be removed to maintain a clean codebase and avoid confusion. This is a straightforward improvement with no negative impact.

    9
    Use Number() for type conversion instead of parseInt()

    Instead of using parseInt, consider using Number to convert the tokenId to a number.
    Number is generally preferred for type conversion in TypeScript as it handles both
    integer and floating-point numbers, and it's more consistent with TypeScript's type
    system.

    src/ingestors/rodeo/index.ts [78]

    -const tokenIdNum = parseInt(tokenId);
    +const tokenIdNum = Number(tokenId);
    • Apply this suggestion
    Suggestion importance[1-10]: 7

    Why: Using Number() instead of parseInt() is a valid suggestion as it aligns better with TypeScript's type system and handles both integers and floating-point numbers. However, the impact is moderate since parseInt() is not incorrect in this context.

    7
    Enhancement
    Use Number.isNaN() for more precise NaN checking

    Consider using a nullish coalescing operator (??) instead of the ternary operator
    when checking for NaN. This makes the code more concise and directly expresses the
    intent of using null when the conversion fails.

    src/ingestors/rodeo/index.ts [82]

    -tokenId: isNaN(tokenIdNum) ? null : tokenIdNum,
    +tokenId: Number.isNaN(tokenIdNum) ? null : tokenIdNum,
    • Apply this suggestion
    Suggestion importance[1-10]: 6

    Why: The suggestion to use Number.isNaN() is valid as it provides a more precise check for NaN values. However, the original code using isNaN() is not incorrect, so the improvement is minor.

    6

    💡 Need additional feedback ? start a PR chat

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    CI Failure Feedback 🧐

    Action: build

    Failed stage: Run Tests [❌]

    Failed test name: createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract

    Failure summary:

    The action failed due to multiple test failures:

  • createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract failed due
    to an assertion error where the expected value '7700000000000000' did not match the actual value
    '0'.
  • supportsUrl: Returns true for a supported URL in the highlight section failed because the test
    expected true but got false.
  • createMintForContract: Returns a mint template for a supported contract in the highlight section
    failed due to missing required data (Id not available).
  • createMintForContract: Returns a mint template for a supported base contract in the rarible section
    failed due to a timeout error.
  • createMintTemplateForUrl: Returns a mint template for a supported URL in the rarible section also
    failed due to a timeout error.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    513:  ✅ Simulation success
    514:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL (1743ms)
    515:  ✔ createMintForContract: Returns a mint template for a supported contract (728ms)
    516:  fxhash
    517:  ✔ supportsUrl: Returns false for an unsupported URL
    518:  ✔ supportsUrl: Returns true for a supported URL
    519:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract (213ms)
    520:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL with fixed price contract (177ms)
    521:  ✔ createMintTemplateForUrl: Throws error if the mint for fxhash is on mainnet or tezos (1504ms)
    522:  ✔ createMintTemplateForUrl: Throws error if incompatible URL
    523:  ✔ createMintTemplateForUrl: Throws error if non-existent project (1712ms)
    524:  ✔ createMintTemplateForContract: Returns a mint template for a supported contract (43ms)
    525:  ✔ createMintTemplateForContract: Throws error for a non supported contract (87ms)
    ...
    
    585:  rarible
    586:  ✔ supportsUrl: Returns false for an unsupported URL
    587:  ✔ supportsUrl: Returns true for a supported URL
    588:  ✔ supportsContract: Returns false for a unsupported contract (1314ms)
    589:  ✔ supportsContract: Returns true for a supported contract (1483ms)
    590:  ✔ supportsContract: Returns false for a non base chain supported contract (690ms)
    591:  7) createMintForContract: Returns a mint template for a supported base contract
    592:  8) createMintTemplateForUrl: Returns a mint template for a supported URL
    593:  ✔ createMintTemplateForUrl: Throws error if incompatible URL
    ...
    
    656:  ✔ ERC7160TL stack (640ms)
    657:  ✔ ERC721TL stack (449ms)
    658:  createMintTemplateForContract: Returns a mint template for a supported contract
    659:  ✔ ERC1155TL contract at 0x7c3a99d4a7adddc04ad05d7ca87f4949c1a62fa8 (250ms)
    660:  ✔ ERC7160TL contract at 0xd2f9c0ef092d7ffd1a5de43b6ee546065461887d (310ms)
    661:  ✔ ERC721TL contract at 0x999f084f06ee49a3deef0c9d1511d2f040da4034 (262ms)
    662:  101 passing (3m)
    663:  1 pending
    664:  8 failing
    665:  1) foundation
    666:  createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract:
    667:  AssertionError: expected '0' to equal '7700000000000000'
    668:  + expected - actual
    669:  -0
    670:  +7700000000000000
    671:  at Context.<anonymous> (test/ingestors/foundation.test.ts:69:42)
    672:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    673:  2) highlight
    674:  supportsUrl: Returns true for a supported URL:
    675:  AssertionError: expected false to be true
    ...
    
    682:  createMintTemplateForUrl: Returns a mint template for a supported URL:
    683:  IncompatibleUrl: Incompatible URL
    684:  at HighlightIngestor.createMintTemplateForUrl (src/ingestors/highlight/index.ts:140:13)
    685:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    686:  at async Context.<anonymous> (test/ingestors/highlight.test.ts:57:22)
    687:  4) highlight
    688:  HighlightIngestor-auto
    689:  supportsUrl: Returns true for a supported URL:
    690:  AssertionError: expected false to be true
    ...
    
    704:  HighlightIngestor-auto
    705:  createMintForContract: Returns a mint template for a supported contract:
    706:  MissingRequiredData: Id not available
    707:  at HighlightIngestor.createMintForContract (src/ingestors/highlight/index.ts:101:13)
    708:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    709:  at async Context.<anonymous> (test/shared/basic-ingestor-tests.ts:73:26)
    710:  7) rarible
    711:  createMintForContract: Returns a mint template for a supported base contract:
    712:  Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/mobile-minting/mobile-minting/test/ingestors/rarible.test.ts)
    713:  at listOnTimeout (node:internal/timers:569:17)
    714:  at processTimers (node:internal/timers:512:7)
    715:  8) rarible
    716:  createMintTemplateForUrl: Returns a mint template for a supported URL:
    717:  Error: Timeout of 60000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves. (/home/runner/work/mobile-minting/mobile-minting/test/ingestors/rarible.test.ts)
    ...
    
    772:  mint-template-builder.ts   |    71.3 |    65.51 |   53.12 |    71.3 | ...,210-212,215-217,220-222 
    773:  lib/simulation              |   71.07 |    59.25 |      70 |   71.07 |                             
    774:  simulation.ts              |   64.53 |    61.11 |   66.66 |   64.53 | ...0-74,125,127,131,138-141 
    775:  tenderly.ts                |   85.71 |    55.55 |      75 |   85.71 | 52-60                       
    776:  lib/simulation/types        |     100 |      100 |     100 |     100 |                             
    777:  tenderly.types.ts          |     100 |      100 |     100 |     100 |                             
    778:  lib/types                   |     100 |      100 |     100 |     100 |                             
    779:  index.ts                   |     100 |      100 |     100 |     100 |                             
    780:  mint-ingestor-error.ts     |     100 |      100 |     100 |     100 |                             
    781:  mint-ingestor.ts           |     100 |      100 |     100 |     100 |                             
    782:  mint-template.ts           |     100 |      100 |     100 |     100 |                             
    783:  -----------------------------|---------|----------|---------|---------|-----------------------------
    784:  error Command failed with exit code 8.
    785:  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    786:  ##[error]Process completed with exit code 8.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    Copy link

    PR-Agent was enabled for this repository. To continue using it, please link your git user with your CodiumAI identity here.

    CI Failure Feedback 🧐

    Action: build

    Failed stage: Run Tests [❌]

    Failed test name: createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract

    Failure summary:

    The action failed due to multiple test failures:

  • foundation test failed in createMintTemplateForUrl with an AssertionError: expected '0' to equal
    '7700000000000000'.
  • highlight test failed in supportsUrl with an AssertionError: expected false to be true.
  • highlight test failed in createMintTemplateForUrl due to an IncompatibleUrl error.
  • highlight test failed again in supportsUrl with an AssertionError: expected false to be true.
  • highlight test failed again in createMintTemplateForUrl due to an IncompatibleUrl error.
  • rarible test failed in createMintTemplateForUrl with an AssertionError: expected +0 to equal
    1725163200000.

  • Relevant error logs:
    1:  ##[group]Operating System
    2:  Ubuntu
    ...
    
    513:  ✅ Simulation success
    514:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL (3107ms)
    515:  ✔ createMintForContract: Returns a mint template for a supported contract (1355ms)
    516:  fxhash
    517:  ✔ supportsUrl: Returns false for an unsupported URL
    518:  ✔ supportsUrl: Returns true for a supported URL
    519:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract (808ms)
    520:  ✔ createMintTemplateForUrl: Returns a mint template for a supported URL with fixed price contract (568ms)
    521:  ✔ createMintTemplateForUrl: Throws error if the mint for fxhash is on mainnet or tezos (1990ms)
    522:  ✔ createMintTemplateForUrl: Throws error if incompatible URL
    523:  ✔ createMintTemplateForUrl: Throws error if non-existent project (2046ms)
    524:  ✔ createMintTemplateForContract: Returns a mint template for a supported contract (301ms)
    525:  ✔ createMintTemplateForContract: Throws error for a non supported contract (286ms)
    ...
    
    585:  rarible
    586:  ✔ supportsUrl: Returns false for an unsupported URL
    587:  ✔ supportsUrl: Returns true for a supported URL
    588:  ✔ supportsContract: Returns false for a unsupported contract (1262ms)
    589:  ✔ supportsContract: Returns true for a supported contract (2277ms)
    590:  ✔ supportsContract: Returns false for a non base chain supported contract (1001ms)
    591:  ✔ createMintForContract: Returns a mint template for a supported base contract (1883ms)
    592:  6) createMintTemplateForUrl: Returns a mint template for a supported URL
    593:  ✔ createMintTemplateForUrl: Throws error if incompatible URL
    ...
    
    656:  ✔ ERC7160TL stack (2012ms)
    657:  ✔ ERC721TL stack (1571ms)
    658:  createMintTemplateForContract: Returns a mint template for a supported contract
    659:  ✔ ERC1155TL contract at 0x7c3a99d4a7adddc04ad05d7ca87f4949c1a62fa8 (411ms)
    660:  ✔ ERC7160TL contract at 0xd2f9c0ef092d7ffd1a5de43b6ee546065461887d (609ms)
    661:  ✔ ERC721TL contract at 0x999f084f06ee49a3deef0c9d1511d2f040da4034 (590ms)
    662:  103 passing (2m)
    663:  1 pending
    664:  6 failing
    665:  1) foundation
    666:  createMintTemplateForUrl: Returns a mint template for a supported URL with frame contract:
    667:  AssertionError: expected '0' to equal '7700000000000000'
    668:  + expected - actual
    669:  -0
    670:  +7700000000000000
    671:  at Context.<anonymous> (test/ingestors/foundation.test.ts:69:42)
    672:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    673:  2) highlight
    674:  supportsUrl: Returns true for a supported URL:
    675:  AssertionError: expected false to be true
    ...
    
    682:  createMintTemplateForUrl: Returns a mint template for a supported URL:
    683:  IncompatibleUrl: Incompatible URL
    684:  at HighlightIngestor.createMintTemplateForUrl (src/ingestors/highlight/index.ts:140:13)
    685:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    686:  at async Context.<anonymous> (test/ingestors/highlight.test.ts:57:22)
    687:  4) highlight
    688:  HighlightIngestor-auto
    689:  supportsUrl: Returns true for a supported URL:
    690:  AssertionError: expected false to be true
    ...
    
    697:  HighlightIngestor-auto
    698:  createMintTemplateForUrl: Returns a mint template for a supported URL:
    699:  IncompatibleUrl: Incompatible URL
    700:  at HighlightIngestor.createMintTemplateForUrl (src/ingestors/highlight/index.ts:140:13)
    701:  at processTicksAndRejections (node:internal/process/task_queues:95:5)
    702:  at async Context.<anonymous> (test/shared/basic-ingestor-tests.ts:49:26)
    703:  6) rarible
    704:  createMintTemplateForUrl: Returns a mint template for a supported URL:
    705:  AssertionError: expected +0 to equal 1725163200000
    ...
    
    763:  mint-template-builder.ts   |    71.3 |    65.51 |   53.12 |    71.3 | ...,210-212,215-217,220-222 
    764:  lib/simulation              |   71.07 |    59.25 |      70 |   71.07 |                             
    765:  simulation.ts              |   64.53 |    61.11 |   66.66 |   64.53 | ...0-74,125,127,131,138-141 
    766:  tenderly.ts                |   85.71 |    55.55 |      75 |   85.71 | 52-60                       
    767:  lib/simulation/types        |     100 |      100 |     100 |     100 |                             
    768:  tenderly.types.ts          |     100 |      100 |     100 |     100 |                             
    769:  lib/types                   |     100 |      100 |     100 |     100 |                             
    770:  index.ts                   |     100 |      100 |     100 |     100 |                             
    771:  mint-ingestor-error.ts     |     100 |      100 |     100 |     100 |                             
    772:  mint-ingestor.ts           |     100 |      100 |     100 |     100 |                             
    773:  mint-template.ts           |     100 |      100 |     100 |     100 |                             
    774:  -----------------------------|---------|----------|---------|---------|-----------------------------
    775:  error Command failed with exit code 6.
    776:  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
    777:  ##[error]Process completed with exit code 6.
    

    ✨ CI feedback usage guide:

    The CI feedback tool (/checks) automatically triggers when a PR has a failed check.
    The tool analyzes the failed checks and provides several feedbacks:

    • Failed stage
    • Failed test name
    • Failure summary
    • Relevant error logs

    In addition to being automatically triggered, the tool can also be invoked manually by commenting on a PR:

    /checks "https://github.com/{repo_name}/actions/runs/{run_number}/job/{job_number}"
    

    where {repo_name} is the name of the repository, {run_number} is the run number of the failed check, and {job_number} is the job number of the failed check.

    Configuration options

    • enable_auto_checks_feedback - if set to true, the tool will automatically provide feedback when a check is failed. Default is true.
    • excluded_checks_list - a list of checks to exclude from the feedback, for example: ["check1", "check2"]. Default is an empty list.
    • enable_help_text - if set to true, the tool will provide a help message with the feedback. Default is true.
    • persistent_comment - if set to true, the tool will overwrite a previous checks comment with the new feedback. Default is true.
    • final_update_message - if persistent_comment is true and updating a previous checks message, the tool will also create a new message: "Persistent checks updated to latest commit". Default is true.

    See more information about the checks tool in the docs.

    @agans agans closed this Sep 30, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    1 participant