Skip to content

Add IPFS invoice metadata pinning with CID verification #848

Description

@Kingsman-99

Overview

Allow invoice creators to attach structured metadata stored on IPFS. The CID is stored in the contract memo field. The SDK should pin metadata to IPFS, verify the CID matches the content, and enrich invoice reads with the resolved metadata.

Requirements

  • pinInvoiceMetadata(metadata: InvoiceMetadata): Promise — pins JSON to IPFS, returns CID
  • InvoiceMetadata { title, description, lineItems: LineItem[], attachmentCIDs: string[] }
  • verifyCID(cid, content): Promise — fetches and checks content hash
  • enrichInvoice(invoiceId): Promise — merges on-chain + IPFS data
  • Support IPFS HTTP gateway and kubo RPC backends (configurable)
  • Tests with mock IPFS server; CID mismatch handled gracefully

Acceptance Criteria

  • Metadata pinned and CID returned
  • CID verification detects tampering
  • enrichInvoice merges data correctly
  • Both gateway and kubo backends work
  • npm test passes with zero failures
  • TypeScript compiles with zero errors
  • ESLint passes with zero errors

Definition of Done

All CI checks must pass before the PR is reviewed.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions