Skip to content

feat(sdk): add typed data client and versioned OpenAPI contract - #288

Merged
Sendi0011 merged 1 commit into
mainfrom
feat/sdk-data-client
Nov 5, 2026
Merged

Sendi0011 merged 1 commit into
mainfrom
feat/sdk-data-client

Conversation

@Sendi0011

Copy link
Copy Markdown
Contributor

Description

Adds the SDK's read layer: a runtime-agnostic DataClient for the app/indexer read models, plus a versioned OpenAPI 3.1 contract and an Ajv-backed contract test.

Closes #278

Stacked on #287 → #285 → #284 → #283 → #282 → #281. Retargets to main as the stack merges.

What's included

  • sdk/src/data/client.ts
    • new DataClient({ baseUrl, fetch?, headers?, timeoutMs?, signal?, requestId?, onRequestId? }).
    • listPools, getPool, getPoolHistory, getProtocolSummary, getReputation, getReputationLeaderboard, getGovernanceProposals, getPortfolioSummary.
    • Cursor pagination: { items, nextCursor, hasMore, total? }; bare-array and legacy page shapes are normalized.
    • Deterministic AbortController timeouts (default 15s) + external abort support.
    • DataClientError with status, machine-readable code, requestId, parsed body, and cause.
    • Request id via crypto.randomUUID() when available; never contains wallet identity.
    • getPool falls back to GET /api/pools?id= on 404; getPoolHistory falls back to the activity feed when the server returns sparkline history.
  • sdk/src/data/models.ts
    • Page<T>, PoolSummary, PoolDetail, PoolEvent, ProtocolSummary, ReputationProfile, GovernanceProposalSummary, PortfolioSummary, and related rows.
    • Monetary HTTP fields are documented as display-unit numbers (not on-chain base-unit bigint).
  • docs/api/openapi.json — OpenAPI 3.1 schemas for every consumed route, pagination, error envelope, and x-experimental markers.
  • docs/api/README.md — versioning, pagination, errors, request ids, route fallbacks, and contract-update workflow.
  • Tests — data.test.ts covers normalization, fallbacks, errors, aborts, timeouts, transport failures, and request ids; httpContract.test.ts validates fixtures against the OpenAPI schemas with Ajv 2020.

Type of Change

  • feat: new feature
  • test: adding or updating tests
  • docs: documentation update

How Has This Been Tested?

Run from sdk/:

  • pnpm typecheck — passes
  • pnpm build — emits declarations
  • pnpm test — 187/187 tests pass (15 files)
  • pnpm check:api — ✔ Public API OK (177 symbols exported from the root)

All HTTP tests use mocked fetch; no network access required.

Checklist

  • My code follows the coding conventions of this project
  • I have added/updated tests if needed
  • I have updated documentation if needed (SDK README, docs/api, TSDoc)
  • My changes generate no new warnings or errors

@Sendi0011 Sendi0011 added documentation Improvements or additions to documentation feature New functionality to add Maybe Rewarded Issue may be eligible for a GrantFox reward GrantFox OSS Issue tracked in GrantFox OSS Third Campaign Campaign: Third Campaign labels Nov 5, 2026
@vercel

vercel Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
joint-save Ready Ready Preview Nov 5, 2026 12:26pm UTC
joint-save-y4yx Ready Ready Preview Nov 5, 2026 12:26pm UTC

@Sendi0011
Sendi0011 changed the base branch from feat/sdk-diagnostics-recovery to main November 5, 2026 12:57
@Sendi0011
Sendi0011 merged commit 4d74e9e into main Nov 5, 2026
17 checks passed

This branch was successfully deployed

2 active deployments
Preview – joint-save — 7c612acb Deployed Nov 5, 2026 by vercel[bot]
Preview – joint-save-y4yx — 7c612acb Deployed Nov 5, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation feature New functionality to add GrantFox OSS Issue tracked in GrantFox OSS Maybe Rewarded Issue may be eligible for a GrantFox reward Third Campaign Campaign: Third Campaign

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SDK] Add typed data/indexer client and versioned OpenAPI HTTP contract

1 participant