Skip to content

Fix getViews/resolveView mismatch and EVMBytesMetadata force-unwrap in ExampleNFT#264

Merged
joshuahannan merged 4 commits intomasterfrom
fix-examplenft-view-bugs
Mar 11, 2026
Merged

Fix getViews/resolveView mismatch and EVMBytesMetadata force-unwrap in ExampleNFT#264
joshuahannan merged 4 commits intomasterfrom
fix-examplenft-view-bugs

Conversation

@joshuahannan
Copy link
Copy Markdown
Contributor

@joshuahannan joshuahannan commented Mar 10, 2026

Summary

  • Updates CLAUDE.md and AGENTS.md with more general guidance
  • NFT.getViews() was missing CrossVMMetadataViews.EVMPointer and CrossVMMetadataViews.EVMBytesMetadata, even though resolveView handled both. Callers following the standard protocol (call getViews() first, then resolveView) would never discover or request the cross-VM views, breaking EVM bridge metadata discoverability for collections following this pattern.
  • getContractViews() was similarly missing CrossVMMetadataViews.EVMPointer.
  • The EVMBytesMetadata case in resolveView used a double force-operation (as! followed by !) that would silently panic at runtime if EVMBridgedMetadata returned nil. Replaced with a safe as? cast and a descriptive panic message.

Test plan

  • testGetViews now asserts the two new cross-VM view types are present in getViews()
  • testGetExampleNFTViews now asserts EVMPointer is included in getContractViews()
  • All 22 existing Cadence tests pass (make test)
  • All Go tests pass

🤖 Generated with Claude Code

joshuahannan and others added 2 commits March 10, 2026 15:06
1. Add CrossVMMetadataViews.EVMPointer and EVMBytesMetadata to
   NFT.getViews() so callers can discover these views via the
   standard protocol instead of needing to query them directly.

2. Add CrossVMMetadataViews.EVMPointer to getContractViews() for
   the same reason.

3. Replace the double force-operation (as! followed by !) in the
   EVMBytesMetadata resolveView case with a safe as? cast and a
   descriptive panic, preventing a silent runtime crash if
   EVMBridgedMetadata is not resolvable.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joshuahannan joshuahannan requested review from j1010001, mfbz and nvdtf March 10, 2026 20:19
joshuahannan and others added 2 commits March 10, 2026 15:48
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@joshuahannan joshuahannan merged commit 4583ed6 into master Mar 11, 2026
2 checks passed
@joshuahannan joshuahannan deleted the fix-examplenft-view-bugs branch March 11, 2026 19:50
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.

3 participants