@cancore/contracts 0.1.0 → 0.2.0-rc.3

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 (47) hide show
  1. package/README.md +168 -9
  2. package/dist/abi.d.ts +6086 -1675
  3. package/dist/abi.js +1 -1
  4. package/dist/chunk-NV5IUURP.js +9252 -0
  5. package/dist/chunk-NV5IUURP.js.map +1 -0
  6. package/dist/{chunk-CIBYXHSX.js → chunk-VODZRADO.js} +2 -2
  7. package/dist/chunk-VODZRADO.js.map +1 -0
  8. package/dist/index.d.ts +849 -28
  9. package/dist/index.js +2065 -16
  10. package/dist/index.js.map +1 -1
  11. package/dist/networks.d.ts +2 -2
  12. package/dist/networks.js +1 -1
  13. package/package.json +10 -8
  14. package/spec/abi/AttestorSet.json +476 -0
  15. package/spec/abi/CNRX.json +1294 -0
  16. package/spec/abi/CNRXStaking.json +510 -0
  17. package/spec/abi/CancoreRouter.json +2564 -0
  18. package/spec/abi/FeeVault.json +604 -0
  19. package/spec/abi/HTLC.json +717 -0
  20. package/spec/abi/IBurnMintERC20.json +252 -0
  21. package/spec/abi/ICancoreRouter.json +1226 -0
  22. package/spec/abi/IHTLC.json +382 -0
  23. package/spec/abi/IPermit2.json +150 -0
  24. package/spec/abi/MultiBalanceChecker.json +34 -0
  25. package/spec/abi/PointsClaim.json +791 -0
  26. package/spec/protocol/asyncapi.json +1050 -0
  27. package/spec/protocol/messages.schema.json +414 -0
  28. package/spec/protocol/records.schema.json +93 -0
  29. package/spec/protocol/rest.schema.json +115 -0
  30. package/spec/protocol/typed-data/FillerAuth.json +58 -0
  31. package/spec/protocol/typed-data/FillerQuote.json +75 -0
  32. package/spec/protocol/typed-data/GatewayMessage.json +90 -0
  33. package/spec/protocol/typed-data/StakeBinding.json +75 -0
  34. package/spec/protocol/typed-data/TicketIntent.json +65 -0
  35. package/spec/protocol/typed-data/TicketReceipt.json +51 -0
  36. package/spec/protocol/vectors/draw.json +61 -0
  37. package/spec/protocol/vectors/jcs.json +59 -0
  38. package/spec/protocol/vectors/messages.json +343 -0
  39. package/spec/protocol/vectors/records.json +81 -0
  40. package/spec/typed-data/FillProof.json +199 -0
  41. package/spec/typed-data/FillTicket.json +83 -0
  42. package/spec/typed-data/Order.json +141 -0
  43. package/spec/typed-data/Quote.json +69 -0
  44. package/spec/vectors/canton-order.json +67 -0
  45. package/dist/chunk-CIBYXHSX.js.map +0 -1
  46. package/dist/chunk-ZSX67S72.js +0 -3423
  47. package/dist/chunk-ZSX67S72.js.map +0 -1
package/dist/index.js CHANGED
@@ -1,5 +1,7 @@
1
- export { CNRX_ABI, CNRX_ERRORS, FEE_VAULT_ABI, FEE_VAULT_ERRORS, HTLC_ABI, HTLC_ERRORS, IBURN_MINT_ERC20_ABI, IHTLC_ABI, IPERMIT2_ABI, MULTI_BALANCE_CHECKER_ABI } from './chunk-ZSX67S72.js';
2
- export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-CIBYXHSX.js';
1
+ export { ATTESTOR_SET_ABI, ATTESTOR_SET_ERRORS, CANCORE_ROUTER_ABI, CANCORE_ROUTER_ERRORS, CNRX_ABI, CNRX_ERRORS, CNRX_STAKING_ABI, CNRX_STAKING_ERRORS, FEE_VAULT_ABI, FEE_VAULT_ERRORS, HTLC_ABI, HTLC_ERRORS, IBURN_MINT_ERC20_ABI, ICANCORE_ROUTER_ABI, ICANCORE_ROUTER_ERRORS, IHTLC_ABI, IPERMIT2_ABI, MULTI_BALANCE_CHECKER_ABI, POINTS_CLAIM_ABI, POINTS_CLAIM_ERRORS } from './chunk-NV5IUURP.js';
2
+ export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-VODZRADO.js';
3
+ import { utf8ToBytes, concatBytes, bytesToHex, hexToBytes } from '@noble/hashes/utils';
4
+ import { keccak_256 } from '@noble/hashes/sha3';
3
5
 
4
6
  // src/deployments.ts
5
7
  var DEPLOYMENTS = {
@@ -27,6 +29,58 @@ function deploymentOf(env, network) {
27
29
  return DEPLOYMENTS[env].find((d) => d.network === network);
28
30
  }
29
31
 
32
+ // src/generated/typedData.ts
33
+ var FILL_PROOF_TYPES = {
34
+ "FillProof": [
35
+ {
36
+ "name": "kind",
37
+ "type": "uint8"
38
+ },
39
+ {
40
+ "name": "orderHash",
41
+ "type": "bytes32"
42
+ },
43
+ {
44
+ "name": "destination",
45
+ "type": "bytes32"
46
+ },
47
+ {
48
+ "name": "fillRef",
49
+ "type": "bytes32"
50
+ },
51
+ {
52
+ "name": "recipient",
53
+ "type": "bytes32"
54
+ },
55
+ {
56
+ "name": "outputAsset",
57
+ "type": "bytes32"
58
+ },
59
+ {
60
+ "name": "amountDelivered",
61
+ "type": "uint256"
62
+ },
63
+ {
64
+ "name": "filledAt",
65
+ "type": "uint64"
66
+ },
67
+ {
68
+ "name": "filler",
69
+ "type": "address"
70
+ },
71
+ {
72
+ "name": "attempt",
73
+ "type": "uint32"
74
+ },
75
+ {
76
+ "name": "setId",
77
+ "type": "uint32"
78
+ }
79
+ ]
80
+ };
81
+ var FILL_PROOF_TYPE_STRING = "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,address filler,uint32 attempt,uint32 setId)";
82
+ var FILL_PROOF_DOMAIN = { "name": "CancoreRouter", "version": "1" };
83
+
30
84
  // src/eip712.ts
31
85
  var FEE_CLAIM_DOMAIN_NAME = "CancoreFeeVault";
32
86
  var FEE_CLAIM_DOMAIN_VERSION = "1";
@@ -47,6 +101,1983 @@ function feeClaimDomain(chainId, verifyingContract) {
47
101
  verifyingContract
48
102
  };
49
103
  }
104
+ var PROOF_KIND_ATTESTATION = 1;
105
+ function fillProofDomain(chainId, verifyingContract) {
106
+ return { ...FILL_PROOF_DOMAIN, chainId, verifyingContract };
107
+ }
108
+
109
+ // src/protocol/typedData.ts
110
+ var FILLER_PROTOCOL_DOMAIN = { name: "CancoreFillerProtocol", version: "1" };
111
+ var FILL_TICKET_DOMAIN = { name: "CancoreFillTicket", version: "1" };
112
+ function routerDomain(chainId, verifyingContract) {
113
+ return { name: "CancoreRouter", version: "1", chainId, verifyingContract };
114
+ }
115
+ var ORDER_TYPES = {
116
+ Order: [
117
+ { name: "user", type: "address" },
118
+ { name: "originChainId", type: "uint64" },
119
+ { name: "inputToken", type: "address" },
120
+ { name: "inputAmount", type: "uint256" },
121
+ { name: "destination", type: "bytes32" },
122
+ { name: "outputAsset", type: "bytes32" },
123
+ { name: "minReceived", type: "uint256" },
124
+ { name: "recipient", type: "bytes32" },
125
+ { name: "createdAt", type: "uint64" },
126
+ { name: "fillDeadline", type: "uint64" },
127
+ { name: "feeBps", type: "uint16" }
128
+ ]
129
+ };
130
+ var QUOTE_TYPES = {
131
+ Quote: [
132
+ { name: "orderHash", type: "bytes32" },
133
+ { name: "quoteDeadline", type: "uint64" }
134
+ ]
135
+ };
136
+ var FILL_TICKET_TYPES = {
137
+ FillTicket: [
138
+ { name: "orderHash", type: "bytes32" },
139
+ { name: "filler", type: "address" },
140
+ { name: "attempt", type: "uint32" },
141
+ { name: "validFrom", type: "uint64" },
142
+ { name: "validUntil", type: "uint64" }
143
+ ]
144
+ };
145
+ var FILLER_QUOTE_TYPES = {
146
+ FillerQuote: [
147
+ { name: "requestId", type: "bytes32" },
148
+ { name: "filler", type: "address" },
149
+ { name: "amountOut", type: "uint256" },
150
+ { name: "validUntil", type: "uint64" },
151
+ { name: "nonce", type: "uint64" }
152
+ ]
153
+ };
154
+ var TICKET_INTENT_TYPES = {
155
+ TicketIntent: [
156
+ { name: "orderHash", type: "bytes32" },
157
+ { name: "attempt", type: "uint32" },
158
+ { name: "validFrom", type: "uint64" },
159
+ { name: "validUntil", type: "uint64" }
160
+ ]
161
+ };
162
+ var TICKET_RECEIPT_TYPES = {
163
+ TicketReceipt: [
164
+ { name: "ticketHash", type: "bytes32" },
165
+ { name: "ticketSigHash", type: "bytes32" }
166
+ ]
167
+ };
168
+ var STAKE_BINDING_TYPES = {
169
+ StakeBinding: [
170
+ { name: "partnerId", type: "string" },
171
+ { name: "stakingAddress", type: "address" },
172
+ { name: "chainId", type: "uint256" },
173
+ { name: "nonce", type: "uint64" }
174
+ ]
175
+ };
176
+ var FILLER_AUTH_TYPES = {
177
+ FillerAuth: [
178
+ { name: "fillerId", type: "string" },
179
+ { name: "nonce", type: "bytes32" },
180
+ { name: "expiresAt", type: "uint64" }
181
+ ]
182
+ };
183
+ var GATEWAY_MESSAGE_TYPES = {
184
+ GatewayMessage: [{ name: "bodyHash", type: "bytes32" }]
185
+ };
186
+ var toHex = (bytes) => `0x${bytesToHex(bytes)}`;
187
+ var keccak = (bytes) => keccak_256(bytes);
188
+ function hexBytes(value, field, length) {
189
+ if (typeof value !== "string" || !/^0x([0-9a-fA-F]{2})*$/.test(value)) throw new TypeError(`${field}: expected 0x-prefixed hex, got ${String(value)}`);
190
+ const bytes = hexToBytes(value.slice(2));
191
+ if (length !== void 0 && bytes.length !== length) throw new TypeError(`${field}: expected ${length} bytes, got ${bytes.length}`);
192
+ return bytes;
193
+ }
194
+ function uint(value, bits, field) {
195
+ let n;
196
+ if (typeof value === "bigint") n = value;
197
+ else if (typeof value === "number" && Number.isSafeInteger(value)) n = BigInt(value);
198
+ else if (typeof value === "string" && /^(0|[1-9][0-9]*)$/.test(value)) n = BigInt(value);
199
+ else throw new TypeError(`${field}: expected an unsigned integer, got ${String(value)}`);
200
+ if (n < 0n || n >= 1n << BigInt(bits)) throw new RangeError(`${field}: ${n} does not fit uint${bits}`);
201
+ return n;
202
+ }
203
+ var beBytes = (n, size) => hexToBytes(n.toString(16).padStart(size * 2, "0"));
204
+
205
+ // src/protocol/hash.ts
206
+ var ATOMIC = /^(address|bool|string|bytes([1-9]|[12][0-9]|3[0-2])?|uint(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256))$/;
207
+ var flatOnly = (type, field) => new TypeError(`${field}: type ${type} is not supported \u2014 hashTypedData encodes flat structs of address/bool/bytes/bytesN/string/uintN only`);
208
+ function encodeValue(type, value, field) {
209
+ if (type === "address") return padded(hexBytes(value, field, 20), 12);
210
+ if (type === "string") {
211
+ if (typeof value !== "string") throw new TypeError(`${field}: expected a string`);
212
+ return keccak(utf8ToBytes(value));
213
+ }
214
+ if (type === "bool") {
215
+ if (typeof value !== "boolean") throw new TypeError(`${field}: expected a boolean`);
216
+ return beBytes(value ? 1n : 0n, 32);
217
+ }
218
+ if (type === "bytes") return keccak(hexBytes(value, field));
219
+ if (type.startsWith("bytes")) return padded(hexBytes(value, field, Number(type.slice(5))), 0);
220
+ return beBytes(uint(value, Number(type.slice(4)), field), 32);
221
+ }
222
+ function padded(bytes, offset) {
223
+ const word = new Uint8Array(32);
224
+ word.set(bytes, offset);
225
+ return word;
226
+ }
227
+ function fieldsOf(types, primaryType) {
228
+ const fields = types[primaryType];
229
+ if (!fields) throw new TypeError(`no type ${primaryType}`);
230
+ for (const f of fields) if (!ATOMIC.test(f.type)) throw flatOnly(f.type, `${primaryType}.${f.name}`);
231
+ return fields;
232
+ }
233
+ function encodeType(types, primaryType) {
234
+ return `${primaryType}(${fieldsOf(types, primaryType).map((f) => `${f.type} ${f.name}`).join(",")})`;
235
+ }
236
+ function typeHash(types, primaryType) {
237
+ return toHex(keccak(utf8ToBytes(encodeType(types, primaryType))));
238
+ }
239
+ function structHash(types, primaryType, message) {
240
+ const words = fieldsOf(types, primaryType).map((f) => encodeValue(f.type, message[f.name], `${primaryType}.${f.name}`));
241
+ return keccak(concatBytes(keccak(utf8ToBytes(encodeType(types, primaryType))), ...words));
242
+ }
243
+ function hashStruct(types, primaryType, message) {
244
+ return toHex(structHash(types, primaryType, message));
245
+ }
246
+ var DOMAIN_FIELDS = [
247
+ { name: "name", type: "string" },
248
+ { name: "version", type: "string" },
249
+ { name: "chainId", type: "uint256" },
250
+ { name: "verifyingContract", type: "address" },
251
+ { name: "salt", type: "bytes32" }
252
+ ];
253
+ function hashDomain(domain) {
254
+ const present = DOMAIN_FIELDS.filter((f) => domain[f.name] !== void 0);
255
+ return hashStruct({ EIP712Domain: present }, "EIP712Domain", domain);
256
+ }
257
+ function hashTypedData({ domain, types, primaryType, message }) {
258
+ const separator = hexBytes(hashDomain(domain), "domain", 32);
259
+ return toHex(keccak(concatBytes(new Uint8Array([25, 1]), separator, structHash(types, primaryType, message))));
260
+ }
261
+ function jcs(value) {
262
+ if (value === null || typeof value === "boolean") return JSON.stringify(value);
263
+ if (typeof value === "string") {
264
+ if (/\p{Cs}/u.test(value)) throw new TypeError("jcs: lone surrogate in a string");
265
+ return JSON.stringify(value);
266
+ }
267
+ if (typeof value === "number") {
268
+ if (!Number.isSafeInteger(value)) throw new TypeError(`jcs: ${value} is not a safe integer`);
269
+ return JSON.stringify(value);
270
+ }
271
+ if (Array.isArray(value)) return `[${value.map(jcs).join(",")}]`;
272
+ if (typeof value === "object") {
273
+ const obj = value;
274
+ return `{${Object.keys(obj).sort().map((k) => `${jcs(k)}:${jcs(obj[k])}`).join(",")}}`;
275
+ }
276
+ throw new TypeError(`jcs: a ${typeof value} has no JSON form`);
277
+ }
278
+ function gatewayBodyHash(message) {
279
+ const { sig: _sig, ...body } = message;
280
+ return toHex(keccak(utf8ToBytes(jcs(body))));
281
+ }
282
+ function requestIdHash(requestId) {
283
+ if (!/^[\x21-\x7e]{1,64}$/.test(requestId)) throw new TypeError(`requestId must be 1..64 printable ASCII characters: ${JSON.stringify(requestId)}`);
284
+ return toHex(keccak(utf8ToBytes(requestId)));
285
+ }
286
+ var DRAND_QUICKNET = {
287
+ chainHash: "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971",
288
+ publicKey: "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a",
289
+ scheme: "bls-unchained-g1-rfc9380",
290
+ genesisTime: 1692803367,
291
+ period: 3
292
+ };
293
+ function firstRoundAtOrAfter(unixSeconds) {
294
+ const t = BigInt(unixSeconds);
295
+ const genesis = BigInt(DRAND_QUICKNET.genesisTime);
296
+ const period = BigInt(DRAND_QUICKNET.period);
297
+ return t <= genesis ? 1n : (t - genesis + period - 1n) / period + 1n;
298
+ }
299
+ function drawValue(randomness, orderHash, attempt) {
300
+ const rand = hexBytes(randomness.startsWith("0x") ? randomness : `0x${randomness}`, "randomness", 32);
301
+ const preimage = concatBytes(rand, hexBytes(orderHash, "orderHash", 32), beBytes(uint(attempt, 32, "attempt"), 4));
302
+ return BigInt(toHex(keccak(preimage)));
303
+ }
304
+ function compareUtf8(a, b) {
305
+ const n = Math.min(a.length, b.length);
306
+ for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] - b[i];
307
+ return a.length - b.length;
308
+ }
309
+ function drawWinner(h, candidates) {
310
+ const sorted = candidates.map((c) => ({ id: c.fillerId, key: utf8ToBytes(c.fillerId), weight: uint(c.weight, 256, `weight of ${c.fillerId}`) })).sort((a, b) => compareUtf8(a.key, b.key));
311
+ if (new Set(sorted.map((c) => c.id)).size !== sorted.length) throw new Error("draw: duplicated fillerId");
312
+ const total = sorted.reduce((sum, c) => sum + c.weight, 0n);
313
+ if (total === 0n) throw new Error("draw: no candidate with a positive weight");
314
+ const r = h % total;
315
+ let acc = 0n;
316
+ const winner = sorted.find((c) => (acc += c.weight) > r);
317
+ return { r, winnerFillerId: winner.id };
318
+ }
319
+
320
+ // src/protocol/gateway.ts
321
+ var PROTOCOL_VERSION = "1";
322
+ var FILLER_GATEWAYS = {
323
+ mainnet: { gateway: null, ticketSigners: [] },
324
+ testnet: { gateway: null, ticketSigners: [] },
325
+ devnet: { gateway: null, ticketSigners: [] }
326
+ };
327
+
328
+ // src/protocol/messages.ts
329
+ var DECLINE_REASONS = [
330
+ "NO_INVENTORY",
331
+ "RISK_LIMIT",
332
+ "PRICE_MOVED",
333
+ "PAUSED",
334
+ "OTHER",
335
+ "TICKET_SIGNER_UNKNOWN",
336
+ "TICKET_MISMATCH",
337
+ "TICKET_TTL_TOO_SHORT",
338
+ "TICKET_ISSUED_LATE",
339
+ "TICKET_BEYOND_DEADLINE",
340
+ "ESCROW_NOT_OPEN",
341
+ "ESCROW_MISMATCH",
342
+ "PROOF_WINDOW_TOO_SHORT",
343
+ "SKEW_MARGIN_TOO_SHORT",
344
+ "DRAW_MISMATCH"
345
+ ];
346
+ var ERROR_CODES = [
347
+ "BAD_REQUEST",
348
+ "UNAUTHENTICATED",
349
+ "UNSUPPORTED_VERSION",
350
+ "UNSUPPORTED_TYPE",
351
+ "BAD_SIGNATURE",
352
+ "UNKNOWN_REQUEST",
353
+ "UNKNOWN_TICKET",
354
+ "TICKET_CLOSED",
355
+ "NOT_ELIGIBLE",
356
+ "RATE_LIMITED",
357
+ "INTERNAL"
358
+ ];
359
+ var ERROR_HTTP_STATUS = {
360
+ BAD_REQUEST: 400,
361
+ UNAUTHENTICATED: 401,
362
+ UNSUPPORTED_VERSION: 400,
363
+ UNSUPPORTED_TYPE: 400,
364
+ BAD_SIGNATURE: 422,
365
+ UNKNOWN_REQUEST: 404,
366
+ UNKNOWN_TICKET: 404,
367
+ TICKET_CLOSED: 409,
368
+ NOT_ELIGIBLE: 403,
369
+ RATE_LIMITED: 429,
370
+ INTERNAL: 500
371
+ };
372
+ var EXPIRED_RESULTS = ["FILLED", "NO_SHOW", "NO_SHOW_UNCONFIRMED", "EXEMPT"];
373
+ var EXEMPT_REASONS = ["DESTINATION_HALTED", "GATEWAY_FAULT", "REORGED_AFTER_INCLUSION", "RECIPIENT_NOT_READY", "OTHER"];
374
+ var QUOTE_ACK_STATUSES = ["COUNTED", "LATE", "SHORT_TTL"];
375
+ var QUOTE_FINAL_STATUSES = [...QUOTE_ACK_STATUSES, "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"];
376
+ var PENALTY_STEPS = ["L1", "L2", "L3", "L4"];
377
+ var DRAW_CLOSED_BY = ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED"];
378
+ var TICKET_LIST_STATUSES = ["OFFERED", "ISSUED"];
379
+
380
+ // spec/protocol/asyncapi.json
381
+ var asyncapi_default = {
382
+ asyncapi: "3.0.0",
383
+ info: {
384
+ title: "Cancore filler protocol",
385
+ version: "1.0.0-rc.1",
386
+ description: "The WebSocket protocol between a taker (filler) and the Cancore filler gateway, v1 (release candidate, @cancore/contracts 0.2.0-rc.1). Operations are the gateway's: it sends S\u2192F frames and receives F\u2192S frames. Every S\u2192F frame carries fillerId, sentAt and sig = the gateway key over GatewayMessage{bodyHash} in the CancoreFillerProtocol v1 domain. Payload schemas: messages.schema.json. Generated by scripts/gen-protocol-docs.mjs.",
387
+ license: {
388
+ name: "Apache-2.0"
389
+ }
390
+ },
391
+ defaultContentType: "application/json",
392
+ servers: {
393
+ mock: {
394
+ host: "localhost:{port}",
395
+ protocol: "ws",
396
+ description: "@cancore/test-kit mock-gateway",
397
+ variables: {
398
+ port: {
399
+ default: "8787"
400
+ }
401
+ }
402
+ },
403
+ devnet: {
404
+ host: "{gatewayHost}",
405
+ protocol: "wss",
406
+ description: "Published per environment (O-6)",
407
+ variables: {
408
+ gatewayHost: {
409
+ default: "filler.dev.cancore.io"
410
+ }
411
+ }
412
+ }
413
+ },
414
+ channels: {
415
+ filler: {
416
+ address: "/v1",
417
+ description: "One JSON object per text frame. Nothing but auth.* and error flows before auth.ok; FillerAuth in auth.response authenticates the socket (the REST fallback uses a bearer token).",
418
+ messages: {
419
+ "auth.challenge": {
420
+ $ref: "#/components/messages/auth.challenge"
421
+ },
422
+ "auth.response": {
423
+ $ref: "#/components/messages/auth.response"
424
+ },
425
+ "auth.ok": {
426
+ $ref: "#/components/messages/auth.ok"
427
+ },
428
+ pingS2F: {
429
+ $ref: "#/components/messages/pingS2F"
430
+ },
431
+ pingF2S: {
432
+ $ref: "#/components/messages/pingF2S"
433
+ },
434
+ pongS2F: {
435
+ $ref: "#/components/messages/pongS2F"
436
+ },
437
+ pongF2S: {
438
+ $ref: "#/components/messages/pongF2S"
439
+ },
440
+ error: {
441
+ $ref: "#/components/messages/error"
442
+ },
443
+ "epoch.weights": {
444
+ $ref: "#/components/messages/epoch.weights"
445
+ },
446
+ "quote.request": {
447
+ $ref: "#/components/messages/quote.request"
448
+ },
449
+ quote: {
450
+ $ref: "#/components/messages/quote"
451
+ },
452
+ "quote.ack": {
453
+ $ref: "#/components/messages/quote.ack"
454
+ },
455
+ "quote.reconfirm": {
456
+ $ref: "#/components/messages/quote.reconfirm"
457
+ },
458
+ "quote.reconfirm.reply": {
459
+ $ref: "#/components/messages/quote.reconfirm.reply"
460
+ },
461
+ "ticket.offer": {
462
+ $ref: "#/components/messages/ticket.offer"
463
+ },
464
+ "ticket.intent": {
465
+ $ref: "#/components/messages/ticket.intent"
466
+ },
467
+ "ticket.decline": {
468
+ $ref: "#/components/messages/ticket.decline"
469
+ },
470
+ "ticket.intent.ack": {
471
+ $ref: "#/components/messages/ticket.intent.ack"
472
+ },
473
+ "ticket.issued": {
474
+ $ref: "#/components/messages/ticket.issued"
475
+ },
476
+ "ticket.receipt": {
477
+ $ref: "#/components/messages/ticket.receipt"
478
+ },
479
+ "fill.reported": {
480
+ $ref: "#/components/messages/fill.reported"
481
+ },
482
+ "ticket.expired": {
483
+ $ref: "#/components/messages/ticket.expired"
484
+ },
485
+ "order.settled": {
486
+ $ref: "#/components/messages/order.settled"
487
+ },
488
+ "penalty.applied": {
489
+ $ref: "#/components/messages/penalty.applied"
490
+ }
491
+ }
492
+ }
493
+ },
494
+ operations: {
495
+ sendAuthChallenge: {
496
+ action: "send",
497
+ channel: {
498
+ $ref: "#/channels/filler"
499
+ },
500
+ messages: [
501
+ {
502
+ $ref: "#/channels/filler/messages/auth.challenge"
503
+ }
504
+ ]
505
+ },
506
+ receiveAuthResponse: {
507
+ action: "receive",
508
+ channel: {
509
+ $ref: "#/channels/filler"
510
+ },
511
+ messages: [
512
+ {
513
+ $ref: "#/channels/filler/messages/auth.response"
514
+ }
515
+ ]
516
+ },
517
+ sendAuthOk: {
518
+ action: "send",
519
+ channel: {
520
+ $ref: "#/channels/filler"
521
+ },
522
+ messages: [
523
+ {
524
+ $ref: "#/channels/filler/messages/auth.ok"
525
+ }
526
+ ]
527
+ },
528
+ sendPing: {
529
+ action: "send",
530
+ channel: {
531
+ $ref: "#/channels/filler"
532
+ },
533
+ messages: [
534
+ {
535
+ $ref: "#/channels/filler/messages/pingS2F"
536
+ }
537
+ ]
538
+ },
539
+ receivePing: {
540
+ action: "receive",
541
+ channel: {
542
+ $ref: "#/channels/filler"
543
+ },
544
+ messages: [
545
+ {
546
+ $ref: "#/channels/filler/messages/pingF2S"
547
+ }
548
+ ]
549
+ },
550
+ sendPong: {
551
+ action: "send",
552
+ channel: {
553
+ $ref: "#/channels/filler"
554
+ },
555
+ messages: [
556
+ {
557
+ $ref: "#/channels/filler/messages/pongS2F"
558
+ }
559
+ ]
560
+ },
561
+ receivePong: {
562
+ action: "receive",
563
+ channel: {
564
+ $ref: "#/channels/filler"
565
+ },
566
+ messages: [
567
+ {
568
+ $ref: "#/channels/filler/messages/pongF2S"
569
+ }
570
+ ]
571
+ },
572
+ sendError: {
573
+ action: "send",
574
+ channel: {
575
+ $ref: "#/channels/filler"
576
+ },
577
+ messages: [
578
+ {
579
+ $ref: "#/channels/filler/messages/error"
580
+ }
581
+ ]
582
+ },
583
+ sendEpochWeights: {
584
+ action: "send",
585
+ channel: {
586
+ $ref: "#/channels/filler"
587
+ },
588
+ messages: [
589
+ {
590
+ $ref: "#/channels/filler/messages/epoch.weights"
591
+ }
592
+ ]
593
+ },
594
+ sendQuoteRequest: {
595
+ action: "send",
596
+ channel: {
597
+ $ref: "#/channels/filler"
598
+ },
599
+ messages: [
600
+ {
601
+ $ref: "#/channels/filler/messages/quote.request"
602
+ }
603
+ ]
604
+ },
605
+ receiveQuote: {
606
+ action: "receive",
607
+ channel: {
608
+ $ref: "#/channels/filler"
609
+ },
610
+ messages: [
611
+ {
612
+ $ref: "#/channels/filler/messages/quote"
613
+ }
614
+ ]
615
+ },
616
+ sendQuoteAck: {
617
+ action: "send",
618
+ channel: {
619
+ $ref: "#/channels/filler"
620
+ },
621
+ messages: [
622
+ {
623
+ $ref: "#/channels/filler/messages/quote.ack"
624
+ }
625
+ ]
626
+ },
627
+ sendQuoteReconfirm: {
628
+ action: "send",
629
+ channel: {
630
+ $ref: "#/channels/filler"
631
+ },
632
+ messages: [
633
+ {
634
+ $ref: "#/channels/filler/messages/quote.reconfirm"
635
+ }
636
+ ]
637
+ },
638
+ receiveQuoteReconfirmReply: {
639
+ action: "receive",
640
+ channel: {
641
+ $ref: "#/channels/filler"
642
+ },
643
+ messages: [
644
+ {
645
+ $ref: "#/channels/filler/messages/quote.reconfirm.reply"
646
+ }
647
+ ]
648
+ },
649
+ sendTicketOffer: {
650
+ action: "send",
651
+ channel: {
652
+ $ref: "#/channels/filler"
653
+ },
654
+ messages: [
655
+ {
656
+ $ref: "#/channels/filler/messages/ticket.offer"
657
+ }
658
+ ]
659
+ },
660
+ receiveTicketIntent: {
661
+ action: "receive",
662
+ channel: {
663
+ $ref: "#/channels/filler"
664
+ },
665
+ messages: [
666
+ {
667
+ $ref: "#/channels/filler/messages/ticket.intent"
668
+ }
669
+ ]
670
+ },
671
+ receiveTicketDecline: {
672
+ action: "receive",
673
+ channel: {
674
+ $ref: "#/channels/filler"
675
+ },
676
+ messages: [
677
+ {
678
+ $ref: "#/channels/filler/messages/ticket.decline"
679
+ }
680
+ ]
681
+ },
682
+ sendTicketIntentAck: {
683
+ action: "send",
684
+ channel: {
685
+ $ref: "#/channels/filler"
686
+ },
687
+ messages: [
688
+ {
689
+ $ref: "#/channels/filler/messages/ticket.intent.ack"
690
+ }
691
+ ]
692
+ },
693
+ sendTicketIssued: {
694
+ action: "send",
695
+ channel: {
696
+ $ref: "#/channels/filler"
697
+ },
698
+ messages: [
699
+ {
700
+ $ref: "#/channels/filler/messages/ticket.issued"
701
+ }
702
+ ]
703
+ },
704
+ receiveTicketReceipt: {
705
+ action: "receive",
706
+ channel: {
707
+ $ref: "#/channels/filler"
708
+ },
709
+ messages: [
710
+ {
711
+ $ref: "#/channels/filler/messages/ticket.receipt"
712
+ }
713
+ ]
714
+ },
715
+ receiveFillReported: {
716
+ action: "receive",
717
+ channel: {
718
+ $ref: "#/channels/filler"
719
+ },
720
+ messages: [
721
+ {
722
+ $ref: "#/channels/filler/messages/fill.reported"
723
+ }
724
+ ]
725
+ },
726
+ sendTicketExpired: {
727
+ action: "send",
728
+ channel: {
729
+ $ref: "#/channels/filler"
730
+ },
731
+ messages: [
732
+ {
733
+ $ref: "#/channels/filler/messages/ticket.expired"
734
+ }
735
+ ]
736
+ },
737
+ sendOrderSettled: {
738
+ action: "send",
739
+ channel: {
740
+ $ref: "#/channels/filler"
741
+ },
742
+ messages: [
743
+ {
744
+ $ref: "#/channels/filler/messages/order.settled"
745
+ }
746
+ ]
747
+ },
748
+ sendPenaltyApplied: {
749
+ action: "send",
750
+ channel: {
751
+ $ref: "#/channels/filler"
752
+ },
753
+ messages: [
754
+ {
755
+ $ref: "#/channels/filler/messages/penalty.applied"
756
+ }
757
+ ]
758
+ }
759
+ },
760
+ components: {
761
+ messages: {
762
+ "auth.challenge": {
763
+ name: "auth.challenge",
764
+ title: "auth.challenge (S2F)",
765
+ payload: {
766
+ schemaFormat: "application/schema+json;version=draft-2020-12",
767
+ schema: {
768
+ $ref: "messages.schema.json#/$defs/auth.challenge"
769
+ }
770
+ },
771
+ examples: [
772
+ {
773
+ name: "auth-challenge-1",
774
+ payload: {
775
+ type: "auth.challenge",
776
+ sentAt: 178999998e4,
777
+ nonce: "0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5",
778
+ expiresAt: "1790000030",
779
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
780
+ }
781
+ }
782
+ ]
783
+ },
784
+ "auth.response": {
785
+ name: "auth.response",
786
+ title: "auth.response (F2S)",
787
+ payload: {
788
+ schemaFormat: "application/schema+json;version=draft-2020-12",
789
+ schema: {
790
+ $ref: "messages.schema.json#/$defs/auth.response"
791
+ }
792
+ },
793
+ examples: [
794
+ {
795
+ name: "auth-response-1",
796
+ payload: {
797
+ type: "auth.response",
798
+ id: "a-1",
799
+ fillerId: "acme-markets",
800
+ keyAddress: "0x90f79bf6eb2c4f870365e785982e1f101e93b906",
801
+ protocolVersion: "1",
802
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
803
+ }
804
+ }
805
+ ]
806
+ },
807
+ "auth.ok": {
808
+ name: "auth.ok",
809
+ title: "auth.ok (S2F)",
810
+ payload: {
811
+ schemaFormat: "application/schema+json;version=draft-2020-12",
812
+ schema: {
813
+ $ref: "messages.schema.json#/$defs/auth.ok"
814
+ }
815
+ },
816
+ examples: [
817
+ {
818
+ name: "auth-ok-1",
819
+ payload: {
820
+ type: "auth.ok",
821
+ fillerId: "acme-markets",
822
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
823
+ sentAt: 1789999980200,
824
+ re: "a-1",
825
+ heartbeatIntervalMs: 15e3
826
+ }
827
+ }
828
+ ]
829
+ },
830
+ pingS2F: {
831
+ name: "ping",
832
+ title: "ping (S2F)",
833
+ payload: {
834
+ schemaFormat: "application/schema+json;version=draft-2020-12",
835
+ schema: {
836
+ $ref: "messages.schema.json#/$defs/pingS2F"
837
+ }
838
+ },
839
+ examples: [
840
+ {
841
+ name: "pingS2F-1",
842
+ payload: {
843
+ type: "ping",
844
+ fillerId: "acme-markets",
845
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
846
+ sentAt: 1789999995e3,
847
+ id: "gp-1"
848
+ }
849
+ }
850
+ ]
851
+ },
852
+ pingF2S: {
853
+ name: "ping",
854
+ title: "ping (F2S)",
855
+ payload: {
856
+ schemaFormat: "application/schema+json;version=draft-2020-12",
857
+ schema: {
858
+ $ref: "messages.schema.json#/$defs/pingF2S"
859
+ }
860
+ },
861
+ examples: [
862
+ {
863
+ name: "pingF2S-1",
864
+ payload: {
865
+ type: "ping",
866
+ id: "p-1"
867
+ }
868
+ }
869
+ ]
870
+ },
871
+ pongS2F: {
872
+ name: "pong",
873
+ title: "pong (S2F)",
874
+ payload: {
875
+ schemaFormat: "application/schema+json;version=draft-2020-12",
876
+ schema: {
877
+ $ref: "messages.schema.json#/$defs/pongS2F"
878
+ }
879
+ },
880
+ examples: [
881
+ {
882
+ name: "pongS2F-1",
883
+ payload: {
884
+ type: "pong",
885
+ fillerId: "acme-markets",
886
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
887
+ sentAt: 1789999995100,
888
+ re: "p-1"
889
+ }
890
+ }
891
+ ]
892
+ },
893
+ pongF2S: {
894
+ name: "pong",
895
+ title: "pong (F2S)",
896
+ payload: {
897
+ schemaFormat: "application/schema+json;version=draft-2020-12",
898
+ schema: {
899
+ $ref: "messages.schema.json#/$defs/pongF2S"
900
+ }
901
+ },
902
+ examples: [
903
+ {
904
+ name: "pongF2S-1",
905
+ payload: {
906
+ type: "pong",
907
+ re: "gp-1"
908
+ }
909
+ }
910
+ ]
911
+ },
912
+ error: {
913
+ name: "error",
914
+ title: "error (S2F)",
915
+ payload: {
916
+ schemaFormat: "application/schema+json;version=draft-2020-12",
917
+ schema: {
918
+ $ref: "messages.schema.json#/$defs/error"
919
+ }
920
+ },
921
+ examples: [
922
+ {
923
+ name: "error-1",
924
+ payload: {
925
+ type: "error",
926
+ fillerId: "acme-markets",
927
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
928
+ sentAt: 1790000023500,
929
+ re: "i-2",
930
+ code: "TICKET_CLOSED",
931
+ message: "ticket.intent after acceptBy"
932
+ }
933
+ },
934
+ {
935
+ name: "error-2",
936
+ payload: {
937
+ type: "error",
938
+ sentAt: 1789999980100,
939
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
940
+ re: "q-0",
941
+ code: "UNAUTHENTICATED",
942
+ message: "quote before auth.ok"
943
+ }
944
+ }
945
+ ]
946
+ },
947
+ "epoch.weights": {
948
+ name: "epoch.weights",
949
+ title: "epoch.weights (S2F)",
950
+ payload: {
951
+ schemaFormat: "application/schema+json;version=draft-2020-12",
952
+ schema: {
953
+ $ref: "messages.schema.json#/$defs/epoch.weights"
954
+ }
955
+ },
956
+ examples: [
957
+ {
958
+ name: "epoch-weights-1",
959
+ payload: {
960
+ type: "epoch.weights",
961
+ fillerId: "acme-markets",
962
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
963
+ sentAt: 1789999980300,
964
+ epochId: "20717",
965
+ startsAt: "1789948800",
966
+ endsAt: "1790035200",
967
+ weightsRoot: "0xa1c24765b55b34e0c206f808d2fac2e448d9db6f154d89f898921a80bad76e92"
968
+ }
969
+ }
970
+ ]
971
+ },
972
+ "quote.request": {
973
+ name: "quote.request",
974
+ title: "quote.request (S2F)",
975
+ payload: {
976
+ schemaFormat: "application/schema+json;version=draft-2020-12",
977
+ schema: {
978
+ $ref: "messages.schema.json#/$defs/quote.request"
979
+ }
980
+ },
981
+ examples: [
982
+ {
983
+ name: "quote-request-1",
984
+ payload: {
985
+ type: "quote.request",
986
+ fillerId: "acme-markets",
987
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
988
+ sentAt: 178999999e4,
989
+ requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
990
+ route: {
991
+ src: "eip155:11155111",
992
+ dst: "eip155:421614"
993
+ },
994
+ inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
995
+ inputAmount: "1003000000",
996
+ outputAsset: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
997
+ feeBps: 30,
998
+ fillDeadlineHint: "1790000600",
999
+ windowCloseAt: 1789999992e3,
1000
+ quoteTtlMs: 6e4,
1001
+ imbalanceHint: {
1002
+ dstAsset: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
1003
+ netFlow24hUsd: "-12500.50"
1004
+ }
1005
+ }
1006
+ }
1007
+ ]
1008
+ },
1009
+ quote: {
1010
+ name: "quote",
1011
+ title: "quote (F2S)",
1012
+ payload: {
1013
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1014
+ schema: {
1015
+ $ref: "messages.schema.json#/$defs/quote"
1016
+ }
1017
+ },
1018
+ examples: [
1019
+ {
1020
+ name: "quote-1",
1021
+ payload: {
1022
+ type: "quote",
1023
+ id: "q-1",
1024
+ requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
1025
+ filler: "0x742d35cc6634c0532925a3b844bc454e4438f44e",
1026
+ amountOut: "999000000",
1027
+ validUntil: "1790000060",
1028
+ nonce: "1",
1029
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1030
+ }
1031
+ }
1032
+ ]
1033
+ },
1034
+ "quote.ack": {
1035
+ name: "quote.ack",
1036
+ title: "quote.ack (S2F)",
1037
+ payload: {
1038
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1039
+ schema: {
1040
+ $ref: "messages.schema.json#/$defs/quote.ack"
1041
+ }
1042
+ },
1043
+ examples: [
1044
+ {
1045
+ name: "quote-ack-1",
1046
+ payload: {
1047
+ type: "quote.ack",
1048
+ fillerId: "acme-markets",
1049
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1050
+ sentAt: 1789999991001,
1051
+ re: "q-1",
1052
+ requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
1053
+ quoteHash: "0xdfbd4a1d732d8a105714d38ed6c46b8ee6e299e8bf90990ac502ebaea19fbe70",
1054
+ receivedAt: 1789999991e3,
1055
+ status: "COUNTED"
1056
+ }
1057
+ }
1058
+ ]
1059
+ },
1060
+ "quote.reconfirm": {
1061
+ name: "quote.reconfirm",
1062
+ title: "quote.reconfirm (S2F)",
1063
+ payload: {
1064
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1065
+ schema: {
1066
+ $ref: "messages.schema.json#/$defs/quote.reconfirm"
1067
+ }
1068
+ },
1069
+ examples: [
1070
+ {
1071
+ name: "quote-reconfirm-1",
1072
+ payload: {
1073
+ type: "quote.reconfirm",
1074
+ fillerId: "acme-markets",
1075
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1076
+ sentAt: 1790000013e3,
1077
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1078
+ requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
1079
+ order: {
1080
+ user: "0xa11ce00000000000000000000000000000000001",
1081
+ originChainId: "11155111",
1082
+ inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
1083
+ inputAmount: "1003000000",
1084
+ destination: "0x0000000000000000000000000000000000000000000000000000000000066eee",
1085
+ outputAsset: "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
1086
+ minReceived: "999000000",
1087
+ recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
1088
+ createdAt: "1790000000",
1089
+ fillDeadline: "1790000600",
1090
+ feeBps: "30"
1091
+ },
1092
+ amountOut: "999000000",
1093
+ ticketTtl: 360,
1094
+ replyBy: 1790000016e3
1095
+ }
1096
+ }
1097
+ ]
1098
+ },
1099
+ "quote.reconfirm.reply": {
1100
+ name: "quote.reconfirm.reply",
1101
+ title: "quote.reconfirm.reply (F2S)",
1102
+ payload: {
1103
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1104
+ schema: {
1105
+ $ref: "messages.schema.json#/$defs/quote.reconfirm.reply"
1106
+ }
1107
+ },
1108
+ examples: [
1109
+ {
1110
+ name: "quote-reconfirm-reply-1",
1111
+ payload: {
1112
+ type: "quote.reconfirm.reply",
1113
+ id: "r-1",
1114
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1115
+ accept: true,
1116
+ validUntil: "1790000400",
1117
+ nonce: "2",
1118
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1119
+ }
1120
+ },
1121
+ {
1122
+ name: "quote-reconfirm-reply-2",
1123
+ payload: {
1124
+ type: "quote.reconfirm.reply",
1125
+ id: "r-2",
1126
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1127
+ accept: false
1128
+ }
1129
+ }
1130
+ ]
1131
+ },
1132
+ "ticket.offer": {
1133
+ name: "ticket.offer",
1134
+ title: "ticket.offer (S2F)",
1135
+ payload: {
1136
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1137
+ schema: {
1138
+ $ref: "messages.schema.json#/$defs/ticket.offer"
1139
+ }
1140
+ },
1141
+ examples: [
1142
+ {
1143
+ name: "ticket-offer-1",
1144
+ payload: {
1145
+ type: "ticket.offer",
1146
+ fillerId: "acme-markets",
1147
+ sentAt: 179000002e4,
1148
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1149
+ attempt: 0,
1150
+ order: {
1151
+ user: "0xa11ce00000000000000000000000000000000001",
1152
+ originChainId: "11155111",
1153
+ inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
1154
+ inputAmount: "1003000000",
1155
+ destination: "0x0000000000000000000000000000000000000000000000000000000000066eee",
1156
+ outputAsset: "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
1157
+ minReceived: "999000000",
1158
+ recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
1159
+ createdAt: "1790000000",
1160
+ fillDeadline: "1790000600",
1161
+ feeBps: "30"
1162
+ },
1163
+ amountOut: "999000000",
1164
+ validFrom: "1790000040",
1165
+ validUntil: "1790000400",
1166
+ acceptBy: 1790000023e3,
1167
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1168
+ }
1169
+ }
1170
+ ]
1171
+ },
1172
+ "ticket.intent": {
1173
+ name: "ticket.intent",
1174
+ title: "ticket.intent (F2S)",
1175
+ payload: {
1176
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1177
+ schema: {
1178
+ $ref: "messages.schema.json#/$defs/ticket.intent"
1179
+ }
1180
+ },
1181
+ examples: [
1182
+ {
1183
+ name: "ticket-intent-1",
1184
+ payload: {
1185
+ type: "ticket.intent",
1186
+ id: "i-1",
1187
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1188
+ attempt: 0,
1189
+ validFrom: "1790000040",
1190
+ validUntil: "1790000400",
1191
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1192
+ }
1193
+ }
1194
+ ]
1195
+ },
1196
+ "ticket.decline": {
1197
+ name: "ticket.decline",
1198
+ title: "ticket.decline (F2S)",
1199
+ payload: {
1200
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1201
+ schema: {
1202
+ $ref: "messages.schema.json#/$defs/ticket.decline"
1203
+ }
1204
+ },
1205
+ examples: [
1206
+ {
1207
+ name: "ticket-decline-1",
1208
+ payload: {
1209
+ type: "ticket.decline",
1210
+ id: "d-1",
1211
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1212
+ attempt: 0,
1213
+ reason: "TICKET_ISSUED_LATE",
1214
+ detail: "ticket.issued 3001 ms after acceptBy"
1215
+ }
1216
+ }
1217
+ ]
1218
+ },
1219
+ "ticket.intent.ack": {
1220
+ name: "ticket.intent.ack",
1221
+ title: "ticket.intent.ack (S2F)",
1222
+ payload: {
1223
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1224
+ schema: {
1225
+ $ref: "messages.schema.json#/$defs/ticket.intent.ack"
1226
+ }
1227
+ },
1228
+ examples: [
1229
+ {
1230
+ name: "ticket-intent-ack-1",
1231
+ payload: {
1232
+ type: "ticket.intent.ack",
1233
+ fillerId: "acme-markets",
1234
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1235
+ sentAt: 1790000021001,
1236
+ re: "i-1",
1237
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1238
+ attempt: 0,
1239
+ intentHash: "0xf3a07f98be564fb062f1574d933fc33f40e5c9e36c0fec83d3b3c4c15e9199c2",
1240
+ receivedAt: 1790000021e3
1241
+ }
1242
+ }
1243
+ ]
1244
+ },
1245
+ "ticket.issued": {
1246
+ name: "ticket.issued",
1247
+ title: "ticket.issued (S2F)",
1248
+ payload: {
1249
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1250
+ schema: {
1251
+ $ref: "messages.schema.json#/$defs/ticket.issued"
1252
+ }
1253
+ },
1254
+ examples: [
1255
+ {
1256
+ name: "ticket-issued-1",
1257
+ payload: {
1258
+ type: "ticket.issued",
1259
+ fillerId: "acme-markets",
1260
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1261
+ sentAt: 1790000024e3,
1262
+ form: "evm",
1263
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1264
+ attempt: 0,
1265
+ ticket: {
1266
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1267
+ filler: "0x742d35cc6634c0532925a3b844bc454e4438f44e",
1268
+ attempt: 0,
1269
+ validFrom: "1790000040",
1270
+ validUntil: "1790000400"
1271
+ },
1272
+ ticketSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1273
+ }
1274
+ },
1275
+ {
1276
+ name: "ticket-issued-2",
1277
+ payload: {
1278
+ type: "ticket.issued",
1279
+ fillerId: "acme-markets",
1280
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1281
+ sentAt: 1790000024e3,
1282
+ form: "canton",
1283
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1284
+ attempt: 0,
1285
+ deliveryOrderCid: "00a1b2c3d4e5f6#fixture-delivery-order",
1286
+ validUntil: "1790000400"
1287
+ }
1288
+ }
1289
+ ]
1290
+ },
1291
+ "ticket.receipt": {
1292
+ name: "ticket.receipt",
1293
+ title: "ticket.receipt (F2S)",
1294
+ payload: {
1295
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1296
+ schema: {
1297
+ $ref: "messages.schema.json#/$defs/ticket.receipt"
1298
+ }
1299
+ },
1300
+ examples: [
1301
+ {
1302
+ name: "ticket-receipt-1",
1303
+ payload: {
1304
+ type: "ticket.receipt",
1305
+ id: "rc-1",
1306
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1307
+ attempt: 0,
1308
+ ticketHash: "0x466bc75e5efad07ad975aeea9ec731902bc804461686a6c8f76ef4fd50297819",
1309
+ ticketSigHash: "0x9d30145c6e97cad96cf7cee181ac9d5b879dea7fed0730d7197e84e28487292b",
1310
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
1311
+ }
1312
+ }
1313
+ ]
1314
+ },
1315
+ "fill.reported": {
1316
+ name: "fill.reported",
1317
+ title: "fill.reported (F2S)",
1318
+ payload: {
1319
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1320
+ schema: {
1321
+ $ref: "messages.schema.json#/$defs/fill.reported"
1322
+ }
1323
+ },
1324
+ examples: [
1325
+ {
1326
+ name: "fill-reported-1",
1327
+ payload: {
1328
+ type: "fill.reported",
1329
+ id: "f-1",
1330
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1331
+ attempt: 0,
1332
+ txRef: "0xfc4cba975d6b96ed2be00adae2d970f61413b963279089dcfc6402ddccc42740"
1333
+ }
1334
+ }
1335
+ ]
1336
+ },
1337
+ "ticket.expired": {
1338
+ name: "ticket.expired",
1339
+ title: "ticket.expired (S2F)",
1340
+ payload: {
1341
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1342
+ schema: {
1343
+ $ref: "messages.schema.json#/$defs/ticket.expired"
1344
+ }
1345
+ },
1346
+ examples: [
1347
+ {
1348
+ name: "ticket-expired-1",
1349
+ payload: {
1350
+ type: "ticket.expired",
1351
+ fillerId: "acme-markets",
1352
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1353
+ sentAt: 179000046e4,
1354
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1355
+ attempt: 0,
1356
+ result: "FILLED"
1357
+ }
1358
+ },
1359
+ {
1360
+ name: "ticket-expired-2",
1361
+ payload: {
1362
+ type: "ticket.expired",
1363
+ fillerId: "acme-markets",
1364
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1365
+ sentAt: 179000046e4,
1366
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1367
+ attempt: 0,
1368
+ result: "EXEMPT",
1369
+ exemptReason: "DESTINATION_HALTED"
1370
+ }
1371
+ }
1372
+ ]
1373
+ },
1374
+ "order.settled": {
1375
+ name: "order.settled",
1376
+ title: "order.settled (S2F)",
1377
+ payload: {
1378
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1379
+ schema: {
1380
+ $ref: "messages.schema.json#/$defs/order.settled"
1381
+ }
1382
+ },
1383
+ examples: [
1384
+ {
1385
+ name: "order-settled-1",
1386
+ payload: {
1387
+ type: "order.settled",
1388
+ fillerId: "acme-markets",
1389
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1390
+ sentAt: 17900009e5,
1391
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1392
+ payout: "1000000000",
1393
+ fee: "3000000",
1394
+ penaltyWithheld: "0",
1395
+ txRef: "0x8d99b79edaf0d9c062753bb308a72f52ec1ed8873fe06580c14524bb66a9f614"
1396
+ }
1397
+ }
1398
+ ]
1399
+ },
1400
+ "penalty.applied": {
1401
+ name: "penalty.applied",
1402
+ title: "penalty.applied (S2F)",
1403
+ payload: {
1404
+ schemaFormat: "application/schema+json;version=draft-2020-12",
1405
+ schema: {
1406
+ $ref: "messages.schema.json#/$defs/penalty.applied"
1407
+ }
1408
+ },
1409
+ examples: [
1410
+ {
1411
+ name: "penalty-applied-1",
1412
+ payload: {
1413
+ type: "penalty.applied",
1414
+ fillerId: "acme-markets",
1415
+ sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
1416
+ sentAt: 1790001e6,
1417
+ violationId: "v-1",
1418
+ code: "NO_SHOW",
1419
+ step: "L1",
1420
+ details: {
1421
+ orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
1422
+ attempt: 0
1423
+ }
1424
+ }
1425
+ }
1426
+ ]
1427
+ }
1428
+ }
1429
+ }
1430
+ };
1431
+
1432
+ // spec/protocol/messages.schema.json
1433
+ var messages_schema_default = {
1434
+ $schema: "https://json-schema.org/draft/2020-12/schema",
1435
+ $id: "https://cancore.io/schemas/filler-protocol/v1/messages.schema.json",
1436
+ title: "Cancore filler protocol v1 \u2014 WebSocket frames",
1437
+ $comment: "One $def per frame type, validated by name ($defs/<type>). The schemas encode the SENDER rule (protocol \xA73.1): lowercase hex, uint64 and wider as canonical decimal strings, uint8/16/32 as JSON integers, gateway times in milliseconds. No object is closed (V-2): receivers ignore unknown fields, takers ignore unknown S\u2192F types, and treat an unknown reason/result/code as OTHER/generic. Every enum is open: anyOf [known values, futureEnumValue]. x-direction: S2F = gateway to taker (signed, addressed, timed), F2S = taker to gateway, both = either way (ping/pong; <type>S2F is the signed gateway copy, <type>F2S the taker's).",
1438
+ $defs: {
1439
+ uintDec64: { type: "string", pattern: "^(0|[1-9][0-9]*)$", maxLength: 20, description: "uint64 as a decimal string: digits only, no sign, no exponent, no leading zero" },
1440
+ uintDec256: { type: "string", pattern: "^(0|[1-9][0-9]*)$", maxLength: 78, description: "uint256 as a decimal string" },
1441
+ intDecUsd: { type: "string", pattern: "^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$", description: "signed decimal USD amount" },
1442
+ uint8: { type: "integer", minimum: 0, maximum: 255 },
1443
+ uint16: { type: "integer", minimum: 0, maximum: 65535 },
1444
+ uint32: { type: "integer", minimum: 0, maximum: 4294967295 },
1445
+ address: { type: "string", pattern: "^0x[0-9a-f]{40}$", description: "EVM address, lowercase hex" },
1446
+ bytes32: { type: "string", pattern: "^0x[0-9a-f]{64}$" },
1447
+ sig65: { type: "string", pattern: "^0x[0-9a-f]{128}(1b|1c)$", description: "65-byte r \u2016 s \u2016 v, low-s, v \u2208 {27, 28}" },
1448
+ timeMs: { type: "integer", minimum: 1e12, maximum: 9007199254740991, description: "unix milliseconds, gateway clock; the minimum rejects seconds" },
1449
+ durationMs: { type: "integer", minimum: 0, maximum: 9007199254740991 },
1450
+ timeS: { $ref: "#/$defs/uintDec64", description: "unix seconds as a decimal string (on-chain and signed times)" },
1451
+ caip2: { type: "string", pattern: "^(eip155:[1-9][0-9]*|canton:(mainnet|testnet|devnet))$" },
1452
+ cantonAsset: {
1453
+ type: "object",
1454
+ required: ["admin", "id"],
1455
+ properties: { admin: { type: "string", minLength: 1 }, id: { type: "string", minLength: 1 } }
1456
+ },
1457
+ asset: { oneOf: [{ $ref: "#/$defs/address" }, { $ref: "#/$defs/cantonAsset" }] },
1458
+ requestId: { type: "string", pattern: "^[!-~]{1,64}$", description: "1..64 printable ASCII (Canonical.daml:90-93)" },
1459
+ fillerId: { type: "string", pattern: "^[a-z0-9][a-z0-9-]{0,62}$" },
1460
+ messageId: { type: "string", minLength: 1, maxLength: 64 },
1461
+ protocolVersion: { const: "1" },
1462
+ order: {
1463
+ type: "object",
1464
+ description: "ICancoreRouter.Order, eleven fields, every numeric field a decimal string (the shape of canton-order.json vector.order)",
1465
+ required: ["user", "originChainId", "inputToken", "inputAmount", "destination", "outputAsset", "minReceived", "recipient", "createdAt", "fillDeadline", "feeBps"],
1466
+ properties: {
1467
+ user: { $ref: "#/$defs/address" },
1468
+ originChainId: { $ref: "#/$defs/uintDec64" },
1469
+ inputToken: { $ref: "#/$defs/address" },
1470
+ inputAmount: { $ref: "#/$defs/uintDec256" },
1471
+ destination: { $ref: "#/$defs/bytes32" },
1472
+ outputAsset: { $ref: "#/$defs/bytes32" },
1473
+ minReceived: { $ref: "#/$defs/uintDec256" },
1474
+ recipient: { $ref: "#/$defs/bytes32" },
1475
+ createdAt: { $ref: "#/$defs/timeS" },
1476
+ fillDeadline: { $ref: "#/$defs/timeS" },
1477
+ feeBps: { type: "string", pattern: "^(0|[1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$", description: "uint16" }
1478
+ }
1479
+ },
1480
+ ticket: {
1481
+ type: "object",
1482
+ required: ["orderHash", "filler", "attempt", "validFrom", "validUntil"],
1483
+ properties: {
1484
+ orderHash: { $ref: "#/$defs/bytes32" },
1485
+ filler: { $ref: "#/$defs/address" },
1486
+ attempt: { $ref: "#/$defs/uint32" },
1487
+ validFrom: { $ref: "#/$defs/timeS" },
1488
+ validUntil: { $ref: "#/$defs/timeS" }
1489
+ }
1490
+ },
1491
+ futureEnumValue: { type: "string", pattern: "^[A-Z][A-Z0-9_]*$", description: "a value added to an open enum within v1 (V-2); the receiver treats it as OTHER/generic. Every protocol enum is `anyOf: [{enum: known values}, futureEnumValue]`" },
1492
+ declineReason: {
1493
+ anyOf: [
1494
+ { enum: ["NO_INVENTORY", "RISK_LIMIT", "PRICE_MOVED", "PAUSED", "OTHER", "TICKET_SIGNER_UNKNOWN", "TICKET_MISMATCH", "TICKET_TTL_TOO_SHORT", "TICKET_ISSUED_LATE", "TICKET_BEYOND_DEADLINE", "ESCROW_NOT_OPEN", "ESCROW_MISMATCH", "PROOF_WINDOW_TOO_SHORT", "SKEW_MARGIN_TOO_SHORT", "DRAW_MISMATCH"] },
1495
+ { $ref: "#/$defs/futureEnumValue" }
1496
+ ]
1497
+ },
1498
+ errorCode: {
1499
+ anyOf: [
1500
+ { enum: ["BAD_REQUEST", "UNAUTHENTICATED", "UNSUPPORTED_VERSION", "UNSUPPORTED_TYPE", "BAD_SIGNATURE", "UNKNOWN_REQUEST", "UNKNOWN_TICKET", "TICKET_CLOSED", "NOT_ELIGIBLE", "RATE_LIMITED", "INTERNAL"] },
1501
+ { $ref: "#/$defs/futureEnumValue" }
1502
+ ]
1503
+ },
1504
+ expiredResult: { anyOf: [{ enum: ["FILLED", "NO_SHOW", "NO_SHOW_UNCONFIRMED", "EXEMPT"] }, { $ref: "#/$defs/futureEnumValue" }] },
1505
+ exemptReason: { anyOf: [{ enum: ["DESTINATION_HALTED", "GATEWAY_FAULT", "REORGED_AFTER_INCLUSION", "RECIPIENT_NOT_READY", "OTHER"] }, { $ref: "#/$defs/futureEnumValue" }] },
1506
+ quoteAckStatus: { anyOf: [{ enum: ["COUNTED", "LATE", "SHORT_TTL"] }, { $ref: "#/$defs/futureEnumValue" }], description: "verdict at receipt time; the final status is on GET /v1/filler/quotes" },
1507
+ penaltyStep: { anyOf: [{ enum: ["L1", "L2", "L3", "L4"] }, { $ref: "#/$defs/futureEnumValue" }] },
1508
+ s2fEnvelope: {
1509
+ type: "object",
1510
+ required: ["type", "sentAt", "sig"],
1511
+ properties: {
1512
+ type: { type: "string" },
1513
+ fillerId: { $ref: "#/$defs/fillerId", description: "the addressee" },
1514
+ sentAt: { $ref: "#/$defs/timeMs" },
1515
+ sig: { $ref: "#/$defs/sig65", description: "gateway key over GatewayMessage{bodyHash = keccak256(JCS(frame without sig))}" },
1516
+ re: { $ref: "#/$defs/messageId" }
1517
+ }
1518
+ },
1519
+ s2fBase: { allOf: [{ $ref: "#/$defs/s2fEnvelope" }, { type: "object", required: ["fillerId"], properties: { fillerId: { $ref: "#/$defs/fillerId" } } }] },
1520
+ f2sBase: {
1521
+ type: "object",
1522
+ required: ["type", "id"],
1523
+ properties: { type: { type: "string" }, id: { $ref: "#/$defs/messageId" } }
1524
+ },
1525
+ "auth.challenge": {
1526
+ "x-direction": "S2F",
1527
+ type: "object",
1528
+ description: "First frame after connect; the addressee is not known yet, so no fillerId",
1529
+ allOf: [{ $ref: "#/$defs/s2fEnvelope" }],
1530
+ required: ["type", "nonce", "expiresAt"],
1531
+ properties: { type: { const: "auth.challenge" }, nonce: { $ref: "#/$defs/bytes32" }, expiresAt: { $ref: "#/$defs/timeS" } }
1532
+ },
1533
+ "auth.response": {
1534
+ "x-direction": "F2S",
1535
+ type: "object",
1536
+ description: "sig = FillerAuth{fillerId, nonce, expiresAt} by a registered quote key",
1537
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1538
+ required: ["type", "fillerId", "keyAddress", "protocolVersion", "sig"],
1539
+ properties: {
1540
+ type: { const: "auth.response" },
1541
+ fillerId: { $ref: "#/$defs/fillerId" },
1542
+ keyAddress: { $ref: "#/$defs/address" },
1543
+ protocolVersion: { type: "string", description: 'the gateway answers UNSUPPORTED_VERSION to anything it does not serve; v1 senders send "1"' },
1544
+ sig: { $ref: "#/$defs/sig65" }
1545
+ }
1546
+ },
1547
+ "auth.ok": {
1548
+ "x-direction": "S2F",
1549
+ type: "object",
1550
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1551
+ required: ["type", "heartbeatIntervalMs"],
1552
+ properties: { type: { const: "auth.ok" }, heartbeatIntervalMs: { $ref: "#/$defs/durationMs" } }
1553
+ },
1554
+ ping: {
1555
+ "x-direction": "both",
1556
+ description: "Heartbeat, either way. A receiver checks the copy of its direction: pingS2F (gateway to taker: signed, addressed, timed) or pingF2S (unsigned)",
1557
+ anyOf: [{ $ref: "#/$defs/pingF2S" }, { $ref: "#/$defs/pingS2F" }]
1558
+ },
1559
+ pingF2S: {
1560
+ type: "object",
1561
+ required: ["type", "id"],
1562
+ properties: { type: { const: "ping" }, id: { $ref: "#/$defs/messageId" } }
1563
+ },
1564
+ pingS2F: {
1565
+ type: "object",
1566
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1567
+ required: ["type", "id"],
1568
+ properties: { type: { const: "ping" }, id: { $ref: "#/$defs/messageId" } }
1569
+ },
1570
+ pong: {
1571
+ "x-direction": "both",
1572
+ description: "Answer to a ping, re = ping.id. A receiver checks the copy of its direction: pongS2F (signed, addressed, timed) or pongF2S (unsigned)",
1573
+ anyOf: [{ $ref: "#/$defs/pongF2S" }, { $ref: "#/$defs/pongS2F" }]
1574
+ },
1575
+ pongF2S: {
1576
+ type: "object",
1577
+ required: ["type", "re"],
1578
+ properties: { type: { const: "pong" }, re: { $ref: "#/$defs/messageId" } }
1579
+ },
1580
+ pongS2F: {
1581
+ type: "object",
1582
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1583
+ required: ["type", "re"],
1584
+ properties: { type: { const: "pong" }, re: { $ref: "#/$defs/messageId" } }
1585
+ },
1586
+ error: {
1587
+ "x-direction": "S2F",
1588
+ type: "object",
1589
+ description: "Reply to the F\u2192S frame `re`; also the REST error body. fillerId is absent before authentication",
1590
+ allOf: [{ $ref: "#/$defs/s2fEnvelope" }],
1591
+ required: ["type", "code", "message"],
1592
+ properties: { type: { const: "error" }, code: { $ref: "#/$defs/errorCode" }, message: { type: "string" } }
1593
+ },
1594
+ "epoch.weights": {
1595
+ "x-direction": "S2F",
1596
+ type: "object",
1597
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1598
+ required: ["type", "epochId", "startsAt", "endsAt", "weightsRoot"],
1599
+ properties: {
1600
+ type: { const: "epoch.weights" },
1601
+ epochId: { $ref: "#/$defs/uintDec64" },
1602
+ startsAt: { $ref: "#/$defs/timeS" },
1603
+ endsAt: { $ref: "#/$defs/timeS" },
1604
+ weightsRoot: { $ref: "#/$defs/bytes32" }
1605
+ }
1606
+ },
1607
+ "quote.request": {
1608
+ "x-direction": "S2F",
1609
+ type: "object",
1610
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1611
+ required: ["type", "requestId", "route", "inputToken", "inputAmount", "outputAsset", "feeBps", "fillDeadlineHint", "windowCloseAt", "quoteTtlMs"],
1612
+ properties: {
1613
+ type: { const: "quote.request" },
1614
+ requestId: { $ref: "#/$defs/requestId" },
1615
+ route: {
1616
+ type: "object",
1617
+ required: ["src", "dst"],
1618
+ properties: { src: { $ref: "#/$defs/caip2" }, dst: { $ref: "#/$defs/caip2" } }
1619
+ },
1620
+ inputToken: { $ref: "#/$defs/asset" },
1621
+ inputAmount: { $ref: "#/$defs/uintDec256", description: "the total T the maker deposits (inclusive fee), input base units" },
1622
+ outputAsset: { $ref: "#/$defs/asset" },
1623
+ feeBps: { $ref: "#/$defs/uint16" },
1624
+ fillDeadlineHint: { $ref: "#/$defs/timeS" },
1625
+ windowCloseAt: { $ref: "#/$defs/timeMs" },
1626
+ quoteTtlMs: { $ref: "#/$defs/durationMs" },
1627
+ imbalanceHint: {
1628
+ type: "object",
1629
+ required: ["dstAsset", "netFlow24hUsd"],
1630
+ properties: { dstAsset: { $ref: "#/$defs/asset" }, netFlow24hUsd: { $ref: "#/$defs/intDecUsd" } }
1631
+ }
1632
+ }
1633
+ },
1634
+ quote: {
1635
+ "x-direction": "F2S",
1636
+ type: "object",
1637
+ description: "sig = FillerQuote{keccak256(utf8(requestId)), filler, amountOut, validUntil, nonce} by the quote key; counts only if validUntil \xD7 1000 \u2265 windowCloseAt + quoteTtlMs",
1638
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1639
+ required: ["type", "requestId", "filler", "amountOut", "validUntil", "nonce", "sig"],
1640
+ properties: {
1641
+ type: { const: "quote" },
1642
+ requestId: { $ref: "#/$defs/requestId" },
1643
+ filler: { $ref: "#/$defs/address" },
1644
+ amountOut: { $ref: "#/$defs/uintDec256" },
1645
+ validUntil: { $ref: "#/$defs/timeS" },
1646
+ nonce: { $ref: "#/$defs/uintDec64" },
1647
+ sig: { $ref: "#/$defs/sig65" }
1648
+ }
1649
+ },
1650
+ "quote.ack": {
1651
+ "x-direction": "S2F",
1652
+ type: "object",
1653
+ description: "For every well-formed, correctly signed quote, late ones included (S-12)",
1654
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1655
+ required: ["type", "requestId", "quoteHash", "receivedAt", "status"],
1656
+ properties: {
1657
+ type: { const: "quote.ack" },
1658
+ requestId: { $ref: "#/$defs/requestId" },
1659
+ quoteHash: { $ref: "#/$defs/bytes32" },
1660
+ receivedAt: { $ref: "#/$defs/timeMs" },
1661
+ status: { $ref: "#/$defs/quoteAckStatus" }
1662
+ }
1663
+ },
1664
+ "quote.reconfirm": {
1665
+ "x-direction": "S2F",
1666
+ type: "object",
1667
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1668
+ required: ["type", "orderHash", "requestId", "order", "amountOut", "ticketTtl", "replyBy"],
1669
+ properties: {
1670
+ type: { const: "quote.reconfirm" },
1671
+ orderHash: { $ref: "#/$defs/bytes32" },
1672
+ requestId: { $ref: "#/$defs/requestId" },
1673
+ order: { $ref: "#/$defs/order" },
1674
+ amountOut: { $ref: "#/$defs/uintDec256" },
1675
+ ticketTtl: { $ref: "#/$defs/uint32", description: "seconds" },
1676
+ replyBy: { $ref: "#/$defs/timeMs" }
1677
+ }
1678
+ },
1679
+ "quote.reconfirm.reply": {
1680
+ "x-direction": "F2S",
1681
+ type: "object",
1682
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1683
+ required: ["type", "orderHash", "accept"],
1684
+ properties: {
1685
+ type: { const: "quote.reconfirm.reply" },
1686
+ orderHash: { $ref: "#/$defs/bytes32" },
1687
+ accept: { type: "boolean" },
1688
+ validUntil: { $ref: "#/$defs/timeS" },
1689
+ nonce: { $ref: "#/$defs/uintDec64" },
1690
+ sig: { $ref: "#/$defs/sig65" }
1691
+ },
1692
+ if: { type: "object", properties: { accept: { const: true } }, required: ["accept"] },
1693
+ then: { type: "object", required: ["validUntil", "nonce", "sig"], properties: { validUntil: true, nonce: true, sig: true } }
1694
+ },
1695
+ "ticket.offer": {
1696
+ "x-direction": "S2F",
1697
+ type: "object",
1698
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1699
+ required: ["type", "orderHash", "attempt", "order", "amountOut", "validFrom", "validUntil", "acceptBy"],
1700
+ properties: {
1701
+ type: { const: "ticket.offer" },
1702
+ orderHash: { $ref: "#/$defs/bytes32" },
1703
+ attempt: { $ref: "#/$defs/uint32" },
1704
+ order: { $ref: "#/$defs/order" },
1705
+ amountOut: { $ref: "#/$defs/uintDec256" },
1706
+ validFrom: { $ref: "#/$defs/timeS" },
1707
+ validUntil: { $ref: "#/$defs/timeS" },
1708
+ acceptBy: { $ref: "#/$defs/timeMs" }
1709
+ }
1710
+ },
1711
+ "ticket.intent": {
1712
+ "x-direction": "F2S",
1713
+ type: "object",
1714
+ description: "sig = TicketIntent{orderHash, attempt, validFrom, validUntil} by the filler address; values equal the offer",
1715
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1716
+ required: ["type", "orderHash", "attempt", "validFrom", "validUntil", "sig"],
1717
+ properties: {
1718
+ type: { const: "ticket.intent" },
1719
+ orderHash: { $ref: "#/$defs/bytes32" },
1720
+ attempt: { $ref: "#/$defs/uint32" },
1721
+ validFrom: { $ref: "#/$defs/timeS" },
1722
+ validUntil: { $ref: "#/$defs/timeS" },
1723
+ sig: { $ref: "#/$defs/sig65" }
1724
+ }
1725
+ },
1726
+ "ticket.decline": {
1727
+ "x-direction": "F2S",
1728
+ type: "object",
1729
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1730
+ required: ["type", "orderHash", "attempt", "reason"],
1731
+ properties: {
1732
+ type: { const: "ticket.decline" },
1733
+ orderHash: { $ref: "#/$defs/bytes32" },
1734
+ attempt: { $ref: "#/$defs/uint32" },
1735
+ reason: { $ref: "#/$defs/declineReason" },
1736
+ detail: { type: "string" }
1737
+ }
1738
+ },
1739
+ "ticket.intent.ack": {
1740
+ "x-direction": "S2F",
1741
+ type: "object",
1742
+ description: "Idempotent: a repeated identical intent gets the identical ack",
1743
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1744
+ required: ["type", "orderHash", "attempt", "intentHash", "receivedAt"],
1745
+ properties: {
1746
+ type: { const: "ticket.intent.ack" },
1747
+ orderHash: { $ref: "#/$defs/bytes32" },
1748
+ attempt: { $ref: "#/$defs/uint32" },
1749
+ intentHash: { $ref: "#/$defs/bytes32" },
1750
+ receivedAt: { $ref: "#/$defs/timeMs" }
1751
+ }
1752
+ },
1753
+ "ticket.issued": {
1754
+ "x-direction": "S2F",
1755
+ type: "object",
1756
+ description: "form discriminates the EVM-destination ticket (FillTicket + ticketSig) from the Canton-destination one (DeliveryOrder); a form added within v1 (V-2) is checked against the common fields only",
1757
+ required: ["type", "form", "orderHash", "attempt"],
1758
+ properties: {
1759
+ type: { const: "ticket.issued" },
1760
+ form: { anyOf: [{ enum: ["evm", "canton"] }, { type: "string", pattern: "^[a-z][a-z0-9-]*$" }] },
1761
+ orderHash: { $ref: "#/$defs/bytes32" },
1762
+ attempt: { $ref: "#/$defs/uint32" }
1763
+ },
1764
+ allOf: [
1765
+ { $ref: "#/$defs/s2fBase" },
1766
+ {
1767
+ if: { type: "object", properties: { form: { const: "evm" } }, required: ["form"] },
1768
+ then: { type: "object", required: ["ticket", "ticketSig"], properties: { ticket: { $ref: "#/$defs/ticket" }, ticketSig: { $ref: "#/$defs/sig65" } } }
1769
+ },
1770
+ {
1771
+ if: { type: "object", properties: { form: { const: "canton" } }, required: ["form"] },
1772
+ then: { type: "object", required: ["deliveryOrderCid", "validUntil"], properties: { deliveryOrderCid: { type: "string", minLength: 1 }, validUntil: { $ref: "#/$defs/timeS" } } }
1773
+ }
1774
+ ]
1775
+ },
1776
+ "ticket.receipt": {
1777
+ "x-direction": "F2S",
1778
+ type: "object",
1779
+ description: "sig = TicketReceipt{ticketHash, ticketSigHash} by the filler address",
1780
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1781
+ required: ["type", "orderHash", "attempt", "ticketHash", "ticketSigHash", "sig"],
1782
+ properties: {
1783
+ type: { const: "ticket.receipt" },
1784
+ orderHash: { $ref: "#/$defs/bytes32" },
1785
+ attempt: { $ref: "#/$defs/uint32" },
1786
+ ticketHash: { $ref: "#/$defs/bytes32" },
1787
+ ticketSigHash: { $ref: "#/$defs/bytes32" },
1788
+ sig: { $ref: "#/$defs/sig65" }
1789
+ }
1790
+ },
1791
+ "fill.reported": {
1792
+ "x-direction": "F2S",
1793
+ type: "object",
1794
+ allOf: [{ $ref: "#/$defs/f2sBase" }],
1795
+ required: ["type", "orderHash", "attempt", "txRef"],
1796
+ properties: {
1797
+ type: { const: "fill.reported" },
1798
+ orderHash: { $ref: "#/$defs/bytes32" },
1799
+ attempt: { $ref: "#/$defs/uint32" },
1800
+ txRef: { type: "string", minLength: 1, description: "EVM tx hash or Canton update id" }
1801
+ }
1802
+ },
1803
+ "ticket.expired": {
1804
+ "x-direction": "S2F",
1805
+ type: "object",
1806
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1807
+ required: ["type", "orderHash", "attempt", "result"],
1808
+ properties: {
1809
+ type: { const: "ticket.expired" },
1810
+ orderHash: { $ref: "#/$defs/bytes32" },
1811
+ attempt: { $ref: "#/$defs/uint32" },
1812
+ result: { $ref: "#/$defs/expiredResult" },
1813
+ exemptReason: { $ref: "#/$defs/exemptReason" }
1814
+ },
1815
+ if: { type: "object", properties: { result: { const: "EXEMPT" } }, required: ["result"] },
1816
+ then: { type: "object", required: ["exemptReason"], properties: { exemptReason: true } }
1817
+ },
1818
+ "order.settled": {
1819
+ "x-direction": "S2F",
1820
+ type: "object",
1821
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1822
+ required: ["type", "orderHash", "payout", "fee", "penaltyWithheld", "txRef"],
1823
+ properties: {
1824
+ type: { const: "order.settled" },
1825
+ orderHash: { $ref: "#/$defs/bytes32" },
1826
+ payout: { $ref: "#/$defs/uintDec256" },
1827
+ fee: { $ref: "#/$defs/uintDec256" },
1828
+ penaltyWithheld: { $ref: "#/$defs/uintDec256" },
1829
+ txRef: { type: "string", minLength: 1 }
1830
+ }
1831
+ },
1832
+ "penalty.applied": {
1833
+ "x-direction": "S2F",
1834
+ type: "object",
1835
+ allOf: [{ $ref: "#/$defs/s2fBase" }],
1836
+ required: ["type", "violationId", "code", "step", "details"],
1837
+ properties: {
1838
+ type: { const: "penalty.applied" },
1839
+ violationId: { type: "string", minLength: 1 },
1840
+ code: { type: "string", minLength: 1 },
1841
+ step: { $ref: "#/$defs/penaltyStep" },
1842
+ details: { type: "object" }
1843
+ }
1844
+ }
1845
+ }
1846
+ };
1847
+
1848
+ // spec/protocol/records.schema.json
1849
+ var records_schema_default = {
1850
+ $schema: "https://json-schema.org/draft/2020-12/schema",
1851
+ $id: "https://cancore.io/schemas/filler-protocol/v1/records.schema.json",
1852
+ title: "Cancore filler protocol v1 \u2014 public records",
1853
+ $comment: "The draw record (GET /v1/draws/{orderHash}), the epoch record (GET /v1/draws/epochs/{id}) \u2014 auction-and-draw \xA73.3\u20133.4 \u2014 and the gateway identity (GET /v1/gateway). Records are signed by the gateway like an S\u2192F frame (sig over GatewayMessage{keccak256(JCS(record without sig))}) but are public: no fillerId, no sentAt.",
1854
+ $defs: {
1855
+ drawCandidate: {
1856
+ type: "object",
1857
+ required: ["fillerId", "weight"],
1858
+ properties: { fillerId: { $ref: "messages.schema.json#/$defs/fillerId" }, weight: { $ref: "messages.schema.json#/$defs/uintDec256" } }
1859
+ },
1860
+ drawAttempt: {
1861
+ type: "object",
1862
+ required: ["attempt", "tBase", "closedBy", "drandRound", "drandRandomness", "drandSignature", "candidates", "r", "winnerFillerId", "fallbackReason"],
1863
+ properties: {
1864
+ attempt: { $ref: "messages.schema.json#/$defs/uint32" },
1865
+ tBase: { $ref: "messages.schema.json#/$defs/timeS" },
1866
+ closedBy: { anyOf: [{ enum: ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED", null] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] },
1867
+ drandRound: { $ref: "messages.schema.json#/$defs/uintDec64" },
1868
+ drandRandomness: { $ref: "messages.schema.json#/$defs/bytes32" },
1869
+ drandSignature: { type: "string", pattern: "^0x[0-9a-f]{96}$", description: "BLS signature of the round, 48 bytes (G1)" },
1870
+ candidates: { type: "array", items: { $ref: "#/$defs/drawCandidate" }, description: "ascending by the UTF-8 bytes of fillerId (A-22)" },
1871
+ r: { $ref: "messages.schema.json#/$defs/uintDec256" },
1872
+ winnerFillerId: { $ref: "messages.schema.json#/$defs/fillerId" },
1873
+ fallbackReason: { anyOf: [{ enum: ["DRAW_FALLBACK", null] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] }
1874
+ }
1875
+ },
1876
+ drawRecord: {
1877
+ type: "object",
1878
+ required: ["orderHash", "source", "openRef", "t0", "epochId", "deltaDrand", "attempts", "sig"],
1879
+ properties: {
1880
+ orderHash: { $ref: "messages.schema.json#/$defs/bytes32" },
1881
+ source: { $ref: "messages.schema.json#/$defs/caip2" },
1882
+ openRef: { type: "string", minLength: 1, description: "EVM: open tx hash; Canton: Execute update id" },
1883
+ t0: { $ref: "messages.schema.json#/$defs/timeS" },
1884
+ epochId: { $ref: "messages.schema.json#/$defs/uintDec64" },
1885
+ deltaDrand: { $ref: "messages.schema.json#/$defs/uint32", description: "seconds" },
1886
+ attempts: { type: "array", items: { $ref: "#/$defs/drawAttempt" } },
1887
+ sig: { $ref: "messages.schema.json#/$defs/sig65" }
1888
+ }
1889
+ },
1890
+ epochLeaf: {
1891
+ type: "object",
1892
+ description: 'StandardMerkleTree leaf ["string", "uint256", "uint8", "uint16"] = (fillerId, base, tier, reliabilityBps)',
1893
+ required: ["fillerId", "base", "tier", "reliabilityBps"],
1894
+ properties: {
1895
+ fillerId: { $ref: "messages.schema.json#/$defs/fillerId" },
1896
+ base: { $ref: "messages.schema.json#/$defs/uintDec256" },
1897
+ tier: { $ref: "messages.schema.json#/$defs/uint8" },
1898
+ reliabilityBps: { type: "integer", minimum: 0, maximum: 1e4 }
1899
+ }
1900
+ },
1901
+ stakeStep: {
1902
+ type: "object",
1903
+ required: ["tier", "minStake", "step"],
1904
+ properties: {
1905
+ tier: { $ref: "messages.schema.json#/$defs/uint8" },
1906
+ minStake: { $ref: "messages.schema.json#/$defs/uintDec256" },
1907
+ step: { $ref: "messages.schema.json#/$defs/uintDec256" }
1908
+ }
1909
+ },
1910
+ epochRecord: {
1911
+ type: "object",
1912
+ required: ["epochId", "startsAt", "endsAt", "weightsRoot", "leaves", "stakeSteps", "rMinBps", "snapshotBlocks", "sig"],
1913
+ properties: {
1914
+ epochId: { $ref: "messages.schema.json#/$defs/uintDec64" },
1915
+ startsAt: { $ref: "messages.schema.json#/$defs/timeS" },
1916
+ endsAt: { $ref: "messages.schema.json#/$defs/timeS" },
1917
+ weightsRoot: { $ref: "messages.schema.json#/$defs/bytes32" },
1918
+ leaves: { type: "array", items: { $ref: "#/$defs/epochLeaf" } },
1919
+ stakeSteps: { type: "array", items: { $ref: "#/$defs/stakeStep" } },
1920
+ rMinBps: { type: "integer", minimum: 0, maximum: 1e4 },
1921
+ snapshotBlocks: {
1922
+ type: "object",
1923
+ propertyNames: { $ref: "messages.schema.json#/$defs/caip2" },
1924
+ additionalProperties: { $ref: "messages.schema.json#/$defs/uintDec64" }
1925
+ },
1926
+ sig: { $ref: "messages.schema.json#/$defs/sig65" }
1927
+ }
1928
+ },
1929
+ gatewayInfo: {
1930
+ type: "object",
1931
+ description: "GET /v1/gateway: the mirror of @cancore/contracts FILLER_GATEWAYS for this environment. A taker trusts the package, and uses this to notice a rotation",
1932
+ required: ["env", "gateway", "ticketSigners", "protocolVersion"],
1933
+ properties: {
1934
+ env: { type: "string", minLength: 1 },
1935
+ gateway: { $ref: "messages.schema.json#/$defs/address" },
1936
+ ticketSigners: { type: "array", items: { $ref: "messages.schema.json#/$defs/address" } },
1937
+ protocolVersion: { $ref: "messages.schema.json#/$defs/protocolVersion" }
1938
+ }
1939
+ }
1940
+ }
1941
+ };
1942
+
1943
+ // spec/protocol/rest.schema.json
1944
+ var rest_schema_default = {
1945
+ $schema: "https://json-schema.org/draft/2020-12/schema",
1946
+ $id: "https://cancore.io/schemas/filler-protocol/v1/rest.schema.json",
1947
+ title: "Cancore filler protocol v1 \u2014 REST fallback",
1948
+ $comment: "protocol \xA73.6. Bodies are the WebSocket frames (S\u2192F responses carry the gateway sig). /v1/filler/* needs `Authorization: Bearer <token>` from POST /v1/filler/auth; the token is bound to the fillerId it was issued for, and a ticket of another filler is 404 UNKNOWN_TICKET. /v1/draws/* and /v1/gateway are public. Every non-2xx body is the `error` frame, with the HTTP status of x-error-status. x-endpoints: request/response name a $def here or in messages.schema.json.",
1949
+ "x-endpoints": [
1950
+ { method: "GET", path: "/v1/filler/auth/challenge", auth: "none", response: "messages.schema.json#/$defs/auth.challenge" },
1951
+ { method: "POST", path: "/v1/filler/auth", auth: "none", request: "messages.schema.json#/$defs/auth.response", response: "#/$defs/authToken" },
1952
+ { method: "GET", path: "/v1/filler/tickets", auth: "bearer", query: "#/$defs/ticketListQuery", response: "#/$defs/ticketList" },
1953
+ { method: "POST", path: "/v1/filler/tickets/{orderHash}/{attempt}/intent", auth: "bearer", request: "messages.schema.json#/$defs/ticket.intent", response: "messages.schema.json#/$defs/ticket.intent.ack" },
1954
+ { method: "POST", path: "/v1/filler/tickets/{orderHash}/{attempt}/receipt", auth: "bearer", request: "messages.schema.json#/$defs/ticket.receipt", response: "#/$defs/empty" },
1955
+ { method: "POST", path: "/v1/filler/tickets/{orderHash}/{attempt}/decline", auth: "bearer", request: "messages.schema.json#/$defs/ticket.decline", response: "#/$defs/empty" },
1956
+ { method: "POST", path: "/v1/filler/stake-bindings", auth: "bearer", request: "#/$defs/stakeBindingRequest", response: "#/$defs/empty" },
1957
+ { method: "GET", path: "/v1/filler/quotes", auth: "bearer", query: "#/$defs/quoteListQuery", response: "#/$defs/quoteList" },
1958
+ { method: "GET", path: "/v1/filler/stats", auth: "bearer", response: "#/$defs/fillerStats" },
1959
+ { method: "GET", path: "/v1/filler/penalties", auth: "bearer", query: "#/$defs/pageQuery", response: "#/$defs/penaltyList" },
1960
+ { method: "GET", path: "/v1/draws/{orderHash}", auth: "none", response: "records.schema.json#/$defs/drawRecord" },
1961
+ { method: "GET", path: "/v1/draws/epochs/{id}", auth: "none", response: "records.schema.json#/$defs/epochRecord" },
1962
+ { method: "GET", path: "/v1/gateway", auth: "none", response: "records.schema.json#/$defs/gatewayInfo" }
1963
+ ],
1964
+ "x-error-status": {
1965
+ BAD_REQUEST: 400,
1966
+ UNAUTHENTICATED: 401,
1967
+ UNSUPPORTED_VERSION: 400,
1968
+ UNSUPPORTED_TYPE: 400,
1969
+ BAD_SIGNATURE: 422,
1970
+ UNKNOWN_REQUEST: 404,
1971
+ UNKNOWN_TICKET: 404,
1972
+ TICKET_CLOSED: 409,
1973
+ NOT_ELIGIBLE: 403,
1974
+ RATE_LIMITED: 429,
1975
+ INTERNAL: 500
1976
+ },
1977
+ $defs: {
1978
+ errorBody: { $ref: "messages.schema.json#/$defs/error" },
1979
+ empty: { type: "object", description: "no fields in v1; receivers ignore unknown ones (V-2)" },
1980
+ authToken: {
1981
+ type: "object",
1982
+ required: ["token", "expiresAt"],
1983
+ properties: { token: { type: "string", minLength: 1 }, expiresAt: { $ref: "messages.schema.json#/$defs/timeMs" } }
1984
+ },
1985
+ pageQuery: {
1986
+ type: "object",
1987
+ properties: { cursor: { type: "string", minLength: 1 }, limit: { type: "string", pattern: "^([1-9][0-9]?|100)$", description: "1..100, default 50" } }
1988
+ },
1989
+ ticketListQuery: {
1990
+ allOf: [{ $ref: "#/$defs/pageQuery" }],
1991
+ type: "object",
1992
+ properties: { status: { enum: ["OFFERED", "ISSUED"], description: "a request filter: the gateway owns the list, so it is closed" } }
1993
+ },
1994
+ quoteListQuery: {
1995
+ allOf: [{ $ref: "#/$defs/pageQuery" }],
1996
+ type: "object",
1997
+ properties: { since: { type: "string", pattern: "^(0|[1-9][0-9]*)$", description: "unix ms" } }
1998
+ },
1999
+ ticketList: {
2000
+ type: "object",
2001
+ required: ["items", "nextCursor"],
2002
+ properties: {
2003
+ items: {
2004
+ type: "array",
2005
+ items: { oneOf: [{ $ref: "messages.schema.json#/$defs/ticket.offer" }, { $ref: "messages.schema.json#/$defs/ticket.issued" }] }
2006
+ },
2007
+ nextCursor: { type: ["string", "null"] }
2008
+ }
2009
+ },
2010
+ stakeBindingRequest: {
2011
+ type: "object",
2012
+ description: "sig = StakeBinding{partnerId, stakingAddress, chainId, nonce} by the staking address",
2013
+ required: ["partnerId", "stakingAddress", "chainId", "nonce", "sig"],
2014
+ properties: {
2015
+ partnerId: { $ref: "messages.schema.json#/$defs/fillerId" },
2016
+ stakingAddress: { $ref: "messages.schema.json#/$defs/address" },
2017
+ chainId: { $ref: "messages.schema.json#/$defs/uintDec256" },
2018
+ nonce: { $ref: "messages.schema.json#/$defs/uintDec64" },
2019
+ sig: { $ref: "messages.schema.json#/$defs/sig65" }
2020
+ }
2021
+ },
2022
+ quoteRecord: {
2023
+ type: "object",
2024
+ required: ["quote", "ack", "status"],
2025
+ properties: {
2026
+ quote: { $ref: "messages.schema.json#/$defs/quote" },
2027
+ ack: { $ref: "messages.schema.json#/$defs/quote.ack" },
2028
+ status: { anyOf: [{ enum: ["COUNTED", "LATE", "SHORT_TTL", "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] }
2029
+ }
2030
+ },
2031
+ quoteList: {
2032
+ type: "object",
2033
+ required: ["items", "nextCursor"],
2034
+ properties: { items: { type: "array", items: { $ref: "#/$defs/quoteRecord" } }, nextCursor: { type: ["string", "null"] } }
2035
+ },
2036
+ fillerStats: {
2037
+ type: "object",
2038
+ required: ["won", "delivered", "noShow", "reliability", "capacityUsd", "inFlightUsd"],
2039
+ properties: {
2040
+ won: { type: "integer", minimum: 0 },
2041
+ delivered: { type: "integer", minimum: 0 },
2042
+ noShow: { type: "integer", minimum: 0 },
2043
+ reliability: { type: "integer", minimum: 0, maximum: 1e4, description: "basis points" },
2044
+ capacityUsd: { $ref: "messages.schema.json#/$defs/intDecUsd" },
2045
+ inFlightUsd: { $ref: "messages.schema.json#/$defs/intDecUsd" }
2046
+ }
2047
+ },
2048
+ penaltyRecord: {
2049
+ type: "object",
2050
+ required: ["violationId", "code", "step", "at", "details"],
2051
+ properties: {
2052
+ violationId: { type: "string", minLength: 1 },
2053
+ code: { type: "string", minLength: 1 },
2054
+ step: { $ref: "messages.schema.json#/$defs/penaltyStep" },
2055
+ orderHash: { $ref: "messages.schema.json#/$defs/bytes32" },
2056
+ attempt: { $ref: "messages.schema.json#/$defs/uint32" },
2057
+ at: { $ref: "messages.schema.json#/$defs/timeMs" },
2058
+ details: { type: "object" }
2059
+ }
2060
+ },
2061
+ penaltyList: {
2062
+ type: "object",
2063
+ required: ["items", "nextCursor"],
2064
+ properties: { items: { type: "array", items: { $ref: "#/$defs/penaltyRecord" } }, nextCursor: { type: ["string", "null"] } }
2065
+ }
2066
+ }
2067
+ };
2068
+
2069
+ // src/protocol/schemas.ts
2070
+ var PROTOCOL_SCHEMAS = { messages: messages_schema_default, rest: rest_schema_default, records: records_schema_default };
2071
+ var ASYNCAPI = asyncapi_default;
2072
+ var SCHEMA_VOCABULARY = ["x-direction", "x-endpoints", "x-error-status"];
2073
+ var MESSAGE_DIRECTIONS = Object.fromEntries(
2074
+ Object.entries(messages_schema_default.$defs).filter(([, def]) => def["x-direction"]).map(([type, def]) => [type, def["x-direction"]])
2075
+ );
2076
+ var REST_ENDPOINTS = rest_schema_default["x-endpoints"];
2077
+ function messageSchemaRef(type, direction) {
2078
+ const def = direction && MESSAGE_DIRECTIONS[type] === "both" ? `${type}${direction}` : type;
2079
+ return `${messages_schema_default.$id}#/$defs/${def}`;
2080
+ }
50
2081
 
51
2082
  // src/generated/meta.ts
52
2083
  var CONTRACTS_RELEASE = {
@@ -56,16 +2087,16 @@ var CONTRACTS_RELEASE = {
56
2087
  };
57
2088
  var BYTECODE_HASHES = {
58
2089
  "HTLC": {
59
- "bytecodeHash": "17e8b4dfbb8cb7095ce9f0c0334a8f506233e70c3baa1c15784ccb594c5ba07f",
60
- "deployedBytecodeHash": "86cff816f5875c8c5afefe9feb223c62ec5c0e2754606db2cecc96883c50c6a2",
61
- "bytecodeLength": 14204,
62
- "deployedBytecodeLength": 13914
2090
+ "bytecodeHash": "93a991d3a6451f7c3f02dfb70b365a48d29bebccc7f16d8dbe3d56d3dfee0af1",
2091
+ "deployedBytecodeHash": "40ab52456c3b5a04365fc1fad837eb79bbe4b85c8dbd990f549468ae48f97e3a",
2092
+ "bytecodeLength": 14976,
2093
+ "deployedBytecodeLength": 14686
63
2094
  },
64
2095
  "FeeVault": {
65
- "bytecodeHash": "83785435a8a603143b3bbf0a68587a0df1f966bfdbb66b364ca4f39b9c276da4",
66
- "deployedBytecodeHash": "e2458a305d0b8c4489cdf5cde2f1fa3411157292ffb7b2cfc95169550f093bec",
67
- "bytecodeLength": 13680,
68
- "deployedBytecodeLength": 11472
2096
+ "bytecodeHash": "1c97d27c8d3e584f879bb57549d75ef10394a56a298eaf4a772516b9316e2248",
2097
+ "deployedBytecodeHash": "0631177a64cde0829c2cec8426c08a507564f7d8b084e0237d724ed63faea0e9",
2098
+ "bytecodeLength": 13176,
2099
+ "deployedBytecodeLength": 10968
69
2100
  },
70
2101
  "MultiBalanceChecker": {
71
2102
  "bytecodeHash": "c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423",
@@ -73,17 +2104,35 @@ var BYTECODE_HASHES = {
73
2104
  "bytecodeLength": 2456,
74
2105
  "deployedBytecodeLength": 2394
75
2106
  },
76
- "CNRX": {
77
- "bytecodeHash": "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95",
78
- "deployedBytecodeHash": "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948",
79
- "bytecodeLength": 21266,
80
- "deployedBytecodeLength": 17374
2107
+ "CancoreRouter": {
2108
+ "bytecodeHash": "615b6fb47a4255df9f7fdec963811cdfbefb53166645cd19466fa268df7fb39d",
2109
+ "deployedBytecodeHash": "dec1f5d541c6b383b95b6c53e278123cc3844bdeff3f977a166fb6e9cbf86343",
2110
+ "bytecodeLength": 43102,
2111
+ "deployedBytecodeLength": 36984
2112
+ },
2113
+ "CNRXStaking": {
2114
+ "bytecodeHash": "dfda056ee22b593e2f2e1fc4e679fbb9dc34b04964f389b46914402c422b40fb",
2115
+ "deployedBytecodeHash": "d11534242f166e52f4ad063b5b6b59146e31634d3932f7ad63db05d83a1485f6",
2116
+ "bytecodeLength": 7412,
2117
+ "deployedBytecodeLength": 6240
2118
+ },
2119
+ "PointsClaim": {
2120
+ "bytecodeHash": "0f29890b609f7e15ef4dbcda17a7f2cd7482d016a0057a5f6c4270d7780ff38d",
2121
+ "deployedBytecodeHash": "f2b10c4ec8458c0d6ab0f465481e645524f618f7a3327822e8ae5d3fd42fa46c",
2122
+ "bytecodeLength": 14300,
2123
+ "deployedBytecodeLength": 11504
81
2124
  },
82
2125
  "BurnMintTokenPool": {
83
2126
  "bytecodeHash": "b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416",
84
2127
  "deployedBytecodeHash": "c9aaa6a40ef4f0caadeb66f0a9adc68b1191949e9e0bdb420f331132bf651c3a",
85
2128
  "bytecodeLength": 41756,
86
2129
  "deployedBytecodeLength": 39936
2130
+ },
2131
+ "CNRX": {
2132
+ "bytecodeHash": "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95",
2133
+ "deployedBytecodeHash": "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948",
2134
+ "bytecodeLength": 21266,
2135
+ "deployedBytecodeLength": 17374
87
2136
  }
88
2137
  };
89
2138
 
@@ -97,6 +2146,6 @@ function describeRevert(selectorOrData, tables) {
97
2146
  return void 0;
98
2147
  }
99
2148
 
100
- export { BYTECODE_HASHES, CONTRACTS_RELEASE, DEPLOYMENTS, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, PERMIT2_ADDRESS, deploymentOf, describeRevert, feeClaimDomain };
2149
+ export { ASYNCAPI, BYTECODE_HASHES, CONTRACTS_RELEASE, DECLINE_REASONS, DEPLOYMENTS, DRAND_QUICKNET, DRAW_CLOSED_BY, ERROR_CODES, ERROR_HTTP_STATUS, EXEMPT_REASONS, EXPIRED_RESULTS, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, FILLER_AUTH_TYPES, FILLER_GATEWAYS, FILLER_PROTOCOL_DOMAIN, FILLER_QUOTE_TYPES, FILL_PROOF_DOMAIN, FILL_PROOF_TYPES, FILL_PROOF_TYPE_STRING, FILL_TICKET_DOMAIN, FILL_TICKET_TYPES, GATEWAY_MESSAGE_TYPES, MESSAGE_DIRECTIONS, ORDER_TYPES, PENALTY_STEPS, PERMIT2_ADDRESS, PROOF_KIND_ATTESTATION, PROTOCOL_SCHEMAS, PROTOCOL_VERSION, QUOTE_ACK_STATUSES, QUOTE_FINAL_STATUSES, QUOTE_TYPES, REST_ENDPOINTS, SCHEMA_VOCABULARY, STAKE_BINDING_TYPES, TICKET_INTENT_TYPES, TICKET_LIST_STATUSES, TICKET_RECEIPT_TYPES, deploymentOf, describeRevert, drawValue, drawWinner, encodeType, feeClaimDomain, fillProofDomain, firstRoundAtOrAfter, gatewayBodyHash, hashDomain, hashStruct, hashTypedData, jcs, messageSchemaRef, requestIdHash, routerDomain, typeHash };
101
2150
  //# sourceMappingURL=index.js.map
102
2151
  //# sourceMappingURL=index.js.map