Skip to content

Implement PayloadRefUtils and PayloadResolver #2

@nolnol3

Description

@nolnol3

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions