Description:
Implement utilities for PayloadRef encoding/decoding and data resolution.
PayloadRefUtils handles conversion between raw data, URI strings, and 65-byte encoded PayloadRef. PayloadResolver fetches actual data from off-chain storage based on URI scheme.
Scope:
These are the core utilities used by both Agent (for input resolution and output encoding) and Client DApp (for output retrieval).
Acceptance Criteria:
- PayloadRefUtils.create() converts data to PayloadRef with auto scheme selection (inline if <1KB, IPFS otherwise)
- PayloadRefUtils.encode() produces exactly 65 bytes
- PayloadRefUtils.decode() correctly parses 65-byte input
- PayloadRefUtils.fromUri() parses all 5 URI schemes (data:, ipfs://, ar://, https://, chain://)
- PayloadRefUtils.toUri() generates valid URI strings
- PayloadRefUtils.verify() validates content against contentHash
- PayloadResolver.resolve() fetches data for all supported schemes
- PayloadResolver supports multi-gateway fallback for IPFS
- Unit tests achieve >80% coverage
Description:
Implement utilities for PayloadRef encoding/decoding and data resolution.
PayloadRefUtils handles conversion between raw data, URI strings, and 65-byte encoded PayloadRef. PayloadResolver fetches actual data from off-chain storage based on URI scheme.
Scope:
These are the core utilities used by both Agent (for input resolution and output encoding) and Client DApp (for output retrieval).
Acceptance Criteria: