@eco-foundation/api-schemas 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.
Files changed (102) hide show
  1. package/README.md +160 -0
  2. package/dist/build-digest.d.ts +2 -0
  3. package/dist/build-digest.js +10 -0
  4. package/dist/build-digest.js.map +1 -0
  5. package/dist/fixtures/index.d.ts +14 -0
  6. package/dist/fixtures/index.js +71 -0
  7. package/dist/fixtures/index.js.map +1 -0
  8. package/dist/fixtures/v1/chains-list.response.default.json +37 -0
  9. package/dist/fixtures/v1/deposit-addresses-create.request.gateway-erc20.json +16 -0
  10. package/dist/fixtures/v1/deposit-addresses-create.response.gateway-erc20.json +20 -0
  11. package/dist/fixtures/v1/deposit-addresses-lookup.response.default.json +24 -0
  12. package/dist/fixtures/v1/deposit-addresses-submit-erc-2612.request.deposit-address-target.json +23 -0
  13. package/dist/fixtures/v1/deposit-addresses-submit-erc-3009.request.deposit-address-target.json +24 -0
  14. package/dist/fixtures/v1/intents-status.response.gasless-handoff.json +30 -0
  15. package/dist/fixtures/v1/intents-status.response.intent-filled.json +21 -0
  16. package/dist/fixtures/v1/intents-status.response.unknown.json +20 -0
  17. package/dist/fixtures/v1/intents-status.response.wallet-page.json +27 -0
  18. package/dist/fixtures/v1/intents-submit-erc-3009.response.job.json +25 -0
  19. package/dist/fixtures/v1/intents-submit-permit2.request.quote-target.json +25 -0
  20. package/dist/fixtures/v1/intents-submit-permit3.request.quote-target.json +27 -0
  21. package/dist/fixtures/v1/quotes-create.request.public-swap.json +25 -0
  22. package/dist/fixtures/v1/quotes-create.response.all-quotes.json +455 -0
  23. package/dist/fixtures/v1/quotes-create.response.private-swap.json +152 -0
  24. package/dist/fixtures/v1/quotes-create.response.public-swap.json +158 -0
  25. package/dist/fixtures/v1/routes-list.response.default.json +26 -0
  26. package/dist/fixtures/v1/tokens-list.response.default.json +24 -0
  27. package/dist/generated/build-digest.json +7 -0
  28. package/dist/index.d.ts +6 -0
  29. package/dist/index.js +47 -0
  30. package/dist/index.js.map +1 -0
  31. package/dist/openapi.d.ts +2 -0
  32. package/dist/openapi.js +81 -0
  33. package/dist/openapi.js.map +1 -0
  34. package/dist/scripts/generate-build-digest.d.ts +1 -0
  35. package/dist/scripts/generate-build-digest.js +25 -0
  36. package/dist/scripts/generate-build-digest.js.map +1 -0
  37. package/dist/scripts/generate-openapi.d.ts +1 -0
  38. package/dist/scripts/generate-openapi.js +21 -0
  39. package/dist/scripts/generate-openapi.js.map +1 -0
  40. package/dist/testing/index.d.ts +7 -0
  41. package/dist/testing/index.js +27 -0
  42. package/dist/testing/index.js.map +1 -0
  43. package/dist/v1/endpoints/chains.d.ts +52 -0
  44. package/dist/v1/endpoints/chains.js +23 -0
  45. package/dist/v1/endpoints/chains.js.map +1 -0
  46. package/dist/v1/endpoints/deposit-addresses.d.ts +100 -0
  47. package/dist/v1/endpoints/deposit-addresses.js +61 -0
  48. package/dist/v1/endpoints/deposit-addresses.js.map +1 -0
  49. package/dist/v1/endpoints/quotes.d.ts +861 -0
  50. package/dist/v1/endpoints/quotes.js +297 -0
  51. package/dist/v1/endpoints/quotes.js.map +1 -0
  52. package/dist/v1/endpoints/registry.d.ts +641 -0
  53. package/dist/v1/endpoints/registry.js +108 -0
  54. package/dist/v1/endpoints/registry.js.map +1 -0
  55. package/dist/v1/endpoints/routes.d.ts +35 -0
  56. package/dist/v1/endpoints/routes.js +21 -0
  57. package/dist/v1/endpoints/routes.js.map +1 -0
  58. package/dist/v1/endpoints/status.d.ts +149 -0
  59. package/dist/v1/endpoints/status.js +110 -0
  60. package/dist/v1/endpoints/status.js.map +1 -0
  61. package/dist/v1/endpoints/submit.d.ts +271 -0
  62. package/dist/v1/endpoints/submit.js +127 -0
  63. package/dist/v1/endpoints/submit.js.map +1 -0
  64. package/dist/v1/endpoints/tokens.d.ts +59 -0
  65. package/dist/v1/endpoints/tokens.js +22 -0
  66. package/dist/v1/endpoints/tokens.js.map +1 -0
  67. package/dist/v1/enums.d.ts +133 -0
  68. package/dist/v1/enums.js +62 -0
  69. package/dist/v1/enums.js.map +1 -0
  70. package/dist/v1/errors/catalog.d.ts +247 -0
  71. package/dist/v1/errors/catalog.js +124 -0
  72. package/dist/v1/errors/catalog.js.map +1 -0
  73. package/dist/v1/errors/lock.d.ts +10 -0
  74. package/dist/v1/errors/lock.js +45 -0
  75. package/dist/v1/errors/lock.js.map +1 -0
  76. package/dist/v1/errors/problem.d.ts +50 -0
  77. package/dist/v1/errors/problem.js +82 -0
  78. package/dist/v1/errors/problem.js.map +1 -0
  79. package/dist/v1/index.d.ts +14 -0
  80. package/dist/v1/index.js +32 -0
  81. package/dist/v1/index.js.map +1 -0
  82. package/dist/v1/primitives.d.ts +33 -0
  83. package/dist/v1/primitives.js +63 -0
  84. package/dist/v1/primitives.js.map +1 -0
  85. package/dist/v1/signature.d.ts +10 -0
  86. package/dist/v1/signature.js +72 -0
  87. package/dist/v1/signature.js.map +1 -0
  88. package/dist/v1/tolerant.d.ts +4 -0
  89. package/dist/v1/tolerant.js +11 -0
  90. package/dist/v1/tolerant.js.map +1 -0
  91. package/dist/v1/types.d.ts +277 -0
  92. package/dist/v1/types.js +3 -0
  93. package/dist/v1/types.js.map +1 -0
  94. package/errors/catalog.lock.json +232 -0
  95. package/fixtures/quote-signature/vector-1.json +9 -0
  96. package/fixtures/quote-signature/vector-2.json +13 -0
  97. package/fixtures/quote-signature/vector-3.json +9 -0
  98. package/fixtures/signature-hash/vectors.json +58 -0
  99. package/openapi/v1.json +5225 -0
  100. package/package.json +71 -0
  101. package/v1/types.d.ts +7 -0
  102. package/v1/types.js +5 -0
package/README.md ADDED
@@ -0,0 +1,160 @@
1
+ # @eco-foundation/api-schemas
2
+
3
+ Zod-first schemas, error catalog, golden fixtures, and generated OpenAPI 3.1 for the Eco `/v1`
4
+ API. The Zod schemas are the source of truth; everything else (OpenAPI, fixtures, plain types)
5
+ is generated from or gated against them.
6
+
7
+ Today the package covers **13 endpoints across 12 paths**, **33 error codes** (51 namespaced
8
+ legacy references), and **19 golden fixtures**.
9
+
10
+ ## Install
11
+
12
+ While the package is 0.x, pin the patch range or the exact version:
13
+
14
+ ```json
15
+ {
16
+ "dependencies": {
17
+ "@eco-foundation/api-schemas": "~0.1.0"
18
+ }
19
+ }
20
+ ```
21
+
22
+ **Never write `^0`.** npm resolves `^0.x` as `>=0.0.0 <1.0.0`, so it silently accepts every
23
+ future breaking `0.y` — it is not a pin at all. Use `~0.1.0` or the exact `0.1.0`.
24
+
25
+ A matching version string is not evidence of a matching artifact: also compare
26
+ `V1_SCHEMA_DIGEST` (see [Invariants](#invariants-enforced-in-ci)). Two builds both called
27
+ `0.1.0` — a registry copy and a `file:` tarball, say — can carry different schemas.
28
+
29
+ ## Consumers
30
+
31
+ | Consumer | Import | Zod requirement |
32
+ | ------------------------------------ | ---------------------------------------------------------------------------------------- | -------------------------------------- |
33
+ | eco-router (serves /v1) | `import { v1 } from '@eco-foundation/api-schemas'` | none extra — zod ships as a dependency |
34
+ | deposit-addresses (native endpoints) | same, plus `assertMatchesV1Schema` from `./testing` in CI | none extra |
35
+ | solver-v2 (Zod 3 — must not upgrade) | `import type { V1QuoteResponse } from '@eco-foundation/api-schemas/v1/types'` + fixtures | ZERO zod at runtime and in the `.d.ts` |
36
+
37
+ Zod-major compatibility is the reason there are two interfaces, not one:
38
+
39
+ - **Zod-4 consumers** (eco-router `^4.4.3`, deposit-addresses `^4.3.5`) import the schemas
40
+ directly. `zod` is a regular dependency of this package pinned **exact `4.4.3`** — nobody has
41
+ to install Zod 4 themselves, and the exact pin is what keeps the generated OpenAPI byte-stable
42
+ across zod patches. pnpm dedupes it against a consumer's own Zod 4.
43
+ - **solver-v2 is on Zod 3 and must never be forced to Zod 4.** It consumes the zod-free
44
+ `./v1/types` subpath (plain `type` aliases, no zod in the emitted `.d.ts`) plus the golden
45
+ fixtures. Root-level type re-exports from the bare package name exist as a convenience for
46
+ Zod-4 consumers, but their `.d.ts` reaches zod through the `v1` namespace — solver-v2 must use
47
+ the subpath.
48
+ - `viem` is a **dev-only** dependency (the reference implementation the signature and
49
+ quote-signature vector suites check against). It stays out of `dependencies`, so a consumer
50
+ install pulls only `zod` and `@noble/hashes`.
51
+
52
+ ## Import surface
53
+
54
+ | Subpath | Contents |
55
+ | ------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------ |
56
+ | `.` | `v1` namespace, `V1_SCHEMA_DIGEST`, `assertMatchesV1Schema`, `loadV1Fixtures`, `generateOpenApiDocument`, root type re-exports |
57
+ | `./v1/types` | zod-free `type` aliases (the solver-v2 interface) |
58
+ | `./testing` | `assertMatchesV1Schema`, `loadV1Fixtures`, `V1Fixture` |
59
+ | `./openapi/v1.json` | the generated OpenAPI 3.1 document |
60
+ | `./fixtures/signature-hash/vectors.json` | cross-repo `signatureHash` vectors |
61
+ | `./fixtures/quote-signature/vector-*.json` | cross-repo F3 quote-signature (EIP-712) vectors |
62
+
63
+ ## Fixtures
64
+
65
+ There are two fixture locations and they serve different jobs — do not conflate them:
66
+
67
+ - **`src/fixtures/v1/`** — the 19 golden request/response payloads, one per endpoint variant,
68
+ consumed through **`loadV1Fixtures()`** rather than by file path. Each entry carries its
69
+ endpoint id, direction, variant, and the C12 replay metadata (`method`, `path`,
70
+ `expectedStatus`, `sideEffect`, optional `stability` and `headers`), so a live-replay harness
71
+ drives itself from the array. They are TypeScript-imported, so `tsc` emits them into `dist/`
72
+ and they ship compiled — no copy step.
73
+ - **Package-root `fixtures/`** — the shared cross-repo vectors, shipped raw and read by
74
+ subpath, because all four repos assert against the same bytes:
75
+ `fixtures/signature-hash/vectors.json` (the `signatureHash` canonicalization contract) and
76
+ `fixtures/quote-signature/vector-*.json` (the F3 EIP-712 `EcoQuoteV1` vectors, each with its
77
+ `digest`, `signature`, and `signer`; the signing key is derived from a public domain string,
78
+ so this repo ships no private-key bytes).
79
+
80
+ `routes.list` is the one fixture tagged `stability: 'draft'`. A live-replay consumer skips it
81
+ with the reason `draft endpoint (x-stability: draft) — not served at launch` instead of
82
+ demanding a 200 from an endpoint no service serves at launch, which makes the read-safe replay
83
+ set **7 of the 8 GET fixtures**. Schema conformance still covers it in this package's own suite,
84
+ which needs no server.
85
+
86
+ ## Invariants (enforced in CI)
87
+
88
+ - Error catalog is append-only: `errors/catalog.lock.json` diffed against `origin/main`
89
+ (`pnpm run catalog:check`). Codes are explicit literals; `legacyCodes` are namespaced
90
+ (`eco-quotes:` / `deposit-addresses:` collide numerically by construction).
91
+ - `openapi/v1.json` is regenerated and diffed (`pnpm run openapi:check`).
92
+ - Every fixture in `src/fixtures/v1` parses through its endpoint schema, and its replay metadata
93
+ matches the registry entry (`method`, `expectedStatus`, `sideEffect`, `stability`).
94
+ - `v1/types` stays mutually assignable with the schemas (compile-time gate) and zod-free at
95
+ runtime.
96
+ - Wire schemas are transform-free; requests strip unknown keys, responses are loose
97
+ (`z.looseObject`). Tolerant enum helpers exist for consumers only.
98
+ - `signatureHash` = keccak256 of the canonical signature encoding (low-s, v ∈ {27,28}, 65-byte
99
+ expanded). Consumers MUST enforce uniqueness in the store (unique index / atomic upsert) —
100
+ never check-then-act.
101
+ - `fixtures/signature-hash/vectors.json` is the cross-repo `signatureHash` contract: eco-router
102
+ and deposit-addresses import the util and assert these vectors; solver-v2 keeps a local copy
103
+ of the util ONLY with this file copied into its fixtures and asserted byte-for-byte.
104
+ - `fixtures/quote-signature/vector-*.json` are the F3 quote-signature golden vectors (EIP-712
105
+ `EcoQuoteV1` domain); eco-router's signing path must reproduce every `digest`/`signature`.
106
+ - `V1_SCHEMA_DIGEST` is sha256 over `errors/catalog.lock.json` then `openapi/v1.json`,
107
+ byte-exact and in that order, regenerated and diffed (`pnpm run digest:check`). It is the
108
+ cross-consumer skew identity: every service serving or validating `/v1` must report the same
109
+ digest.
110
+ - Status vocabularies are the single source (canon C1) — every service maps its internal states
111
+ INTO them; the `intentHashes: Bytes32[]` handoff field is plural bare hashes everywhere.
112
+ - A quote response's `quotes` field is ALWAYS present (P8): `null` unless the request set
113
+ `options.allQuotes`, otherwise the ranked list (best-priced first) whose entry 0 IS the
114
+ envelope's quote. Entries are the same core quote object, each independently executable and
115
+ separately signed.
116
+
117
+ ## Gates
118
+
119
+ `pnpm run verify` is the whole gate and runs all six steps in order:
120
+
121
+ ```
122
+ build → lint:check → test → catalog:check → openapi:check → digest:check
123
+ ```
124
+
125
+ Both `.github/workflows/ci.yml` (every PR) and `.github/workflows/publish-api-schemas.yml`
126
+ (every release tag) run exactly that one command.
127
+
128
+ **The `verify`-before-`publish` step in the publish workflow is load-bearing — do not
129
+ streamline it away.** `build` uses `tsconfig.build.json`, which excludes `src/**/*.spec.ts`, so
130
+ the compile-time gates that live in spec files — most importantly the `v1/types` parity gate —
131
+ cannot fail `build`. They fail `test`. Publishing without running `verify` would therefore ship
132
+ a `./v1/types` alias that has silently drifted from its schema.
133
+
134
+ What each gate says when it trips:
135
+
136
+ | Gate | Failure output | Fix |
137
+ | --------------- | --------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------- |
138
+ | types parity | `error TS2344: Type '"V1QuoteRequest"' does not satisfy the constraint 'never'` — the message NAMES the drifted alias | update the alias in `src/v1/types.ts` to match the schema |
139
+ | `openapi:check` | `openapi/v1.json is stale — run: pnpm run openapi:generate` | `pnpm run openapi:generate` (byte-stable across runs) |
140
+ | `digest:check` | `src/generated/build-digest.json is stale — run: pnpm run digest:generate` | `pnpm run digest:generate` |
141
+ | `catalog:check` | a per-violation list naming the removed or mutated code | append instead of mutating; `pnpm run catalog:lock` |
142
+
143
+ Two `catalog:check` outcomes are NOT failures and must not be confused with each other:
144
+
145
+ - `no baseline lock at origin/main:… — append-only check skipped (first introduction)` is
146
+ correct while the lock has never been on `main`. The gate starts enforcing the moment it is.
147
+ - An **unresolvable** `origin/main` FAILS instead, naming `fetch-depth: 0` — a shallow clone
148
+ must never silently turn the append-only gate into a permanent no-op.
149
+
150
+ ## Publishing
151
+
152
+ Tag `api-schemas-v<version>` (must equal `package.json` version) — the `publish-api-schemas`
153
+ workflow verifies and publishes. It fails with `::error::tag version <x> != package version <y>`
154
+ if the two drift, so a stale tag can never publish a mismatched artifact.
155
+
156
+ Semver: breaking schema change = major, additive = minor; consumers pin minor. **While the
157
+ package is 0.x, "pin minor" means `~0.1.0` or the exact `0.1.0` — never `^0`** (see
158
+ [Install](#install)). Consumers additionally compare `V1_SCHEMA_DIGEST`: a matching version
159
+ string is not evidence of a matching artifact. `/v1/routes` is draft-tagged and exempt until its
160
+ stability flips.
@@ -0,0 +1,2 @@
1
+ export declare const V1_SCHEMA_DIGEST: string;
2
+ export declare const V1_SCHEMA_DIGEST_INPUTS: readonly string[];
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.V1_SCHEMA_DIGEST_INPUTS = exports.V1_SCHEMA_DIGEST = void 0;
7
+ const build_digest_json_1 = __importDefault(require("./generated/build-digest.json"));
8
+ exports.V1_SCHEMA_DIGEST = build_digest_json_1.default.digest;
9
+ exports.V1_SCHEMA_DIGEST_INPUTS = build_digest_json_1.default.inputs;
10
+ //# sourceMappingURL=build-digest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build-digest.js","sourceRoot":"","sources":["../src/build-digest.ts"],"names":[],"mappings":";;;;;;AAAA,sFAAsD;AASzC,QAAA,gBAAgB,GAAW,2BAAS,CAAC,MAAM,CAAC;AAC5C,QAAA,uBAAuB,GAAsB,2BAAS,CAAC,MAAM,CAAC"}
@@ -0,0 +1,14 @@
1
+ import type { V1EndpointId } from '../v1/endpoints/registry';
2
+ export interface V1Fixture {
3
+ endpointId: V1EndpointId;
4
+ direction: 'request' | 'response';
5
+ variant: string;
6
+ method: 'GET' | 'POST';
7
+ path: string;
8
+ expectedStatus: number;
9
+ sideEffect: boolean;
10
+ stability?: 'stable' | 'draft';
11
+ headers?: Record<string, string>;
12
+ payload: unknown;
13
+ }
14
+ export declare const V1_FIXTURES: readonly V1Fixture[];
@@ -0,0 +1,71 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.V1_FIXTURES = void 0;
7
+ const chains_list_response_default_json_1 = __importDefault(require("./v1/chains-list.response.default.json"));
8
+ const deposit_addresses_create_request_gateway_erc20_json_1 = __importDefault(require("./v1/deposit-addresses-create.request.gateway-erc20.json"));
9
+ const deposit_addresses_create_response_gateway_erc20_json_1 = __importDefault(require("./v1/deposit-addresses-create.response.gateway-erc20.json"));
10
+ const deposit_addresses_lookup_response_default_json_1 = __importDefault(require("./v1/deposit-addresses-lookup.response.default.json"));
11
+ const deposit_addresses_submit_erc_2612_request_deposit_address_target_json_1 = __importDefault(require("./v1/deposit-addresses-submit-erc-2612.request.deposit-address-target.json"));
12
+ const deposit_addresses_submit_erc_3009_request_deposit_address_target_json_1 = __importDefault(require("./v1/deposit-addresses-submit-erc-3009.request.deposit-address-target.json"));
13
+ const intents_status_response_gasless_handoff_json_1 = __importDefault(require("./v1/intents-status.response.gasless-handoff.json"));
14
+ const intents_status_response_intent_filled_json_1 = __importDefault(require("./v1/intents-status.response.intent-filled.json"));
15
+ const intents_status_response_unknown_json_1 = __importDefault(require("./v1/intents-status.response.unknown.json"));
16
+ const intents_status_response_wallet_page_json_1 = __importDefault(require("./v1/intents-status.response.wallet-page.json"));
17
+ const intents_submit_erc_3009_response_job_json_1 = __importDefault(require("./v1/intents-submit-erc-3009.response.job.json"));
18
+ const intents_submit_permit2_request_quote_target_json_1 = __importDefault(require("./v1/intents-submit-permit2.request.quote-target.json"));
19
+ const intents_submit_permit3_request_quote_target_json_1 = __importDefault(require("./v1/intents-submit-permit3.request.quote-target.json"));
20
+ const quotes_create_request_public_swap_json_1 = __importDefault(require("./v1/quotes-create.request.public-swap.json"));
21
+ const quotes_create_response_all_quotes_json_1 = __importDefault(require("./v1/quotes-create.response.all-quotes.json"));
22
+ const quotes_create_response_private_swap_json_1 = __importDefault(require("./v1/quotes-create.response.private-swap.json"));
23
+ const quotes_create_response_public_swap_json_1 = __importDefault(require("./v1/quotes-create.response.public-swap.json"));
24
+ const routes_list_response_default_json_1 = __importDefault(require("./v1/routes-list.response.default.json"));
25
+ const tokens_list_response_default_json_1 = __importDefault(require("./v1/tokens-list.response.default.json"));
26
+ const bind = (endpointId, direction, variant, json, meta = {}) => ({ endpointId, direction, variant, json, ...meta });
27
+ const FIXTURE_BINDINGS = [
28
+ bind('quotes.create', 'request', 'public-swap', quotes_create_request_public_swap_json_1.default),
29
+ bind('quotes.create', 'response', 'public-swap', quotes_create_response_public_swap_json_1.default),
30
+ bind('quotes.create', 'response', 'private-swap', quotes_create_response_private_swap_json_1.default),
31
+ bind('quotes.create', 'response', 'all-quotes', quotes_create_response_all_quotes_json_1.default),
32
+ bind('intents.submit.permit3', 'request', 'quote-target', intents_submit_permit3_request_quote_target_json_1.default),
33
+ bind('intents.submit.permit2', 'request', 'quote-target', intents_submit_permit2_request_quote_target_json_1.default),
34
+ bind('intents.submit.erc-3009', 'response', 'job', intents_submit_erc_3009_response_job_json_1.default),
35
+ bind('deposit-addresses.submit.erc-3009', 'request', 'deposit-address-target', deposit_addresses_submit_erc_3009_request_deposit_address_target_json_1.default),
36
+ bind('deposit-addresses.submit.erc-2612', 'request', 'deposit-address-target', deposit_addresses_submit_erc_2612_request_deposit_address_target_json_1.default),
37
+ bind('intents.status', 'response', 'intent-filled', intents_status_response_intent_filled_json_1.default),
38
+ bind('intents.status', 'response', 'unknown', intents_status_response_unknown_json_1.default),
39
+ bind('intents.status', 'response', 'gasless-handoff', intents_status_response_gasless_handoff_json_1.default),
40
+ bind('intents.status', 'response', 'wallet-page', intents_status_response_wallet_page_json_1.default),
41
+ bind('chains.list', 'response', 'default', chains_list_response_default_json_1.default),
42
+ bind('tokens.list', 'response', 'default', tokens_list_response_default_json_1.default),
43
+ bind('routes.list', 'response', 'default', routes_list_response_default_json_1.default, { stability: 'draft' }),
44
+ bind('deposit-addresses.create', 'request', 'gateway-erc20', deposit_addresses_create_request_gateway_erc20_json_1.default),
45
+ bind('deposit-addresses.create', 'response', 'gateway-erc20', deposit_addresses_create_response_gateway_erc20_json_1.default),
46
+ bind('deposit-addresses.lookup', 'response', 'default', deposit_addresses_lookup_response_default_json_1.default),
47
+ ];
48
+ function bindFixture(binding) {
49
+ const file = binding.json;
50
+ if (file.endpointId !== binding.endpointId ||
51
+ file.direction !== binding.direction ||
52
+ file.variant !== binding.variant) {
53
+ throw new Error(`fixture envelope disagrees with its binding: expected ` +
54
+ `${binding.endpointId}:${binding.direction}:${binding.variant}, file says ` +
55
+ `${String(file.endpointId)}:${String(file.direction)}:${String(file.variant)}`);
56
+ }
57
+ const declaredStability = binding.stability ?? 'stable';
58
+ const fileStability = file.stability ?? 'stable';
59
+ if (fileStability !== declaredStability) {
60
+ throw new Error(`fixture stability disagrees with its binding for ` +
61
+ `${binding.endpointId}:${binding.direction}:${binding.variant}: binding says ` +
62
+ `${declaredStability}, file says ${fileStability}`);
63
+ }
64
+ if (JSON.stringify(file.headers ?? {}) !== JSON.stringify(binding.headers ?? {})) {
65
+ throw new Error(`fixture headers disagree with their binding for ` +
66
+ `${binding.endpointId}:${binding.direction}:${binding.variant}`);
67
+ }
68
+ return file;
69
+ }
70
+ exports.V1_FIXTURES = FIXTURE_BINDINGS.map(bindFixture);
71
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/fixtures/index.ts"],"names":[],"mappings":";;;;;;AACA,+GAAgE;AAChE,mJAAuF;AACvF,qJAAyF;AACzF,yIAA2E;AAC3E,uLAAsG;AACtG,uLAAsG;AACtG,qIAA8E;AAC9E,iIAA2E;AAC3E,qHAAsE;AACtE,6HAAuE;AACvE,+HAA2E;AAC3E,6IAAkF;AACl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CAAC,UAAU,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,iBAAiB;YAC9E,GAAG,iBAAiB,eAAe,aAAa,EAAE,CACrD,CAAC;IACJ,CAAC;IACD,IAAI,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,IAAI,EAAE,CAAC,KAAK,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,EAAE,CAAC;QACjF,MAAM,IAAI,KAAK,CACb,kDAAkD;YAChD,GAAG,OAAO,CAAC,UAAU,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAClE,CAAC;IACJ,CAAC;IACD,OAAO,IAA4B,CAAC;AACtC,CAAC;AAEY,QAAA,WAAW,GAAyB,gBAAgB,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,37 @@
1
+ {
2
+ "endpointId": "chains.list",
3
+ "direction": "response",
4
+ "variant": "default",
5
+ "method": "GET",
6
+ "path": "/v1/chains",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "chains": [
11
+ {
12
+ "chainId": 728126428,
13
+ "name": "Tron",
14
+ "type": "tvm",
15
+ "encoding": "abi",
16
+ "status": "live",
17
+ "quoteSigner": "0x1111111111111111111111111111111111111111",
18
+ "contracts": {
19
+ "portal": "TJRabPrwbZy45sbavfcjinPJC18kjpRTv8",
20
+ "executor": null
21
+ }
22
+ },
23
+ {
24
+ "chainId": 8453,
25
+ "name": "Base",
26
+ "type": "evm",
27
+ "encoding": "abi",
28
+ "status": "live",
29
+ "quoteSigner": "0x1111111111111111111111111111111111111111",
30
+ "contracts": {
31
+ "portal": "0x2222222222222222222222222222222222222222",
32
+ "executor": "0x3333333333333333333333333333333333333333"
33
+ }
34
+ }
35
+ ]
36
+ }
37
+ }
@@ -0,0 +1,16 @@
1
+ {
2
+ "endpointId": "deposit-addresses.create",
3
+ "direction": "request",
4
+ "variant": "gateway-erc20",
5
+ "method": "POST",
6
+ "path": "/v1/deposit-addresses",
7
+ "expectedStatus": 201,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "chainId": 8453,
11
+ "depositor": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
12
+ "kind": "gateway-erc20",
13
+ "destinationAddress": "0x1111111111111111111111111111111111111111",
14
+ "destinationChainId": 137
15
+ }
16
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "endpointId": "deposit-addresses.create",
3
+ "direction": "response",
4
+ "variant": "gateway-erc20",
5
+ "method": "POST",
6
+ "path": "/v1/deposit-addresses",
7
+ "expectedStatus": 201,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "id": "deposit-address:0x4444444444444444444444444444444444444444",
11
+ "depositAddress": "0x4444444444444444444444444444444444444444",
12
+ "chainId": 8453,
13
+ "depositor": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
14
+ "kind": "gateway-erc20",
15
+ "destinationAddress": "0x1111111111111111111111111111111111111111",
16
+ "destinationChainId": 137,
17
+ "expiresAt": null,
18
+ "createdAt": 1767225000
19
+ }
20
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "endpointId": "deposit-addresses.lookup",
3
+ "direction": "response",
4
+ "variant": "default",
5
+ "method": "GET",
6
+ "path": "/v1/deposit-addresses?depositAddress=0x4444444444444444444444444444444444444444",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "results": [
11
+ {
12
+ "id": "deposit-address:0x4444444444444444444444444444444444444444",
13
+ "depositAddress": "0x4444444444444444444444444444444444444444",
14
+ "chainId": 8453,
15
+ "depositor": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb1",
16
+ "kind": "gateway-erc20",
17
+ "destinationAddress": "0x1111111111111111111111111111111111111111",
18
+ "destinationChainId": 137,
19
+ "expiresAt": null,
20
+ "createdAt": 1767225000
21
+ }
22
+ ]
23
+ }
24
+ }
@@ -0,0 +1,23 @@
1
+ {
2
+ "endpointId": "deposit-addresses.submit.erc-2612",
3
+ "direction": "request",
4
+ "variant": "deposit-address-target",
5
+ "method": "POST",
6
+ "path": "/v1/deposit-addresses/submit/erc-2612",
7
+ "expectedStatus": 202,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "chainId": 8453,
11
+ "target": {
12
+ "depositAddress": "0x4444444444444444444444444444444444444444"
13
+ },
14
+ "permit": {
15
+ "owner": "0x1111111111111111111111111111111111111111",
16
+ "spender": "0x4444444444444444444444444444444444444444",
17
+ "value": "1000000",
18
+ "nonce": "0",
19
+ "deadline": 1767225600
20
+ },
21
+ "signature": "0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
22
+ }
23
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "endpointId": "deposit-addresses.submit.erc-3009",
3
+ "direction": "request",
4
+ "variant": "deposit-address-target",
5
+ "method": "POST",
6
+ "path": "/v1/deposit-addresses/submit/erc-3009",
7
+ "expectedStatus": 202,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "chainId": 8453,
11
+ "target": {
12
+ "depositAddress": "0x4444444444444444444444444444444444444444"
13
+ },
14
+ "authorization": {
15
+ "from": "0x1111111111111111111111111111111111111111",
16
+ "to": "0x4444444444444444444444444444444444444444",
17
+ "value": "1000000",
18
+ "validAfter": "0",
19
+ "validBefore": "1767225600",
20
+ "nonce": "0xabababababababababababababababababababababababababababababababab"
21
+ },
22
+ "signature": "0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
23
+ }
24
+ }
@@ -0,0 +1,30 @@
1
+ {
2
+ "endpointId": "intents.status",
3
+ "direction": "response",
4
+ "variant": "gasless-handoff",
5
+ "method": "GET",
6
+ "path": "/v1/intents/status?jobId=0f450218-1b2c-4d3e-8f9a-0b1c2d3e4f5a",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "results": [
11
+ {
12
+ "id": "gasless:0f450218-1b2c-4d3e-8f9a-0b1c2d3e4f5a",
13
+ "type": "gasless",
14
+ "status": "published",
15
+ "updatedAt": 1767225600,
16
+ "intentHashes": ["0xabababababababababababababababababababababababababababababababab"],
17
+ "subStatuses": [
18
+ {
19
+ "chainId": 8453,
20
+ "quoteIds": ["quote:8f14e45f-ea3c-4c2d-9b6e-1a2b3c4d5e6f"],
21
+ "txHash": "0xefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef",
22
+ "intentHashes": ["0xabababababababababababababababababababababababababababababababab"],
23
+ "state": "published"
24
+ }
25
+ ]
26
+ }
27
+ ],
28
+ "nextCursor": null
29
+ }
30
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "endpointId": "intents.status",
3
+ "direction": "response",
4
+ "variant": "intent-filled",
5
+ "method": "GET",
6
+ "path": "/v1/intents/status?intentHash=0xabababababababababababababababababababababababababababababababab",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "results": [
11
+ {
12
+ "id": "intent:0xabababababababababababababababababababababababababababababababab",
13
+ "type": "intent",
14
+ "status": "filled",
15
+ "updatedAt": 1767225600,
16
+ "txHash": "0xefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef"
17
+ }
18
+ ],
19
+ "nextCursor": null
20
+ }
21
+ }
@@ -0,0 +1,20 @@
1
+ {
2
+ "endpointId": "intents.status",
3
+ "direction": "response",
4
+ "variant": "unknown",
5
+ "method": "GET",
6
+ "path": "/v1/intents/status?intentHash=0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "results": [
11
+ {
12
+ "id": "intent:0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
13
+ "type": "intent",
14
+ "status": "unknown",
15
+ "updatedAt": null
16
+ }
17
+ ],
18
+ "nextCursor": null
19
+ }
20
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "endpointId": "intents.status",
3
+ "direction": "response",
4
+ "variant": "wallet-page",
5
+ "method": "GET",
6
+ "path": "/v1/intents/status?wallet=0x1111111111111111111111111111111111111111&limit=2",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "results": [
11
+ {
12
+ "id": "intent:0xabababababababababababababababababababababababababababababababab",
13
+ "type": "intent",
14
+ "status": "filled",
15
+ "updatedAt": 1767225600,
16
+ "txHash": "0xefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef"
17
+ },
18
+ {
19
+ "id": "intent:0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
20
+ "type": "intent",
21
+ "status": "unknown",
22
+ "updatedAt": null
23
+ }
24
+ ],
25
+ "nextCursor": "Y3Vyc29yOjE3NjcyMjU2MDA6aW50ZW50OjB4YWJhYg"
26
+ }
27
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "endpointId": "intents.submit.erc-3009",
3
+ "direction": "response",
4
+ "variant": "job",
5
+ "method": "POST",
6
+ "path": "/v1/intents/submit/erc-3009",
7
+ "expectedStatus": 202,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "id": "gasless:0f450218-1b2c-4d3e-8f9a-0b1c2d3e4f5a",
11
+ "status": "processing",
12
+ "signatureHash": "0xabababababababababababababababababababababababababababababababab",
13
+ "subStatuses": [
14
+ {
15
+ "chainId": 8453,
16
+ "quoteIds": ["quote:8f14e45f-ea3c-4c2d-9b6e-1a2b3c4d5e6f"],
17
+ "txHash": null,
18
+ "intentHashes": [],
19
+ "state": "pending"
20
+ }
21
+ ],
22
+ "createdAt": 1767225000,
23
+ "updatedAt": 1767225010
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "endpointId": "intents.submit.permit2",
3
+ "direction": "request",
4
+ "variant": "quote-target",
5
+ "method": "POST",
6
+ "path": "/v1/intents/submit/permit2",
7
+ "expectedStatus": 202,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "target": {
11
+ "quoteId": "quote:8f14e45f-ea3c-4c2d-9b6e-1a2b3c4d5e6f"
12
+ },
13
+ "permit2": {
14
+ "details": {
15
+ "token": "0x2222222222222222222222222222222222222222",
16
+ "amount": "1043221",
17
+ "expiration": 1767225600,
18
+ "nonce": 0
19
+ },
20
+ "spender": "0x1111111111111111111111111111111111111111",
21
+ "sigDeadline": 1767225600
22
+ },
23
+ "signature": "0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
24
+ }
25
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "endpointId": "intents.submit.permit3",
3
+ "direction": "request",
4
+ "variant": "quote-target",
5
+ "method": "POST",
6
+ "path": "/v1/intents/submit/permit3",
7
+ "expectedStatus": 202,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "target": {
11
+ "quoteId": "quote:8f14e45f-ea3c-4c2d-9b6e-1a2b3c4d5e6f"
12
+ },
13
+ "permit3": {
14
+ "owner": "0x1111111111111111111111111111111111111111",
15
+ "salt": "0xabababababababababababababababababababababababababababababababab",
16
+ "deadline": 1767225600,
17
+ "permits": [
18
+ {
19
+ "chainId": 8453,
20
+ "token": "0x2222222222222222222222222222222222222222",
21
+ "amount": "1043221"
22
+ }
23
+ ]
24
+ },
25
+ "signature": "0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd"
26
+ }
27
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "endpointId": "quotes.create",
3
+ "direction": "request",
4
+ "variant": "public-swap",
5
+ "method": "POST",
6
+ "path": "/v1/quotes",
7
+ "expectedStatus": 200,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "swapType": "exact-in",
11
+ "source": {
12
+ "chainId": 8453,
13
+ "token": "0x1111111111111111111111111111111111111111",
14
+ "amount": "1043221"
15
+ },
16
+ "destination": {
17
+ "chainId": 10,
18
+ "token": "0x2222222222222222222222222222222222222222",
19
+ "recipient": "0x3333333333333333333333333333333333333333"
20
+ },
21
+ "funder": "0x3333333333333333333333333333333333333333",
22
+ "slippage": 0.005,
23
+ "dappId": "example-dapp"
24
+ }
25
+ }