Skip to content

Add URI resolution for Ethscriptions in ERC721 Collection#139

Merged
RogerPodacter merged 1 commit into
evm-backend-demofrom
fix_collections
Nov 7, 2025
Merged

Add URI resolution for Ethscriptions in ERC721 Collection#139
RogerPodacter merged 1 commit into
evm-backend-demofrom
fix_collections

Conversation

@RogerPodacter

@RogerPodacter RogerPodacter commented Nov 7, 2025

Copy link
Copy Markdown
Member
  • Introduced _resolveEthscriptionURI function to handle esc://ethscriptions/{id}/data references, resolving them to their corresponding media URIs.
  • Updated contractURI method to utilize resolved URIs for logo and banner images, enhancing metadata representation.
  • Added comprehensive tests for URI resolution, including validation for regular HTTP URIs, data URIs, and handling of malformed or non-existent ethscription references.

Note

Adds URI resolution for esc://ethscriptions/{id}/data in contractURI and introduces tests covering pass-through, valid, and malformed references.

  • Contracts:
    • contracts/src/ERC721EthscriptionsCollection.sol:
      • Add _resolveEthscriptionURI to handle esc://ethscriptions/{id}/data, fetching media via ethscriptions.getMediaUri with try/catch and empty fallback.
      • Update contractURI to resolve logoImageUri and bannerImageUri using the helper.
      • Add external _parseHexToBytes32 using JSONParserLib and import it.
  • Tests:
    • contracts/test/CollectionURIResolution.t.sol:
      • New tests verifying pass-through for HTTP/data URIs, successful resolution of valid esc:// references, and non-reverting handling of nonexistent/malformed references.

Written by Cursor Bugbot for commit 772146b. This will update automatically on new commits. Configure here.

- Introduced `_resolveEthscriptionURI` function to handle `esc://ethscriptions/{id}/data` references, resolving them to their corresponding media URIs.
- Updated `contractURI` method to utilize resolved URIs for logo and banner images, enhancing metadata representation.
- Added comprehensive tests for URI resolution, including validation for regular HTTP URIs, data URIs, and handling of malformed or non-existent ethscription references.
@RogerPodacter RogerPodacter requested a review from Copilot November 7, 2025 19:00

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull Request Overview

This PR implements URI resolution for ERC-721 collection metadata, enabling support for esc://ethscriptions/{id}/data references alongside regular HTTP and data URIs. The feature allows collection logos and banners to reference other ethscriptions, which are resolved to their media URIs when building contract metadata.

Key changes:

  • Added URI resolution logic to handle esc:// references to ethscriptions
  • Implemented graceful error handling that returns empty strings instead of reverting on invalid references
  • Comprehensive test coverage for regular URIs, data URIs, valid ethscription references, and various invalid/malformed URI formats

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
contracts/test/CollectionURIResolution.t.sol New test file with comprehensive coverage of URI resolution scenarios including pass-through for HTTP/data URIs, ethscription reference resolution, and error handling for invalid references
contracts/src/ERC721EthscriptionsCollection.sol Added _resolveEthscriptionURI helper function to resolve esc:// references and _parseHexToBytes32 external helper for hex parsing with try/catch support; integrated resolution into contractURI() method

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

return ""; // Must be 0x + 64 hex chars
}

// Parse hex string to bytes32 using JSONParserLib (reverts on invalid)

Copilot AI Nov 7, 2025

Copy link

Choose a reason for hiding this comment

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

The comment states "using JSONParserLib (reverts on invalid)" but the code explicitly catches the revert and returns an empty string. The comment should be updated to reflect the actual behavior, e.g., "Parse hex string to bytes32 (returns empty on invalid)".

Suggested change
// Parse hex string to bytes32 using JSONParserLib (reverts on invalid)
// Parse hex string to bytes32 (returns empty on invalid)

Copilot uses AI. Check for mistakes.
@RogerPodacter RogerPodacter merged commit 71d2611 into evm-backend-demo Nov 7, 2025
8 checks passed
@RogerPodacter RogerPodacter deleted the fix_collections branch November 7, 2025 21:14
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.

2 participants