Skip to content

Add paid-query settlement audit digest endpoint #71

Description

@emrekayat

Why this matters

SCF reviewers and investor diligence need a compact way to verify that paid-query activity is backed by recorded payment evidence, not just dashboard totals.

Scope

Add a read-only API endpoint that returns a small audit digest for recent paid queries:

  • total paid runs counted;
  • total settled amount by asset/network;
  • number of records with payment evidence present;
  • number of records missing evidence;
  • latest recorded payment timestamp;
  • deterministic generatedAt timestamp.

Suggested route:

  • GET /api/audit/settlement-digest

Suggested files:

  • apps/api/src/routes/public.ts
  • apps/api/src/lib/persistence.ts
  • packages/shared/src/schemas.ts

Acceptance criteria

  • Endpoint is read-only and does not trigger provider execution or payment.
  • Empty analytics storage returns zeros, not a 500.
  • Demo-mode and real-payment rows are distinguishable if that metadata already exists.
  • Unit or API test covers empty storage and at least one populated digest.
  • Existing npm test --workspace @query402/api still passes.

Wave complexity

High - reviewer/investor evidence surface for paid-query settlement health.

Metadata

Metadata

Assignees

Labels

Stellar WaveIssue proposed for the Drips Stellar Wave programarea: apiAPI servicearea: x402x402 and Stellar paymentscomplexity: highExpected high implementation complexitydrips-candidateCandidate for a Drips Stellar WaveenhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions