@stridge/openapi 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,111 @@
1
+ # @stridge/openapi
2
+
3
+ The **public** OpenAPI 3.1 specification for the Stridge API, published as an npm
4
+ package (spec JSON + generated TypeScript types). It is the single source the
5
+ public API reference site (`reference.stridge.com`) consumes.
6
+
7
+ This repo is hand-authored and curated. It is **not** generated from core — it
8
+ deliberately re-expresses a small, public subset of the internal API with clean
9
+ names, public-facing copy, and realistic examples. Core's internal Swagger 2.0
10
+ document (`../core/docs/swagger.yaml`) is the source of truth for field shapes —
11
+ keep this spec in sync by hand when core's UDA endpoints change.
12
+
13
+ ## Scope
14
+
15
+ Currently the **UDA** surface only — 7 operations under the `UDA` tag:
16
+
17
+ | Method · Path | Operation | Auth |
18
+ | --- | --- | --- |
19
+ | `GET /uda` | `list-uda-addresses` | `X-API-Key` |
20
+ | `POST /uda` | `create-uda-address` | `X-API-Key` |
21
+ | `GET /uda/quote` | `get-quote` | public |
22
+ | `GET /uda/supported-assets` | `list-supported-assets` | public |
23
+ | `GET /uda/{id}/settlements` | `list-settlements-for-uda` | `X-API-Key` |
24
+ | `GET /uda/settlements/{id}` | `get-settlement` | `X-API-Key` |
25
+ | `GET /uda/settlements/by-reference` | `list-settlements-by-reference` | `X-API-Key` |
26
+
27
+ > **Onchain Balance is intentionally excluded for now.** `GET /v1/balance/onchain/{wallet_address}`
28
+ > authenticates with `X-Gateway-Key` (the gateway-scoped key), not `X-API-Key`.
29
+ > It will be added once its public authentication is reconciled.
30
+
31
+ Paths are relative to the server base URL, which carries the `/v1` prefix
32
+ (`POST /uda` → `https://api.stridge.com/v1/uda`).
33
+
34
+ ## Authoring note
35
+
36
+ The spec is authored as a **single file** (`spec/openapi.yaml`) rather than the
37
+ split-file layout originally sketched in the build plan. At 7 operations this is
38
+ simpler and avoids cross-file `$ref` resolution pitfalls; Redocly bundles and
39
+ dereferences it identically. Split by domain later if the surface grows.
40
+
41
+ ### Clean name ↔ core definition map
42
+
43
+ | Public schema | Core definition |
44
+ | --- | --- |
45
+ | `UDAAddress` | `internal_uda_application_http.UDAAddressResponse` |
46
+ | `UDAAddressList` | `…ListUDAAddressResponse` |
47
+ | `CreateUDAAddressRequest` | `…CreateUDAAddressRequest` |
48
+ | `DestinationInput` / `Destination` | `…DestinationRequest` / `…DestinationDTO` |
49
+ | `DepositAddress` / `DepositAsset` | `…DepositAddressDTO` / `…DepositAssetDTO` |
50
+ | `RoutingRuleInput` / `RoutingRule` (+ Match/Destination) | `…RoutingRule*Request` / `…RoutingRule*Response` |
51
+ | `Quote` / `QuoteSide` / `QuoteFees` / `QuoteFeeItem` / `QuoteRoute` | `…Quote*` |
52
+ | `Settlement` (+ Deposit/Outbound/Fees/Route) | `…Settlement*DTO` / `…SettlementResponse` |
53
+ | `SettlementList` / `SettlementsByReference` | `…ListSettlementsResponse` / `…SettlementsByReferenceResponse` |
54
+ | `SupportedAssetsResponse` / `SupportedAssetChain` / `AssetInfo` / `NativeCurrency` | `…supportedassets.*` |
55
+ | `Pagination` | `…PaginationResponse` |
56
+ | `Error` | unified from `…shared_response.ErrorResponse` + `echo.HTTPError` |
57
+ | `SuccessEnvelope` | `…shared_response.OkResponse` |
58
+
59
+ ## Develop
60
+
61
+ ```sh
62
+ pnpm install
63
+ pnpm run lint # redocly lint
64
+ pnpm run build # → dist/openapi.json, dist/openapi.dereferenced.json, dist/types.d.ts
65
+ pnpm exec tsc --noEmit # typecheck the generated types
66
+ ```
67
+
68
+ ## Consuming
69
+
70
+ ```ts
71
+ import spec from "@stridge/openapi/dereferenced"; // fully flattened OAS 3.1 doc
72
+ import type { paths, components } from "@stridge/openapi/types";
73
+ ```
74
+
75
+ `apps/web` imports the **dereferenced** bundle so it never resolves `$ref`s at
76
+ build time.
77
+
78
+ ## Releasing (Changesets)
79
+
80
+ Releases are automated with [Changesets](https://github.com/changesets/changesets),
81
+ mirroring [`stridge-foundation/kit`](https://github.com/stridge-foundation/kit).
82
+ The `Release` workflow (`.github/workflows/release.yml`) runs the shared
83
+ `technance-foundation/github-actions/release@main` action on every push to
84
+ `main`, using the org-wide `NPM_PUBLISH_TOKEN` / `RELEASE_PUSH_TOKEN` secrets —
85
+ so it works without per-repo secret setup.
86
+
87
+ The flow:
88
+
89
+ 1. Add a changeset to your PR describing the spec change:
90
+
91
+ ```sh
92
+ pnpm changeset
93
+ ```
94
+
95
+ 2. When the PR merges to `main`, the release action opens a **"Version
96
+ Packages"** PR that applies the version bump and updates `CHANGELOG.md`.
97
+ 3. Merging that PR publishes `@stridge/openapi` to npm and tags the release.
98
+
99
+ Nothing publishes until the Version Packages PR is merged, so a pending
100
+ changeset on `main` is always safe.
101
+
102
+ > **Access:** `access` in `.changeset/config.json` is `public`, matching kit.
103
+ > Flip it to `restricted` if this package should be private (requires the
104
+ > `@stridge` npm org token to permit restricted publishes).
105
+
106
+ Local sanity checks (never run `pnpm release` from a laptop — CI owns it):
107
+
108
+ ```sh
109
+ pnpm changeset status # what's pending
110
+ pnpm bump # apply versions locally to preview; revert with git
111
+ ```