Skip to content

Conversation

@marcomariscal
Copy link
Collaborator

Summary

  • Implements ERC-5564 compliant metadata building functions
  • Adds support for ETH, ERC-20, ERC-721, and custom contract metadata
  • Includes comprehensive test suite and updated examples
  • Maintains backward compatibility with existing view-tag-only approach

Features Added

  • buildMetadataForETH() - Native ETH transfers with amounts
  • buildMetadataForERC20() - Token transfers with addresses and amounts
  • buildMetadataForERC721() - NFT transfers with token IDs
  • buildMetadataCustom() - Custom contract interactions
  • parseMetadata() - Parse metadata back into components for debugging
  • buildMetadataWithViewTagOnly() - Backward compatibility function

Test Coverage

  • 18 comprehensive tests covering all metadata builders
  • Error handling and validation tests
  • Integration tests with existing SDK functions
  • Round-trip parsing validation

Breaking Changes

None - fully backward compatible

Resolves

Closes #95

🤖 Generated with Claude Code

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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
…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 <noreply@anthropic.com>
- 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 <noreply@anthropic.com>
…tent

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

Co-Authored-By: Claude <noreply@anthropic.com>
@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 <noreply@anthropic.com>
@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 <noreply@anthropic.com>
@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 <noreply@anthropic.com>
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

2 participants