@eco-foundation/api-schemas 0.13.0 → 0.14.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
@@ -14,13 +14,13 @@ 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.13.0"
17
+ "@eco-foundation/api-schemas": "~0.14.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.13.0` or the exact `0.13.0`.
23
+ future breaking `0.y` — it is not a pin at all. Use `~0.14.0` or the exact `0.14.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
@@ -30,6 +30,36 @@ A matching version string is not evidence of a matching artifact: also compare
30
30
  zod-bearing entry point. Which case you are in is decided entirely by your imports; see
31
31
  [Consumers](#consumers).
32
32
 
33
+ ## Migrating 0.13.0 -> 0.14.0
34
+
35
+ **BREAKING only for consumers of the draft `/v1/routes` schemas.** No stable endpoint changes.
36
+ `/v1/routes` stays `stability: 'draft'`.
37
+
38
+ **`V1_SCHEMA_DIGEST` MOVES** to
39
+ `b5a7e99f743687c57fb0cda933a772c03e71e43f6581766eae2c79935b061c5b`, because `openapi/v1.json`
40
+ changed. Every consumer running `assertNoSkew` moves in the same rollout.
41
+
42
+ New exports: `ROUTES_LIST_QUERY_SHAPE`, `ROUTES_CURSOR_MAX_LENGTH`, `RoutesListQuerySchema`,
43
+ `RouteLimitsSchema`, `RoutePairLegSchema`, `RoutePairSchema`, `RouteChainSchema`,
44
+ `RouteAnyAssetSchema`, and the types `RoutesListQuery`, `RouteEntry`, `RoutesResponse`.
45
+
46
+ **1. `RouteEntrySchema` is one row per chain pair.** A row is
47
+ `{ source: { chainId }, destination: { chainId }, pairs, anyAsset }`. `pairs[]` holds
48
+ `{ baseline, source, destination }`, where each side is `{ token, symbol, decimals, limits }` and
49
+ `limits` is `{ min?, max? }` in base-unit integer strings. `anyAsset` is
50
+ `{ source: boolean, destination: boolean }`. The placeholder fields `source.token`,
51
+ `destination.token` and `swapTypes` are gone.
52
+
53
+ **2. `RoutesResponseSchema` gains a required `updatedAt`**, a Unix-seconds number (`UnixSeconds`),
54
+ matching every other /v1 timestamp.
55
+
56
+ **3. `/v1/routes` publishes three optional query parameters** through
57
+ `ROUTES_LIST_QUERY_SHAPE` / `RoutesListQuerySchema`: `sourceChainId`, `destinationChainId`
58
+ (both `ChainIdParam`) and `cursor`.
59
+
60
+ **4. The `routes.list` golden fixture** now carries a Base -> Arbitrum row with two pairs. It is
61
+ still draft-tagged, so live replay still skips it.
62
+
33
63
  ## Migrating 0.12.0 -> 0.13.0
34
64
 
35
65
  **BREAKING under 0.x semver only for exhaustive handling of `V1ErrorCode`.** Nothing on the wire
@@ -10,17 +10,44 @@
10
10
  "payload": {
11
11
  "routes": [
12
12
  {
13
- "source": {
14
- "chainId": 8453,
15
- "token": "0x1111111111111111111111111111111111111111"
16
- },
17
- "destination": {
18
- "chainId": 10,
19
- "token": "0x1111111111111111111111111111111111111111"
20
- },
21
- "swapTypes": ["exact-in"]
13
+ "source": { "chainId": 8453 },
14
+ "destination": { "chainId": 42161 },
15
+ "pairs": [
16
+ {
17
+ "baseline": true,
18
+ "source": {
19
+ "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
20
+ "symbol": "USDC",
21
+ "decimals": 6,
22
+ "limits": { "min": "1000000", "max": "50000000000" }
23
+ },
24
+ "destination": {
25
+ "token": "0xaf88d065e77c8cC2239327C5EDb3A432268e5831",
26
+ "symbol": "USDC",
27
+ "decimals": 6,
28
+ "limits": { "min": "1000000", "max": "50000000000" }
29
+ }
30
+ },
31
+ {
32
+ "baseline": false,
33
+ "source": {
34
+ "token": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
35
+ "symbol": "USDC",
36
+ "decimals": 6,
37
+ "limits": { "min": "1000000", "max": "20000000000" }
38
+ },
39
+ "destination": {
40
+ "token": "0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",
41
+ "symbol": "USDT",
42
+ "decimals": 6,
43
+ "limits": { "max": "20000000000" }
44
+ }
45
+ }
46
+ ],
47
+ "anyAsset": { "source": true, "destination": true }
22
48
  }
23
49
  ],
50
+ "updatedAt": 1791381600,
24
51
  "nextCursor": null
25
52
  }
26
53
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "digest": "e5a684f678f80135ddf7241029d965d2a206b3b573a9969ad1352610d1b4abc9",
2
+ "digest": "b5a7e99f743687c57fb0cda933a772c03e71e43f6581766eae2c79935b061c5b",
3
3
  "inputs": [
4
4
  "errors/catalog.lock.json",
5
5
  "openapi/v1.json"
@@ -683,27 +683,50 @@ export declare const V1_ENDPOINTS: {
683
683
  readonly 'routes.list': {
684
684
  readonly method: "GET";
685
685
  readonly path: "/v1/routes";
686
- readonly summary: "Enabled routes (DRAFT — final shape depends on the WS2 solver feed).";
686
+ readonly summary: string;
687
687
  readonly tag: "discovery";
688
688
  readonly stability: "draft";
689
689
  readonly successStatus: 200;
690
+ readonly query: {
691
+ sourceChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
692
+ destinationChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
693
+ cursor: z.ZodOptional<z.ZodString>;
694
+ };
690
695
  readonly response: z.ZodObject<{
691
696
  routes: z.ZodArray<z.ZodObject<{
692
697
  source: z.ZodObject<{
693
698
  chainId: z.ZodNumber;
694
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
695
699
  }, z.core.$loose>;
696
700
  destination: z.ZodObject<{
697
701
  chainId: z.ZodNumber;
698
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
699
702
  }, z.core.$loose>;
700
- swapTypes: z.ZodArray<z.ZodEnum<{
701
- custom: "custom";
702
- "exact-in": "exact-in";
703
- "exact-out": "exact-out";
704
- "gateway-deposit": "gateway-deposit";
705
- }>>;
703
+ pairs: z.ZodArray<z.ZodObject<{
704
+ baseline: z.ZodBoolean;
705
+ source: z.ZodObject<{
706
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
707
+ symbol: z.ZodString;
708
+ decimals: z.ZodNumber;
709
+ limits: z.ZodObject<{
710
+ min: z.ZodOptional<z.ZodString>;
711
+ max: z.ZodOptional<z.ZodString>;
712
+ }, z.core.$loose>;
713
+ }, z.core.$loose>;
714
+ destination: z.ZodObject<{
715
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
716
+ symbol: z.ZodString;
717
+ decimals: z.ZodNumber;
718
+ limits: z.ZodObject<{
719
+ min: z.ZodOptional<z.ZodString>;
720
+ max: z.ZodOptional<z.ZodString>;
721
+ }, z.core.$loose>;
722
+ }, z.core.$loose>;
723
+ }, z.core.$loose>>;
724
+ anyAsset: z.ZodObject<{
725
+ source: z.ZodBoolean;
726
+ destination: z.ZodBoolean;
727
+ }, z.core.$loose>;
706
728
  }, z.core.$loose>>;
729
+ updatedAt: z.ZodNumber;
707
730
  nextCursor: z.ZodNullable<z.ZodString>;
708
731
  }, z.core.$loose>;
709
732
  };
@@ -79,10 +79,12 @@ exports.V1_ENDPOINTS = {
79
79
  'routes.list': {
80
80
  method: 'GET',
81
81
  path: '/v1/routes',
82
- summary: 'Enabled routes (DRAFT — final shape depends on the WS2 solver feed).',
82
+ summary: 'Chain pairs the caller can quote: token pairs served directly, with order-size limits, ' +
83
+ 'and any-asset flags for the rest (DRAFT).',
83
84
  tag: 'discovery',
84
85
  stability: 'draft',
85
86
  successStatus: 200,
87
+ query: routes_1.ROUTES_LIST_QUERY_SHAPE,
86
88
  response: routes_1.RoutesResponseSchema,
87
89
  },
88
90
  'deposit-addresses.create': {
@@ -1 +1 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../../src/v1/endpoints/registry.ts"],"names":[],"mappings":";;;AAEA,+CAAoD;AACpD,qCAAyE;AACzE,2DAK6B;AAC7B,qCAAmE;AACnE,qCAAgD;AAChD,qCAIkB;AAClB,qCAOkB;AAClB,qCAAyE;AAmDzE,MAAM,cAAc,GAAG,CACrB,OAAwC,EACxC,QAAgB,EAChB,OAAkB,EACI,EAAE,CAAC,CAAC;IAC1B,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,OAAO,OAAO,WAAW,QAAQ,EAAE;IACzC,OAAO,EACL,mBAAmB,QAAQ,0DAA0D;QACrF,iEAAiE;IACnE,GAAG,EAAE,OAAO;IACZ,SAAS,EAAE,QAAQ;IACnB,aAAa,EAAE,GAAG;IAClB,OAAO;IACP,QAAQ,EAAE,yBAAgB;CAC3B,CAAC,CAAC;AAGU,QAAA,YAAY,GAAG;IAC1B,eAAe,EAAE;QACf,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,YAAY;QAClB,OAAO,EAAE,kBAAkB;QAC3B,GAAG,EAAE,QAAQ;QACb,SAAS,EAAE,QAAQ;QACnB,aAAa,EAAE,GAAG;QAClB,OAAO,EAAE,2BAAkB;QAC3B,QAAQ,EAAE,4BAAmB;KAC9B;IAID,yBAAyB,EAAE,cAAc,CAAC,SAAS,EAAE,UAAU,EAAE,mCAA0B,CAAC;IAC5F,wBAAwB,EAAE,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,4BAAmB,CAAC;IACnF,wBAAwB,EAAE,cAAc,CAAC,SAAS,EAAE,SAAS,EAAE,4BAAmB,CAAC;IAMnF,mCAAmC,EAAE,cAAc,CACjD,mBAAmB,EACnB,UAAU,EACV,0CAAiC,CAClC;IACD,mCAAmC,EAAE,cAAc,CACjD,mBAAmB,EACnB,UA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Q,EAAE,6BAAoB;KAC/B;IACD,aAAa,EAAE;QACb,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,YAAY;QAClB,OAAO,EACL,yFAAyF;YACzF,2CAA2C;QAC7C,GAAG,EAAE,WAAW;QAChB,SAAS,EAAE,OAAO;QAClB,aAAa,EAAE,GAAG;QAClB,KAAK,EAAE,gCAAuB;QAC9B,QAAQ,EAAE,6BAAoB;KAC/B;IACD,0BAA0B,EAAE;QAC1B,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,sDAAsD;QAC/D,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;QACnB,aAAa,EAAE,GAAG;QAClB,OAAO,EAAE,qDAAiC;QAC1C,QAAQ,EAAE,sDAAkC;KAC7C;IACD,0BAA0B,EAAE;QAC1B,MAAM,EAAE,KAAK;QACb,IAAI,EAAE,uBAAuB;QAC7B,OAAO,EAAE,yEAAyE;QAClF,GAAG,EAAE,mBAAmB;QACxB,SAAS,EAAE,QAAQ;QACnB,aAAa,EAAE,GAAG;QAKlB,KAAK,EAAE,sDAAkC;QACzC,QAAQ,EAAE,sDAAkC;KAC7C;CACsD,CAAC;AAK7C,QAAA,wBAAwB,GAAG,yBAAe,CAAC"}
@@ -1,37 +1,127 @@
1
1
  import { z } from 'zod';
2
2
  export declare const ROUTES_STABILITY: "draft";
3
+ export declare const ROUTES_CURSOR_MAX_LENGTH = 512;
4
+ export declare const ROUTES_LIST_QUERY_SHAPE: {
5
+ sourceChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
6
+ destinationChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
7
+ cursor: z.ZodOptional<z.ZodString>;
8
+ };
9
+ export declare const RoutesListQuerySchema: z.ZodObject<{
10
+ sourceChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
11
+ destinationChainId: z.ZodOptional<z.ZodCoercedNumber<unknown>>;
12
+ cursor: z.ZodOptional<z.ZodString>;
13
+ }, z.core.$strip>;
14
+ export type RoutesListQuery = z.infer<typeof RoutesListQuerySchema>;
15
+ export declare const RouteLimitsSchema: z.ZodObject<{
16
+ min: z.ZodOptional<z.ZodString>;
17
+ max: z.ZodOptional<z.ZodString>;
18
+ }, z.core.$loose>;
19
+ export declare const RoutePairLegSchema: z.ZodObject<{
20
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
21
+ symbol: z.ZodString;
22
+ decimals: z.ZodNumber;
23
+ limits: z.ZodObject<{
24
+ min: z.ZodOptional<z.ZodString>;
25
+ max: z.ZodOptional<z.ZodString>;
26
+ }, z.core.$loose>;
27
+ }, z.core.$loose>;
28
+ export declare const RoutePairSchema: z.ZodObject<{
29
+ baseline: z.ZodBoolean;
30
+ source: z.ZodObject<{
31
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
32
+ symbol: z.ZodString;
33
+ decimals: z.ZodNumber;
34
+ limits: z.ZodObject<{
35
+ min: z.ZodOptional<z.ZodString>;
36
+ max: z.ZodOptional<z.ZodString>;
37
+ }, z.core.$loose>;
38
+ }, z.core.$loose>;
39
+ destination: z.ZodObject<{
40
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
41
+ symbol: z.ZodString;
42
+ decimals: z.ZodNumber;
43
+ limits: z.ZodObject<{
44
+ min: z.ZodOptional<z.ZodString>;
45
+ max: z.ZodOptional<z.ZodString>;
46
+ }, z.core.$loose>;
47
+ }, z.core.$loose>;
48
+ }, z.core.$loose>;
49
+ export declare const RouteChainSchema: z.ZodObject<{
50
+ chainId: z.ZodNumber;
51
+ }, z.core.$loose>;
52
+ export declare const RouteAnyAssetSchema: z.ZodObject<{
53
+ source: z.ZodBoolean;
54
+ destination: z.ZodBoolean;
55
+ }, z.core.$loose>;
3
56
  export declare const RouteEntrySchema: z.ZodObject<{
4
57
  source: z.ZodObject<{
5
58
  chainId: z.ZodNumber;
6
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
7
59
  }, z.core.$loose>;
8
60
  destination: z.ZodObject<{
9
61
  chainId: z.ZodNumber;
10
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
11
62
  }, z.core.$loose>;
12
- swapTypes: z.ZodArray<z.ZodEnum<{
13
- custom: "custom";
14
- "exact-in": "exact-in";
15
- "exact-out": "exact-out";
16
- "gateway-deposit": "gateway-deposit";
17
- }>>;
63
+ pairs: z.ZodArray<z.ZodObject<{
64
+ baseline: z.ZodBoolean;
65
+ source: z.ZodObject<{
66
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
67
+ symbol: z.ZodString;
68
+ decimals: z.ZodNumber;
69
+ limits: z.ZodObject<{
70
+ min: z.ZodOptional<z.ZodString>;
71
+ max: z.ZodOptional<z.ZodString>;
72
+ }, z.core.$loose>;
73
+ }, z.core.$loose>;
74
+ destination: z.ZodObject<{
75
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
76
+ symbol: z.ZodString;
77
+ decimals: z.ZodNumber;
78
+ limits: z.ZodObject<{
79
+ min: z.ZodOptional<z.ZodString>;
80
+ max: z.ZodOptional<z.ZodString>;
81
+ }, z.core.$loose>;
82
+ }, z.core.$loose>;
83
+ }, z.core.$loose>>;
84
+ anyAsset: z.ZodObject<{
85
+ source: z.ZodBoolean;
86
+ destination: z.ZodBoolean;
87
+ }, z.core.$loose>;
18
88
  }, z.core.$loose>;
89
+ export type RouteEntry = z.input<typeof RouteEntrySchema>;
19
90
  export declare const RoutesResponseSchema: z.ZodObject<{
20
91
  routes: z.ZodArray<z.ZodObject<{
21
92
  source: z.ZodObject<{
22
93
  chainId: z.ZodNumber;
23
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
24
94
  }, z.core.$loose>;
25
95
  destination: z.ZodObject<{
26
96
  chainId: z.ZodNumber;
27
- token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
28
97
  }, z.core.$loose>;
29
- swapTypes: z.ZodArray<z.ZodEnum<{
30
- custom: "custom";
31
- "exact-in": "exact-in";
32
- "exact-out": "exact-out";
33
- "gateway-deposit": "gateway-deposit";
34
- }>>;
98
+ pairs: z.ZodArray<z.ZodObject<{
99
+ baseline: z.ZodBoolean;
100
+ source: z.ZodObject<{
101
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
102
+ symbol: z.ZodString;
103
+ decimals: z.ZodNumber;
104
+ limits: z.ZodObject<{
105
+ min: z.ZodOptional<z.ZodString>;
106
+ max: z.ZodOptional<z.ZodString>;
107
+ }, z.core.$loose>;
108
+ }, z.core.$loose>;
109
+ destination: z.ZodObject<{
110
+ token: z.ZodUnion<readonly [z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>, z.ZodString]>;
111
+ symbol: z.ZodString;
112
+ decimals: z.ZodNumber;
113
+ limits: z.ZodObject<{
114
+ min: z.ZodOptional<z.ZodString>;
115
+ max: z.ZodOptional<z.ZodString>;
116
+ }, z.core.$loose>;
117
+ }, z.core.$loose>;
118
+ }, z.core.$loose>>;
119
+ anyAsset: z.ZodObject<{
120
+ source: z.ZodBoolean;
121
+ destination: z.ZodBoolean;
122
+ }, z.core.$loose>;
35
123
  }, z.core.$loose>>;
124
+ updatedAt: z.ZodNumber;
36
125
  nextCursor: z.ZodNullable<z.ZodString>;
37
126
  }, z.core.$loose>;
127
+ export type RoutesResponse = z.input<typeof RoutesResponseSchema>;
@@ -1,21 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RoutesResponseSchema = exports.RouteEntrySchema = exports.ROUTES_STABILITY = void 0;
3
+ exports.RoutesResponseSchema = exports.RouteEntrySchema = exports.RouteAnyAssetSchema = exports.RouteChainSchema = exports.RoutePairSchema = exports.RoutePairLegSchema = exports.RouteLimitsSchema = exports.RoutesListQuerySchema = exports.ROUTES_LIST_QUERY_SHAPE = exports.ROUTES_CURSOR_MAX_LENGTH = exports.ROUTES_STABILITY = void 0;
4
4
  const zod_1 = require("zod");
5
- const enums_1 = require("../enums");
6
5
  const primitives_1 = require("../primitives");
7
6
  exports.ROUTES_STABILITY = 'draft';
8
- const RouteLegSchema = zod_1.z.looseObject({
9
- chainId: primitives_1.ChainId,
7
+ exports.ROUTES_CURSOR_MAX_LENGTH = 512;
8
+ exports.ROUTES_LIST_QUERY_SHAPE = {
9
+ sourceChainId: primitives_1.ChainIdParam.optional(),
10
+ destinationChainId: primitives_1.ChainIdParam.optional(),
11
+ cursor: zod_1.z.string().min(1).max(exports.ROUTES_CURSOR_MAX_LENGTH).optional(),
12
+ };
13
+ exports.RoutesListQuerySchema = zod_1.z.object(exports.ROUTES_LIST_QUERY_SHAPE);
14
+ exports.RouteLimitsSchema = zod_1.z.looseObject({
15
+ min: primitives_1.UintString.optional(),
16
+ max: primitives_1.UintString.optional(),
17
+ });
18
+ exports.RoutePairLegSchema = zod_1.z.looseObject({
10
19
  token: primitives_1.AnyAddress,
20
+ symbol: zod_1.z.string().min(1),
21
+ decimals: zod_1.z.number().int().nonnegative().max(255),
22
+ limits: exports.RouteLimitsSchema,
23
+ });
24
+ exports.RoutePairSchema = zod_1.z.looseObject({
25
+ baseline: zod_1.z.boolean(),
26
+ source: exports.RoutePairLegSchema,
27
+ destination: exports.RoutePairLegSchema,
28
+ });
29
+ exports.RouteChainSchema = zod_1.z.looseObject({
30
+ chainId: primitives_1.ChainId,
31
+ });
32
+ exports.RouteAnyAssetSchema = zod_1.z.looseObject({
33
+ source: zod_1.z.boolean(),
34
+ destination: zod_1.z.boolean(),
11
35
  });
12
36
  exports.RouteEntrySchema = zod_1.z.looseObject({
13
- source: RouteLegSchema,
14
- destination: RouteLegSchema,
15
- swapTypes: zod_1.z.array(enums_1.QuoteType),
37
+ source: exports.RouteChainSchema,
38
+ destination: exports.RouteChainSchema,
39
+ pairs: zod_1.z.array(exports.RoutePairSchema),
40
+ anyAsset: exports.RouteAnyAssetSchema,
16
41
  });
17
42
  exports.RoutesResponseSchema = zod_1.z.looseObject({
18
43
  routes: zod_1.z.array(exports.RouteEntrySchema),
19
- nextCursor: zod_1.z.string().nullable(),
44
+ updatedAt: primitives_1.UnixSeconds,
45
+ nextCursor: zod_1.z.string().min(1).max(exports.ROUTES_CURSOR_MAX_LENGTH).nullable(),
20
46
  });
21
47
  //# sourceMappingURL=routes.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/v1/endpoints/routes.ts"],"names":[],"mappings":";;;AAAA,6BAAwB;AAExB,oCAAqC;AACrC,8CAAoD;AASvC,QAAA,gBAAgB,GAAG,OAAgB,CAAC;AAEjD,MAAM,cAAc,GAAG,OAAC,CAAC,WAAW,CAAC;IACnC,OAAO,EAAE,oBAAO;IAChB,KAAK,EAAE,uBAAU;CAClB,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,OAAC,CAAC,WAAW,CAAC;IAC5C,MAAM,EAAE,cAAc;IACtB,WAAW,EAAE,cAAc;IAC3B,SAAS,EAAE,OAAC,CAAC,KAAK,CAAC,iBAAS,CAAC;CAC9B,CAAC,CAAC;AAEU,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC;IAEjC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;CAClC,CAAC,CAAC"}
1
+ {"version":3,"file":"routes.js","sourceRoot":"","sources":["../../../src/v1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AC,WAAW,CAAC;IAC/C,MAAM,EAAE,OAAC,CAAC,OAAO,EAAE;IACnB,WAAW,EAAE,OAAC,CAAC,OAAO,EAAE;CACzB,CAAC,CAAC;AAEU,QAAA,gBAAgB,GAAG,OAAC,CAAC,WAAW,CAAC;IAC5C,MAAM,EAAE,wBAAgB;IACxB,WAAW,EAAE,wBAAgB;IAC7B,KAAK,EAAE,OAAC,CAAC,KAAK,CAAC,uBAAe,CAAC;IAC/B,QAAQ,EAAE,2BAAmB;CAC9B,CAAC,CAAC;AAGU,QAAA,oBAAoB,GAAG,OAAC,CAAC,WAAW,CAAC;IAChD,MAAM,EAAE,OAAC,CAAC,KAAK,CAAC,wBAAgB,CAAC;IAEjC,SAAS,EAAE,wBAAW;IAEtB,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,gCAAwB,CAAC,CAAC,QAAQ,EAAE;CACvE,CAAC,CAAC"}
package/openapi/v1.json CHANGED
@@ -5367,11 +5367,43 @@
5367
5367
  "/v1/routes": {
5368
5368
  "get": {
5369
5369
  "operationId": "routes.list",
5370
- "summary": "Enabled routes (DRAFT — final shape depends on the WS2 solver feed).",
5370
+ "summary": "Chain pairs the caller can quote: token pairs served directly, with order-size limits, and any-asset flags for the rest (DRAFT).",
5371
5371
  "tags": [
5372
5372
  "discovery"
5373
5373
  ],
5374
5374
  "x-stability": "draft",
5375
+ "parameters": [
5376
+ {
5377
+ "name": "sourceChainId",
5378
+ "in": "query",
5379
+ "required": false,
5380
+ "schema": {
5381
+ "type": "integer",
5382
+ "exclusiveMinimum": 0,
5383
+ "maximum": 9007199254740991
5384
+ }
5385
+ },
5386
+ {
5387
+ "name": "destinationChainId",
5388
+ "in": "query",
5389
+ "required": false,
5390
+ "schema": {
5391
+ "type": "integer",
5392
+ "exclusiveMinimum": 0,
5393
+ "maximum": 9007199254740991
5394
+ }
5395
+ },
5396
+ {
5397
+ "name": "cursor",
5398
+ "in": "query",
5399
+ "required": false,
5400
+ "schema": {
5401
+ "type": "string",
5402
+ "minLength": 1,
5403
+ "maxLength": 512
5404
+ }
5405
+ }
5406
+ ],
5375
5407
  "responses": {
5376
5408
  "200": {
5377
5409
  "description": "Success",
@@ -5392,35 +5424,10 @@
5392
5424
  "type": "integer",
5393
5425
  "exclusiveMinimum": 0,
5394
5426
  "maximum": 9007199254740991
5395
- },
5396
- "token": {
5397
- "anyOf": [
5398
- {
5399
- "type": "string",
5400
- "pattern": "^0x[0-9a-fA-F]{40}$"
5401
- },
5402
- {
5403
- "anyOf": [
5404
- {
5405
- "type": "string",
5406
- "pattern": "^T[1-9A-HJ-NP-Za-km-z]{33}$"
5407
- },
5408
- {
5409
- "type": "string",
5410
- "pattern": "^0x41[0-9a-fA-F]{40}$"
5411
- }
5412
- ]
5413
- },
5414
- {
5415
- "type": "string",
5416
- "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
5417
- }
5418
- ]
5419
5427
  }
5420
5428
  },
5421
5429
  "required": [
5422
- "chainId",
5423
- "token"
5430
+ "chainId"
5424
5431
  ]
5425
5432
  },
5426
5433
  "destination": {
@@ -5430,61 +5437,181 @@
5430
5437
  "type": "integer",
5431
5438
  "exclusiveMinimum": 0,
5432
5439
  "maximum": 9007199254740991
5433
- },
5434
- "token": {
5435
- "anyOf": [
5436
- {
5437
- "type": "string",
5438
- "pattern": "^0x[0-9a-fA-F]{40}$"
5439
- },
5440
- {
5441
- "anyOf": [
5442
- {
5443
- "type": "string",
5444
- "pattern": "^T[1-9A-HJ-NP-Za-km-z]{33}$"
5445
- },
5446
- {
5447
- "type": "string",
5448
- "pattern": "^0x41[0-9a-fA-F]{40}$"
5449
- }
5450
- ]
5451
- },
5452
- {
5453
- "type": "string",
5454
- "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
5455
- }
5456
- ]
5457
5440
  }
5458
5441
  },
5459
5442
  "required": [
5460
- "chainId",
5461
- "token"
5443
+ "chainId"
5462
5444
  ]
5463
5445
  },
5464
- "swapTypes": {
5446
+ "pairs": {
5465
5447
  "type": "array",
5466
5448
  "items": {
5467
- "type": "string",
5468
- "enum": [
5469
- "exact-in",
5470
- "exact-out",
5471
- "custom",
5472
- "gateway-deposit"
5449
+ "type": "object",
5450
+ "properties": {
5451
+ "baseline": {
5452
+ "type": "boolean"
5453
+ },
5454
+ "source": {
5455
+ "type": "object",
5456
+ "properties": {
5457
+ "token": {
5458
+ "anyOf": [
5459
+ {
5460
+ "type": "string",
5461
+ "pattern": "^0x[0-9a-fA-F]{40}$"
5462
+ },
5463
+ {
5464
+ "anyOf": [
5465
+ {
5466
+ "type": "string",
5467
+ "pattern": "^T[1-9A-HJ-NP-Za-km-z]{33}$"
5468
+ },
5469
+ {
5470
+ "type": "string",
5471
+ "pattern": "^0x41[0-9a-fA-F]{40}$"
5472
+ }
5473
+ ]
5474
+ },
5475
+ {
5476
+ "type": "string",
5477
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
5478
+ }
5479
+ ]
5480
+ },
5481
+ "symbol": {
5482
+ "type": "string",
5483
+ "minLength": 1
5484
+ },
5485
+ "decimals": {
5486
+ "type": "integer",
5487
+ "minimum": 0,
5488
+ "maximum": 255
5489
+ },
5490
+ "limits": {
5491
+ "type": "object",
5492
+ "properties": {
5493
+ "min": {
5494
+ "type": "string",
5495
+ "maxLength": 78,
5496
+ "pattern": "^(0|[1-9]\\d*)$"
5497
+ },
5498
+ "max": {
5499
+ "type": "string",
5500
+ "maxLength": 78,
5501
+ "pattern": "^(0|[1-9]\\d*)$"
5502
+ }
5503
+ }
5504
+ }
5505
+ },
5506
+ "required": [
5507
+ "token",
5508
+ "symbol",
5509
+ "decimals",
5510
+ "limits"
5511
+ ]
5512
+ },
5513
+ "destination": {
5514
+ "type": "object",
5515
+ "properties": {
5516
+ "token": {
5517
+ "anyOf": [
5518
+ {
5519
+ "type": "string",
5520
+ "pattern": "^0x[0-9a-fA-F]{40}$"
5521
+ },
5522
+ {
5523
+ "anyOf": [
5524
+ {
5525
+ "type": "string",
5526
+ "pattern": "^T[1-9A-HJ-NP-Za-km-z]{33}$"
5527
+ },
5528
+ {
5529
+ "type": "string",
5530
+ "pattern": "^0x41[0-9a-fA-F]{40}$"
5531
+ }
5532
+ ]
5533
+ },
5534
+ {
5535
+ "type": "string",
5536
+ "pattern": "^[1-9A-HJ-NP-Za-km-z]{32,44}$"
5537
+ }
5538
+ ]
5539
+ },
5540
+ "symbol": {
5541
+ "type": "string",
5542
+ "minLength": 1
5543
+ },
5544
+ "decimals": {
5545
+ "type": "integer",
5546
+ "minimum": 0,
5547
+ "maximum": 255
5548
+ },
5549
+ "limits": {
5550
+ "type": "object",
5551
+ "properties": {
5552
+ "min": {
5553
+ "type": "string",
5554
+ "maxLength": 78,
5555
+ "pattern": "^(0|[1-9]\\d*)$"
5556
+ },
5557
+ "max": {
5558
+ "type": "string",
5559
+ "maxLength": 78,
5560
+ "pattern": "^(0|[1-9]\\d*)$"
5561
+ }
5562
+ }
5563
+ }
5564
+ },
5565
+ "required": [
5566
+ "token",
5567
+ "symbol",
5568
+ "decimals",
5569
+ "limits"
5570
+ ]
5571
+ }
5572
+ },
5573
+ "required": [
5574
+ "baseline",
5575
+ "source",
5576
+ "destination"
5473
5577
  ]
5474
5578
  }
5579
+ },
5580
+ "anyAsset": {
5581
+ "type": "object",
5582
+ "properties": {
5583
+ "source": {
5584
+ "type": "boolean"
5585
+ },
5586
+ "destination": {
5587
+ "type": "boolean"
5588
+ }
5589
+ },
5590
+ "required": [
5591
+ "source",
5592
+ "destination"
5593
+ ]
5475
5594
  }
5476
5595
  },
5477
5596
  "required": [
5478
5597
  "source",
5479
5598
  "destination",
5480
- "swapTypes"
5599
+ "pairs",
5600
+ "anyAsset"
5481
5601
  ]
5482
5602
  }
5483
5603
  },
5604
+ "updatedAt": {
5605
+ "type": "integer",
5606
+ "minimum": 0,
5607
+ "maximum": 4102444800
5608
+ },
5484
5609
  "nextCursor": {
5485
5610
  "anyOf": [
5486
5611
  {
5487
- "type": "string"
5612
+ "type": "string",
5613
+ "minLength": 1,
5614
+ "maxLength": 512
5488
5615
  },
5489
5616
  {
5490
5617
  "type": "null"
@@ -5494,6 +5621,7 @@
5494
5621
  },
5495
5622
  "required": [
5496
5623
  "routes",
5624
+ "updatedAt",
5497
5625
  "nextCursor"
5498
5626
  ]
5499
5627
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eco-foundation/api-schemas",
3
- "version": "0.13.0",
3
+ "version": "0.14.0",
4
4
  "description": "Zod-first schemas, error catalog, golden fixtures, and generated OpenAPI 3.1 for the Eco /v1 API",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",