Skip to content

feat: add ERC-5564 compliant metadata builders#97

Open
marcomariscal wants to merge 15 commits intomainfrom
feat/metadata-builder
Open

feat: add ERC-5564 compliant metadata builders#97
marcomariscal wants to merge 15 commits intomainfrom
feat/metadata-builder

Conversation

@marcomariscal
Copy link
Copy Markdown
Collaborator

@marcomariscal marcomariscal commented Jun 18, 2025

Summary

  • add ERC-5564 metadata builders for ETH, ERC-20, ERC-721, and custom contract payloads
  • harden metadata validation for hex fields, addresses, and uint256-sized numeric values
  • clarify the announce example so it only claims to emit metadata, not transfer assets
  • stabilize long-running and env-dependent tests so CI reflects real failures

Changes

  • add strict metadata builders plus parseMetadata()
  • restrict metadata amount inputs to exact values only: bigint or decimal integer strings
  • reject malformed view tags, function selectors, invalid contract addresses, negative values, and values above uint256
  • update the prepare-announce example copy and button labels to match actual behavior
  • make chain-backed Bun tests more reliable with explicit timeouts and skip real-subgraph coverage when required env is absent

Test Plan

  • bun run check
  • bun run build
  • bun test

Closes #95

marcomariscal and others added 2 commits December 11, 2024 14:57
- Add buildMetadataForETH() for native ETH transfers
- Add buildMetadataForERC20() for token transfers
- Add buildMetadataForERC721() for NFT transfers
- Add buildMetadataCustom() for arbitrary contract calls
- Add parseMetadata() for debugging/validation
- Include comprehensive test suite (18 tests)
- Update prepareAnnounce example with multiple metadata types
- Maintain backward compatibility with buildMetadataWithViewTagOnly()

Resolves #95

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Remove buildMetadataWithViewTagOnly() function
- Remove BaseMetadataParams type
- Update examples to show only proper ERC-5564 metadata
- Remove backward compatibility tests
- Simplify API surface for cleaner developer experience

All metadata must now follow proper ERC-5564 structure:
- viewTag + functionSelector + contractAddress + amount/data

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Replace hardcoded hex values with viem's toFunctionSelector()
- Improves maintainability and accuracy
- Self-documenting function signatures
- Ensures compatibility with viem's ABI handling

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Log hostname, FQDN, and IP of GitHub Actions runner
- Will help identify correct domain allowlist for subgraph access

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
…steps

- Environment variables were only available in test step, not debug step
- Moving to job level makes them available throughout the job
- Should fix 403 errors in subgraph tests

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
- Test actual HTTP response from subgraph endpoint
- Use simple metadata query to verify auth and connectivity
- Will help identify if issue is auth, network, or API-related

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@marcomariscal marcomariscal had a problem deploying to Testing All Networks June 18, 2025 20:13 — with GitHub Actions Failure
@marcomariscal marcomariscal had a problem deploying to Testing All Networks June 18, 2025 20:13 — with GitHub Actions Failure
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:20 — with GitHub Actions Inactive
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:20 — with GitHub Actions Inactive
…bles

- Remove all debug logging steps
- Keep environment variables at job level for proper access
- Clean up both test and coverage jobs
- Ready for actual testing with fixed subgraph domain restrictions

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:26 — with GitHub Actions Inactive
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:26 — with GitHub Actions Inactive
- Add detailed JSDoc comments to all exported functions with examples
- Improve parseMetadata error handling with specific error messages
- Add validation for hex format in parseMetadata
- Update tests to match new error messages
- Better IDE support and developer experience

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:37 — with GitHub Actions Inactive
@marcomariscal marcomariscal temporarily deployed to Testing All Networks June 18, 2025 20:37 — with GitHub Actions Inactive
- Fix formatting in buildMetadata.ts JSDoc comments
- Fix formatting in buildMetadata.test.ts test assertions
- Ensure consistent code style for CI/CD pipeline

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
… into tmp/pr97-merge-main-no-workflows

# Conflicts:
#	.github/workflows/ci.yml
#	src/lib/actions/getAnnouncementsUsingSubgraph/getAnnouncementsUsingSubgraph.test.ts
@marcomariscal marcomariscal temporarily deployed to Testing All Networks April 8, 2026 19:31 — with GitHub Actions Inactive
@marcomariscal marcomariscal deployed to Testing All Networks April 8, 2026 19:31 — with GitHub Actions Active
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.

feat: helper method for building metadata with amounts

1 participant