@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
@@ -0,0 +1,158 @@
1
+ {
2
+ "endpointId": "quotes.create",
3
+ "direction": "response",
4
+ "variant": "public-swap",
5
+ "method": "POST",
6
+ "path": "/v1/quotes",
7
+ "expectedStatus": 200,
8
+ "sideEffect": true,
9
+ "payload": {
10
+ "id": "quote:8f14e45f-ea3c-4c2d-9b6e-1a2b3c4d5e6f",
11
+ "swapType": "exact-in",
12
+ "visibility": "public",
13
+ "guarantee": "atomic-or-refund",
14
+ "source": {
15
+ "chainId": 8453,
16
+ "token": "0x1111111111111111111111111111111111111111",
17
+ "amount": "1043221",
18
+ "symbol": "USDC",
19
+ "decimals": 6
20
+ },
21
+ "destination": {
22
+ "chainId": 10,
23
+ "token": "0x2222222222222222222222222222222222222222",
24
+ "amount": "1043221",
25
+ "minAmountOut": "1038005",
26
+ "recipient": "0x3333333333333333333333333333333333333333",
27
+ "symbol": "USDC",
28
+ "decimals": 6
29
+ },
30
+ "slippage": 0.005,
31
+ "fees": [
32
+ {
33
+ "kind": "gas",
34
+ "amount": "1200",
35
+ "token": {
36
+ "chainId": 8453,
37
+ "address": "0x1111111111111111111111111111111111111111",
38
+ "symbol": "USDC",
39
+ "decimals": 6
40
+ },
41
+ "estimate": true
42
+ }
43
+ ],
44
+ "steps": [
45
+ {
46
+ "kind": "swap",
47
+ "tool": "uniswap-v3",
48
+ "aggregator": "ecoswap",
49
+ "from": {
50
+ "chainId": 8453,
51
+ "token": "0x1111111111111111111111111111111111111111",
52
+ "amount": "1043221"
53
+ },
54
+ "to": {
55
+ "chainId": 8453,
56
+ "token": "0x2222222222222222222222222222222222222222",
57
+ "amount": "1043000"
58
+ },
59
+ "fees": [
60
+ {
61
+ "kind": "protocol",
62
+ "amount": "221",
63
+ "token": {
64
+ "chainId": 8453,
65
+ "address": "0x1111111111111111111111111111111111111111",
66
+ "symbol": null,
67
+ "decimals": null
68
+ },
69
+ "estimate": false
70
+ }
71
+ ],
72
+ "estimatedDurationSec": 3
73
+ },
74
+ {
75
+ "kind": "bridge",
76
+ "tool": "eco",
77
+ "from": {
78
+ "chainId": 8453,
79
+ "token": "0x1111111111111111111111111111111111111111",
80
+ "amount": "1043221"
81
+ },
82
+ "to": {
83
+ "chainId": 10,
84
+ "token": "0x2222222222222222222222222222222222222222",
85
+ "amount": "1038005"
86
+ },
87
+ "fees": [],
88
+ "estimatedDurationSec": 20
89
+ }
90
+ ],
91
+ "relatedIntents": [
92
+ {
93
+ "role": "local",
94
+ "intentHash": "0xabababababababababababababababababababababababababababababababab"
95
+ },
96
+ {
97
+ "role": "bucket-candidate",
98
+ "intentHash": "0xefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefefef",
99
+ "routeHash": "0x1212121212121212121212121212121212121212121212121212121212121212",
100
+ "bucketIndex": 0
101
+ }
102
+ ],
103
+ "solver": {
104
+ "id": "0x3333333333333333333333333333333333333333",
105
+ "name": "eco"
106
+ },
107
+ "intentHash": "0xabababababababababababababababababababababababababababababababab",
108
+ "execution": {
109
+ "transaction": {
110
+ "kind": "evm",
111
+ "chainId": 8453,
112
+ "to": "0x1111111111111111111111111111111111111111",
113
+ "data": "0xdeadbeef",
114
+ "value": "0"
115
+ },
116
+ "intent": {
117
+ "route": {
118
+ "salt": "0xabababababababababababababababababababababababababababababababab",
119
+ "deadline": 1767226200,
120
+ "source": 8453,
121
+ "destination": 10,
122
+ "portal": "0x2222222222222222222222222222222222222222",
123
+ "nativeAmount": "0",
124
+ "tokens": [
125
+ {
126
+ "token": "0x2222222222222222222222222222222222222222",
127
+ "amount": "1038005"
128
+ }
129
+ ],
130
+ "calls": [
131
+ {
132
+ "target": "0x2222222222222222222222222222222222222222",
133
+ "data": "0xbeef",
134
+ "value": "0"
135
+ }
136
+ ]
137
+ },
138
+ "reward": {
139
+ "deadline": 1767229800,
140
+ "creator": "0x3333333333333333333333333333333333333333",
141
+ "prover": "0x1111111111111111111111111111111111111111",
142
+ "nativeAmount": "0",
143
+ "tokens": [
144
+ {
145
+ "token": "0x1111111111111111111111111111111111111111",
146
+ "amount": "1043221"
147
+ }
148
+ ]
149
+ }
150
+ },
151
+ "encodedRoute": "0xdead",
152
+ "encodedReward": "0xbeef"
153
+ },
154
+ "expiresAt": 1767225600,
155
+ "signature": "0xcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcdcd",
156
+ "quotes": null
157
+ }
158
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "endpointId": "routes.list",
3
+ "direction": "response",
4
+ "variant": "default",
5
+ "method": "GET",
6
+ "path": "/v1/routes",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "stability": "draft",
10
+ "payload": {
11
+ "routes": [
12
+ {
13
+ "source": {
14
+ "chainId": 8453,
15
+ "token": "0x1111111111111111111111111111111111111111"
16
+ },
17
+ "destination": {
18
+ "chainId": 10,
19
+ "token": "0x1111111111111111111111111111111111111111"
20
+ },
21
+ "swapTypes": ["exact-in"]
22
+ }
23
+ ],
24
+ "nextCursor": null
25
+ }
26
+ }
@@ -0,0 +1,24 @@
1
+ {
2
+ "endpointId": "tokens.list",
3
+ "direction": "response",
4
+ "variant": "default",
5
+ "method": "GET",
6
+ "path": "/v1/tokens",
7
+ "expectedStatus": 200,
8
+ "sideEffect": false,
9
+ "payload": {
10
+ "tokens": [
11
+ {
12
+ "chainId": 8453,
13
+ "address": "0x1111111111111111111111111111111111111111",
14
+ "symbol": "USDC",
15
+ "decimals": 6,
16
+ "supports": {
17
+ "quote": ["permit3", "permit2", "erc-3009"],
18
+ "depositAddress": ["erc-2612", "erc-3009"]
19
+ }
20
+ }
21
+ ],
22
+ "nextCursor": null
23
+ }
24
+ }
@@ -0,0 +1,7 @@
1
+ {
2
+ "digest": "72dceef6f939c524c595a94c80bdf2b545478022511aa58009573c8cd69dc432",
3
+ "inputs": [
4
+ "errors/catalog.lock.json",
5
+ "openapi/v1.json"
6
+ ]
7
+ }
@@ -0,0 +1,6 @@
1
+ export { V1_SCHEMA_DIGEST, V1_SCHEMA_DIGEST_INPUTS } from './build-digest';
2
+ export { generateOpenApiDocument, STABLE_TAG } from './openapi';
3
+ export type { V1Fixture } from './testing';
4
+ export { assertMatchesV1Schema, loadV1Fixtures } from './testing';
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';
package/dist/index.js ADDED
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || (function () {
19
+ var ownKeys = function(o) {
20
+ ownKeys = Object.getOwnPropertyNames || function (o) {
21
+ var ar = [];
22
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
+ return ar;
24
+ };
25
+ return ownKeys(o);
26
+ };
27
+ return function (mod) {
28
+ if (mod && mod.__esModule) return mod;
29
+ var result = {};
30
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
+ __setModuleDefault(result, mod);
32
+ return result;
33
+ };
34
+ })();
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.v1 = exports.loadV1Fixtures = exports.assertMatchesV1Schema = exports.STABLE_TAG = exports.generateOpenApiDocument = exports.V1_SCHEMA_DIGEST_INPUTS = exports.V1_SCHEMA_DIGEST = void 0;
37
+ var build_digest_1 = require("./build-digest");
38
+ Object.defineProperty(exports, "V1_SCHEMA_DIGEST", { enumerable: true, get: function () { return build_digest_1.V1_SCHEMA_DIGEST; } });
39
+ Object.defineProperty(exports, "V1_SCHEMA_DIGEST_INPUTS", { enumerable: true, get: function () { return build_digest_1.V1_SCHEMA_DIGEST_INPUTS; } });
40
+ var openapi_1 = require("./openapi");
41
+ Object.defineProperty(exports, "generateOpenApiDocument", { enumerable: true, get: function () { return openapi_1.generateOpenApiDocument; } });
42
+ Object.defineProperty(exports, "STABLE_TAG", { enumerable: true, get: function () { return openapi_1.STABLE_TAG; } });
43
+ var testing_1 = require("./testing");
44
+ Object.defineProperty(exports, "assertMatchesV1Schema", { enumerable: true, get: function () { return testing_1.assertMatchesV1Schema; } });
45
+ Object.defineProperty(exports, "loadV1Fixtures", { enumerable: true, get: function () { return testing_1.loadV1Fixtures; } });
46
+ exports.v1 = __importStar(require("./v1"));
47
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA2E;AAAlE,gHAAA,gBAAgB,OAAA;AAAE,uHAAA,uBAAuB,OAAA;AAClD,qCAAgE;AAAvD,kHAAA,uBAAuB,OAAA;AAAE,qGAAA,UAAU,OAAA;AAE5C,qCAAkE;AAAzD,gHAAA,qBAAqB,OAAA;AAAE,yGAAA,cAAc,OAAA;AAC9C,2CAA2B"}
@@ -0,0 +1,2 @@
1
+ export declare const STABLE_TAG = "stable";
2
+ export declare function generateOpenApiDocument(): Record<string, unknown>;
@@ -0,0 +1,81 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.STABLE_TAG = void 0;
4
+ exports.generateOpenApiDocument = generateOpenApiDocument;
5
+ const zod_1 = require("zod");
6
+ const registry_1 = require("./v1/endpoints/registry");
7
+ const catalog_1 = require("./v1/errors/catalog");
8
+ const problem_1 = require("./v1/errors/problem");
9
+ const PROBLEM_REF = '#/components/schemas/Problem';
10
+ exports.STABLE_TAG = 'stable';
11
+ function toSchema(schema, io) {
12
+ const json = zod_1.z.toJSONSchema(schema, { target: 'draft-2020-12', io });
13
+ delete json.$schema;
14
+ return json;
15
+ }
16
+ function parameters(def) {
17
+ const params = [];
18
+ for (const [name, schema] of Object.entries(def.pathParams ?? {})) {
19
+ params.push({ name, in: 'path', required: true, schema: toSchema(schema, 'input') });
20
+ }
21
+ for (const [name, schema] of Object.entries(def.query ?? {})) {
22
+ const optional = schema.safeParse(undefined).success;
23
+ params.push({ name, in: 'query', required: !optional, schema: toSchema(schema, 'input') });
24
+ }
25
+ return params;
26
+ }
27
+ function generateOpenApiDocument() {
28
+ const paths = {};
29
+ for (const [id, def] of Object.entries(registry_1.V1_ENDPOINTS)) {
30
+ const params = parameters(def);
31
+ const operation = {
32
+ operationId: id,
33
+ summary: def.summary,
34
+ tags: def.stability === 'draft' ? [def.tag] : [def.tag, exports.STABLE_TAG],
35
+ ...(def.stability === 'draft' ? { 'x-stability': 'draft' } : {}),
36
+ ...(params.length > 0 ? { parameters: params } : {}),
37
+ ...(def.request
38
+ ? {
39
+ requestBody: {
40
+ required: true,
41
+ content: { 'application/json': { schema: toSchema(def.request, 'input') } },
42
+ },
43
+ }
44
+ : {}),
45
+ responses: {
46
+ [String(def.successStatus)]: {
47
+ description: 'Success',
48
+ content: { 'application/json': { schema: toSchema(def.response, 'output') } },
49
+ },
50
+ default: {
51
+ description: 'Error (RFC 9457 problem+json; see x-error-catalog)',
52
+ content: { [problem_1.PROBLEM_CONTENT_TYPE]: { schema: { $ref: PROBLEM_REF } } },
53
+ },
54
+ },
55
+ };
56
+ (paths[def.path] ??= {})[def.method.toLowerCase()] = operation;
57
+ }
58
+ return {
59
+ openapi: '3.1.0',
60
+ info: {
61
+ title: 'Eco API',
62
+ version: 'v1',
63
+ description: 'Generated from @eco-foundation/api-schemas — the Zod schemas are the source of truth.',
64
+ },
65
+ tags: [
66
+ { name: 'quotes' },
67
+ { name: 'intents' },
68
+ { name: 'status' },
69
+ { name: 'discovery' },
70
+ { name: 'deposit-addresses' },
71
+ {
72
+ name: exports.STABLE_TAG,
73
+ description: 'Operations committed for launch. Draft operations (x-stability: draft) are omitted.',
74
+ },
75
+ ],
76
+ paths,
77
+ components: { schemas: { Problem: toSchema(problem_1.V1ProblemSchema, 'output') } },
78
+ 'x-error-catalog': catalog_1.V1_ERROR_CATALOG,
79
+ };
80
+ }
81
+ //# sourceMappingURL=openapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"openapi.js","sourceRoot":"","sources":["../src/openapi.ts"],"names":[],"mappings":";;;AAwDA,0DAyDC;AAjHD,6BAAwB;AAExB,sDAA2F;AAC3F,iDAAuD;AACvD,iDAA4E;AAE5E,MAAM,WAAW,GAAG,8BAA8B,CAAC;AAQtC,QAAA,UAAU,GAAG,QAAQ,CAAC;AAgBnC,SAAS,QAAQ,CAAC,MAAiB,EAAE,EAAsB;IACzD,MAAM,IAAI,GAAG,OAAC,CAAC,YAAY,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,EAAE,CAA4B,CAAC;IAChG,OAAO,IAAI,CAAC,OAAO,CAAC;IACpB,OAAO,IAAI,CAAC;AACd,CAAC;AAQD,SAAS,UAAU,CAAC,GAAyB;IAC3C,MAAM,MAAM,GAA8B,EAAE,CAAC;IAC7C,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,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YAClB,EAAE,IAAI,EAAE,WAAW,EAAE;YACrB,EAAE,IAAI,EAAE,mBAAmB,EAAE;YAC7B;gBACE,IAAI,EAAE,kBAAU;gBAChB,WAAW,EACT,qFAAqF;aACxF;SACF;QACD,KAAK;QACL,UAAU,EAAE,EAAE,OAAO,EAAE,EAAE,OAAO,EAAE,QAAQ,CAAC,yBAAe,EAAE,QAAQ,CAAC,EAAE,EAAE;QAGzE,iBAAiB,EAAE,0BAAgB;KACpC,CAAC;AACJ,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_crypto_1 = require("node:crypto");
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const pkgRoot = (0, node_path_1.join)(__dirname, '..', '..');
7
+ const INPUTS = ['errors/catalog.lock.json', 'openapi/v1.json'];
8
+ const hash = (0, node_crypto_1.createHash)('sha256');
9
+ for (const rel of INPUTS)
10
+ hash.update((0, node_fs_1.readFileSync)((0, node_path_1.join)(pkgRoot, rel)));
11
+ const rendered = `${JSON.stringify({ digest: hash.digest('hex'), inputs: INPUTS }, null, 2)}\n`;
12
+ const outPath = (0, node_path_1.join)(pkgRoot, 'src', 'generated', 'build-digest.json');
13
+ if (process.argv.includes('--check')) {
14
+ const current = (0, node_fs_1.existsSync)(outPath) ? (0, node_fs_1.readFileSync)(outPath, 'utf8') : '';
15
+ if (current !== rendered) {
16
+ console.error('src/generated/build-digest.json is stale — run: pnpm run digest:generate');
17
+ process.exit(1);
18
+ }
19
+ console.log('build digest is current');
20
+ }
21
+ else {
22
+ (0, node_fs_1.writeFileSync)(outPath, rendered);
23
+ console.log(`wrote ${outPath}`);
24
+ }
25
+ //# sourceMappingURL=generate-build-digest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-build-digest.js","sourceRoot":"","sources":["../../src/scripts/generate-build-digest.ts"],"names":[],"mappings":";;AAAA,6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,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const node_fs_1 = require("node:fs");
4
+ const node_path_1 = require("node:path");
5
+ const openapi_1 = require("../openapi");
6
+ const outPath = (0, node_path_1.join)(__dirname, '..', '..', 'openapi', 'v1.json');
7
+ const rendered = `${JSON.stringify((0, openapi_1.generateOpenApiDocument)(), null, 2)}\n`;
8
+ if (process.argv.includes('--check')) {
9
+ const current = (0, node_fs_1.existsSync)(outPath) ? (0, node_fs_1.readFileSync)(outPath, 'utf8') : '';
10
+ if (current !== rendered) {
11
+ console.error('openapi/v1.json is stale — run: pnpm run openapi:generate');
12
+ process.exit(1);
13
+ }
14
+ console.log('openapi/v1.json is current');
15
+ }
16
+ else {
17
+ (0, node_fs_1.mkdirSync)((0, node_path_1.dirname)(outPath), { recursive: true });
18
+ (0, node_fs_1.writeFileSync)(outPath, rendered);
19
+ console.log(`wrote ${outPath}`);
20
+ }
21
+ //# sourceMappingURL=generate-openapi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generate-openapi.js","sourceRoot":"","sources":["../../src/scripts/generate-openapi.ts"],"names":[],"mappings":";;AAAA,qCAA6E;AAC7E,yCAA0C;AAE1C,wCAAqD;AAGrD,MAAM,OAAO,GAAG,IAAA,gBAAI,EAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;AAClE,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAA,iCAAuB,GAAE,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;AAE3E,IAAI,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC;IACrC,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAA,sBAAY,EAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACzB,OAAO,CAAC,KAAK,CAAC,2DAA2D,CAAC,CAAC;QAC3E,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,4BAA4B,CAAC,CAAC;AAC5C,CAAC;KAAM,CAAC;IACN,IAAA,mBAAS,EAAC,IAAA,mBAAO,EAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACjD,IAAA,uBAAa,EAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;IACjC,OAAO,CAAC,GAAG,CAAC,SAAS,OAAO,EAAE,CAAC,CAAC;AAClC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { V1Fixture } from '../fixtures';
2
+ import { V1EndpointId } from '../v1/endpoints/registry';
3
+ export type { V1Fixture };
4
+ export declare function assertMatchesV1Schema(endpointId: V1EndpointId, payload: unknown, opts?: {
5
+ direction?: 'request' | 'response';
6
+ }): void;
7
+ export declare function loadV1Fixtures(): readonly V1Fixture[];
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.assertMatchesV1Schema = assertMatchesV1Schema;
4
+ exports.loadV1Fixtures = loadV1Fixtures;
5
+ const zod_1 = require("zod");
6
+ const fixtures_1 = require("../fixtures");
7
+ const registry_1 = require("../v1/endpoints/registry");
8
+ const DEFINITIONS = registry_1.V1_ENDPOINTS;
9
+ function assertMatchesV1Schema(endpointId, payload, opts = {}) {
10
+ const direction = opts.direction ?? 'response';
11
+ const def = DEFINITIONS[endpointId];
12
+ if (!def) {
13
+ throw new Error(`unknown v1 endpoint id: "${String(endpointId)}" (direction: ${direction}); ` +
14
+ `known ids: ${Object.keys(registry_1.V1_ENDPOINTS).join(', ')}`);
15
+ }
16
+ const schema = direction === 'request' ? def.request : def.response;
17
+ if (!schema)
18
+ throw new Error(`${endpointId} has no ${direction} schema`);
19
+ const result = schema.safeParse(payload);
20
+ if (!result.success) {
21
+ throw new Error(`payload does not match ${endpointId} ${direction} schema:\n${zod_1.z.prettifyError(result.error)}`);
22
+ }
23
+ }
24
+ function loadV1Fixtures() {
25
+ return fixtures_1.V1_FIXTURES;
26
+ }
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/testing/index.ts"],"names":[],"mappings":";;AA0BA,sDAqBC;AAED,wCAEC;AAnDD,6BAAwB;AAExB,0CAAqD;AACrD,uDAA4F;AAY5F,MAAM,WAAW,GAA+C,uBAAY,CAAC;AAW7E,SAAgB,qBAAqB,CACnC,UAAwB,EACxB,OAAgB,EAChB,OAA+C,EAAE;IAEjD,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,IAAI,UAAU,CAAC;IAC/C,MAAM,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,CAAC,GAAG,EAAE,CAAC;QACT,MAAM,IAAI,KAAK,CACb,4BAA4B,MAAM,CAAC,UAAU,CAAC,iBAAiB,SAAS,KAAK;YAC3E,cAAc,MAAM,CAAC,IAAI,CAAC,uBAAY,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACvD,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAA0B,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC;IAC3F,IAAI,CAAC,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,GAAG,UAAU,WAAW,SAAS,SAAS,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,MAAM,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC;IACzC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CACb,0BAA0B,UAAU,IAAI,SAAS,aAAa,OAAC,CAAC,aAAa,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAC9F,CAAC;IACJ,CAAC;AACH,CAAC;AAED,SAAgB,cAAc;IAC5B,OAAO,sBAAW,CAAC;AACrB,CAAC"}
@@ -0,0 +1,52 @@
1
+ import { z } from 'zod';
2
+ export declare const ChainContractsSchema: z.ZodObject<{
3
+ portal: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>;
4
+ executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>>;
5
+ }, z.core.$loose>;
6
+ export declare const ChainSchema: z.ZodObject<{
7
+ chainId: z.ZodNumber;
8
+ name: z.ZodString;
9
+ quoteSigner: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>;
10
+ type: z.ZodEnum<{
11
+ evm: "evm";
12
+ svm: "svm";
13
+ tvm: "tvm";
14
+ }>;
15
+ encoding: z.ZodEnum<{
16
+ abi: "abi";
17
+ borsh: "borsh";
18
+ }>;
19
+ status: z.ZodEnum<{
20
+ live: "live";
21
+ paused: "paused";
22
+ }>;
23
+ contracts: z.ZodObject<{
24
+ portal: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>;
25
+ executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>>;
26
+ }, z.core.$loose>;
27
+ }, z.core.$loose>;
28
+ export type Chain = z.input<typeof ChainSchema>;
29
+ export declare const ChainsResponseSchema: z.ZodObject<{
30
+ chains: z.ZodArray<z.ZodObject<{
31
+ chainId: z.ZodNumber;
32
+ name: z.ZodString;
33
+ quoteSigner: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>;
34
+ type: z.ZodEnum<{
35
+ evm: "evm";
36
+ svm: "svm";
37
+ tvm: "tvm";
38
+ }>;
39
+ encoding: z.ZodEnum<{
40
+ abi: "abi";
41
+ borsh: "borsh";
42
+ }>;
43
+ status: z.ZodEnum<{
44
+ live: "live";
45
+ paused: "paused";
46
+ }>;
47
+ contracts: z.ZodObject<{
48
+ portal: z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>;
49
+ executor: z.ZodNullable<z.ZodUnion<readonly [z.ZodString, z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodString]>]>>;
50
+ }, z.core.$loose>;
51
+ }, z.core.$loose>>;
52
+ }, z.core.$loose>;
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ChainsResponseSchema = exports.ChainSchema = exports.ChainContractsSchema = void 0;
4
+ const zod_1 = require("zod");
5
+ const enums_1 = require("../enums");
6
+ const primitives_1 = require("../primitives");
7
+ exports.ChainContractsSchema = zod_1.z.looseObject({
8
+ portal: primitives_1.AnyAddress,
9
+ executor: primitives_1.AnyAddress.nullable(),
10
+ });
11
+ exports.ChainSchema = zod_1.z.looseObject({
12
+ chainId: primitives_1.ChainId,
13
+ name: zod_1.z.string().min(1),
14
+ quoteSigner: primitives_1.AnyAddress,
15
+ type: enums_1.ChainType,
16
+ encoding: enums_1.ChainEncoding,
17
+ status: enums_1.ChainStatus,
18
+ contracts: exports.ChainContractsSchema,
19
+ });
20
+ exports.ChainsResponseSchema = zod_1.z.looseObject({
21
+ chains: zod_1.z.array(exports.ChainSchema),
22
+ });
23
+ //# sourceMappingURL=chains.js.map
@@ -0,0 +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"}