@eco-foundation/api-schemas 0.3.0 → 0.4.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 CHANGED
@@ -4,7 +4,7 @@ Zod-first schemas, error catalog, golden fixtures, and generated OpenAPI 3.1 for
4
4
  API. The Zod schemas are the source of truth; everything else (OpenAPI, fixtures, plain types)
5
5
  is generated from or gated against them.
6
6
 
7
- Today the package covers **13 endpoints across 12 paths**, **33 error codes** (51 namespaced
7
+ Today the package covers **13 endpoints across 12 paths**, **37 error codes** (51 namespaced
8
8
  legacy references), and **19 golden fixtures**.
9
9
 
10
10
  ## Install
@@ -14,17 +14,278 @@ While the package is 0.x, pin the patch range or the exact version:
14
14
  ```json
15
15
  {
16
16
  "dependencies": {
17
- "@eco-foundation/api-schemas": "~0.3.0"
17
+ "@eco-foundation/api-schemas": "~0.4.0"
18
18
  }
19
19
  }
20
20
  ```
21
21
 
22
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.3.0` or the exact `0.3.0`.
23
+ future breaking `0.y` — it is not a pin at all. Use `~0.4.0` or the exact `0.4.0`.
24
24
 
25
25
  A matching version string is not evidence of a matching artifact: also compare
26
26
  `V1_SCHEMA_DIGEST` (see [Invariants](#invariants-enforced-in-ci)). Two builds both called
27
- `0.3.0` — a registry copy and a `file:` tarball, say — can carry different schemas.
27
+ `0.4.0` — a registry copy and a `file:` tarball, say — can carry different schemas.
28
+
29
+ `zod` is a peer dependency, and since `0.3.1` an **optional** one — required only if you import a
30
+ zod-bearing entry point. Which case you are in is decided entirely by your imports; see
31
+ [Consumers](#consumers).
32
+
33
+ ## Migrating 0.3.1 -> 0.4.0
34
+
35
+ `0.3.1` was never published, so **`0.4.0` is the upgrade from `0.3.0`** and carries `0.3.1`'s
36
+ change as well. It is a BREAKING release under 0.x semver (breaking bumps the minor while the
37
+ major is 0), and it carries ONE breaking change plus two additive ones. The break is scoped to
38
+ consumers that read the **SVM** branch of a quote's funding transaction; EVM quotes are
39
+ byte-identical to `0.3.0`. Nothing here rejects a request body `0.3.0` accepted, and no existing
40
+ code, status, or `legacyCodes` mapping moved.
41
+
42
+ **`V1_SCHEMA_DIGEST` MOVES.** Both digest inputs changed (`errors/catalog.lock.json` gained four
43
+ codes, and `openapi/v1.json` was regenerated for both the instruction list and the new response
44
+ member), so the value is now
45
+ `1d8e88e957795b23e1317dc1e3783fd64bf79b756e3f28bd40e02b047542d790` — was
46
+ `3d41b4893b54e77e9ea56c24af1d7a1e9de0685ee911e497834dcd746e72c1f6` on `0.3.0`/`0.3.1`. Every
47
+ consumer running `assertNoSkew` must move to the new value **in the same rollout**: the check
48
+ compares services against each other, so a fleet running two versions fails it by design.
49
+
50
+ **THE BREAKING HALF FIRST (PAR-576), then the two additive ones (PAR-601, PAR-605).**
51
+
52
+ **The SVM funding transaction is now an ORDERED LIST OF INSTRUCTIONS, not a serialized
53
+ transaction.** `SvmTransactionSchema` dropped `serializedTransaction` and gained `feePayer`
54
+ and `instructions`:
55
+
56
+ ```diff
57
+ -{ "kind": "svm", "chainId": 1399811149, "serializedTransaction": "<base64 tx>" }
58
+ +{
59
+ + "kind": "svm",
60
+ + "chainId": 1399811149,
61
+ + "feePayer": "<base58 pubkey>",
62
+ + "instructions": [
63
+ + {
64
+ + "programId": "<base58 pubkey>",
65
+ + "accounts": [{ "pubkey": "<base58>", "isSigner": true, "isWritable": true }],
66
+ + "data": "<base64: 8-byte Anchor discriminator + Borsh args>"
67
+ + }
68
+ + ]
69
+ +}
70
+ ```
71
+
72
+ `serializedTransaction` is not deprecated-but-accepted; the key is gone and a body carrying
73
+ it fails `QuoteResponseSchema`. That is deliberate — response schemas are `looseObject`, so
74
+ leaving the old key valid would let a consumer keep reading a field the server no longer
75
+ fills and get `undefined` at signing time instead of a named rejection.
76
+
77
+ **Why the break, since `0.3.1` never shipped a working SVM quote:** a serialized Solana
78
+ transaction embeds a recent blockhash, valid for roughly 150 slots — 60 to 90 seconds. Every
79
+ realistic caller flow (fetch the quote, render it, let a human review it, sign, submit) is
80
+ longer than that, so the transaction was already dead when the caller signed it, the failure
81
+ surfaced as an opaque `BlockhashNotFound`, and the schema carried no field with which to
82
+ refresh it. The old shape was undeliverable rather than merely awkward. Instructions have no
83
+ expiry: the caller fetches its own blockhash at signing time, which is how every Solana
84
+ wallet already works.
85
+
86
+ **What the caller now owns.** In order:
87
+
88
+ 1. Fetch a recent blockhash (or use a durable nonce).
89
+ 2. Compile `instructions` **in the given order** into a legacy or v0 message, with `feePayer`
90
+ as the fee payer.
91
+ 3. Sign with every key marked `isSigner` — `feePayer` is always one of them.
92
+ 4. Choose its own compute-unit limit and priority fee. None is prescribed.
93
+
94
+ **Two contracts that are load-bearing, and that no schema can check for you:**
95
+
96
+ - **`instructions[].accounts` is POSITIONAL.** Solana resolves an instruction's accounts by
97
+ INDEX. Pass the array through verbatim — do not sort it, deduplicate it, drop an account
98
+ that also appears in another instruction, or regroup signers and writables. A permuted list
99
+ is a different instruction that still validates, and it fails on-chain with an unhelpful
100
+ message (a permuted Eco Portal `fund` reports `InvalidVault`, `InvalidAta` or
101
+ `InvalidTokenTransferAccounts` depending on which pair swapped). The schema does not know
102
+ which program `programId` is, so it cannot police this; it validates each entry's shape and
103
+ the PRESENCE of both privilege flags, and nothing more.
104
+ - **`instructions` may exceed one transaction, and that is not an error.** A public-visibility
105
+ quote emits `Portal.publish` (carrying the whole route preimage) plus `Portal.fund`, and
106
+ Solana's packet ceiling is 1232 bytes: an EVM-destination route with one token and one call
107
+ ABI-encodes to about 600 bytes, so `publish` alone is roughly 710 bytes of instruction data,
108
+ `fund` adds about 173, and ten unique pubkeys add about 320 — over the ceiling before
109
+ headers. The instructions are independent on-chain, so submit them in the given order across
110
+ two transactions, or compile a v0 message against your own address-lookup table. Splitting is
111
+ safe; reordering is not.
112
+
113
+ **No address-lookup-table references are emitted.** An ALT must already exist on-chain and
114
+ eco-router has no Solana RPC with which to create or read one, so every account is inline and
115
+ the message compiles as legacy. Bring your own ALT if you want a v0 message; the account metas
116
+ are unaffected by that choice.
117
+
118
+ **`isSigner` and `isWritable` are REQUIRED booleans** on every account meta, never optional and
119
+ never defaulted. Both directions of a wrong value are a real failure — a missing `isWritable`
120
+ makes the program's write revert, a missing `isSigner` makes Anchor's `Signer` constraint reject
121
+ the instruction — so absence is a 400 rather than a guess.
122
+
123
+ **New, additive:** the `Base64Bytes` primitive (standard padded base64; URL-safe, unpadded, and
124
+ whitespace-bearing values are rejected, because Node's decoder silently accepts all three and
125
+ strict decoders do not), plus the `SvmAccountMetaSchema` / `SvmInstructionSchema` schemas and the
126
+ zod-free `V1SvmAccountMeta` / `V1SvmInstruction` aliases.
127
+
128
+ **Unchanged:** the EVM branch, every request schema, and the error catalog — it gained NO new
129
+ codes from this change.
130
+
131
+ **TVM STAYS UNREPRESENTABLE, AND THAT IS NOW A DECISION RATHER THAN AN OPEN QUESTION.** Tron is
132
+ OUT OF SCOPE for `/v1` funding. `FundingTransactionSchema` has no `tvm` member, a `kind: "tvm"`
133
+ transaction fails `QuoteResponseSchema`, and eco-router answers `chain-not-supported` (422) for a
134
+ Tron-source funding quote. Do not read the SVM lane as a precedent that a `tvm` branch is queued
135
+ behind it: adding one would be a breaking wire change with its own migration note, and nothing
136
+ here commits `/v1` to that surface.
137
+
138
+ **Added — the `errors` problem extension (per-field caller faults).**
139
+
140
+ ```json
141
+ {
142
+ "type": "https://.../invalid-request",
143
+ "title": "Invalid request",
144
+ "status": 400,
145
+ "code": "invalid-request",
146
+ "detail": "source.chainId: must be a supported chain id",
147
+ "errors": [{ "field": "source.chainId", "detail": "must be a supported chain id" }]
148
+ }
149
+ ```
150
+
151
+ `errors` is **OPTIONAL**: an `invalid-request` for a body that is not JSON at all has no
152
+ field to name, so absence is legal and means exactly that. `field` names the offending
153
+ input in YOUR terms — the path into what you sent (`body.source.chainId`, `query.limit`) —
154
+ and `detail` obeys the same free-text policy as the problem's own `detail`.
155
+
156
+ **`errors` is NOT `solverErrors`.** They sit adjacent and answer different questions:
157
+ `errors` is your own fault (a field you sent, and naming it is how you fix it);
158
+ `solverErrors` is a downstream solver's failure, which you did not cause and usually
159
+ cannot fix. A body never needs both to explain one failure. The name `errors` is the
160
+ de-facto RFC 9457 validation extension (Spring `ProblemDetail`, ASP.NET
161
+ `ValidationProblemDetails`), so it is probably already in your SDK.
162
+
163
+ `problemFromZodError` populates it from the issues it already renders into `detail`, so
164
+ you get the machine-readable form for free — bounded to 8 entries, and an issue with no
165
+ path is omitted rather than given a placeholder field.
166
+
167
+ **Added — `chains`, REQUIRED on the deposit-address create response (PAR-571).**
168
+
169
+ ```json
170
+ {
171
+ "id": "deposit-address:0x…",
172
+ "chains": [
173
+ { "chainId": 8453, "source": true, "registration": "registered" },
174
+ { "chainId": 137, "source": false, "registration": "registered" }
175
+ ]
176
+ }
177
+ ```
178
+
179
+ Four identifiers, two pairs, and the members of a pair are one word apart — pair them
180
+ carefully, because the wrong pairing still compiles.
181
+ **`DepositAddressChainRegistrationSchema`** is the ENUM and
182
+ **`DepositAddressChainRegistration`** its inferred type;
183
+ **`DepositAddressChainStatusSchema`** is the OBJECT that `chains[]` holds and
184
+ **`DepositAddressChainStatus`** its inferred type. The `Schema` suffix is what distinguishes
185
+ schema from type — the bare name is always the type.
186
+
187
+ **REQUIRED on the create response, and absent from the shared record.**
188
+ `DepositAddressCreateResponseSchema` is now `DepositAddressSchema.extend({ chains })`
189
+ rather than a bare alias. If you read a create response, `chains` is always there; if you
190
+ read a lookup page, it is never there. That is deliberate — an optional member on the
191
+ shared record would make one key mean "bug" on one lane and "correct" on the other, with
192
+ nothing in the type to distinguish them. **Migration:** a server build that returns 201
193
+ without `chains` now fails its own response schema.
194
+
195
+ `.min(1)`: the source chain is always attempted, so an empty array could only mean the
196
+ producer lost the outcome — and an empty `chains` reads as "no chain is live", the
197
+ opposite of what a 201 means.
198
+
199
+ **Two constraints are enforced beyond the shape:** exactly one entry has `source: true`,
200
+ and no `chainId` repeats. `source` is what tells you which chain the top-level
201
+ `depositAddress` is definitely correct for, so zero or two source entries would be a
202
+ silently wrong answer about where funds may go. Errors name the field and carry the count
203
+ (`chains must contain exactly one source entry, found 2`); a duplicate is reported at the
204
+ offending index.
205
+
206
+ These live in a `superRefine`, which means **they do not appear in `openapi/v1.json`** —
207
+ `z.toJSONSchema` drops refinements. Validate against the zod schema if you need them
208
+ enforced; a client generated from the OpenAPI document alone will accept a body the zod
209
+ schema rejects.
210
+
211
+ **What `.min(1)` does NOT give you:** it rejects an empty array, not an incomplete one. A
212
+ schema cannot know which chains should be present. Completeness is a producer guarantee —
213
+ deposit-addresses builds the array from the full attempted set — not something validated
214
+ here.
215
+
216
+ Two things to read correctly:
217
+
218
+ - **`registration` is binary today.** The enum exists so `'pending'` can be added
219
+ additively if a retry lane is ever built; there is no such lane, so do not look for a
220
+ third state.
221
+ - **`registration: "registered"` means the chain-state ROW EXISTS.** That row is what the
222
+ polling services rebuild their watch set from at boot. It does NOT promise the
223
+ in-process publish succeeded, so it can **lead the live process by one restart**. Read
224
+ it as "known, and picked up no later than the next boot" — never "being watched right
225
+ now". It is also **not** `isDeployed`, which is CREATE2 deployment of the address
226
+ contract: `isDeployed: false` does not mean "do not send funds here".
227
+
228
+ New zod-free aliases: `V1DepositAddressChainStatus` and `V1DepositAddressCreateResponse`.
229
+
230
+ **Added — four error codes for the transport statuses `/v1` could not answer (PAR-601).**
231
+
232
+ | Code | Status | Reached by |
233
+ | ------------------------ | ------ | ------------------------------------------------------------ |
234
+ | `endpoint-not-found` | 404 | a typo'd path — no `/v1` endpoint at that path |
235
+ | `method-not-allowed` | 405 | a real path, wrong HTTP method |
236
+ | `request-too-large` | 413 | body bytes over the limit, or too many urlencoded parameters |
237
+ | `unsupported-media-type` | 415 | an unsupported media type, charset, or content encoding |
238
+
239
+ All four are `audience: 'all'` and carry no `legacyCodes`. Before `0.4.0` these four statuses
240
+ had no catalog code at all, so a `/v1` response at any of them fell through to eco-router's
241
+ legacy envelope — a partner SDK keying on `type`/`code` saw neither.
242
+
243
+ **The one newly-possible rejection, and it is consumer-side.** `V1ProblemSchema` cross-checks a
244
+ KNOWN code's `status`/`type` against the catalog and ignores codes it does not know. These four
245
+ are now known, so a problem body carrying one of them with a CONTRADICTING status or type stops
246
+ parsing where `0.3.0` tolerated it as "a newer server". If you already emit any of these four
247
+ spellings, confirm the status and `type` match the table above before upgrading.
248
+
249
+ **`endpoint-not-found` is NOT `token-not-found`.** Both are 404. A consumer branching on status
250
+ alone will conflate "that path does not exist" with "that token is unknown on that chain" —
251
+ branch on `code`.
252
+
253
+ **Exhaustive `switch` over `V1ErrorCode` will not compile until you handle the four.** That is
254
+ the intended signal, not a break to work around.
255
+
256
+ **Added — `/v1/chains` may advertise the deployment's effective page bounds (PAR-605).**
257
+
258
+ ```json
259
+ {
260
+ "chains": [{ "chainId": 8453, "...": "..." }],
261
+ "limits": { "paging": { "maxLimit": 25, "defaultLimit": 10 } }
262
+ }
263
+ ```
264
+
265
+ `limits` is **OPTIONAL**, and **absence has a documented meaning: the published `PagingFields`
266
+ bounds apply** — cap `STATUS_PAGE_MAX_LIMIT` (50), default `STATUS_PAGE_DEFAULT_LIMIT` (20),
267
+ which is exactly the `0.3.0` contract. So a server that does not populate it stays correct and
268
+ a consumer needs no new branch. When `limits` IS present, `paging` is required inside it:
269
+ `limits: {}` is rejected rather than read as "bounds advertised, none given".
270
+
271
+ An operator may only NARROW, so both numbers are capped at the canon values, and
272
+ `defaultLimit <= maxLimit` is enforced — a deployment cannot advertise a first page it would
273
+ reject on request.
274
+
275
+ Read it if you choose page sizes programmatically. The 400 that names the bound is unchanged;
276
+ this exists so the bound is discoverable in one request rather than one rejection.
277
+
278
+ **Scope — it is the bound of the service serving that document.** eco-router serves
279
+ `/v1/chains` and `/v1/intents/status` from one config, so its answer covers both.
280
+ `/v1/deposit-addresses/status` and the `/v1/deposit-addresses` lookup are the
281
+ deposit-addresses service's, paged from its own config; `DepositAddressLookupResponseSchema`
282
+ deliberately does not carry this member.
283
+
284
+ **Carried over from the unpublished `0.3.1`: the `zod` peer is now `optional`.** The range is
285
+ unchanged (`^4.3.0`). It only widens the set of installs that resolve cleanly — a consumer
286
+ importing only the zod-free entry points (`./v1/signature`, `./v1/types`) no longer gets a
287
+ permanently wrong unmet-peer warning. `optional` suppresses the warning only when zod is
288
+ ABSENT: a consumer holding a zod outside `^4.3.0` still sees a version-mismatch warning.
28
289
 
29
290
  ## Migrating 0.2.0 -> 0.3.0
30
291
 
@@ -134,11 +395,32 @@ must: it is the artifact identity, not the version string.
134
395
  | 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` |
135
396
  | any consumer needing `signatureHash` | `import { signatureHash } from '@eco-foundation/api-schemas/v1/signature'` | NONE — that subpath is zod-free |
136
397
 
398
+ **Do you need `zod`? Only if you import a zod-bearing entry point.** Since `0.3.1` the peer is
399
+ declared optional (`peerDependenciesMeta: { zod: { optional: true } }`), because for two of the
400
+ published entry points it is genuinely not needed:
401
+
402
+ - **Needs `zod` (`^4.3.0`):** the bare package name `.`, `./testing`, and anything reached
403
+ through the `v1` namespace on either. These load schema modules, and their `.d.ts` names zod
404
+ types.
405
+ - **Needs NO `zod`:** `./v1/signature` (runtime code importing `@noble/hashes` and nothing else)
406
+ and `./v1/types` (plain `type` aliases, erased at compile time). A consumer whose imports stay
407
+ inside these two installs only `@noble/hashes` — declaring zod would be dead weight.
408
+
409
+ Read `optional` narrowly: it says zod **may be absent**, not that any zod version works. pnpm
410
+ suppresses the unmet-peer warning only when zod is MISSING (verified against pnpm 10.16); a
411
+ consumer that HAS a zod outside `^4.3.0` — solver-v2, on zod 3 — still sees
412
+ `unmet peer zod@^4.3.0: found <version>`, since that is a version mismatch rather than a missing
413
+ peer. Suppressing that one is the consumer's own call
414
+ (`pnpm.peerDependencyRules.allowedVersions`), and it is safe exactly while its imports are
415
+ limited to the two zod-free subpaths above. The range itself cannot be widened — the schemas
416
+ require Zod 4.
417
+
137
418
  Zod-major compatibility is the reason there are two interfaces, not one:
138
419
 
139
420
  - **Zod-4 consumers** (eco-router `^4.4.3`, deposit-addresses `^4.3.5`) import the schemas
140
- directly. Since `0.2.0`, `zod` is a **`peerDependency` with a range (`^4.3.0`)**, not a
141
- hard-pinned dependency: the consumer's own single copy satisfies it. The previous exact
421
+ directly. Since `0.2.0`, `zod` is a **`peerDependency` with a range (`^4.3.0`)** — optional
422
+ since `0.3.1` — not a hard-pinned dependency: the consumer's own single copy satisfies it. For
423
+ these consumers optional changes nothing; they must still install zod. The previous exact
142
424
  `dependencies` pin at `4.4.3` materialised a SECOND nested zod for every consumer not on that
143
425
  exact version, and two zod instances in one type graph is the documented failure — `TS2345` on
144
426
  `_zod.version.minor` when a package schema is passed to a local `z.ZodType<T>`, and `tsc`
@@ -269,7 +551,7 @@ workflow verifies and publishes. It fails with `::error::tag version <x> != pack
269
551
  if the two drift, so a stale tag can never publish a mismatched artifact.
270
552
 
271
553
  Semver: breaking schema change = major, additive = minor; consumers pin minor. **While the
272
- package is 0.x, "pin minor" means `~0.3.0` or the exact `0.3.0` — never `^0`** (see
554
+ package is 0.x, "pin minor" means `~0.4.0` or the exact `0.4.0` — never `^0`** (see
273
555
  [Install](#install)). Consumers additionally compare `V1_SCHEMA_DIGEST`: a matching version
274
556
  string is not evidence of a matching artifact. `/v1/routes` is draft-tagged and exempt until its
275
557
  stability flips.
@@ -15,6 +15,18 @@
15
15
  "destinationAddress": "0x1111111111111111111111111111111111111111",
16
16
  "destinationChainId": 137,
17
17
  "expiresAt": null,
18
- "createdAt": 1767225000
18
+ "createdAt": 1767225000,
19
+ "chains": [
20
+ {
21
+ "chainId": 8453,
22
+ "source": true,
23
+ "registration": "registered"
24
+ },
25
+ {
26
+ "chainId": 137,
27
+ "source": false,
28
+ "registration": "registered"
29
+ }
30
+ ]
19
31
  }
20
32
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "digest": "3d41b4893b54e77e9ea56c24af1d7a1e9de0685ee911e497834dcd746e72c1f6",
2
+ "digest": "1d8e88e957795b23e1317dc1e3783fd64bf79b756e3f28bd40e02b047542d790",
3
3
  "inputs": [
4
4
  "errors/catalog.lock.json",
5
5
  "openapi/v1.json"
package/dist/index.d.ts CHANGED
@@ -3,4 +3,4 @@ export { generateOpenApiDocument, STABLE_TAG } from './openapi';
3
3
  export type { V1Fixture } from './testing';
4
4
  export { assertMatchesV1Schema, loadV1Fixtures } from './testing';
5
5
  export * as v1 from './v1';
6
- export type { LegacyCodeRef, V1Chain, V1ChainType, V1DepositAddress, V1DepositAddressCreateRequest, V1DepositAddressKind, V1DestinationCall, V1ErrorCode, V1ErrorDefinition, V1Execution, V1Fee, V1FeeKind, V1FeeToken, V1FundingTransaction, V1GaslessJob, V1GaslessJobStatus, V1GaslessSubState, V1GaslessSubStatus, V1Guarantee, V1IntentCall, V1IntentReward, V1IntentRoute, V1IntentTokenAmount, V1ProblemBody, V1QuoteCore, V1QuoteRequest, V1QuoteResponse, V1RankedQuoteEntry, V1RelatedIntent, V1RelatedIntentRole, V1SolverIdentity, V1StatusEntry, V1StatusType, V1Step, V1StepKind, V1StepLeg, V1SwapType, V1TokenEntry, V1Visibility, } from './v1/types';
6
+ export type { LegacyCodeRef, V1Chain, V1ChainType, V1DepositAddress, V1DepositAddressChainStatus, V1DepositAddressCreateRequest, V1DepositAddressCreateResponse, V1DepositAddressKind, V1DestinationCall, V1ErrorCode, V1ErrorDefinition, V1Execution, V1Fee, V1FeeKind, V1FeeToken, V1FundingTransaction, V1GaslessJob, V1GaslessJobStatus, V1GaslessSubState, V1GaslessSubStatus, V1Guarantee, V1IntentCall, V1IntentReward, V1IntentRoute, V1IntentTokenAmount, V1ProblemBody, V1QuoteCore, V1QuoteRequest, V1QuoteResponse, V1RankedQuoteEntry, V1RelatedIntent, V1RelatedIntentRole, V1SolverIdentity, V1StatusEntry, V1StatusType, V1Step, V1StepKind, V1StepLeg, V1SvmAccountMeta, V1SvmInstruction, V1SwapType, V1TokenEntry, V1Visibility, } from './v1/types';
@@ -26,6 +26,13 @@ export declare const ChainSchema: z.ZodObject<{
26
26
  }, z.core.$loose>;
27
27
  }, z.core.$loose>;
28
28
  export type Chain = z.input<typeof ChainSchema>;
29
+ export declare const V1LimitsSchema: z.ZodObject<{
30
+ paging: z.ZodObject<{
31
+ maxLimit: z.ZodNumber;
32
+ defaultLimit: z.ZodNumber;
33
+ }, z.core.$loose>;
34
+ }, z.core.$loose>;
35
+ export type V1Limits = z.input<typeof V1LimitsSchema>;
29
36
  export declare const ChainsResponseSchema: z.ZodObject<{
30
37
  chains: z.ZodArray<z.ZodObject<{
31
38
  chainId: z.ZodNumber;
@@ -49,4 +56,10 @@ export declare const ChainsResponseSchema: z.ZodObject<{
49
56
  executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>>;
50
57
  }, z.core.$loose>;
51
58
  }, z.core.$loose>>;
59
+ limits: z.ZodOptional<z.ZodObject<{
60
+ paging: z.ZodObject<{
61
+ maxLimit: z.ZodNumber;
62
+ defaultLimit: z.ZodNumber;
63
+ }, z.core.$loose>;
64
+ }, z.core.$loose>>;
52
65
  }, z.core.$loose>;
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ChainsResponseSchema = exports.ChainSchema = exports.ChainContractsSchema = void 0;
3
+ exports.ChainsResponseSchema = exports.V1LimitsSchema = exports.ChainSchema = exports.ChainContractsSchema = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const enums_1 = require("../enums");
6
6
  const primitives_1 = require("../primitives");
7
+ const status_1 = require("./status");
7
8
  exports.ChainContractsSchema = zod_1.z.looseObject({
8
9
  portal: primitives_1.AnyAddress,
9
10
  executor: primitives_1.AnyAddress.nullable(),
@@ -17,7 +18,11 @@ exports.ChainSchema = zod_1.z.looseObject({
17
18
  status: enums_1.ChainStatus,
18
19
  contracts: exports.ChainContractsSchema,
19
20
  });
21
+ exports.V1LimitsSchema = zod_1.z.looseObject({
22
+ paging: status_1.PagingBoundsSchema,
23
+ });
20
24
  exports.ChainsResponseSchema = zod_1.z.looseObject({
21
25
  chains: zod_1.z.array(exports.ChainSchema),
26
+ limits: exports.V1LimitsSchema.optional(),
22
27
  });
23
28
  //# sourceMappingURL=chains.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../src/v1/endpoints/chains.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,oCAAiE;AACjE,8CAAoD;AAKvC,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,uBAAU;IAMlB,QAAQ,EAAE,uBAAU,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,OAAC,CAAC,WAAW,CAAC;IACvC,OAAO,EAAE,oBAAO;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IASvB,WAAW,EAAE,uBAAU;IAEvB,IAAI,EAAE,iBAAS;IACf,QAAQ,EAAE,qBAAa;IAEvB,MAAM,EAAE,mBAAW;IACnB,SAAS,EAAE,4BAAoB;CAChC,CAAC,CAAC;AAGU,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAW,CAAC;CAC7B,CAAC,CAAC"}
1
+ {"version":3,"file":"chains.js","sourceRoot":"","sources":["../../../src/v1/endpoints/chains.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,oCAAiE;AACjE,8CAAoD;AACpD,qCAA8C;AAKjC,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,uBAAU;IAMlB,QAAQ,EAAE,uBAAU,CAAC,QAAQ,EAAE;CAChC,CAAC,CAAC;AAEU,QAAA,WAAW,GAAG,OAAC,CAAC,WAAW,CAAC;IACvC,OAAO,EAAE,oBAAO;IAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;IASvB,WAAW,EAAE,uBAAU;IAEvB,IAAI,EAAE,iBAAS;IACf,QAAQ,EAAE,qBAAa;IAEvB,MAAM,EAAE,mBAAW;IACnB,SAAS,EAAE,4BAAoB;CAChC,CAAC,CAAC;AAwCU,QAAA,cAAc,GAAG,OAAC,CAAC,WAAW,CAAC;IAC1C,MAAM,EAAE,2BAAkB;CAC3B,CAAC,CAAC;AAGU,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,mBAAW,CAAC;IAC5B,MAAM,EAAE,sBAAc,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
@@ -40,6 +40,20 @@ export declare const DepositAddressSchema: z.ZodObject<{
40
40
  createdAt: z.ZodNumber;
41
41
  }, z.core.$loose>;
42
42
  export type DepositAddress = z.input<typeof DepositAddressSchema>;
43
+ export declare const DepositAddressChainRegistrationSchema: z.ZodEnum<{
44
+ registered: "registered";
45
+ unregistered: "unregistered";
46
+ }>;
47
+ export type DepositAddressChainRegistration = z.infer<typeof DepositAddressChainRegistrationSchema>;
48
+ export declare const DepositAddressChainStatusSchema: z.ZodObject<{
49
+ chainId: z.ZodNumber;
50
+ source: z.ZodBoolean;
51
+ registration: z.ZodEnum<{
52
+ registered: "registered";
53
+ unregistered: "unregistered";
54
+ }>;
55
+ }, z.core.$loose>;
56
+ export type DepositAddressChainStatus = z.input<typeof DepositAddressChainStatusSchema>;
43
57
  export declare const DepositAddressCreateResponseSchema: z.ZodObject<{
44
58
  id: z.ZodString;
45
59
  depositAddress: z.ZodString;
@@ -54,7 +68,16 @@ export declare const DepositAddressCreateResponseSchema: z.ZodObject<{
54
68
  destinationChainId: z.ZodOptional<z.ZodNumber>;
55
69
  expiresAt: z.ZodNullable<z.ZodNumber>;
56
70
  createdAt: z.ZodNumber;
71
+ chains: z.ZodArray<z.ZodObject<{
72
+ chainId: z.ZodNumber;
73
+ source: z.ZodBoolean;
74
+ registration: z.ZodEnum<{
75
+ registered: "registered";
76
+ unregistered: "unregistered";
77
+ }>;
78
+ }, z.core.$loose>>;
57
79
  }, z.core.$loose>;
80
+ export type DepositAddressCreateResponse = z.input<typeof DepositAddressCreateResponseSchema>;
58
81
  export declare const DEPOSIT_ADDRESS_LOOKUP_QUERY_SHAPE: {
59
82
  cursor: z.ZodOptional<z.ZodString>;
60
83
  limit: z.ZodDefault<z.ZodCoercedNumber<unknown>>;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DepositAddressLookupResponseSchema = exports.DepositAddressLookupQuerySchema = exports.DEPOSIT_ADDRESS_LOOKUP_QUERY_SHAPE = exports.DepositAddressCreateResponseSchema = exports.DepositAddressSchema = exports.DepositAddressCreateRequestSchema = exports.DepositAddressKind = exports.DEPOSIT_ADDRESS_KINDS = void 0;
3
+ exports.DepositAddressLookupResponseSchema = exports.DepositAddressLookupQuerySchema = exports.DEPOSIT_ADDRESS_LOOKUP_QUERY_SHAPE = exports.DepositAddressCreateResponseSchema = exports.DepositAddressChainStatusSchema = exports.DepositAddressChainRegistrationSchema = exports.DepositAddressSchema = exports.DepositAddressCreateRequestSchema = exports.DepositAddressKind = exports.DEPOSIT_ADDRESS_KINDS = void 0;
4
4
  const zod_1 = require("zod");
5
5
  const primitives_1 = require("../primitives");
6
6
  const status_1 = require("./status");
@@ -38,7 +38,39 @@ exports.DepositAddressSchema = zod_1.z.looseObject({
38
38
  expiresAt: primitives_1.UnixSeconds.nullable(),
39
39
  createdAt: primitives_1.UnixSeconds,
40
40
  });
41
- exports.DepositAddressCreateResponseSchema = exports.DepositAddressSchema;
41
+ exports.DepositAddressChainRegistrationSchema = zod_1.z.enum(['registered', 'unregistered']);
42
+ exports.DepositAddressChainStatusSchema = zod_1.z.looseObject({
43
+ chainId: primitives_1.ChainId,
44
+ source: zod_1.z.boolean(),
45
+ registration: exports.DepositAddressChainRegistrationSchema,
46
+ });
47
+ exports.DepositAddressCreateResponseSchema = exports.DepositAddressSchema.extend({
48
+ chains: zod_1.z.array(exports.DepositAddressChainStatusSchema).min(1),
49
+ }).superRefine((body, ctx) => {
50
+ const chains = body.chains;
51
+ if (!Array.isArray(chains))
52
+ return;
53
+ const sourceCount = chains.filter((entry) => entry.source === true).length;
54
+ if (sourceCount !== 1) {
55
+ ctx.addIssue({
56
+ code: 'custom',
57
+ path: ['chains'],
58
+ message: `chains must contain exactly one source entry, found ${sourceCount}`,
59
+ });
60
+ }
61
+ const seen = new Set();
62
+ chains.forEach((entry, index) => {
63
+ if (seen.has(entry.chainId)) {
64
+ ctx.addIssue({
65
+ code: 'custom',
66
+ path: ['chains', index, 'chainId'],
67
+ message: `chains must not repeat a chainId, ${entry.chainId} appears more than once`,
68
+ });
69
+ return;
70
+ }
71
+ seen.add(entry.chainId);
72
+ });
73
+ });
42
74
  const DEPOSIT_ADDRESS_LOOKUP_FILTERS = [
43
75
  'depositAddress',
44
76
  'depositor',
@@ -1 +1 @@
1
- {"version":3,"file":"deposit-addresses.js","sourceRoot":"","sources":["../../../src/v1/endpoints/deposit-addresses.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,8CAOuB;AACvB,qCAAiE;AAepD,QAAA,qBAAqB,GAAG,CAAC,QAAQ,EAAE,SAAS,EAAE,eAAe,CAAU,CAAC;AACxE,QAAA,kBAAkB,GAAG,OAAC,CAAC,IAAI,CAAC,6BAAqB,CAAC,CAAC;AAkBnD,QAAA,iCAAiC,GAAG,OAAC,CAAC,kBAAkB,CAAC,MAAM,EAAE;IAC5E,OAAC,CAAC,YAAY,CAAC;QACb,OAAO,EAAE,oBAAO;QAChB,SAAS,EAAE,uBAAU;QACrB,IA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