@cancore/contracts 0.1.0 → 0.2.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +266 -10
- package/dist/abi.d.ts +6086 -1675
- package/dist/abi.js +1 -1
- package/dist/{chunk-CIBYXHSX.js → chunk-IAPV7XWJ.js} +2 -2
- package/dist/chunk-IAPV7XWJ.js.map +1 -0
- package/dist/chunk-NV5IUURP.js +9252 -0
- package/dist/chunk-NV5IUURP.js.map +1 -0
- package/dist/index.d.ts +1180 -29
- package/dist/index.js +2600 -17
- package/dist/index.js.map +1 -1
- package/dist/networks.d.ts +2 -2
- package/dist/networks.js +1 -1
- package/package.json +10 -8
- package/spec/abi/AttestorSet.json +476 -0
- package/spec/abi/CNRX.json +1294 -0
- package/spec/abi/CNRXStaking.json +510 -0
- package/spec/abi/CancoreRouter.json +2564 -0
- package/spec/abi/FeeVault.json +604 -0
- package/spec/abi/HTLC.json +717 -0
- package/spec/abi/IBurnMintERC20.json +252 -0
- package/spec/abi/ICancoreRouter.json +1226 -0
- package/spec/abi/IHTLC.json +382 -0
- package/spec/abi/IPermit2.json +150 -0
- package/spec/abi/MultiBalanceChecker.json +34 -0
- package/spec/abi/PointsClaim.json +791 -0
- package/spec/protocol/asyncapi.json +1288 -0
- package/spec/protocol/messages.schema.json +525 -0
- package/spec/protocol/records.schema.json +94 -0
- package/spec/protocol/rest.schema.json +118 -0
- package/spec/protocol/typed-data/FillerAuth.json +58 -0
- package/spec/protocol/typed-data/FillerKeyRegistration.json +69 -0
- package/spec/protocol/typed-data/FillerMessage.json +115 -0
- package/spec/protocol/typed-data/FillerQuote.json +75 -0
- package/spec/protocol/typed-data/GatewayMessage.json +93 -0
- package/spec/protocol/typed-data/StakeBinding.json +75 -0
- package/spec/protocol/typed-data/TicketIntent.json +113 -0
- package/spec/protocol/typed-data/TicketReceipt.json +51 -0
- package/spec/protocol/vectors/draw.json +61 -0
- package/spec/protocol/vectors/jcs.json +59 -0
- package/spec/protocol/vectors/messages.json +523 -0
- package/spec/protocol/vectors/records.json +81 -0
- package/spec/protocol/vectors/settle-attestations.json +542 -0
- package/spec/typed-data/FillProof.json +227 -0
- package/spec/typed-data/FillTicket.json +115 -0
- package/spec/typed-data/Order.json +141 -0
- package/spec/typed-data/Quote.json +69 -0
- package/spec/vectors/canton-order.json +67 -0
- package/dist/chunk-CIBYXHSX.js.map +0 -1
- package/dist/chunk-ZSX67S72.js +0 -3423
- 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-
|
|
2
|
-
export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-
|
|
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-IAPV7XWJ.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,166 @@ 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": "fillerId",
|
|
69
|
+
"type": "bytes32"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"name": "repayTo",
|
|
73
|
+
"type": "bytes32"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"name": "attempt",
|
|
77
|
+
"type": "uint32"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"name": "setId",
|
|
81
|
+
"type": "uint32"
|
|
82
|
+
}
|
|
83
|
+
]
|
|
84
|
+
};
|
|
85
|
+
var FILL_PROOF_TYPE_STRING = "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,bytes32 fillerId,bytes32 repayTo,uint32 attempt,uint32 setId)";
|
|
86
|
+
var FILL_PROOF_DOMAIN = { "name": "CancoreRouter", "version": "1" };
|
|
87
|
+
var toHex = (bytes) => `0x${bytesToHex(bytes)}`;
|
|
88
|
+
var keccak = (bytes) => keccak_256(bytes);
|
|
89
|
+
function hexBytes(value, field, length) {
|
|
90
|
+
if (typeof value !== "string" || !/^0x([0-9a-fA-F]{2})*$/.test(value)) throw new TypeError(`${field}: expected 0x-prefixed hex, got ${String(value)}`);
|
|
91
|
+
const bytes = hexToBytes(value.slice(2));
|
|
92
|
+
if (length !== void 0 && bytes.length !== length) throw new TypeError(`${field}: expected ${length} bytes, got ${bytes.length}`);
|
|
93
|
+
return bytes;
|
|
94
|
+
}
|
|
95
|
+
function uint(value, bits, field) {
|
|
96
|
+
let n;
|
|
97
|
+
if (typeof value === "bigint") n = value;
|
|
98
|
+
else if (typeof value === "number" && Number.isSafeInteger(value)) n = BigInt(value);
|
|
99
|
+
else if (typeof value === "string" && /^(0|[1-9][0-9]*)$/.test(value)) n = BigInt(value);
|
|
100
|
+
else throw new TypeError(`${field}: expected an unsigned integer, got ${String(value)}`);
|
|
101
|
+
if (n < 0n || n >= 1n << BigInt(bits)) throw new RangeError(`${field}: ${n} does not fit uint${bits}`);
|
|
102
|
+
return n;
|
|
103
|
+
}
|
|
104
|
+
var beBytes = (n, size) => hexToBytes(n.toString(16).padStart(size * 2, "0"));
|
|
105
|
+
|
|
106
|
+
// src/protocol/hash.ts
|
|
107
|
+
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))$/;
|
|
108
|
+
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`);
|
|
109
|
+
function encodeValue(type, value, field) {
|
|
110
|
+
if (type === "address") return padded(hexBytes(value, field, 20), 12);
|
|
111
|
+
if (type === "string") {
|
|
112
|
+
if (typeof value !== "string") throw new TypeError(`${field}: expected a string`);
|
|
113
|
+
return keccak(utf8ToBytes(value));
|
|
114
|
+
}
|
|
115
|
+
if (type === "bool") {
|
|
116
|
+
if (typeof value !== "boolean") throw new TypeError(`${field}: expected a boolean`);
|
|
117
|
+
return beBytes(value ? 1n : 0n, 32);
|
|
118
|
+
}
|
|
119
|
+
if (type === "bytes") return keccak(hexBytes(value, field));
|
|
120
|
+
if (type.startsWith("bytes")) return padded(hexBytes(value, field, Number(type.slice(5))), 0);
|
|
121
|
+
return beBytes(uint(value, Number(type.slice(4)), field), 32);
|
|
122
|
+
}
|
|
123
|
+
function padded(bytes, offset) {
|
|
124
|
+
const word = new Uint8Array(32);
|
|
125
|
+
word.set(bytes, offset);
|
|
126
|
+
return word;
|
|
127
|
+
}
|
|
128
|
+
function fieldsOf(types, primaryType) {
|
|
129
|
+
const fields = types[primaryType];
|
|
130
|
+
if (!fields) throw new TypeError(`no type ${primaryType}`);
|
|
131
|
+
for (const f of fields) if (!ATOMIC.test(f.type)) throw flatOnly(f.type, `${primaryType}.${f.name}`);
|
|
132
|
+
return fields;
|
|
133
|
+
}
|
|
134
|
+
function encodeType(types, primaryType) {
|
|
135
|
+
return `${primaryType}(${fieldsOf(types, primaryType).map((f) => `${f.type} ${f.name}`).join(",")})`;
|
|
136
|
+
}
|
|
137
|
+
function typeHash(types, primaryType) {
|
|
138
|
+
return toHex(keccak(utf8ToBytes(encodeType(types, primaryType))));
|
|
139
|
+
}
|
|
140
|
+
function structHash(types, primaryType, message) {
|
|
141
|
+
const words = fieldsOf(types, primaryType).map((f) => encodeValue(f.type, message[f.name], `${primaryType}.${f.name}`));
|
|
142
|
+
return keccak(concatBytes(keccak(utf8ToBytes(encodeType(types, primaryType))), ...words));
|
|
143
|
+
}
|
|
144
|
+
function hashStruct(types, primaryType, message) {
|
|
145
|
+
return toHex(structHash(types, primaryType, message));
|
|
146
|
+
}
|
|
147
|
+
var DOMAIN_FIELDS = [
|
|
148
|
+
{ name: "name", type: "string" },
|
|
149
|
+
{ name: "version", type: "string" },
|
|
150
|
+
{ name: "chainId", type: "uint256" },
|
|
151
|
+
{ name: "verifyingContract", type: "address" },
|
|
152
|
+
{ name: "salt", type: "bytes32" }
|
|
153
|
+
];
|
|
154
|
+
function hashDomain(domain) {
|
|
155
|
+
const present = DOMAIN_FIELDS.filter((f) => domain[f.name] !== void 0);
|
|
156
|
+
return hashStruct({ EIP712Domain: present }, "EIP712Domain", domain);
|
|
157
|
+
}
|
|
158
|
+
function hashTypedData({ domain, types, primaryType, message }) {
|
|
159
|
+
const separator = hexBytes(hashDomain(domain), "domain", 32);
|
|
160
|
+
return toHex(keccak(concatBytes(new Uint8Array([25, 1]), separator, structHash(types, primaryType, message))));
|
|
161
|
+
}
|
|
162
|
+
function jcs(value) {
|
|
163
|
+
if (value === null || typeof value === "boolean") return JSON.stringify(value);
|
|
164
|
+
if (typeof value === "string") {
|
|
165
|
+
if (/\p{Cs}/u.test(value)) throw new TypeError("jcs: lone surrogate in a string");
|
|
166
|
+
return JSON.stringify(value);
|
|
167
|
+
}
|
|
168
|
+
if (typeof value === "number") {
|
|
169
|
+
if (!Number.isSafeInteger(value)) throw new TypeError(`jcs: ${value} is not a safe integer`);
|
|
170
|
+
return JSON.stringify(value);
|
|
171
|
+
}
|
|
172
|
+
if (Array.isArray(value)) return `[${value.map(jcs).join(",")}]`;
|
|
173
|
+
if (typeof value === "object") {
|
|
174
|
+
const obj = value;
|
|
175
|
+
return `{${Object.keys(obj).sort().map((k) => `${jcs(k)}:${jcs(obj[k])}`).join(",")}}`;
|
|
176
|
+
}
|
|
177
|
+
throw new TypeError(`jcs: a ${typeof value} has no JSON form`);
|
|
178
|
+
}
|
|
179
|
+
function gatewayBodyHash(message) {
|
|
180
|
+
const { sig: _sig, ...body } = message;
|
|
181
|
+
return toHex(keccak(utf8ToBytes(jcs(body))));
|
|
182
|
+
}
|
|
183
|
+
function fillerMessageBodyHash(message) {
|
|
184
|
+
const { msgSig: _msgSig, ...body } = message;
|
|
185
|
+
return toHex(keccak(utf8ToBytes(jcs(body))));
|
|
186
|
+
}
|
|
187
|
+
function requestIdHash(requestId) {
|
|
188
|
+
if (!/^[\x21-\x7e]{1,64}$/.test(requestId)) throw new TypeError(`requestId must be 1..64 printable ASCII characters: ${JSON.stringify(requestId)}`);
|
|
189
|
+
return toHex(keccak(utf8ToBytes(requestId)));
|
|
190
|
+
}
|
|
191
|
+
|
|
30
192
|
// src/eip712.ts
|
|
31
193
|
var FEE_CLAIM_DOMAIN_NAME = "CancoreFeeVault";
|
|
32
194
|
var FEE_CLAIM_DOMAIN_VERSION = "1";
|
|
@@ -47,25 +209,2428 @@ function feeClaimDomain(chainId, verifyingContract) {
|
|
|
47
209
|
verifyingContract
|
|
48
210
|
};
|
|
49
211
|
}
|
|
212
|
+
var PROOF_KIND_ATTESTATION = 1;
|
|
213
|
+
function fillProofDomain(chainId, verifyingContract) {
|
|
214
|
+
return { ...FILL_PROOF_DOMAIN, chainId, verifyingContract };
|
|
215
|
+
}
|
|
216
|
+
function hashFillProof(proof, chainId, verifyingContract) {
|
|
217
|
+
return hashTypedData({ domain: fillProofDomain(chainId, verifyingContract), types: FILL_PROOF_TYPES, primaryType: "FillProof", message: { ...proof } });
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// src/protocol/typedData.ts
|
|
221
|
+
var FILLER_PROTOCOL_DOMAIN = { name: "CancoreFillerProtocol", version: "1" };
|
|
222
|
+
var FILL_TICKET_DOMAIN = { name: "CancoreFillTicket", version: "1" };
|
|
223
|
+
function routerDomain(chainId, verifyingContract) {
|
|
224
|
+
return { name: "CancoreRouter", version: "1", chainId, verifyingContract };
|
|
225
|
+
}
|
|
226
|
+
var ORDER_TYPES = {
|
|
227
|
+
Order: [
|
|
228
|
+
{ name: "user", type: "address" },
|
|
229
|
+
{ name: "originChainId", type: "uint64" },
|
|
230
|
+
{ name: "inputToken", type: "address" },
|
|
231
|
+
{ name: "inputAmount", type: "uint256" },
|
|
232
|
+
{ name: "destination", type: "bytes32" },
|
|
233
|
+
{ name: "outputAsset", type: "bytes32" },
|
|
234
|
+
{ name: "minReceived", type: "uint256" },
|
|
235
|
+
{ name: "recipient", type: "bytes32" },
|
|
236
|
+
{ name: "createdAt", type: "uint64" },
|
|
237
|
+
{ name: "fillDeadline", type: "uint64" },
|
|
238
|
+
{ name: "feeBps", type: "uint16" }
|
|
239
|
+
]
|
|
240
|
+
};
|
|
241
|
+
var QUOTE_TYPES = {
|
|
242
|
+
Quote: [
|
|
243
|
+
{ name: "orderHash", type: "bytes32" },
|
|
244
|
+
{ name: "quoteDeadline", type: "uint64" }
|
|
245
|
+
]
|
|
246
|
+
};
|
|
247
|
+
var FILL_TICKET_TYPES = {
|
|
248
|
+
FillTicket: [
|
|
249
|
+
{ name: "orderHash", type: "bytes32" },
|
|
250
|
+
{ name: "fillerId", type: "bytes32" },
|
|
251
|
+
{ name: "deliveryKey", type: "address" },
|
|
252
|
+
{ name: "repayTo", type: "bytes32" },
|
|
253
|
+
{ name: "attempt", type: "uint32" },
|
|
254
|
+
{ name: "validFrom", type: "uint64" },
|
|
255
|
+
{ name: "validUntil", type: "uint64" }
|
|
256
|
+
]
|
|
257
|
+
};
|
|
258
|
+
var FILLER_QUOTE_TYPES = {
|
|
259
|
+
FillerQuote: [
|
|
260
|
+
{ name: "requestId", type: "bytes32" },
|
|
261
|
+
{ name: "fillerId", type: "string" },
|
|
262
|
+
{ name: "amountOut", type: "uint256" },
|
|
263
|
+
{ name: "validUntil", type: "uint64" },
|
|
264
|
+
{ name: "nonce", type: "uint64" }
|
|
265
|
+
]
|
|
266
|
+
};
|
|
267
|
+
var TICKET_INTENT_TYPES = {
|
|
268
|
+
TicketIntent: [
|
|
269
|
+
{ name: "orderHash", type: "bytes32" },
|
|
270
|
+
{ name: "attempt", type: "uint32" },
|
|
271
|
+
{ name: "validFrom", type: "uint64" },
|
|
272
|
+
{ name: "validUntil", type: "uint64" },
|
|
273
|
+
{ name: "fillerId", type: "string" },
|
|
274
|
+
{ name: "deliveryKey", type: "address" },
|
|
275
|
+
{ name: "repayTo", type: "bytes32" }
|
|
276
|
+
]
|
|
277
|
+
};
|
|
278
|
+
var TICKET_RECEIPT_TYPES = {
|
|
279
|
+
TicketReceipt: [
|
|
280
|
+
{ name: "ticketHash", type: "bytes32" },
|
|
281
|
+
{ name: "ticketSigHash", type: "bytes32" }
|
|
282
|
+
]
|
|
283
|
+
};
|
|
284
|
+
var STAKE_BINDING_TYPES = {
|
|
285
|
+
StakeBinding: [
|
|
286
|
+
{ name: "partnerId", type: "string" },
|
|
287
|
+
{ name: "stakingAddress", type: "address" },
|
|
288
|
+
{ name: "chainId", type: "uint256" },
|
|
289
|
+
{ name: "nonce", type: "uint64" }
|
|
290
|
+
]
|
|
291
|
+
};
|
|
292
|
+
var FILLER_AUTH_TYPES = {
|
|
293
|
+
FillerAuth: [
|
|
294
|
+
{ name: "fillerId", type: "string" },
|
|
295
|
+
{ name: "nonce", type: "bytes32" },
|
|
296
|
+
{ name: "expiresAt", type: "uint64" }
|
|
297
|
+
]
|
|
298
|
+
};
|
|
299
|
+
var GATEWAY_MESSAGE_TYPES = {
|
|
300
|
+
GatewayMessage: [{ name: "bodyHash", type: "bytes32" }]
|
|
301
|
+
};
|
|
302
|
+
var FILLER_MESSAGE_TYPES = {
|
|
303
|
+
FillerMessage: [{ name: "bodyHash", type: "bytes32" }]
|
|
304
|
+
};
|
|
305
|
+
var FILLER_KEY_REGISTRATION_TYPES = {
|
|
306
|
+
FillerKeyRegistration: [
|
|
307
|
+
{ name: "fillerId", type: "string" },
|
|
308
|
+
{ name: "messageKey", type: "address" },
|
|
309
|
+
{ name: "issuedAt", type: "uint64" }
|
|
310
|
+
]
|
|
311
|
+
};
|
|
312
|
+
var FILLER_ID_PATTERN = /^[a-z0-9][a-z0-9-]{0,62}$/;
|
|
313
|
+
var SECP256K1_N = 0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141n;
|
|
314
|
+
function fillerIdHash(fillerId) {
|
|
315
|
+
if (typeof fillerId !== "string" || !FILLER_ID_PATTERN.test(fillerId)) throw new TypeError(`fillerId must match ${FILLER_ID_PATTERN}: ${JSON.stringify(fillerId)}`);
|
|
316
|
+
return toHex(keccak(utf8ToBytes(fillerId)));
|
|
317
|
+
}
|
|
318
|
+
function repayToFromEvm(address) {
|
|
319
|
+
const bytes = hexBytes(address, "repayTo address", 20);
|
|
320
|
+
if (bytes.every((b) => b === 0)) throw new RangeError("repayTo: the zero address is not a payee");
|
|
321
|
+
return `0x${"00".repeat(12)}${address.slice(2).toLowerCase()}`;
|
|
322
|
+
}
|
|
323
|
+
function repayToFromParty(partyId) {
|
|
324
|
+
if (typeof partyId !== "string" || partyId.length === 0) throw new TypeError("repayTo: a Canton party id is a non-empty string");
|
|
325
|
+
return toHex(keccak(utf8ToBytes(partyId)));
|
|
326
|
+
}
|
|
327
|
+
function isEvmRepayTo(repayTo) {
|
|
328
|
+
return /^0x0{24}[0-9a-fA-F]{40}$/.test(repayTo) && !/^0x0{64}$/.test(repayTo);
|
|
329
|
+
}
|
|
330
|
+
function evmAddressFromRepayTo(repayTo) {
|
|
331
|
+
hexBytes(repayTo, "repayTo", 32);
|
|
332
|
+
if (!isEvmRepayTo(repayTo)) throw new RangeError(`repayTo ${repayTo} is not a padded, non-zero EVM address`);
|
|
333
|
+
return `0x${repayTo.slice(26).toLowerCase()}`;
|
|
334
|
+
}
|
|
335
|
+
function isEoaSignature(sig) {
|
|
336
|
+
if (typeof sig !== "string" || !/^0x[0-9a-fA-F]{128}(1[bB]|1[cC])$/.test(sig)) return false;
|
|
337
|
+
const r = BigInt(`0x${sig.slice(2, 66)}`);
|
|
338
|
+
const s = BigInt(`0x${sig.slice(66, 130)}`);
|
|
339
|
+
return r > 0n && r < SECP256K1_N && s > 0n && s <= SECP256K1_N / 2n;
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
// src/protocol/digests.ts
|
|
343
|
+
var hashFillTicket = (ticket) => hashTypedData({ domain: FILL_TICKET_DOMAIN, types: FILL_TICKET_TYPES, primaryType: "FillTicket", message: { ...ticket } });
|
|
344
|
+
var hashFillerQuote = (quote) => hashTypedData({ domain: FILLER_PROTOCOL_DOMAIN, types: FILLER_QUOTE_TYPES, primaryType: "FillerQuote", message: { ...quote } });
|
|
345
|
+
var hashTicketIntent = (intent) => hashTypedData({ domain: FILLER_PROTOCOL_DOMAIN, types: TICKET_INTENT_TYPES, primaryType: "TicketIntent", message: { ...intent } });
|
|
346
|
+
var hashFillerMessage = (message) => hashTypedData({ domain: FILLER_PROTOCOL_DOMAIN, types: FILLER_MESSAGE_TYPES, primaryType: "FillerMessage", message: { bodyHash: fillerMessageBodyHash(message) } });
|
|
347
|
+
var hashFillerKeyRegistration = (registration) => hashTypedData({ domain: FILLER_PROTOCOL_DOMAIN, types: FILLER_KEY_REGISTRATION_TYPES, primaryType: "FillerKeyRegistration", message: { ...registration } });
|
|
348
|
+
|
|
349
|
+
// src/protocol/envelope.ts
|
|
350
|
+
function fillerEnvelopeError(message, ctx) {
|
|
351
|
+
const { msgSig, fillerId, sentAt, id } = message;
|
|
352
|
+
if (!isEoaSignature(msgSig)) return "BAD_SIGNATURE";
|
|
353
|
+
if (fillerId !== ctx.fillerId) return "UNAUTHENTICATED";
|
|
354
|
+
if (typeof sentAt !== "number" || !Number.isSafeInteger(sentAt) || sentAt < 1e12) return "BAD_REQUEST";
|
|
355
|
+
if (Math.abs(ctx.receivedAt - sentAt) > ctx.maxMessageAgeMs) return "STALE_MESSAGE";
|
|
356
|
+
if (typeof id !== "string" || id.length < 1 || id.length > 64) return "BAD_REQUEST";
|
|
357
|
+
return null;
|
|
358
|
+
}
|
|
359
|
+
function messageIdRetainUntil(sentAt, receivedAt, maxMessageAgeMs) {
|
|
360
|
+
return Math.max(receivedAt, sentAt) + maxMessageAgeMs;
|
|
361
|
+
}
|
|
362
|
+
var DRAND_QUICKNET = {
|
|
363
|
+
chainHash: "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971",
|
|
364
|
+
publicKey: "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a",
|
|
365
|
+
scheme: "bls-unchained-g1-rfc9380",
|
|
366
|
+
genesisTime: 1692803367,
|
|
367
|
+
period: 3
|
|
368
|
+
};
|
|
369
|
+
function firstRoundAtOrAfter(unixSeconds) {
|
|
370
|
+
const t = BigInt(unixSeconds);
|
|
371
|
+
const genesis = BigInt(DRAND_QUICKNET.genesisTime);
|
|
372
|
+
const period = BigInt(DRAND_QUICKNET.period);
|
|
373
|
+
return t <= genesis ? 1n : (t - genesis + period - 1n) / period + 1n;
|
|
374
|
+
}
|
|
375
|
+
function drawValue(randomness, orderHash, attempt) {
|
|
376
|
+
const rand = hexBytes(randomness.startsWith("0x") ? randomness : `0x${randomness}`, "randomness", 32);
|
|
377
|
+
const preimage = concatBytes(rand, hexBytes(orderHash, "orderHash", 32), beBytes(uint(attempt, 32, "attempt"), 4));
|
|
378
|
+
return BigInt(toHex(keccak(preimage)));
|
|
379
|
+
}
|
|
380
|
+
function compareUtf8(a, b) {
|
|
381
|
+
const n = Math.min(a.length, b.length);
|
|
382
|
+
for (let i = 0; i < n; i++) if (a[i] !== b[i]) return a[i] - b[i];
|
|
383
|
+
return a.length - b.length;
|
|
384
|
+
}
|
|
385
|
+
function drawWinner(h, candidates) {
|
|
386
|
+
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));
|
|
387
|
+
if (new Set(sorted.map((c) => c.id)).size !== sorted.length) throw new Error("draw: duplicated fillerId");
|
|
388
|
+
const total = sorted.reduce((sum, c) => sum + c.weight, 0n);
|
|
389
|
+
if (total === 0n) throw new Error("draw: no candidate with a positive weight");
|
|
390
|
+
const r = h % total;
|
|
391
|
+
let acc = 0n;
|
|
392
|
+
const winner = sorted.find((c) => (acc += c.weight) > r);
|
|
393
|
+
return { r, winnerFillerId: winner.id };
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// src/protocol/gateway.ts
|
|
397
|
+
var PROTOCOL_VERSION = "1";
|
|
398
|
+
var FILLER_GATEWAYS = {
|
|
399
|
+
mainnet: { gateway: null, ticketSigners: [] },
|
|
400
|
+
testnet: { gateway: null, ticketSigners: [] },
|
|
401
|
+
devnet: { gateway: null, ticketSigners: [] }
|
|
402
|
+
};
|
|
403
|
+
|
|
404
|
+
// src/protocol/messages.ts
|
|
405
|
+
var DECLINE_REASONS = [
|
|
406
|
+
"NO_INVENTORY",
|
|
407
|
+
"RISK_LIMIT",
|
|
408
|
+
"PRICE_MOVED",
|
|
409
|
+
"PAUSED",
|
|
410
|
+
"OTHER",
|
|
411
|
+
"TICKET_SIGNER_UNKNOWN",
|
|
412
|
+
"TICKET_MISMATCH",
|
|
413
|
+
"TICKET_TTL_TOO_SHORT",
|
|
414
|
+
"TICKET_ISSUED_LATE",
|
|
415
|
+
"TICKET_BEYOND_DEADLINE",
|
|
416
|
+
"ESCROW_NOT_OPEN",
|
|
417
|
+
"ESCROW_MISMATCH",
|
|
418
|
+
"PROOF_WINDOW_TOO_SHORT",
|
|
419
|
+
"SKEW_MARGIN_TOO_SHORT",
|
|
420
|
+
"DRAW_MISMATCH"
|
|
421
|
+
];
|
|
422
|
+
var ERROR_CODES = [
|
|
423
|
+
"BAD_REQUEST",
|
|
424
|
+
"UNAUTHENTICATED",
|
|
425
|
+
"UNSUPPORTED_VERSION",
|
|
426
|
+
"UNSUPPORTED_TYPE",
|
|
427
|
+
"BAD_SIGNATURE",
|
|
428
|
+
"STALE_MESSAGE",
|
|
429
|
+
"REPLAYED_MESSAGE",
|
|
430
|
+
"TICKET_REFUSED",
|
|
431
|
+
"UNKNOWN_REQUEST",
|
|
432
|
+
"UNKNOWN_TICKET",
|
|
433
|
+
"TICKET_CLOSED",
|
|
434
|
+
"NOT_ELIGIBLE",
|
|
435
|
+
"RATE_LIMITED",
|
|
436
|
+
"INTERNAL",
|
|
437
|
+
"ATTESTATIONS_NOT_READY"
|
|
438
|
+
];
|
|
439
|
+
var ERROR_HTTP_STATUS = {
|
|
440
|
+
BAD_REQUEST: 400,
|
|
441
|
+
UNAUTHENTICATED: 401,
|
|
442
|
+
UNSUPPORTED_VERSION: 400,
|
|
443
|
+
UNSUPPORTED_TYPE: 400,
|
|
444
|
+
BAD_SIGNATURE: 422,
|
|
445
|
+
STALE_MESSAGE: 400,
|
|
446
|
+
REPLAYED_MESSAGE: 409,
|
|
447
|
+
TICKET_REFUSED: 409,
|
|
448
|
+
UNKNOWN_REQUEST: 404,
|
|
449
|
+
UNKNOWN_TICKET: 404,
|
|
450
|
+
TICKET_CLOSED: 409,
|
|
451
|
+
NOT_ELIGIBLE: 403,
|
|
452
|
+
RATE_LIMITED: 429,
|
|
453
|
+
INTERNAL: 500,
|
|
454
|
+
ATTESTATIONS_NOT_READY: 404
|
|
455
|
+
};
|
|
456
|
+
var TICKET_REFUSED_REASONS = [
|
|
457
|
+
"REPAY_TO_INVALID",
|
|
458
|
+
"REPAY_TO_BLOCKLISTED",
|
|
459
|
+
"DELIVERY_KEY_INVALID",
|
|
460
|
+
"PAYOUT_NOT_READY",
|
|
461
|
+
"RECIPIENT_NOT_READY",
|
|
462
|
+
"OPEN_TICKET_LIMIT",
|
|
463
|
+
"PROOF_WINDOW_TOO_SHORT",
|
|
464
|
+
"ATTESTOR_REVOCATION_PENDING",
|
|
465
|
+
"SERVICE_DEGRADED",
|
|
466
|
+
"OTHER"
|
|
467
|
+
];
|
|
468
|
+
var EXPIRED_RESULTS = ["FILLED", "NO_SHOW", "NO_SHOW_UNCONFIRMED", "EXEMPT"];
|
|
469
|
+
var EXEMPT_REASONS = ["DESTINATION_HALTED", "GATEWAY_FAULT", "REORGED_AFTER_INCLUSION", "RECIPIENT_NOT_READY", "OTHER"];
|
|
470
|
+
var QUOTE_ACK_STATUSES = ["COUNTED", "LATE", "SHORT_TTL"];
|
|
471
|
+
var QUOTE_FINAL_STATUSES = [...QUOTE_ACK_STATUSES, "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"];
|
|
472
|
+
var PENALTY_STEPS = ["L1", "L2", "L3", "L4"];
|
|
473
|
+
var DRAW_CLOSED_BY = ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED"];
|
|
474
|
+
var TICKET_LIST_STATUSES = ["OFFERED", "ISSUED"];
|
|
475
|
+
|
|
476
|
+
// spec/protocol/asyncapi.json
|
|
477
|
+
var asyncapi_default = {
|
|
478
|
+
asyncapi: "3.0.0",
|
|
479
|
+
info: {
|
|
480
|
+
title: "Cancore filler protocol",
|
|
481
|
+
version: "1.0.0-rc.1",
|
|
482
|
+
description: "The WebSocket protocol between a filler and the Cancore filler gateway, v1 (release candidate). Operations are the gateway's: it sends S\u2192F frames and receives F\u2192S frames. Every frame carries id, fillerId and sentAt and is signed in the CancoreFillerProtocol v1 domain: S\u2192F with sig = the gateway key over GatewayMessage{bodyHash}, F\u2192S with msgSig = the filler's message key over FillerMessage{bodyHash}, bodyHash = keccak256(JCS(frame without that field)). Payload schemas: messages.schema.json. Generated by scripts/gen-protocol-docs.mjs.",
|
|
483
|
+
license: {
|
|
484
|
+
name: "Apache-2.0"
|
|
485
|
+
}
|
|
486
|
+
},
|
|
487
|
+
defaultContentType: "application/json",
|
|
488
|
+
servers: {
|
|
489
|
+
devnet: {
|
|
490
|
+
host: "{gatewayHost}",
|
|
491
|
+
protocol: "wss",
|
|
492
|
+
description: "Published per environment (O-6)",
|
|
493
|
+
variables: {
|
|
494
|
+
gatewayHost: {
|
|
495
|
+
default: "filler.dev.cancore.io"
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
},
|
|
500
|
+
channels: {
|
|
501
|
+
filler: {
|
|
502
|
+
address: "/v1",
|
|
503
|
+
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).",
|
|
504
|
+
messages: {
|
|
505
|
+
"auth.challenge": {
|
|
506
|
+
$ref: "#/components/messages/auth.challenge"
|
|
507
|
+
},
|
|
508
|
+
"auth.response": {
|
|
509
|
+
$ref: "#/components/messages/auth.response"
|
|
510
|
+
},
|
|
511
|
+
"auth.ok": {
|
|
512
|
+
$ref: "#/components/messages/auth.ok"
|
|
513
|
+
},
|
|
514
|
+
pingS2F: {
|
|
515
|
+
$ref: "#/components/messages/pingS2F"
|
|
516
|
+
},
|
|
517
|
+
pingF2S: {
|
|
518
|
+
$ref: "#/components/messages/pingF2S"
|
|
519
|
+
},
|
|
520
|
+
pongS2F: {
|
|
521
|
+
$ref: "#/components/messages/pongS2F"
|
|
522
|
+
},
|
|
523
|
+
pongF2S: {
|
|
524
|
+
$ref: "#/components/messages/pongF2S"
|
|
525
|
+
},
|
|
526
|
+
errorS2F: {
|
|
527
|
+
$ref: "#/components/messages/errorS2F"
|
|
528
|
+
},
|
|
529
|
+
errorF2S: {
|
|
530
|
+
$ref: "#/components/messages/errorF2S"
|
|
531
|
+
},
|
|
532
|
+
"epoch.weights": {
|
|
533
|
+
$ref: "#/components/messages/epoch.weights"
|
|
534
|
+
},
|
|
535
|
+
"quote.request": {
|
|
536
|
+
$ref: "#/components/messages/quote.request"
|
|
537
|
+
},
|
|
538
|
+
quote: {
|
|
539
|
+
$ref: "#/components/messages/quote"
|
|
540
|
+
},
|
|
541
|
+
"quote.ack": {
|
|
542
|
+
$ref: "#/components/messages/quote.ack"
|
|
543
|
+
},
|
|
544
|
+
"quote.reconfirm": {
|
|
545
|
+
$ref: "#/components/messages/quote.reconfirm"
|
|
546
|
+
},
|
|
547
|
+
"quote.reconfirm.reply": {
|
|
548
|
+
$ref: "#/components/messages/quote.reconfirm.reply"
|
|
549
|
+
},
|
|
550
|
+
"ticket.offer": {
|
|
551
|
+
$ref: "#/components/messages/ticket.offer"
|
|
552
|
+
},
|
|
553
|
+
"ticket.intent": {
|
|
554
|
+
$ref: "#/components/messages/ticket.intent"
|
|
555
|
+
},
|
|
556
|
+
"ticket.decline": {
|
|
557
|
+
$ref: "#/components/messages/ticket.decline"
|
|
558
|
+
},
|
|
559
|
+
"ticket.intent.ack": {
|
|
560
|
+
$ref: "#/components/messages/ticket.intent.ack"
|
|
561
|
+
},
|
|
562
|
+
"ticket.issued": {
|
|
563
|
+
$ref: "#/components/messages/ticket.issued"
|
|
564
|
+
},
|
|
565
|
+
"ticket.receipt": {
|
|
566
|
+
$ref: "#/components/messages/ticket.receipt"
|
|
567
|
+
},
|
|
568
|
+
"fill.reported": {
|
|
569
|
+
$ref: "#/components/messages/fill.reported"
|
|
570
|
+
},
|
|
571
|
+
"ticket.expired": {
|
|
572
|
+
$ref: "#/components/messages/ticket.expired"
|
|
573
|
+
},
|
|
574
|
+
"order.settled": {
|
|
575
|
+
$ref: "#/components/messages/order.settled"
|
|
576
|
+
},
|
|
577
|
+
"penalty.applied": {
|
|
578
|
+
$ref: "#/components/messages/penalty.applied"
|
|
579
|
+
},
|
|
580
|
+
"settle.attestations": {
|
|
581
|
+
$ref: "#/components/messages/settle.attestations"
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
},
|
|
586
|
+
operations: {
|
|
587
|
+
sendAuthChallenge: {
|
|
588
|
+
action: "send",
|
|
589
|
+
channel: {
|
|
590
|
+
$ref: "#/channels/filler"
|
|
591
|
+
},
|
|
592
|
+
messages: [
|
|
593
|
+
{
|
|
594
|
+
$ref: "#/channels/filler/messages/auth.challenge"
|
|
595
|
+
}
|
|
596
|
+
]
|
|
597
|
+
},
|
|
598
|
+
receiveAuthResponse: {
|
|
599
|
+
action: "receive",
|
|
600
|
+
channel: {
|
|
601
|
+
$ref: "#/channels/filler"
|
|
602
|
+
},
|
|
603
|
+
messages: [
|
|
604
|
+
{
|
|
605
|
+
$ref: "#/channels/filler/messages/auth.response"
|
|
606
|
+
}
|
|
607
|
+
]
|
|
608
|
+
},
|
|
609
|
+
sendAuthOk: {
|
|
610
|
+
action: "send",
|
|
611
|
+
channel: {
|
|
612
|
+
$ref: "#/channels/filler"
|
|
613
|
+
},
|
|
614
|
+
messages: [
|
|
615
|
+
{
|
|
616
|
+
$ref: "#/channels/filler/messages/auth.ok"
|
|
617
|
+
}
|
|
618
|
+
]
|
|
619
|
+
},
|
|
620
|
+
sendPing: {
|
|
621
|
+
action: "send",
|
|
622
|
+
channel: {
|
|
623
|
+
$ref: "#/channels/filler"
|
|
624
|
+
},
|
|
625
|
+
messages: [
|
|
626
|
+
{
|
|
627
|
+
$ref: "#/channels/filler/messages/pingS2F"
|
|
628
|
+
}
|
|
629
|
+
]
|
|
630
|
+
},
|
|
631
|
+
receivePing: {
|
|
632
|
+
action: "receive",
|
|
633
|
+
channel: {
|
|
634
|
+
$ref: "#/channels/filler"
|
|
635
|
+
},
|
|
636
|
+
messages: [
|
|
637
|
+
{
|
|
638
|
+
$ref: "#/channels/filler/messages/pingF2S"
|
|
639
|
+
}
|
|
640
|
+
]
|
|
641
|
+
},
|
|
642
|
+
sendPong: {
|
|
643
|
+
action: "send",
|
|
644
|
+
channel: {
|
|
645
|
+
$ref: "#/channels/filler"
|
|
646
|
+
},
|
|
647
|
+
messages: [
|
|
648
|
+
{
|
|
649
|
+
$ref: "#/channels/filler/messages/pongS2F"
|
|
650
|
+
}
|
|
651
|
+
]
|
|
652
|
+
},
|
|
653
|
+
receivePong: {
|
|
654
|
+
action: "receive",
|
|
655
|
+
channel: {
|
|
656
|
+
$ref: "#/channels/filler"
|
|
657
|
+
},
|
|
658
|
+
messages: [
|
|
659
|
+
{
|
|
660
|
+
$ref: "#/channels/filler/messages/pongF2S"
|
|
661
|
+
}
|
|
662
|
+
]
|
|
663
|
+
},
|
|
664
|
+
sendError: {
|
|
665
|
+
action: "send",
|
|
666
|
+
channel: {
|
|
667
|
+
$ref: "#/channels/filler"
|
|
668
|
+
},
|
|
669
|
+
messages: [
|
|
670
|
+
{
|
|
671
|
+
$ref: "#/channels/filler/messages/errorS2F"
|
|
672
|
+
}
|
|
673
|
+
]
|
|
674
|
+
},
|
|
675
|
+
receiveError: {
|
|
676
|
+
action: "receive",
|
|
677
|
+
channel: {
|
|
678
|
+
$ref: "#/channels/filler"
|
|
679
|
+
},
|
|
680
|
+
messages: [
|
|
681
|
+
{
|
|
682
|
+
$ref: "#/channels/filler/messages/errorF2S"
|
|
683
|
+
}
|
|
684
|
+
]
|
|
685
|
+
},
|
|
686
|
+
sendEpochWeights: {
|
|
687
|
+
action: "send",
|
|
688
|
+
channel: {
|
|
689
|
+
$ref: "#/channels/filler"
|
|
690
|
+
},
|
|
691
|
+
messages: [
|
|
692
|
+
{
|
|
693
|
+
$ref: "#/channels/filler/messages/epoch.weights"
|
|
694
|
+
}
|
|
695
|
+
]
|
|
696
|
+
},
|
|
697
|
+
sendQuoteRequest: {
|
|
698
|
+
action: "send",
|
|
699
|
+
channel: {
|
|
700
|
+
$ref: "#/channels/filler"
|
|
701
|
+
},
|
|
702
|
+
messages: [
|
|
703
|
+
{
|
|
704
|
+
$ref: "#/channels/filler/messages/quote.request"
|
|
705
|
+
}
|
|
706
|
+
]
|
|
707
|
+
},
|
|
708
|
+
receiveQuote: {
|
|
709
|
+
action: "receive",
|
|
710
|
+
channel: {
|
|
711
|
+
$ref: "#/channels/filler"
|
|
712
|
+
},
|
|
713
|
+
messages: [
|
|
714
|
+
{
|
|
715
|
+
$ref: "#/channels/filler/messages/quote"
|
|
716
|
+
}
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
sendQuoteAck: {
|
|
720
|
+
action: "send",
|
|
721
|
+
channel: {
|
|
722
|
+
$ref: "#/channels/filler"
|
|
723
|
+
},
|
|
724
|
+
messages: [
|
|
725
|
+
{
|
|
726
|
+
$ref: "#/channels/filler/messages/quote.ack"
|
|
727
|
+
}
|
|
728
|
+
]
|
|
729
|
+
},
|
|
730
|
+
sendQuoteReconfirm: {
|
|
731
|
+
action: "send",
|
|
732
|
+
channel: {
|
|
733
|
+
$ref: "#/channels/filler"
|
|
734
|
+
},
|
|
735
|
+
messages: [
|
|
736
|
+
{
|
|
737
|
+
$ref: "#/channels/filler/messages/quote.reconfirm"
|
|
738
|
+
}
|
|
739
|
+
]
|
|
740
|
+
},
|
|
741
|
+
receiveQuoteReconfirmReply: {
|
|
742
|
+
action: "receive",
|
|
743
|
+
channel: {
|
|
744
|
+
$ref: "#/channels/filler"
|
|
745
|
+
},
|
|
746
|
+
messages: [
|
|
747
|
+
{
|
|
748
|
+
$ref: "#/channels/filler/messages/quote.reconfirm.reply"
|
|
749
|
+
}
|
|
750
|
+
]
|
|
751
|
+
},
|
|
752
|
+
sendTicketOffer: {
|
|
753
|
+
action: "send",
|
|
754
|
+
channel: {
|
|
755
|
+
$ref: "#/channels/filler"
|
|
756
|
+
},
|
|
757
|
+
messages: [
|
|
758
|
+
{
|
|
759
|
+
$ref: "#/channels/filler/messages/ticket.offer"
|
|
760
|
+
}
|
|
761
|
+
]
|
|
762
|
+
},
|
|
763
|
+
receiveTicketIntent: {
|
|
764
|
+
action: "receive",
|
|
765
|
+
channel: {
|
|
766
|
+
$ref: "#/channels/filler"
|
|
767
|
+
},
|
|
768
|
+
messages: [
|
|
769
|
+
{
|
|
770
|
+
$ref: "#/channels/filler/messages/ticket.intent"
|
|
771
|
+
}
|
|
772
|
+
]
|
|
773
|
+
},
|
|
774
|
+
receiveTicketDecline: {
|
|
775
|
+
action: "receive",
|
|
776
|
+
channel: {
|
|
777
|
+
$ref: "#/channels/filler"
|
|
778
|
+
},
|
|
779
|
+
messages: [
|
|
780
|
+
{
|
|
781
|
+
$ref: "#/channels/filler/messages/ticket.decline"
|
|
782
|
+
}
|
|
783
|
+
]
|
|
784
|
+
},
|
|
785
|
+
sendTicketIntentAck: {
|
|
786
|
+
action: "send",
|
|
787
|
+
channel: {
|
|
788
|
+
$ref: "#/channels/filler"
|
|
789
|
+
},
|
|
790
|
+
messages: [
|
|
791
|
+
{
|
|
792
|
+
$ref: "#/channels/filler/messages/ticket.intent.ack"
|
|
793
|
+
}
|
|
794
|
+
]
|
|
795
|
+
},
|
|
796
|
+
sendTicketIssued: {
|
|
797
|
+
action: "send",
|
|
798
|
+
channel: {
|
|
799
|
+
$ref: "#/channels/filler"
|
|
800
|
+
},
|
|
801
|
+
messages: [
|
|
802
|
+
{
|
|
803
|
+
$ref: "#/channels/filler/messages/ticket.issued"
|
|
804
|
+
}
|
|
805
|
+
]
|
|
806
|
+
},
|
|
807
|
+
receiveTicketReceipt: {
|
|
808
|
+
action: "receive",
|
|
809
|
+
channel: {
|
|
810
|
+
$ref: "#/channels/filler"
|
|
811
|
+
},
|
|
812
|
+
messages: [
|
|
813
|
+
{
|
|
814
|
+
$ref: "#/channels/filler/messages/ticket.receipt"
|
|
815
|
+
}
|
|
816
|
+
]
|
|
817
|
+
},
|
|
818
|
+
receiveFillReported: {
|
|
819
|
+
action: "receive",
|
|
820
|
+
channel: {
|
|
821
|
+
$ref: "#/channels/filler"
|
|
822
|
+
},
|
|
823
|
+
messages: [
|
|
824
|
+
{
|
|
825
|
+
$ref: "#/channels/filler/messages/fill.reported"
|
|
826
|
+
}
|
|
827
|
+
]
|
|
828
|
+
},
|
|
829
|
+
sendTicketExpired: {
|
|
830
|
+
action: "send",
|
|
831
|
+
channel: {
|
|
832
|
+
$ref: "#/channels/filler"
|
|
833
|
+
},
|
|
834
|
+
messages: [
|
|
835
|
+
{
|
|
836
|
+
$ref: "#/channels/filler/messages/ticket.expired"
|
|
837
|
+
}
|
|
838
|
+
]
|
|
839
|
+
},
|
|
840
|
+
sendOrderSettled: {
|
|
841
|
+
action: "send",
|
|
842
|
+
channel: {
|
|
843
|
+
$ref: "#/channels/filler"
|
|
844
|
+
},
|
|
845
|
+
messages: [
|
|
846
|
+
{
|
|
847
|
+
$ref: "#/channels/filler/messages/order.settled"
|
|
848
|
+
}
|
|
849
|
+
]
|
|
850
|
+
},
|
|
851
|
+
sendPenaltyApplied: {
|
|
852
|
+
action: "send",
|
|
853
|
+
channel: {
|
|
854
|
+
$ref: "#/channels/filler"
|
|
855
|
+
},
|
|
856
|
+
messages: [
|
|
857
|
+
{
|
|
858
|
+
$ref: "#/channels/filler/messages/penalty.applied"
|
|
859
|
+
}
|
|
860
|
+
]
|
|
861
|
+
},
|
|
862
|
+
sendSettleAttestations: {
|
|
863
|
+
action: "send",
|
|
864
|
+
channel: {
|
|
865
|
+
$ref: "#/channels/filler"
|
|
866
|
+
},
|
|
867
|
+
messages: [
|
|
868
|
+
{
|
|
869
|
+
$ref: "#/channels/filler/messages/settle.attestations"
|
|
870
|
+
}
|
|
871
|
+
]
|
|
872
|
+
}
|
|
873
|
+
},
|
|
874
|
+
components: {
|
|
875
|
+
messages: {
|
|
876
|
+
"auth.challenge": {
|
|
877
|
+
name: "auth.challenge",
|
|
878
|
+
title: "auth.challenge (S2F)",
|
|
879
|
+
payload: {
|
|
880
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
881
|
+
schema: {
|
|
882
|
+
$ref: "messages.schema.json#/$defs/auth.challenge"
|
|
883
|
+
}
|
|
884
|
+
},
|
|
885
|
+
examples: [
|
|
886
|
+
{
|
|
887
|
+
name: "auth-challenge-1",
|
|
888
|
+
payload: {
|
|
889
|
+
type: "auth.challenge",
|
|
890
|
+
id: "g-1",
|
|
891
|
+
sentAt: 178999998e4,
|
|
892
|
+
nonce: "0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5",
|
|
893
|
+
expiresAt: "1790000030",
|
|
894
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
]
|
|
898
|
+
},
|
|
899
|
+
"auth.response": {
|
|
900
|
+
name: "auth.response",
|
|
901
|
+
title: "auth.response (F2S)",
|
|
902
|
+
payload: {
|
|
903
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
904
|
+
schema: {
|
|
905
|
+
$ref: "messages.schema.json#/$defs/auth.response"
|
|
906
|
+
}
|
|
907
|
+
},
|
|
908
|
+
examples: [
|
|
909
|
+
{
|
|
910
|
+
name: "auth-response-1",
|
|
911
|
+
payload: {
|
|
912
|
+
type: "auth.response",
|
|
913
|
+
id: "a-1",
|
|
914
|
+
fillerId: "acme-markets",
|
|
915
|
+
sentAt: 1789999980100,
|
|
916
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
917
|
+
keyAddress: "0x90f79bf6eb2c4f870365e785982e1f101e93b906",
|
|
918
|
+
protocolVersion: "1",
|
|
919
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
920
|
+
}
|
|
921
|
+
},
|
|
922
|
+
{
|
|
923
|
+
name: "auth-response-2",
|
|
924
|
+
payload: {
|
|
925
|
+
type: "auth.response",
|
|
926
|
+
id: "a-2",
|
|
927
|
+
fillerId: "acme-markets",
|
|
928
|
+
sentAt: 1789999980100,
|
|
929
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
930
|
+
keyAddress: "0x90f79bf6eb2c4f870365e785982e1f101e93b906",
|
|
931
|
+
protocolVersion: "1",
|
|
932
|
+
nonce: "0x63ed6389bd2a1d23bb678583c227172bda874e82b97b1c170bfeeb4373b4b0d5",
|
|
933
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
934
|
+
}
|
|
935
|
+
}
|
|
936
|
+
]
|
|
937
|
+
},
|
|
938
|
+
"auth.ok": {
|
|
939
|
+
name: "auth.ok",
|
|
940
|
+
title: "auth.ok (S2F)",
|
|
941
|
+
payload: {
|
|
942
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
943
|
+
schema: {
|
|
944
|
+
$ref: "messages.schema.json#/$defs/auth.ok"
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
examples: [
|
|
948
|
+
{
|
|
949
|
+
name: "auth-ok-1",
|
|
950
|
+
payload: {
|
|
951
|
+
type: "auth.ok",
|
|
952
|
+
id: "g-2",
|
|
953
|
+
fillerId: "acme-markets",
|
|
954
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
955
|
+
sentAt: 1789999980200,
|
|
956
|
+
re: "a-1",
|
|
957
|
+
heartbeatIntervalMs: 15e3
|
|
958
|
+
}
|
|
959
|
+
}
|
|
960
|
+
]
|
|
961
|
+
},
|
|
962
|
+
pingS2F: {
|
|
963
|
+
name: "ping",
|
|
964
|
+
title: "ping (S2F)",
|
|
965
|
+
payload: {
|
|
966
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
967
|
+
schema: {
|
|
968
|
+
$ref: "messages.schema.json#/$defs/pingS2F"
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
examples: [
|
|
972
|
+
{
|
|
973
|
+
name: "pingS2F-1",
|
|
974
|
+
payload: {
|
|
975
|
+
type: "ping",
|
|
976
|
+
fillerId: "acme-markets",
|
|
977
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
978
|
+
sentAt: 1789999995e3,
|
|
979
|
+
id: "gp-1"
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
]
|
|
983
|
+
},
|
|
984
|
+
pingF2S: {
|
|
985
|
+
name: "ping",
|
|
986
|
+
title: "ping (F2S)",
|
|
987
|
+
payload: {
|
|
988
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
989
|
+
schema: {
|
|
990
|
+
$ref: "messages.schema.json#/$defs/pingF2S"
|
|
991
|
+
}
|
|
992
|
+
},
|
|
993
|
+
examples: [
|
|
994
|
+
{
|
|
995
|
+
name: "pingF2S-1",
|
|
996
|
+
payload: {
|
|
997
|
+
type: "ping",
|
|
998
|
+
id: "p-1",
|
|
999
|
+
fillerId: "acme-markets",
|
|
1000
|
+
sentAt: 1789999994e3,
|
|
1001
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1002
|
+
}
|
|
1003
|
+
}
|
|
1004
|
+
]
|
|
1005
|
+
},
|
|
1006
|
+
pongS2F: {
|
|
1007
|
+
name: "pong",
|
|
1008
|
+
title: "pong (S2F)",
|
|
1009
|
+
payload: {
|
|
1010
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1011
|
+
schema: {
|
|
1012
|
+
$ref: "messages.schema.json#/$defs/pongS2F"
|
|
1013
|
+
}
|
|
1014
|
+
},
|
|
1015
|
+
examples: [
|
|
1016
|
+
{
|
|
1017
|
+
name: "pongS2F-1",
|
|
1018
|
+
payload: {
|
|
1019
|
+
type: "pong",
|
|
1020
|
+
id: "g-3",
|
|
1021
|
+
fillerId: "acme-markets",
|
|
1022
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1023
|
+
sentAt: 1789999994100,
|
|
1024
|
+
re: "p-1"
|
|
1025
|
+
}
|
|
1026
|
+
}
|
|
1027
|
+
]
|
|
1028
|
+
},
|
|
1029
|
+
pongF2S: {
|
|
1030
|
+
name: "pong",
|
|
1031
|
+
title: "pong (F2S)",
|
|
1032
|
+
payload: {
|
|
1033
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1034
|
+
schema: {
|
|
1035
|
+
$ref: "messages.schema.json#/$defs/pongF2S"
|
|
1036
|
+
}
|
|
1037
|
+
},
|
|
1038
|
+
examples: [
|
|
1039
|
+
{
|
|
1040
|
+
name: "pongF2S-1",
|
|
1041
|
+
payload: {
|
|
1042
|
+
type: "pong",
|
|
1043
|
+
id: "po-1",
|
|
1044
|
+
fillerId: "acme-markets",
|
|
1045
|
+
sentAt: 1789999995100,
|
|
1046
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1047
|
+
re: "gp-1"
|
|
1048
|
+
}
|
|
1049
|
+
}
|
|
1050
|
+
]
|
|
1051
|
+
},
|
|
1052
|
+
errorS2F: {
|
|
1053
|
+
name: "error",
|
|
1054
|
+
title: "error (S2F)",
|
|
1055
|
+
payload: {
|
|
1056
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1057
|
+
schema: {
|
|
1058
|
+
$ref: "messages.schema.json#/$defs/errorS2F"
|
|
1059
|
+
}
|
|
1060
|
+
},
|
|
1061
|
+
examples: [
|
|
1062
|
+
{
|
|
1063
|
+
name: "errorS2F-1",
|
|
1064
|
+
payload: {
|
|
1065
|
+
type: "error",
|
|
1066
|
+
id: "g-4",
|
|
1067
|
+
fillerId: "acme-markets",
|
|
1068
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1069
|
+
sentAt: 1790000023500,
|
|
1070
|
+
re: "i-2",
|
|
1071
|
+
code: "TICKET_CLOSED",
|
|
1072
|
+
message: "ticket.intent after acceptBy"
|
|
1073
|
+
}
|
|
1074
|
+
},
|
|
1075
|
+
{
|
|
1076
|
+
name: "errorS2F-2",
|
|
1077
|
+
payload: {
|
|
1078
|
+
type: "error",
|
|
1079
|
+
id: "g-5",
|
|
1080
|
+
sentAt: 1789999980100,
|
|
1081
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1082
|
+
re: "q-0",
|
|
1083
|
+
code: "UNAUTHENTICATED",
|
|
1084
|
+
message: "quote before auth.ok"
|
|
1085
|
+
}
|
|
1086
|
+
},
|
|
1087
|
+
{
|
|
1088
|
+
name: "errorS2F-3",
|
|
1089
|
+
payload: {
|
|
1090
|
+
type: "error",
|
|
1091
|
+
id: "g-6",
|
|
1092
|
+
fillerId: "acme-markets",
|
|
1093
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1094
|
+
sentAt: 1790000021500,
|
|
1095
|
+
re: "i-3",
|
|
1096
|
+
code: "TICKET_REFUSED",
|
|
1097
|
+
reason: "REPAY_TO_BLOCKLISTED",
|
|
1098
|
+
message: "repayTo is blocklisted by the input token"
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
]
|
|
1102
|
+
},
|
|
1103
|
+
errorF2S: {
|
|
1104
|
+
name: "error",
|
|
1105
|
+
title: "error (F2S)",
|
|
1106
|
+
payload: {
|
|
1107
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1108
|
+
schema: {
|
|
1109
|
+
$ref: "messages.schema.json#/$defs/errorF2S"
|
|
1110
|
+
}
|
|
1111
|
+
},
|
|
1112
|
+
examples: [
|
|
1113
|
+
{
|
|
1114
|
+
name: "errorF2S-1",
|
|
1115
|
+
payload: {
|
|
1116
|
+
type: "error",
|
|
1117
|
+
id: "e-1",
|
|
1118
|
+
fillerId: "acme-markets",
|
|
1119
|
+
sentAt: 179000003e4,
|
|
1120
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1121
|
+
re: "g-77",
|
|
1122
|
+
code: "UNKNOWN_TICKET",
|
|
1123
|
+
message: "no ticket for this orderHash"
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
]
|
|
1127
|
+
},
|
|
1128
|
+
"epoch.weights": {
|
|
1129
|
+
name: "epoch.weights",
|
|
1130
|
+
title: "epoch.weights (S2F)",
|
|
1131
|
+
payload: {
|
|
1132
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1133
|
+
schema: {
|
|
1134
|
+
$ref: "messages.schema.json#/$defs/epoch.weights"
|
|
1135
|
+
}
|
|
1136
|
+
},
|
|
1137
|
+
examples: [
|
|
1138
|
+
{
|
|
1139
|
+
name: "epoch-weights-1",
|
|
1140
|
+
payload: {
|
|
1141
|
+
type: "epoch.weights",
|
|
1142
|
+
id: "g-7",
|
|
1143
|
+
fillerId: "acme-markets",
|
|
1144
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1145
|
+
sentAt: 1789999980300,
|
|
1146
|
+
epochId: "20717",
|
|
1147
|
+
startsAt: "1789948800",
|
|
1148
|
+
endsAt: "1790035200",
|
|
1149
|
+
weightsRoot: "0xa1c24765b55b34e0c206f808d2fac2e448d9db6f154d89f898921a80bad76e92"
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
]
|
|
1153
|
+
},
|
|
1154
|
+
"quote.request": {
|
|
1155
|
+
name: "quote.request",
|
|
1156
|
+
title: "quote.request (S2F)",
|
|
1157
|
+
payload: {
|
|
1158
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1159
|
+
schema: {
|
|
1160
|
+
$ref: "messages.schema.json#/$defs/quote.request"
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
examples: [
|
|
1164
|
+
{
|
|
1165
|
+
name: "quote-request-1",
|
|
1166
|
+
payload: {
|
|
1167
|
+
type: "quote.request",
|
|
1168
|
+
id: "g-8",
|
|
1169
|
+
fillerId: "acme-markets",
|
|
1170
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1171
|
+
sentAt: 178999999e4,
|
|
1172
|
+
requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
|
|
1173
|
+
route: {
|
|
1174
|
+
src: "eip155:11155111",
|
|
1175
|
+
dst: "eip155:421614"
|
|
1176
|
+
},
|
|
1177
|
+
inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
|
|
1178
|
+
inputAmount: "1003000000",
|
|
1179
|
+
outputAsset: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
|
|
1180
|
+
feeBps: 30,
|
|
1181
|
+
fillDeadlineHint: "1790000600",
|
|
1182
|
+
windowCloseAt: 1789999992e3,
|
|
1183
|
+
quoteTtlMs: 6e4,
|
|
1184
|
+
imbalanceHint: {
|
|
1185
|
+
dstAsset: "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
|
|
1186
|
+
netFlow24hUsd: "-12500.50"
|
|
1187
|
+
}
|
|
1188
|
+
}
|
|
1189
|
+
}
|
|
1190
|
+
]
|
|
1191
|
+
},
|
|
1192
|
+
quote: {
|
|
1193
|
+
name: "quote",
|
|
1194
|
+
title: "quote (F2S)",
|
|
1195
|
+
payload: {
|
|
1196
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1197
|
+
schema: {
|
|
1198
|
+
$ref: "messages.schema.json#/$defs/quote"
|
|
1199
|
+
}
|
|
1200
|
+
},
|
|
1201
|
+
examples: [
|
|
1202
|
+
{
|
|
1203
|
+
name: "quote-1",
|
|
1204
|
+
payload: {
|
|
1205
|
+
type: "quote",
|
|
1206
|
+
id: "q-1",
|
|
1207
|
+
fillerId: "acme-markets",
|
|
1208
|
+
sentAt: 1789999991e3,
|
|
1209
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1210
|
+
requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
|
|
1211
|
+
amountOut: "999000000",
|
|
1212
|
+
validUntil: "1790000060",
|
|
1213
|
+
nonce: "1",
|
|
1214
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1215
|
+
}
|
|
1216
|
+
}
|
|
1217
|
+
]
|
|
1218
|
+
},
|
|
1219
|
+
"quote.ack": {
|
|
1220
|
+
name: "quote.ack",
|
|
1221
|
+
title: "quote.ack (S2F)",
|
|
1222
|
+
payload: {
|
|
1223
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1224
|
+
schema: {
|
|
1225
|
+
$ref: "messages.schema.json#/$defs/quote.ack"
|
|
1226
|
+
}
|
|
1227
|
+
},
|
|
1228
|
+
examples: [
|
|
1229
|
+
{
|
|
1230
|
+
name: "quote-ack-1",
|
|
1231
|
+
payload: {
|
|
1232
|
+
type: "quote.ack",
|
|
1233
|
+
id: "g-9",
|
|
1234
|
+
fillerId: "acme-markets",
|
|
1235
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1236
|
+
sentAt: 1789999991001,
|
|
1237
|
+
re: "q-1",
|
|
1238
|
+
requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
|
|
1239
|
+
quoteHash: "0xe3b63a6ae2730532fb841002059d6e8c92124d95e98c09857d7e0f5ba3512e3b",
|
|
1240
|
+
receivedAt: 1789999991e3,
|
|
1241
|
+
status: "COUNTED"
|
|
1242
|
+
}
|
|
1243
|
+
}
|
|
1244
|
+
]
|
|
1245
|
+
},
|
|
1246
|
+
"quote.reconfirm": {
|
|
1247
|
+
name: "quote.reconfirm",
|
|
1248
|
+
title: "quote.reconfirm (S2F)",
|
|
1249
|
+
payload: {
|
|
1250
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1251
|
+
schema: {
|
|
1252
|
+
$ref: "messages.schema.json#/$defs/quote.reconfirm"
|
|
1253
|
+
}
|
|
1254
|
+
},
|
|
1255
|
+
examples: [
|
|
1256
|
+
{
|
|
1257
|
+
name: "quote-reconfirm-1",
|
|
1258
|
+
payload: {
|
|
1259
|
+
type: "quote.reconfirm",
|
|
1260
|
+
id: "g-10",
|
|
1261
|
+
fillerId: "acme-markets",
|
|
1262
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1263
|
+
sentAt: 1790000013e3,
|
|
1264
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1265
|
+
requestId: "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
|
|
1266
|
+
order: {
|
|
1267
|
+
user: "0xa11ce00000000000000000000000000000000001",
|
|
1268
|
+
originChainId: "11155111",
|
|
1269
|
+
inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
|
|
1270
|
+
inputAmount: "1003000000",
|
|
1271
|
+
destination: "0x0000000000000000000000000000000000000000000000000000000000066eee",
|
|
1272
|
+
outputAsset: "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
|
|
1273
|
+
minReceived: "999000000",
|
|
1274
|
+
recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1275
|
+
createdAt: "1790000000",
|
|
1276
|
+
fillDeadline: "1790000600",
|
|
1277
|
+
feeBps: "30"
|
|
1278
|
+
},
|
|
1279
|
+
amountOut: "999000000",
|
|
1280
|
+
ticketTtl: 360,
|
|
1281
|
+
replyBy: 1790000016e3
|
|
1282
|
+
}
|
|
1283
|
+
}
|
|
1284
|
+
]
|
|
1285
|
+
},
|
|
1286
|
+
"quote.reconfirm.reply": {
|
|
1287
|
+
name: "quote.reconfirm.reply",
|
|
1288
|
+
title: "quote.reconfirm.reply (F2S)",
|
|
1289
|
+
payload: {
|
|
1290
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1291
|
+
schema: {
|
|
1292
|
+
$ref: "messages.schema.json#/$defs/quote.reconfirm.reply"
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1295
|
+
examples: [
|
|
1296
|
+
{
|
|
1297
|
+
name: "quote-reconfirm-reply-1",
|
|
1298
|
+
payload: {
|
|
1299
|
+
type: "quote.reconfirm.reply",
|
|
1300
|
+
id: "r-1",
|
|
1301
|
+
fillerId: "acme-markets",
|
|
1302
|
+
sentAt: 1790000014e3,
|
|
1303
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1304
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1305
|
+
accept: true,
|
|
1306
|
+
validUntil: "1790000400",
|
|
1307
|
+
nonce: "2",
|
|
1308
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1309
|
+
}
|
|
1310
|
+
},
|
|
1311
|
+
{
|
|
1312
|
+
name: "quote-reconfirm-reply-2",
|
|
1313
|
+
payload: {
|
|
1314
|
+
type: "quote.reconfirm.reply",
|
|
1315
|
+
id: "r-2",
|
|
1316
|
+
fillerId: "acme-markets",
|
|
1317
|
+
sentAt: 1790000014e3,
|
|
1318
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1319
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1320
|
+
accept: false
|
|
1321
|
+
}
|
|
1322
|
+
}
|
|
1323
|
+
]
|
|
1324
|
+
},
|
|
1325
|
+
"ticket.offer": {
|
|
1326
|
+
name: "ticket.offer",
|
|
1327
|
+
title: "ticket.offer (S2F)",
|
|
1328
|
+
payload: {
|
|
1329
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1330
|
+
schema: {
|
|
1331
|
+
$ref: "messages.schema.json#/$defs/ticket.offer"
|
|
1332
|
+
}
|
|
1333
|
+
},
|
|
1334
|
+
examples: [
|
|
1335
|
+
{
|
|
1336
|
+
name: "ticket-offer-1",
|
|
1337
|
+
payload: {
|
|
1338
|
+
type: "ticket.offer",
|
|
1339
|
+
id: "g-20",
|
|
1340
|
+
fillerId: "acme-markets",
|
|
1341
|
+
sentAt: 179000002e4,
|
|
1342
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1343
|
+
attempt: 0,
|
|
1344
|
+
order: {
|
|
1345
|
+
user: "0xa11ce00000000000000000000000000000000001",
|
|
1346
|
+
originChainId: "11155111",
|
|
1347
|
+
inputToken: "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
|
|
1348
|
+
inputAmount: "1003000000",
|
|
1349
|
+
destination: "0x0000000000000000000000000000000000000000000000000000000000066eee",
|
|
1350
|
+
outputAsset: "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
|
|
1351
|
+
minReceived: "999000000",
|
|
1352
|
+
recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1353
|
+
createdAt: "1790000000",
|
|
1354
|
+
fillDeadline: "1790000600",
|
|
1355
|
+
feeBps: "30"
|
|
1356
|
+
},
|
|
1357
|
+
amountOut: "999000000",
|
|
1358
|
+
validFrom: "1790000040",
|
|
1359
|
+
validUntil: "1790000400",
|
|
1360
|
+
acceptBy: 1790000023e3,
|
|
1361
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1362
|
+
}
|
|
1363
|
+
}
|
|
1364
|
+
]
|
|
1365
|
+
},
|
|
1366
|
+
"ticket.intent": {
|
|
1367
|
+
name: "ticket.intent",
|
|
1368
|
+
title: "ticket.intent (F2S)",
|
|
1369
|
+
payload: {
|
|
1370
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1371
|
+
schema: {
|
|
1372
|
+
$ref: "messages.schema.json#/$defs/ticket.intent"
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
examples: [
|
|
1376
|
+
{
|
|
1377
|
+
name: "ticket-intent-1",
|
|
1378
|
+
payload: {
|
|
1379
|
+
type: "ticket.intent",
|
|
1380
|
+
id: "i-1",
|
|
1381
|
+
fillerId: "acme-markets",
|
|
1382
|
+
sentAt: 1790000021e3,
|
|
1383
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1384
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1385
|
+
attempt: 0,
|
|
1386
|
+
validFrom: "1790000040",
|
|
1387
|
+
validUntil: "1790000400",
|
|
1388
|
+
deliveryKey: "0x742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1389
|
+
repayTo: "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
|
|
1390
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1391
|
+
}
|
|
1392
|
+
},
|
|
1393
|
+
{
|
|
1394
|
+
name: "ticket-intent-2",
|
|
1395
|
+
payload: {
|
|
1396
|
+
type: "ticket.intent",
|
|
1397
|
+
id: "i-4",
|
|
1398
|
+
fillerId: "acme-markets",
|
|
1399
|
+
sentAt: 1790000021e3,
|
|
1400
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1401
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1402
|
+
attempt: 2,
|
|
1403
|
+
validFrom: "1790000040",
|
|
1404
|
+
validUntil: "1790000400",
|
|
1405
|
+
deliveryKey: "0x0000000000000000000000000000000000000000",
|
|
1406
|
+
repayTo: "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
|
|
1407
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
]
|
|
1411
|
+
},
|
|
1412
|
+
"ticket.decline": {
|
|
1413
|
+
name: "ticket.decline",
|
|
1414
|
+
title: "ticket.decline (F2S)",
|
|
1415
|
+
payload: {
|
|
1416
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1417
|
+
schema: {
|
|
1418
|
+
$ref: "messages.schema.json#/$defs/ticket.decline"
|
|
1419
|
+
}
|
|
1420
|
+
},
|
|
1421
|
+
examples: [
|
|
1422
|
+
{
|
|
1423
|
+
name: "ticket-decline-1",
|
|
1424
|
+
payload: {
|
|
1425
|
+
type: "ticket.decline",
|
|
1426
|
+
id: "d-1",
|
|
1427
|
+
fillerId: "acme-markets",
|
|
1428
|
+
sentAt: 1790000027001,
|
|
1429
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1430
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1431
|
+
attempt: 0,
|
|
1432
|
+
reason: "TICKET_ISSUED_LATE",
|
|
1433
|
+
detail: "ticket.issued 3001 ms after acceptBy"
|
|
1434
|
+
}
|
|
1435
|
+
}
|
|
1436
|
+
]
|
|
1437
|
+
},
|
|
1438
|
+
"ticket.intent.ack": {
|
|
1439
|
+
name: "ticket.intent.ack",
|
|
1440
|
+
title: "ticket.intent.ack (S2F)",
|
|
1441
|
+
payload: {
|
|
1442
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1443
|
+
schema: {
|
|
1444
|
+
$ref: "messages.schema.json#/$defs/ticket.intent.ack"
|
|
1445
|
+
}
|
|
1446
|
+
},
|
|
1447
|
+
examples: [
|
|
1448
|
+
{
|
|
1449
|
+
name: "ticket-intent-ack-1",
|
|
1450
|
+
payload: {
|
|
1451
|
+
type: "ticket.intent.ack",
|
|
1452
|
+
id: "g-11",
|
|
1453
|
+
fillerId: "acme-markets",
|
|
1454
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1455
|
+
sentAt: 1790000021001,
|
|
1456
|
+
re: "i-1",
|
|
1457
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1458
|
+
attempt: 0,
|
|
1459
|
+
intentHash: "0xd56c4d45d5405c70c5220da1c3e49d6051b0370a3040d1709ae097b37f3ba041",
|
|
1460
|
+
receivedAt: 1790000021e3
|
|
1461
|
+
}
|
|
1462
|
+
}
|
|
1463
|
+
]
|
|
1464
|
+
},
|
|
1465
|
+
"ticket.issued": {
|
|
1466
|
+
name: "ticket.issued",
|
|
1467
|
+
title: "ticket.issued (S2F)",
|
|
1468
|
+
payload: {
|
|
1469
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1470
|
+
schema: {
|
|
1471
|
+
$ref: "messages.schema.json#/$defs/ticket.issued"
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
examples: [
|
|
1475
|
+
{
|
|
1476
|
+
name: "ticket-issued-1",
|
|
1477
|
+
payload: {
|
|
1478
|
+
type: "ticket.issued",
|
|
1479
|
+
id: "g-12",
|
|
1480
|
+
fillerId: "acme-markets",
|
|
1481
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1482
|
+
sentAt: 1790000024e3,
|
|
1483
|
+
form: "evm",
|
|
1484
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1485
|
+
attempt: 0,
|
|
1486
|
+
ticket: {
|
|
1487
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1488
|
+
fillerId: "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
|
|
1489
|
+
deliveryKey: "0x742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1490
|
+
repayTo: "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
|
|
1491
|
+
attempt: 0,
|
|
1492
|
+
validFrom: "1790000040",
|
|
1493
|
+
validUntil: "1790000400"
|
|
1494
|
+
},
|
|
1495
|
+
ticketSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1496
|
+
}
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
name: "ticket-issued-2",
|
|
1500
|
+
payload: {
|
|
1501
|
+
type: "ticket.issued",
|
|
1502
|
+
id: "g-13",
|
|
1503
|
+
fillerId: "acme-markets",
|
|
1504
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1505
|
+
sentAt: 1790000024e3,
|
|
1506
|
+
form: "canton",
|
|
1507
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1508
|
+
attempt: 2,
|
|
1509
|
+
deliveryOrderCid: "00a1b2c3d4e5f6#fixture-delivery-order",
|
|
1510
|
+
validUntil: "1790000400",
|
|
1511
|
+
repayTo: "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc"
|
|
1512
|
+
}
|
|
1513
|
+
}
|
|
1514
|
+
]
|
|
1515
|
+
},
|
|
1516
|
+
"ticket.receipt": {
|
|
1517
|
+
name: "ticket.receipt",
|
|
1518
|
+
title: "ticket.receipt (F2S)",
|
|
1519
|
+
payload: {
|
|
1520
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1521
|
+
schema: {
|
|
1522
|
+
$ref: "messages.schema.json#/$defs/ticket.receipt"
|
|
1523
|
+
}
|
|
1524
|
+
},
|
|
1525
|
+
examples: [
|
|
1526
|
+
{
|
|
1527
|
+
name: "ticket-receipt-1",
|
|
1528
|
+
payload: {
|
|
1529
|
+
type: "ticket.receipt",
|
|
1530
|
+
id: "rc-1",
|
|
1531
|
+
fillerId: "acme-markets",
|
|
1532
|
+
sentAt: 1790000025e3,
|
|
1533
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1534
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1535
|
+
attempt: 0,
|
|
1536
|
+
ticketHash: "0x8eaef6b8d59e72288487b0def58e0eb9200fa7600170351af985111eaec5a0a9",
|
|
1537
|
+
ticketSigHash: "0x9d30145c6e97cad96cf7cee181ac9d5b879dea7fed0730d7197e84e28487292b",
|
|
1538
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b"
|
|
1539
|
+
}
|
|
1540
|
+
}
|
|
1541
|
+
]
|
|
1542
|
+
},
|
|
1543
|
+
"fill.reported": {
|
|
1544
|
+
name: "fill.reported",
|
|
1545
|
+
title: "fill.reported (F2S)",
|
|
1546
|
+
payload: {
|
|
1547
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1548
|
+
schema: {
|
|
1549
|
+
$ref: "messages.schema.json#/$defs/fill.reported"
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
examples: [
|
|
1553
|
+
{
|
|
1554
|
+
name: "fill-reported-1",
|
|
1555
|
+
payload: {
|
|
1556
|
+
type: "fill.reported",
|
|
1557
|
+
id: "f-1",
|
|
1558
|
+
fillerId: "acme-markets",
|
|
1559
|
+
sentAt: 179000006e4,
|
|
1560
|
+
msgSig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1561
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1562
|
+
attempt: 0,
|
|
1563
|
+
txRef: "0xfc4cba975d6b96ed2be00adae2d970f61413b963279089dcfc6402ddccc42740"
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
]
|
|
1567
|
+
},
|
|
1568
|
+
"ticket.expired": {
|
|
1569
|
+
name: "ticket.expired",
|
|
1570
|
+
title: "ticket.expired (S2F)",
|
|
1571
|
+
payload: {
|
|
1572
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1573
|
+
schema: {
|
|
1574
|
+
$ref: "messages.schema.json#/$defs/ticket.expired"
|
|
1575
|
+
}
|
|
1576
|
+
},
|
|
1577
|
+
examples: [
|
|
1578
|
+
{
|
|
1579
|
+
name: "ticket-expired-1",
|
|
1580
|
+
payload: {
|
|
1581
|
+
type: "ticket.expired",
|
|
1582
|
+
id: "g-14",
|
|
1583
|
+
fillerId: "acme-markets",
|
|
1584
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1585
|
+
sentAt: 179000046e4,
|
|
1586
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1587
|
+
attempt: 0,
|
|
1588
|
+
result: "FILLED"
|
|
1589
|
+
}
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
name: "ticket-expired-2",
|
|
1593
|
+
payload: {
|
|
1594
|
+
type: "ticket.expired",
|
|
1595
|
+
id: "g-15",
|
|
1596
|
+
fillerId: "acme-markets",
|
|
1597
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1598
|
+
sentAt: 179000046e4,
|
|
1599
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1600
|
+
attempt: 0,
|
|
1601
|
+
result: "EXEMPT",
|
|
1602
|
+
exemptReason: "DESTINATION_HALTED"
|
|
1603
|
+
}
|
|
1604
|
+
}
|
|
1605
|
+
]
|
|
1606
|
+
},
|
|
1607
|
+
"order.settled": {
|
|
1608
|
+
name: "order.settled",
|
|
1609
|
+
title: "order.settled (S2F)",
|
|
1610
|
+
payload: {
|
|
1611
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1612
|
+
schema: {
|
|
1613
|
+
$ref: "messages.schema.json#/$defs/order.settled"
|
|
1614
|
+
}
|
|
1615
|
+
},
|
|
1616
|
+
examples: [
|
|
1617
|
+
{
|
|
1618
|
+
name: "order-settled-1",
|
|
1619
|
+
payload: {
|
|
1620
|
+
type: "order.settled",
|
|
1621
|
+
id: "g-16",
|
|
1622
|
+
fillerId: "acme-markets",
|
|
1623
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1624
|
+
sentAt: 17900009e5,
|
|
1625
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1626
|
+
payout: "1000000000",
|
|
1627
|
+
fee: "3000000",
|
|
1628
|
+
penaltyWithheld: "0",
|
|
1629
|
+
txRef: "0x8d99b79edaf0d9c062753bb308a72f52ec1ed8873fe06580c14524bb66a9f614"
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1632
|
+
]
|
|
1633
|
+
},
|
|
1634
|
+
"penalty.applied": {
|
|
1635
|
+
name: "penalty.applied",
|
|
1636
|
+
title: "penalty.applied (S2F)",
|
|
1637
|
+
payload: {
|
|
1638
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1639
|
+
schema: {
|
|
1640
|
+
$ref: "messages.schema.json#/$defs/penalty.applied"
|
|
1641
|
+
}
|
|
1642
|
+
},
|
|
1643
|
+
examples: [
|
|
1644
|
+
{
|
|
1645
|
+
name: "penalty-applied-1",
|
|
1646
|
+
payload: {
|
|
1647
|
+
type: "penalty.applied",
|
|
1648
|
+
id: "g-17",
|
|
1649
|
+
fillerId: "acme-markets",
|
|
1650
|
+
sig: "0x000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001b",
|
|
1651
|
+
sentAt: 1790001e6,
|
|
1652
|
+
violationId: "v-1",
|
|
1653
|
+
code: "NO_SHOW",
|
|
1654
|
+
step: "L1",
|
|
1655
|
+
details: {
|
|
1656
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1657
|
+
attempt: 0
|
|
1658
|
+
}
|
|
1659
|
+
}
|
|
1660
|
+
}
|
|
1661
|
+
]
|
|
1662
|
+
},
|
|
1663
|
+
"settle.attestations": {
|
|
1664
|
+
name: "settle.attestations",
|
|
1665
|
+
title: "settle.attestations (S2F)",
|
|
1666
|
+
payload: {
|
|
1667
|
+
schemaFormat: "application/schema+json;version=draft-2020-12",
|
|
1668
|
+
schema: {
|
|
1669
|
+
$ref: "messages.schema.json#/$defs/settle.attestations"
|
|
1670
|
+
}
|
|
1671
|
+
},
|
|
1672
|
+
examples: [
|
|
1673
|
+
{
|
|
1674
|
+
name: "settle-attestations-1",
|
|
1675
|
+
payload: {
|
|
1676
|
+
type: "settle.attestations",
|
|
1677
|
+
id: "g-sa-1",
|
|
1678
|
+
fillerId: "acme-markets",
|
|
1679
|
+
sentAt: 179000016e4,
|
|
1680
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1681
|
+
attempt: 0,
|
|
1682
|
+
sourceChainId: "eip155:11155111",
|
|
1683
|
+
proof: {
|
|
1684
|
+
kind: 1,
|
|
1685
|
+
orderHash: "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
|
|
1686
|
+
destination: "0x0000000000000000000000000000000000000000000000000000000000066eee",
|
|
1687
|
+
fillRef: "0xfc4cba975d6b96ed2be00adae2d970f61413b963279089dcfc6402ddccc42740",
|
|
1688
|
+
recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1689
|
+
outputAsset: "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
|
|
1690
|
+
amountDelivered: "999000000",
|
|
1691
|
+
filledAt: "1790000100",
|
|
1692
|
+
fillerId: "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
|
|
1693
|
+
repayTo: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1694
|
+
attempt: 0,
|
|
1695
|
+
setId: 1
|
|
1696
|
+
},
|
|
1697
|
+
signatures: [
|
|
1698
|
+
{
|
|
1699
|
+
signer: "0x5e877d05b3bfef8b53a59dde76b911fb521415cd",
|
|
1700
|
+
signature: "0x4efcf401d43002b059a1bf5f12a1a6c868a1917a533cb2df79022845bd8704da1d5a6a67e206d057e29bd06efc19fef0afcc0ece462e732268da4cedb57e4c321c"
|
|
1701
|
+
},
|
|
1702
|
+
{
|
|
1703
|
+
signer: "0x6805cf7ce01e1c392d47806813503e367c932544",
|
|
1704
|
+
signature: "0x29a0148c3a5cdcadf63a4aaef763784751a3fa6064dc276330227729ddbc69015ea1efdab546cf1552ca726de9ccf4480e8d5ff3c3ed9b718c4964b5bc03ddcf1c"
|
|
1705
|
+
}
|
|
1706
|
+
],
|
|
1707
|
+
setId: 1,
|
|
1708
|
+
threshold: 2,
|
|
1709
|
+
refundAfter: "1790002400",
|
|
1710
|
+
sig: "0x1d81fa8e56999d9bf8365f2aa18025291198a51b769dcddd7ebaaa3b61eca32f262f218caf2618bc8b351c65eca89417defeb5f3905f7327a68e9cdd1d29f99d1b"
|
|
1711
|
+
}
|
|
1712
|
+
},
|
|
1713
|
+
{
|
|
1714
|
+
name: "settle-attestations-2",
|
|
1715
|
+
payload: {
|
|
1716
|
+
type: "settle.attestations",
|
|
1717
|
+
id: "g-sa-3",
|
|
1718
|
+
fillerId: "cancore-reserve",
|
|
1719
|
+
sentAt: 178999976e4,
|
|
1720
|
+
orderHash: "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204",
|
|
1721
|
+
attempt: 1,
|
|
1722
|
+
sourceChainId: "canton:mainnet",
|
|
1723
|
+
proof: {
|
|
1724
|
+
kind: 1,
|
|
1725
|
+
orderHash: "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204",
|
|
1726
|
+
destination: "0x0000000000000000000000000000000000000000000000000000000000000001",
|
|
1727
|
+
fillRef: "0xfba8fd8a079872a9efe9646fcf34cfbbe8711ebd63665e8f2e0924949264c471",
|
|
1728
|
+
recipient: "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
|
|
1729
|
+
outputAsset: "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
|
|
1730
|
+
amountDelivered: "1200250000",
|
|
1731
|
+
filledAt: "1789999700",
|
|
1732
|
+
fillerId: "0xe3a8297b35498225c7903ca1a305ef64fcd783cf42c6c687b7b332c83d4dd837",
|
|
1733
|
+
repayTo: "0x4fa94ace29856f88ebea07ce6d18e21f52c60b4f66d147134c03c82b62957f9d",
|
|
1734
|
+
attempt: 1,
|
|
1735
|
+
setId: 3
|
|
1736
|
+
},
|
|
1737
|
+
signatures: [
|
|
1738
|
+
{
|
|
1739
|
+
signer: "0x5e877d05b3bfef8b53a59dde76b911fb521415cd",
|
|
1740
|
+
pubKey: "0x3056301006072a8648ce3d020106052b8104000a034200046e4ce4835ad9bacce317724d5a85bfb72f73c0e0e0d9bb0ece443a23c405994056f031b0c83296033a1fd06fc21cbfdab8a821b09c0172ed64ef1b1ee3469be3",
|
|
1741
|
+
signature: "0x3045022100a7554c31e432a90ae7384910ae3f9128b41034769dd072319fcf8131bb8062b1022006ac576ed5858c881238334835d35f5aacb765b16842a3f926a540355997883e"
|
|
1742
|
+
},
|
|
1743
|
+
{
|
|
1744
|
+
signer: "0x6805cf7ce01e1c392d47806813503e367c932544",
|
|
1745
|
+
pubKey: "0x3056301006072a8648ce3d020106052b8104000a034200044f15010d9f9457006502d7cbe0cfc5ed67076c2d6f2d4d034b8412e1c07561c370356c5da930ec7a271c3c8d11d00a14e36a3cd3a2a4fad8c05b367357f15b7e",
|
|
1746
|
+
signature: "0x3044022035cdea625125d6b555d9ab2405afb085c1d9a65d780048e607ace4f78740f5fc02207d4236924fd1e29bdc1576077c56da025ebfe63ed0c13bb720baa9ed4a444a93"
|
|
1747
|
+
},
|
|
1748
|
+
{
|
|
1749
|
+
signer: "0x695ba7eb3c2a35bfc8d16562560a01ba1f9931d0",
|
|
1750
|
+
pubKey: "0x3056301006072a8648ce3d020106052b8104000a0342000479d89465d2de95e32eb728c63c58f4554dbecd39dacf7b680a326672cbc601af2abda0dd84f5b8a4bf8efebcb5eb0d24643dc0cc32af3f76a6ef877b71e19e2b",
|
|
1751
|
+
signature: "0x3045022100b4523bba8213ce348a7334680f4b3c54bfa3b815c907993415a43dc54452cb0e02201fc0f93a9199dfe16f3aff06684146bf6f28ff1df5efea5d874b3d877051678b"
|
|
1752
|
+
}
|
|
1753
|
+
],
|
|
1754
|
+
setId: 3,
|
|
1755
|
+
threshold: 2,
|
|
1756
|
+
refundAfter: "1790001800",
|
|
1757
|
+
sig: "0x31ef2d7b9fb10cc97215e965e9cc866e6e595ba92d9f630a00fbaedc3241399f0d65b0e75c81504ba0989eb4264e55e46b571bd7252f45699ab4792d40e5ca931b"
|
|
1758
|
+
}
|
|
1759
|
+
}
|
|
1760
|
+
]
|
|
1761
|
+
}
|
|
1762
|
+
}
|
|
1763
|
+
}
|
|
1764
|
+
};
|
|
1765
|
+
|
|
1766
|
+
// spec/protocol/messages.schema.json
|
|
1767
|
+
var messages_schema_default = {
|
|
1768
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
1769
|
+
$id: "https://cancore.io/schemas/filler-protocol/v1/messages.schema.json",
|
|
1770
|
+
title: "Cancore filler protocol v1 \u2014 WebSocket frames",
|
|
1771
|
+
$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 filler, F2S = filler to gateway, both = either way (ping, pong, error; <type>S2F is the gateway's copy, <type>F2S the filler's). Every frame in both directions carries id, sentAt and fillerId (absent only on auth.challenge, optional on a pre-auth gateway error) and is signed (protocol \xA73.4): `sig` = the gateway key over GatewayMessage{bodyHash} on S2F, `msgSig` = the filler's message key over FillerMessage{bodyHash} on F2S, bodyHash = keccak256(JCS(frame without that field)). No exceptions: ticket.decline, a declining quote.reconfirm.reply, fill.reported, pong and error from the filler are signed too.",
|
|
1772
|
+
$defs: {
|
|
1773
|
+
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" },
|
|
1774
|
+
uintDec256: { type: "string", pattern: "^(0|[1-9][0-9]*)$", maxLength: 78, description: "uint256 as a decimal string" },
|
|
1775
|
+
intDecUsd: { type: "string", pattern: "^-?(0|[1-9][0-9]*)(\\.[0-9]+)?$", description: "signed decimal USD amount" },
|
|
1776
|
+
uint8: { type: "integer", minimum: 0, maximum: 255 },
|
|
1777
|
+
uint16: { type: "integer", minimum: 0, maximum: 65535 },
|
|
1778
|
+
uint32: { type: "integer", minimum: 0, maximum: 4294967295 },
|
|
1779
|
+
address: { type: "string", pattern: "^0x[0-9a-f]{40}$", description: "EVM address, lowercase hex" },
|
|
1780
|
+
bytes32: { type: "string", pattern: "^0x[0-9a-f]{64}$" },
|
|
1781
|
+
repayTo: { $ref: "#/$defs/bytes32", description: "where settle pays the filler, encoded for the SOURCE chain (protocol \xA73.15): EVM \u2014 the address left-padded to 32 bytes (repayToEvm); Canton \u2014 keccak256(utf8(partyId)) of the filler's registered party" },
|
|
1782
|
+
repayToEvm: { type: "string", pattern: "^0x0{24}(?!0{40})[0-9a-f]{40}$", description: "repayTo for an EVM source: zero top 12 bytes (the router refuses others, InvalidBytes32Address) and not the zero address (ZeroAddress). A receiver that knows the source chain checks repayTo against this" },
|
|
1783
|
+
deliveryKey: { $ref: "#/$defs/address", description: "the address that sends fill on the destination (FillTicket.deliveryKey); the zero address for a Canton destination" },
|
|
1784
|
+
sig65: { type: "string", pattern: "^0x[0-9a-f]{64}[0-7][0-9a-f]{63}(1b|1c)$", description: "65-byte r \u2016 s \u2016 v of an EOA, low-s, v \u2208 {27, 28}; no EIP-1271. The pattern refuses any other length or v and an s with its top bit set; isEoaSignature checks the exact bound s \u2264 n/2" },
|
|
1785
|
+
timeMs: { type: "integer", minimum: 1e12, maximum: 9007199254740991, description: "unix milliseconds, gateway clock; the minimum rejects seconds" },
|
|
1786
|
+
durationMs: { type: "integer", minimum: 0, maximum: 9007199254740991 },
|
|
1787
|
+
timeS: { $ref: "#/$defs/uintDec64", description: "unix seconds as a decimal string (on-chain and signed times)" },
|
|
1788
|
+
caip2: { type: "string", pattern: "^(eip155:[1-9][0-9]*|canton:(mainnet|testnet|devnet))$" },
|
|
1789
|
+
cantonAsset: {
|
|
1790
|
+
type: "object",
|
|
1791
|
+
required: ["admin", "id"],
|
|
1792
|
+
properties: { admin: { type: "string", minLength: 1 }, id: { type: "string", minLength: 1 } }
|
|
1793
|
+
},
|
|
1794
|
+
asset: { oneOf: [{ $ref: "#/$defs/address" }, { $ref: "#/$defs/cantonAsset" }] },
|
|
1795
|
+
requestId: { type: "string", pattern: "^[!-~]{1,64}$", description: "1..64 printable ASCII (Canonical.daml:90-93)" },
|
|
1796
|
+
fillerId: { type: "string", pattern: "^[a-z0-9][a-z0-9-]{0,62}$" },
|
|
1797
|
+
messageId: { type: "string", minLength: 1, maxLength: 64, description: "unique per fillerId and direction across every session of that fillerId; never reused by its sender within maxMessageAgeMs" },
|
|
1798
|
+
protocolVersion: { const: "1" },
|
|
1799
|
+
order: {
|
|
1800
|
+
type: "object",
|
|
1801
|
+
description: "ICancoreRouter.Order, eleven fields, every numeric field a decimal string (the shape of canton-order.json vector.order)",
|
|
1802
|
+
required: ["user", "originChainId", "inputToken", "inputAmount", "destination", "outputAsset", "minReceived", "recipient", "createdAt", "fillDeadline", "feeBps"],
|
|
1803
|
+
properties: {
|
|
1804
|
+
user: { $ref: "#/$defs/address" },
|
|
1805
|
+
originChainId: { $ref: "#/$defs/uintDec64" },
|
|
1806
|
+
inputToken: { $ref: "#/$defs/address" },
|
|
1807
|
+
inputAmount: { $ref: "#/$defs/uintDec256" },
|
|
1808
|
+
destination: { $ref: "#/$defs/bytes32" },
|
|
1809
|
+
outputAsset: { $ref: "#/$defs/bytes32" },
|
|
1810
|
+
minReceived: { $ref: "#/$defs/uintDec256" },
|
|
1811
|
+
recipient: { $ref: "#/$defs/bytes32" },
|
|
1812
|
+
createdAt: { $ref: "#/$defs/timeS" },
|
|
1813
|
+
fillDeadline: { $ref: "#/$defs/timeS" },
|
|
1814
|
+
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" }
|
|
1815
|
+
}
|
|
1816
|
+
},
|
|
1817
|
+
ticket: {
|
|
1818
|
+
type: "object",
|
|
1819
|
+
description: "FillTicket(bytes32 orderHash,bytes32 fillerId,address deliveryKey,bytes32 repayTo,uint32 attempt,uint64 validFrom,uint64 validUntil); fillerId is keccak256(utf8(fillerId)), deliveryKey and repayTo are those of the filler's signed ticket.intent (S-22)",
|
|
1820
|
+
required: ["orderHash", "fillerId", "deliveryKey", "repayTo", "attempt", "validFrom", "validUntil"],
|
|
1821
|
+
properties: {
|
|
1822
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
1823
|
+
fillerId: { $ref: "#/$defs/bytes32" },
|
|
1824
|
+
deliveryKey: { $ref: "#/$defs/address" },
|
|
1825
|
+
repayTo: { $ref: "#/$defs/repayTo" },
|
|
1826
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
1827
|
+
validFrom: { $ref: "#/$defs/timeS" },
|
|
1828
|
+
validUntil: { $ref: "#/$defs/timeS" }
|
|
1829
|
+
}
|
|
1830
|
+
},
|
|
1831
|
+
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]`" },
|
|
1832
|
+
declineReason: {
|
|
1833
|
+
anyOf: [
|
|
1834
|
+
{ 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"] },
|
|
1835
|
+
{ $ref: "#/$defs/futureEnumValue" }
|
|
1836
|
+
]
|
|
1837
|
+
},
|
|
1838
|
+
errorCode: {
|
|
1839
|
+
anyOf: [
|
|
1840
|
+
{ enum: ["BAD_REQUEST", "UNAUTHENTICATED", "UNSUPPORTED_VERSION", "UNSUPPORTED_TYPE", "BAD_SIGNATURE", "STALE_MESSAGE", "REPLAYED_MESSAGE", "TICKET_REFUSED", "UNKNOWN_REQUEST", "UNKNOWN_TICKET", "TICKET_CLOSED", "NOT_ELIGIBLE", "RATE_LIMITED", "INTERNAL", "ATTESTATIONS_NOT_READY"] },
|
|
1841
|
+
{ $ref: "#/$defs/futureEnumValue" }
|
|
1842
|
+
]
|
|
1843
|
+
},
|
|
1844
|
+
ticketRefusedReason: {
|
|
1845
|
+
anyOf: [
|
|
1846
|
+
{ enum: ["REPAY_TO_INVALID", "REPAY_TO_BLOCKLISTED", "DELIVERY_KEY_INVALID", "PAYOUT_NOT_READY", "RECIPIENT_NOT_READY", "OPEN_TICKET_LIMIT", "PROOF_WINDOW_TOO_SHORT", "ATTESTOR_REVOCATION_PENDING", "SERVICE_DEGRADED", "OTHER"] },
|
|
1847
|
+
{ $ref: "#/$defs/futureEnumValue" }
|
|
1848
|
+
],
|
|
1849
|
+
description: "error.reason with TICKET_REFUSED: the pre-ticket check that failed (S-21); the order is re-drawn, nothing is recorded against the filler"
|
|
1850
|
+
},
|
|
1851
|
+
expiredResult: { anyOf: [{ enum: ["FILLED", "NO_SHOW", "NO_SHOW_UNCONFIRMED", "EXEMPT"] }, { $ref: "#/$defs/futureEnumValue" }] },
|
|
1852
|
+
exemptReason: { anyOf: [{ enum: ["DESTINATION_HALTED", "GATEWAY_FAULT", "REORGED_AFTER_INCLUSION", "RECIPIENT_NOT_READY", "OTHER"] }, { $ref: "#/$defs/futureEnumValue" }] },
|
|
1853
|
+
quoteAckStatus: { anyOf: [{ enum: ["COUNTED", "LATE", "SHORT_TTL"] }, { $ref: "#/$defs/futureEnumValue" }], description: "verdict at receipt time; the final status is on GET /v1/filler/quotes" },
|
|
1854
|
+
penaltyStep: { anyOf: [{ enum: ["L1", "L2", "L3", "L4"] }, { $ref: "#/$defs/futureEnumValue" }] },
|
|
1855
|
+
s2fEnvelope: {
|
|
1856
|
+
type: "object",
|
|
1857
|
+
required: ["type", "id", "sentAt", "sig"],
|
|
1858
|
+
properties: {
|
|
1859
|
+
type: { type: "string" },
|
|
1860
|
+
id: { $ref: "#/$defs/messageId" },
|
|
1861
|
+
fillerId: { $ref: "#/$defs/fillerId", description: "the addressee" },
|
|
1862
|
+
sentAt: { $ref: "#/$defs/timeMs" },
|
|
1863
|
+
sig: { $ref: "#/$defs/sig65", description: "gateway key over GatewayMessage{bodyHash = keccak256(JCS(frame without sig))}" },
|
|
1864
|
+
re: { $ref: "#/$defs/messageId" }
|
|
1865
|
+
}
|
|
1866
|
+
},
|
|
1867
|
+
s2fBase: { allOf: [{ $ref: "#/$defs/s2fEnvelope" }, { type: "object", required: ["fillerId"], properties: { fillerId: { $ref: "#/$defs/fillerId" } } }] },
|
|
1868
|
+
f2sEnvelope: {
|
|
1869
|
+
type: "object",
|
|
1870
|
+
description: "What every filler \u2192 filler-gateway message and REST request body carries (protocol \xA73.4, S-19): the gateway refuses one without it, with another fillerId than the session's, with a stale sentAt or a reused id",
|
|
1871
|
+
required: ["id", "fillerId", "sentAt", "msgSig"],
|
|
1872
|
+
properties: {
|
|
1873
|
+
id: { $ref: "#/$defs/messageId" },
|
|
1874
|
+
fillerId: { $ref: "#/$defs/fillerId", description: "the sender; must be the fillerId the session is authenticated for" },
|
|
1875
|
+
sentAt: { $ref: "#/$defs/timeMs" },
|
|
1876
|
+
msgSig: { $ref: "#/$defs/sig65", description: "the filler's message key over FillerMessage{bodyHash = keccak256(JCS(message without msgSig))}; the body keeps id, fillerId, sentAt and any inner sig" },
|
|
1877
|
+
re: { $ref: "#/$defs/messageId" }
|
|
1878
|
+
}
|
|
1879
|
+
},
|
|
1880
|
+
f2sBase: { allOf: [{ $ref: "#/$defs/f2sEnvelope" }, { type: "object", required: ["type"], properties: { type: { type: "string" } } }] },
|
|
1881
|
+
fillerKeyRegistration: {
|
|
1882
|
+
type: "object",
|
|
1883
|
+
description: "Proof of possession of a message key (protocol \xA73.16): FillerKeyRegistration{fillerId, messageKey, issuedAt} signed by that key \u2014 at onboarding, and with the NEW key at a manual key change by Cancore staff, who submit it to the key registry of filler-gateway. Not a frame: there is no key-change message. sig must be an EOA signature (65 bytes, low-s, v \u2208 {27, 28}) that recovers to messageKey; an EIP-1271 signature is refused",
|
|
1884
|
+
required: ["fillerId", "messageKey", "issuedAt", "sig"],
|
|
1885
|
+
properties: {
|
|
1886
|
+
fillerId: { $ref: "#/$defs/fillerId" },
|
|
1887
|
+
messageKey: { $ref: "#/$defs/address" },
|
|
1888
|
+
issuedAt: { $ref: "#/$defs/timeS" },
|
|
1889
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
1890
|
+
}
|
|
1891
|
+
},
|
|
1892
|
+
"auth.challenge": {
|
|
1893
|
+
"x-direction": "S2F",
|
|
1894
|
+
type: "object",
|
|
1895
|
+
description: "First frame after connect; the addressee is not known yet, so no fillerId",
|
|
1896
|
+
allOf: [{ $ref: "#/$defs/s2fEnvelope" }],
|
|
1897
|
+
required: ["type", "nonce", "expiresAt"],
|
|
1898
|
+
properties: { type: { const: "auth.challenge" }, nonce: { $ref: "#/$defs/bytes32" }, expiresAt: { $ref: "#/$defs/timeS" } }
|
|
1899
|
+
},
|
|
1900
|
+
"auth.response": {
|
|
1901
|
+
"x-direction": "F2S",
|
|
1902
|
+
type: "object",
|
|
1903
|
+
description: "sig = FillerAuth{fillerId, nonce, expiresAt} by the registered message key of fillerId (keyAddress = its address); msgSig by the same key",
|
|
1904
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
1905
|
+
required: ["type", "fillerId", "keyAddress", "protocolVersion", "sig"],
|
|
1906
|
+
properties: {
|
|
1907
|
+
type: { const: "auth.response" },
|
|
1908
|
+
fillerId: { $ref: "#/$defs/fillerId" },
|
|
1909
|
+
keyAddress: { $ref: "#/$defs/address" },
|
|
1910
|
+
protocolVersion: { type: "string", description: 'the gateway answers UNSUPPORTED_VERSION to anything it does not serve; v1 senders send "1"' },
|
|
1911
|
+
nonce: { $ref: "#/$defs/bytes32", description: "optional: the auth.challenge nonce this response answers, so the REST login (POST /v1/filler/auth) finds its challenge without trying every live one; on WebSocket the challenge is the connection's own" },
|
|
1912
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
1913
|
+
}
|
|
1914
|
+
},
|
|
1915
|
+
"auth.ok": {
|
|
1916
|
+
"x-direction": "S2F",
|
|
1917
|
+
type: "object",
|
|
1918
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
1919
|
+
required: ["type", "heartbeatIntervalMs"],
|
|
1920
|
+
properties: { type: { const: "auth.ok" }, heartbeatIntervalMs: { $ref: "#/$defs/durationMs" } }
|
|
1921
|
+
},
|
|
1922
|
+
ping: {
|
|
1923
|
+
"x-direction": "both",
|
|
1924
|
+
description: "Heartbeat, either way. A receiver checks the copy of its direction: pingS2F (gateway sig) or pingF2S (filler msgSig)",
|
|
1925
|
+
anyOf: [{ $ref: "#/$defs/pingF2S" }, { $ref: "#/$defs/pingS2F" }]
|
|
1926
|
+
},
|
|
1927
|
+
pingF2S: {
|
|
1928
|
+
type: "object",
|
|
1929
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
1930
|
+
required: ["type", "id"],
|
|
1931
|
+
properties: { type: { const: "ping" }, id: { $ref: "#/$defs/messageId" } }
|
|
1932
|
+
},
|
|
1933
|
+
pingS2F: {
|
|
1934
|
+
type: "object",
|
|
1935
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
1936
|
+
required: ["type", "id"],
|
|
1937
|
+
properties: { type: { const: "ping" }, id: { $ref: "#/$defs/messageId" } }
|
|
1938
|
+
},
|
|
1939
|
+
pong: {
|
|
1940
|
+
"x-direction": "both",
|
|
1941
|
+
description: "Answer to a ping, re = ping.id. A receiver checks the copy of its direction: pongS2F (gateway sig) or pongF2S (filler msgSig)",
|
|
1942
|
+
anyOf: [{ $ref: "#/$defs/pongF2S" }, { $ref: "#/$defs/pongS2F" }]
|
|
1943
|
+
},
|
|
1944
|
+
pongF2S: {
|
|
1945
|
+
type: "object",
|
|
1946
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
1947
|
+
required: ["type", "re"],
|
|
1948
|
+
properties: { type: { const: "pong" }, re: { $ref: "#/$defs/messageId" } }
|
|
1949
|
+
},
|
|
1950
|
+
pongS2F: {
|
|
1951
|
+
type: "object",
|
|
1952
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
1953
|
+
required: ["type", "re"],
|
|
1954
|
+
properties: { type: { const: "pong" }, re: { $ref: "#/$defs/messageId" } }
|
|
1955
|
+
},
|
|
1956
|
+
error: {
|
|
1957
|
+
"x-direction": "both",
|
|
1958
|
+
description: "Either way. A receiver checks the copy of its direction: errorS2F (the gateway's reply, also the REST error body) or errorF2S (the filler's reply to a gateway frame it cannot handle)",
|
|
1959
|
+
anyOf: [{ $ref: "#/$defs/errorF2S" }, { $ref: "#/$defs/errorS2F" }]
|
|
1960
|
+
},
|
|
1961
|
+
errorS2F: {
|
|
1962
|
+
type: "object",
|
|
1963
|
+
description: "Reply to the F\u2192S frame `re`; also the REST error body. fillerId is absent before authentication. reason names the failed pre-ticket check with TICKET_REFUSED",
|
|
1964
|
+
allOf: [{ $ref: "#/$defs/s2fEnvelope" }],
|
|
1965
|
+
required: ["type", "code", "message"],
|
|
1966
|
+
properties: { type: { const: "error" }, code: { $ref: "#/$defs/errorCode" }, message: { type: "string" }, reason: { $ref: "#/$defs/ticketRefusedReason" } },
|
|
1967
|
+
if: { type: "object", properties: { code: { const: "TICKET_REFUSED" } }, required: ["code"] },
|
|
1968
|
+
then: { type: "object", required: ["reason"], properties: { reason: true } }
|
|
1969
|
+
},
|
|
1970
|
+
errorF2S: {
|
|
1971
|
+
type: "object",
|
|
1972
|
+
description: "The filler's reply to the S\u2192F frame `re` it cannot handle (malformed, unknown orderHash); informational, it changes no state in filler-gateway. Signed like every filler message",
|
|
1973
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
1974
|
+
required: ["type", "re", "code", "message"],
|
|
1975
|
+
properties: { type: { const: "error" }, re: { $ref: "#/$defs/messageId" }, code: { $ref: "#/$defs/errorCode" }, message: { type: "string" } }
|
|
1976
|
+
},
|
|
1977
|
+
"epoch.weights": {
|
|
1978
|
+
"x-direction": "S2F",
|
|
1979
|
+
type: "object",
|
|
1980
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
1981
|
+
required: ["type", "epochId", "startsAt", "endsAt", "weightsRoot"],
|
|
1982
|
+
properties: {
|
|
1983
|
+
type: { const: "epoch.weights" },
|
|
1984
|
+
epochId: { $ref: "#/$defs/uintDec64" },
|
|
1985
|
+
startsAt: { $ref: "#/$defs/timeS" },
|
|
1986
|
+
endsAt: { $ref: "#/$defs/timeS" },
|
|
1987
|
+
weightsRoot: { $ref: "#/$defs/bytes32" }
|
|
1988
|
+
}
|
|
1989
|
+
},
|
|
1990
|
+
"quote.request": {
|
|
1991
|
+
"x-direction": "S2F",
|
|
1992
|
+
type: "object",
|
|
1993
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
1994
|
+
required: ["type", "requestId", "route", "inputToken", "inputAmount", "outputAsset", "feeBps", "fillDeadlineHint", "windowCloseAt", "quoteTtlMs"],
|
|
1995
|
+
properties: {
|
|
1996
|
+
type: { const: "quote.request" },
|
|
1997
|
+
requestId: { $ref: "#/$defs/requestId" },
|
|
1998
|
+
route: {
|
|
1999
|
+
type: "object",
|
|
2000
|
+
required: ["src", "dst"],
|
|
2001
|
+
properties: { src: { $ref: "#/$defs/caip2" }, dst: { $ref: "#/$defs/caip2" } }
|
|
2002
|
+
},
|
|
2003
|
+
inputToken: { $ref: "#/$defs/asset" },
|
|
2004
|
+
inputAmount: { $ref: "#/$defs/uintDec256", description: "the total T the maker deposits (inclusive fee), input base units" },
|
|
2005
|
+
outputAsset: { $ref: "#/$defs/asset" },
|
|
2006
|
+
feeBps: { $ref: "#/$defs/uint16" },
|
|
2007
|
+
fillDeadlineHint: { $ref: "#/$defs/timeS" },
|
|
2008
|
+
windowCloseAt: { $ref: "#/$defs/timeMs" },
|
|
2009
|
+
quoteTtlMs: { $ref: "#/$defs/durationMs" },
|
|
2010
|
+
imbalanceHint: {
|
|
2011
|
+
type: "object",
|
|
2012
|
+
required: ["dstAsset", "netFlow24hUsd"],
|
|
2013
|
+
properties: { dstAsset: { $ref: "#/$defs/asset" }, netFlow24hUsd: { $ref: "#/$defs/intDecUsd" } }
|
|
2014
|
+
}
|
|
2015
|
+
}
|
|
2016
|
+
},
|
|
2017
|
+
quote: {
|
|
2018
|
+
"x-direction": "F2S",
|
|
2019
|
+
type: "object",
|
|
2020
|
+
description: "sig = FillerQuote{keccak256(utf8(requestId)), fillerId, amountOut, validUntil, nonce} by the message key, fillerId the envelope's; counts only if validUntil \xD7 1000 \u2265 windowCloseAt + quoteTtlMs",
|
|
2021
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2022
|
+
required: ["type", "requestId", "amountOut", "validUntil", "nonce", "sig"],
|
|
2023
|
+
properties: {
|
|
2024
|
+
type: { const: "quote" },
|
|
2025
|
+
requestId: { $ref: "#/$defs/requestId" },
|
|
2026
|
+
amountOut: { $ref: "#/$defs/uintDec256" },
|
|
2027
|
+
validUntil: { $ref: "#/$defs/timeS" },
|
|
2028
|
+
nonce: { $ref: "#/$defs/uintDec64" },
|
|
2029
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
2030
|
+
}
|
|
2031
|
+
},
|
|
2032
|
+
"quote.ack": {
|
|
2033
|
+
"x-direction": "S2F",
|
|
2034
|
+
type: "object",
|
|
2035
|
+
description: "For every well-formed, correctly signed quote, late ones included (S-12)",
|
|
2036
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2037
|
+
required: ["type", "requestId", "quoteHash", "receivedAt", "status"],
|
|
2038
|
+
properties: {
|
|
2039
|
+
type: { const: "quote.ack" },
|
|
2040
|
+
requestId: { $ref: "#/$defs/requestId" },
|
|
2041
|
+
quoteHash: { $ref: "#/$defs/bytes32" },
|
|
2042
|
+
receivedAt: { $ref: "#/$defs/timeMs" },
|
|
2043
|
+
status: { $ref: "#/$defs/quoteAckStatus" }
|
|
2044
|
+
}
|
|
2045
|
+
},
|
|
2046
|
+
"quote.reconfirm": {
|
|
2047
|
+
"x-direction": "S2F",
|
|
2048
|
+
type: "object",
|
|
2049
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2050
|
+
required: ["type", "orderHash", "requestId", "order", "amountOut", "ticketTtl", "replyBy"],
|
|
2051
|
+
properties: {
|
|
2052
|
+
type: { const: "quote.reconfirm" },
|
|
2053
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2054
|
+
requestId: { $ref: "#/$defs/requestId" },
|
|
2055
|
+
order: { $ref: "#/$defs/order" },
|
|
2056
|
+
amountOut: { $ref: "#/$defs/uintDec256" },
|
|
2057
|
+
ticketTtl: { $ref: "#/$defs/uint32", description: "seconds" },
|
|
2058
|
+
replyBy: { $ref: "#/$defs/timeMs" }
|
|
2059
|
+
}
|
|
2060
|
+
},
|
|
2061
|
+
"quote.reconfirm.reply": {
|
|
2062
|
+
"x-direction": "F2S",
|
|
2063
|
+
type: "object",
|
|
2064
|
+
description: "An accept carries sig = FillerQuote{keccak256(utf8(requestId)), fillerId, amountOut, validUntil, nonce} by the message key; a decline carries only the envelope msgSig",
|
|
2065
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2066
|
+
required: ["type", "orderHash", "accept"],
|
|
2067
|
+
properties: {
|
|
2068
|
+
type: { const: "quote.reconfirm.reply" },
|
|
2069
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2070
|
+
accept: { type: "boolean" },
|
|
2071
|
+
validUntil: { $ref: "#/$defs/timeS" },
|
|
2072
|
+
nonce: { $ref: "#/$defs/uintDec64" },
|
|
2073
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
2074
|
+
},
|
|
2075
|
+
if: { type: "object", properties: { accept: { const: true } }, required: ["accept"] },
|
|
2076
|
+
then: { type: "object", required: ["validUntil", "nonce", "sig"], properties: { validUntil: true, nonce: true, sig: true } }
|
|
2077
|
+
},
|
|
2078
|
+
"ticket.offer": {
|
|
2079
|
+
"x-direction": "S2F",
|
|
2080
|
+
type: "object",
|
|
2081
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2082
|
+
required: ["type", "orderHash", "attempt", "order", "amountOut", "validFrom", "validUntil", "acceptBy"],
|
|
2083
|
+
properties: {
|
|
2084
|
+
type: { const: "ticket.offer" },
|
|
2085
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2086
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2087
|
+
order: { $ref: "#/$defs/order" },
|
|
2088
|
+
amountOut: { $ref: "#/$defs/uintDec256" },
|
|
2089
|
+
validFrom: { $ref: "#/$defs/timeS" },
|
|
2090
|
+
validUntil: { $ref: "#/$defs/timeS" },
|
|
2091
|
+
acceptBy: { $ref: "#/$defs/timeMs" }
|
|
2092
|
+
}
|
|
2093
|
+
},
|
|
2094
|
+
"ticket.intent": {
|
|
2095
|
+
"x-direction": "F2S",
|
|
2096
|
+
type: "object",
|
|
2097
|
+
description: "sig = TicketIntent{orderHash, attempt, validFrom, validUntil, fillerId, deliveryKey, repayTo} by the message key, fillerId the envelope's; orderHash, attempt, validFrom, validUntil equal the offer; the issued ticket carries exactly this deliveryKey and repayTo (S-22), or the gateway answers error TICKET_REFUSED (S-21)",
|
|
2098
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2099
|
+
required: ["type", "orderHash", "attempt", "validFrom", "validUntil", "deliveryKey", "repayTo", "sig"],
|
|
2100
|
+
properties: {
|
|
2101
|
+
type: { const: "ticket.intent" },
|
|
2102
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2103
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2104
|
+
validFrom: { $ref: "#/$defs/timeS" },
|
|
2105
|
+
validUntil: { $ref: "#/$defs/timeS" },
|
|
2106
|
+
deliveryKey: { $ref: "#/$defs/deliveryKey" },
|
|
2107
|
+
repayTo: { $ref: "#/$defs/repayTo" },
|
|
2108
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
2109
|
+
}
|
|
2110
|
+
},
|
|
2111
|
+
"ticket.decline": {
|
|
2112
|
+
"x-direction": "F2S",
|
|
2113
|
+
type: "object",
|
|
2114
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2115
|
+
required: ["type", "orderHash", "attempt", "reason"],
|
|
2116
|
+
properties: {
|
|
2117
|
+
type: { const: "ticket.decline" },
|
|
2118
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2119
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2120
|
+
reason: { $ref: "#/$defs/declineReason" },
|
|
2121
|
+
detail: { type: "string" }
|
|
2122
|
+
}
|
|
2123
|
+
},
|
|
2124
|
+
"ticket.intent.ack": {
|
|
2125
|
+
"x-direction": "S2F",
|
|
2126
|
+
type: "object",
|
|
2127
|
+
description: "Idempotent: a repeated identical intent gets the identical ack",
|
|
2128
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2129
|
+
required: ["type", "orderHash", "attempt", "intentHash", "receivedAt"],
|
|
2130
|
+
properties: {
|
|
2131
|
+
type: { const: "ticket.intent.ack" },
|
|
2132
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2133
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2134
|
+
intentHash: { $ref: "#/$defs/bytes32" },
|
|
2135
|
+
receivedAt: { $ref: "#/$defs/timeMs" }
|
|
2136
|
+
}
|
|
2137
|
+
},
|
|
2138
|
+
"ticket.issued": {
|
|
2139
|
+
"x-direction": "S2F",
|
|
2140
|
+
type: "object",
|
|
2141
|
+
description: "form discriminates the EVM-destination ticket (FillTicket + ticketSig) from the Canton-destination one (DeliveryOrder, with its repayTo); a form added within v1 (V-2) is checked against the common fields only. The filler checks fillerId, deliveryKey and repayTo against its own ticket.intent before it delivers (T-15)",
|
|
2142
|
+
required: ["type", "form", "orderHash", "attempt"],
|
|
2143
|
+
properties: {
|
|
2144
|
+
type: { const: "ticket.issued" },
|
|
2145
|
+
form: { anyOf: [{ enum: ["evm", "canton"] }, { type: "string", pattern: "^[a-z][a-z0-9-]*$" }] },
|
|
2146
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2147
|
+
attempt: { $ref: "#/$defs/uint32" }
|
|
2148
|
+
},
|
|
2149
|
+
allOf: [
|
|
2150
|
+
{ $ref: "#/$defs/s2fBase" },
|
|
2151
|
+
{
|
|
2152
|
+
if: { type: "object", properties: { form: { const: "evm" } }, required: ["form"] },
|
|
2153
|
+
then: { type: "object", required: ["ticket", "ticketSig"], properties: { ticket: { $ref: "#/$defs/ticket" }, ticketSig: { $ref: "#/$defs/sig65" } } }
|
|
2154
|
+
},
|
|
2155
|
+
{
|
|
2156
|
+
if: { type: "object", properties: { form: { const: "canton" } }, required: ["form"] },
|
|
2157
|
+
then: { type: "object", required: ["deliveryOrderCid", "validUntil", "repayTo"], properties: { deliveryOrderCid: { type: "string", minLength: 1 }, validUntil: { $ref: "#/$defs/timeS" }, repayTo: { $ref: "#/$defs/repayTo", description: "the repayTo of the DeliveryOrder, = the filler's signed ticket.intent (S-22); fillerId is the envelope's" } } }
|
|
2158
|
+
}
|
|
2159
|
+
]
|
|
2160
|
+
},
|
|
2161
|
+
"ticket.receipt": {
|
|
2162
|
+
"x-direction": "F2S",
|
|
2163
|
+
type: "object",
|
|
2164
|
+
description: "sig = TicketReceipt{ticketHash, ticketSigHash} by the message key",
|
|
2165
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2166
|
+
required: ["type", "orderHash", "attempt", "ticketHash", "ticketSigHash", "sig"],
|
|
2167
|
+
properties: {
|
|
2168
|
+
type: { const: "ticket.receipt" },
|
|
2169
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2170
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2171
|
+
ticketHash: { $ref: "#/$defs/bytes32" },
|
|
2172
|
+
ticketSigHash: { $ref: "#/$defs/bytes32" },
|
|
2173
|
+
sig: { $ref: "#/$defs/sig65" }
|
|
2174
|
+
}
|
|
2175
|
+
},
|
|
2176
|
+
"fill.reported": {
|
|
2177
|
+
"x-direction": "F2S",
|
|
2178
|
+
type: "object",
|
|
2179
|
+
allOf: [{ $ref: "#/$defs/f2sBase" }],
|
|
2180
|
+
required: ["type", "orderHash", "attempt", "txRef"],
|
|
2181
|
+
properties: {
|
|
2182
|
+
type: { const: "fill.reported" },
|
|
2183
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2184
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2185
|
+
txRef: { type: "string", minLength: 1, description: "EVM tx hash or Canton update id" }
|
|
2186
|
+
}
|
|
2187
|
+
},
|
|
2188
|
+
"ticket.expired": {
|
|
2189
|
+
"x-direction": "S2F",
|
|
2190
|
+
type: "object",
|
|
2191
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2192
|
+
required: ["type", "orderHash", "attempt", "result"],
|
|
2193
|
+
properties: {
|
|
2194
|
+
type: { const: "ticket.expired" },
|
|
2195
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2196
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2197
|
+
result: { $ref: "#/$defs/expiredResult" },
|
|
2198
|
+
exemptReason: { $ref: "#/$defs/exemptReason" }
|
|
2199
|
+
},
|
|
2200
|
+
if: { type: "object", properties: { result: { const: "EXEMPT" } }, required: ["result"] },
|
|
2201
|
+
then: { type: "object", required: ["exemptReason"], properties: { exemptReason: true } }
|
|
2202
|
+
},
|
|
2203
|
+
"order.settled": {
|
|
2204
|
+
"x-direction": "S2F",
|
|
2205
|
+
type: "object",
|
|
2206
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2207
|
+
required: ["type", "orderHash", "payout", "fee", "penaltyWithheld", "txRef"],
|
|
2208
|
+
properties: {
|
|
2209
|
+
type: { const: "order.settled" },
|
|
2210
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2211
|
+
payout: { $ref: "#/$defs/uintDec256" },
|
|
2212
|
+
fee: { $ref: "#/$defs/uintDec256" },
|
|
2213
|
+
penaltyWithheld: { $ref: "#/$defs/uintDec256" },
|
|
2214
|
+
txRef: { type: "string", minLength: 1 }
|
|
2215
|
+
}
|
|
2216
|
+
},
|
|
2217
|
+
"penalty.applied": {
|
|
2218
|
+
"x-direction": "S2F",
|
|
2219
|
+
type: "object",
|
|
2220
|
+
allOf: [{ $ref: "#/$defs/s2fBase" }],
|
|
2221
|
+
required: ["type", "violationId", "code", "step", "details"],
|
|
2222
|
+
properties: {
|
|
2223
|
+
type: { const: "penalty.applied" },
|
|
2224
|
+
violationId: { type: "string", minLength: 1 },
|
|
2225
|
+
code: { type: "string", minLength: 1 },
|
|
2226
|
+
step: { $ref: "#/$defs/penaltyStep" },
|
|
2227
|
+
details: { type: "object" }
|
|
2228
|
+
}
|
|
2229
|
+
},
|
|
2230
|
+
fillProof: {
|
|
2231
|
+
type: "object",
|
|
2232
|
+
description: "FillProof as the source router hashes it (FILL_PROOF_TYPES, the twelve variant A fields, protocol \xA73.3), encoded per protocol \xA73.1: kind, attempt, setId JSON integers; amountDelivered, filledAt decimal strings; fillerId the on-chain form keccak256(utf8(fillerId))",
|
|
2233
|
+
required: ["kind", "orderHash", "destination", "fillRef", "recipient", "outputAsset", "amountDelivered", "filledAt", "fillerId", "repayTo", "attempt", "setId"],
|
|
2234
|
+
properties: {
|
|
2235
|
+
kind: { $ref: "#/$defs/uint8" },
|
|
2236
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2237
|
+
destination: { $ref: "#/$defs/bytes32" },
|
|
2238
|
+
fillRef: { $ref: "#/$defs/bytes32" },
|
|
2239
|
+
recipient: { $ref: "#/$defs/bytes32" },
|
|
2240
|
+
outputAsset: { $ref: "#/$defs/bytes32" },
|
|
2241
|
+
amountDelivered: { $ref: "#/$defs/uintDec256" },
|
|
2242
|
+
filledAt: { $ref: "#/$defs/timeS" },
|
|
2243
|
+
fillerId: { $ref: "#/$defs/bytes32", description: "keccak256(utf8(fillerId)) of the filler that delivered: this filler's" },
|
|
2244
|
+
repayTo: { $ref: "#/$defs/repayTo", description: "the payee of settle, encoded for the source chain: the repayTo of this filler's ticket" },
|
|
2245
|
+
attempt: { $ref: "#/$defs/uint32" },
|
|
2246
|
+
setId: { $ref: "#/$defs/uint32" }
|
|
2247
|
+
}
|
|
2248
|
+
},
|
|
2249
|
+
attestationEvm: {
|
|
2250
|
+
type: "object",
|
|
2251
|
+
description: "One attestor signature for an EVM source: EIP-712 over FillProof in the source-router domain; in the payload's order the signature values are the sigs argument of settle",
|
|
2252
|
+
required: ["signer", "signature"],
|
|
2253
|
+
properties: { signer: { $ref: "#/$defs/address" }, signature: { $ref: "#/$defs/sig65" } }
|
|
2254
|
+
},
|
|
2255
|
+
attestationCanton: {
|
|
2256
|
+
type: "object",
|
|
2257
|
+
description: "One attestor signature for a Canton source: the same digest, carried as SwapIntent_SettleWithProof takes it (SigEntry {pubKey, sig}; strip 0x for Daml). signer is the address Daml derives from pubKey",
|
|
2258
|
+
required: ["signer", "pubKey", "signature"],
|
|
2259
|
+
properties: {
|
|
2260
|
+
signer: { $ref: "#/$defs/address" },
|
|
2261
|
+
pubKey: { type: "string", pattern: "^0x3056301006072a8648ce3d020106052b8104000a03420004[0-9a-f]{128}$", description: "DER SubjectPublicKeyInfo of the uncompressed secp256k1 key (88 bytes), as KMS GetPublicKey returns it" },
|
|
2262
|
+
signature: { type: "string", pattern: "^0x30([0-9a-f]{2}){7,71}$", description: "minimal DER ECDSA signature, low-s, no recovery byte" }
|
|
2263
|
+
}
|
|
2264
|
+
},
|
|
2265
|
+
"settle.attestations": {
|
|
2266
|
+
"x-direction": "S2F",
|
|
2267
|
+
type: "object",
|
|
2268
|
+
description: "\u2265 threshold attestor signatures over the filler's FillProof (\xA710 D-N, S-13). Sent once per (orderHash, attempt); GET /v1/filler/attestations/{orderHash} serves the same payload. signatures: at least threshold entries, strictly ascending by signer (not expressible here; settleAttestationsErrors checks it). sourceChainId picks the entry form: eip155 \u2192 attestationEvm, canton \u2192 attestationCanton",
|
|
2269
|
+
allOf: [
|
|
2270
|
+
{ $ref: "#/$defs/s2fBase" },
|
|
2271
|
+
{
|
|
2272
|
+
if: { type: "object", properties: { sourceChainId: { type: "string", pattern: "^canton:" } }, required: ["sourceChainId"] },
|
|
2273
|
+
then: { type: "object", properties: { signatures: { type: "array", items: { $ref: "#/$defs/attestationCanton" } } } },
|
|
2274
|
+
else: { type: "object", properties: { signatures: { type: "array", items: { $ref: "#/$defs/attestationEvm" } } } }
|
|
2275
|
+
}
|
|
2276
|
+
],
|
|
2277
|
+
required: ["type", "orderHash", "attempt", "sourceChainId", "proof", "signatures", "setId", "threshold", "refundAfter"],
|
|
2278
|
+
properties: {
|
|
2279
|
+
type: { const: "settle.attestations" },
|
|
2280
|
+
orderHash: { $ref: "#/$defs/bytes32" },
|
|
2281
|
+
attempt: { $ref: "#/$defs/uint32", description: "equals proof.attempt" },
|
|
2282
|
+
sourceChainId: { $ref: "#/$defs/caip2", description: "where settle is submitted" },
|
|
2283
|
+
proof: { $ref: "#/$defs/fillProof" },
|
|
2284
|
+
signatures: { type: "array", minItems: 1 },
|
|
2285
|
+
setId: { $ref: "#/$defs/uint32", description: "equals proof.setId; EVM: attestationSetFor(orderHash)" },
|
|
2286
|
+
threshold: { type: "integer", minimum: 1, maximum: 4294967295, description: "k of that set" },
|
|
2287
|
+
refundAfter: { $ref: "#/$defs/timeS", description: "from this time settle reverts; the node gets its settle included before it" }
|
|
2288
|
+
}
|
|
2289
|
+
}
|
|
2290
|
+
}
|
|
2291
|
+
};
|
|
2292
|
+
|
|
2293
|
+
// spec/protocol/records.schema.json
|
|
2294
|
+
var records_schema_default = {
|
|
2295
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
2296
|
+
$id: "https://cancore.io/schemas/filler-protocol/v1/records.schema.json",
|
|
2297
|
+
title: "Cancore filler protocol v1 \u2014 public records",
|
|
2298
|
+
$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.",
|
|
2299
|
+
$defs: {
|
|
2300
|
+
drawCandidate: {
|
|
2301
|
+
type: "object",
|
|
2302
|
+
required: ["fillerId", "weight"],
|
|
2303
|
+
properties: { fillerId: { $ref: "messages.schema.json#/$defs/fillerId" }, weight: { $ref: "messages.schema.json#/$defs/uintDec256" } }
|
|
2304
|
+
},
|
|
2305
|
+
drawAttempt: {
|
|
2306
|
+
type: "object",
|
|
2307
|
+
required: ["attempt", "tBase", "closedBy", "drandRound", "drandRandomness", "drandSignature", "candidates", "r", "winnerFillerId", "fallbackReason"],
|
|
2308
|
+
properties: {
|
|
2309
|
+
attempt: { $ref: "messages.schema.json#/$defs/uint32" },
|
|
2310
|
+
tBase: { $ref: "messages.schema.json#/$defs/timeS" },
|
|
2311
|
+
closedBy: { anyOf: [{ enum: ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED", null] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] },
|
|
2312
|
+
drandRound: { $ref: "messages.schema.json#/$defs/uintDec64" },
|
|
2313
|
+
drandRandomness: { $ref: "messages.schema.json#/$defs/bytes32" },
|
|
2314
|
+
drandSignature: { type: "string", pattern: "^0x[0-9a-f]{96}$", description: "BLS signature of the round, 48 bytes (G1)" },
|
|
2315
|
+
candidates: { type: "array", items: { $ref: "#/$defs/drawCandidate" }, description: "ascending by the UTF-8 bytes of fillerId (A-22)" },
|
|
2316
|
+
r: { $ref: "messages.schema.json#/$defs/uintDec256" },
|
|
2317
|
+
winnerFillerId: { $ref: "messages.schema.json#/$defs/fillerId" },
|
|
2318
|
+
fallbackReason: { anyOf: [{ enum: ["DRAW_FALLBACK", null] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] }
|
|
2319
|
+
}
|
|
2320
|
+
},
|
|
2321
|
+
drawRecord: {
|
|
2322
|
+
type: "object",
|
|
2323
|
+
required: ["orderHash", "source", "openRef", "t0", "epochId", "deltaDrand", "attempts", "sig"],
|
|
2324
|
+
properties: {
|
|
2325
|
+
orderHash: { $ref: "messages.schema.json#/$defs/bytes32" },
|
|
2326
|
+
source: { $ref: "messages.schema.json#/$defs/caip2" },
|
|
2327
|
+
openRef: { type: "string", minLength: 1, description: "EVM: open tx hash; Canton: Execute update id" },
|
|
2328
|
+
t0: { $ref: "messages.schema.json#/$defs/timeS" },
|
|
2329
|
+
epochId: { $ref: "messages.schema.json#/$defs/uintDec64" },
|
|
2330
|
+
deltaDrand: { $ref: "messages.schema.json#/$defs/uint32", description: "seconds" },
|
|
2331
|
+
attempts: { type: "array", items: { $ref: "#/$defs/drawAttempt" } },
|
|
2332
|
+
sig: { $ref: "messages.schema.json#/$defs/sig65" }
|
|
2333
|
+
}
|
|
2334
|
+
},
|
|
2335
|
+
epochLeaf: {
|
|
2336
|
+
type: "object",
|
|
2337
|
+
description: 'StandardMerkleTree leaf ["string", "uint256", "uint8", "uint16"] = (fillerId, base, tier, reliabilityBps)',
|
|
2338
|
+
required: ["fillerId", "base", "tier", "reliabilityBps"],
|
|
2339
|
+
properties: {
|
|
2340
|
+
fillerId: { $ref: "messages.schema.json#/$defs/fillerId" },
|
|
2341
|
+
base: { $ref: "messages.schema.json#/$defs/uintDec256" },
|
|
2342
|
+
tier: { $ref: "messages.schema.json#/$defs/uint8" },
|
|
2343
|
+
reliabilityBps: { type: "integer", minimum: 0, maximum: 1e4 }
|
|
2344
|
+
}
|
|
2345
|
+
},
|
|
2346
|
+
stakeStep: {
|
|
2347
|
+
type: "object",
|
|
2348
|
+
required: ["tier", "minStake", "step"],
|
|
2349
|
+
properties: {
|
|
2350
|
+
tier: { $ref: "messages.schema.json#/$defs/uint8" },
|
|
2351
|
+
minStake: { $ref: "messages.schema.json#/$defs/uintDec256" },
|
|
2352
|
+
step: { $ref: "messages.schema.json#/$defs/uintDec256" }
|
|
2353
|
+
}
|
|
2354
|
+
},
|
|
2355
|
+
epochRecord: {
|
|
2356
|
+
type: "object",
|
|
2357
|
+
required: ["epochId", "startsAt", "endsAt", "weightsRoot", "leaves", "stakeSteps", "rMinBps", "snapshotBlocks", "sig"],
|
|
2358
|
+
properties: {
|
|
2359
|
+
epochId: { $ref: "messages.schema.json#/$defs/uintDec64" },
|
|
2360
|
+
startsAt: { $ref: "messages.schema.json#/$defs/timeS" },
|
|
2361
|
+
endsAt: { $ref: "messages.schema.json#/$defs/timeS" },
|
|
2362
|
+
weightsRoot: { $ref: "messages.schema.json#/$defs/bytes32" },
|
|
2363
|
+
leaves: { type: "array", items: { $ref: "#/$defs/epochLeaf" } },
|
|
2364
|
+
stakeSteps: { type: "array", items: { $ref: "#/$defs/stakeStep" } },
|
|
2365
|
+
rMinBps: { type: "integer", minimum: 0, maximum: 1e4 },
|
|
2366
|
+
snapshotBlocks: {
|
|
2367
|
+
type: "object",
|
|
2368
|
+
propertyNames: { $ref: "messages.schema.json#/$defs/caip2" },
|
|
2369
|
+
additionalProperties: { $ref: "messages.schema.json#/$defs/uintDec64" }
|
|
2370
|
+
},
|
|
2371
|
+
sig: { $ref: "messages.schema.json#/$defs/sig65" }
|
|
2372
|
+
}
|
|
2373
|
+
},
|
|
2374
|
+
gatewayInfo: {
|
|
2375
|
+
type: "object",
|
|
2376
|
+
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",
|
|
2377
|
+
required: ["env", "gateway", "ticketSigners", "protocolVersion", "maxMessageAgeMs"],
|
|
2378
|
+
properties: {
|
|
2379
|
+
env: { type: "string", minLength: 1 },
|
|
2380
|
+
gateway: { $ref: "messages.schema.json#/$defs/address" },
|
|
2381
|
+
ticketSigners: { type: "array", items: { $ref: "messages.schema.json#/$defs/address" } },
|
|
2382
|
+
protocolVersion: { $ref: "messages.schema.json#/$defs/protocolVersion" },
|
|
2383
|
+
maxMessageAgeMs: { $ref: "messages.schema.json#/$defs/durationMs", description: "freshness bound of \xA73.4 in both directions: |receivedAt \u2212 sentAt| \u2264 maxMessageAgeMs, and a message id is not reused within it" }
|
|
2384
|
+
}
|
|
2385
|
+
}
|
|
2386
|
+
}
|
|
2387
|
+
};
|
|
2388
|
+
|
|
2389
|
+
// spec/protocol/rest.schema.json
|
|
2390
|
+
var rest_schema_default = {
|
|
2391
|
+
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
2392
|
+
$id: "https://cancore.io/schemas/filler-protocol/v1/rest.schema.json",
|
|
2393
|
+
title: "Cancore filler protocol v1 \u2014 REST fallback",
|
|
2394
|
+
$comment: "protocol \xA73.6. Bodies are the WebSocket frames: every request body is a filler message with its envelope (id, fillerId, sentAt) and msgSig, verified before processing as on the WebSocket (S-19); every response is a freshly signed S\u2192F message. /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. GET /v1/filler/attestations/{orderHash} answers 404 ATTESTATIONS_NOT_READY until the gateway holds \u2265 threshold verified signatures for this filler's fill, and 404 UNKNOWN_TICKET when this filler holds no ticket on the order. /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.",
|
|
2395
|
+
"x-endpoints": [
|
|
2396
|
+
{ method: "GET", path: "/v1/filler/auth/challenge", auth: "none", response: "messages.schema.json#/$defs/auth.challenge" },
|
|
2397
|
+
{ method: "POST", path: "/v1/filler/auth", auth: "none", request: "messages.schema.json#/$defs/auth.response", response: "#/$defs/authToken" },
|
|
2398
|
+
{ method: "GET", path: "/v1/filler/tickets", auth: "bearer", query: "#/$defs/ticketListQuery", response: "#/$defs/ticketList" },
|
|
2399
|
+
{ 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" },
|
|
2400
|
+
{ method: "POST", path: "/v1/filler/tickets/{orderHash}/{attempt}/receipt", auth: "bearer", request: "messages.schema.json#/$defs/ticket.receipt", response: "#/$defs/empty" },
|
|
2401
|
+
{ method: "POST", path: "/v1/filler/tickets/{orderHash}/{attempt}/decline", auth: "bearer", request: "messages.schema.json#/$defs/ticket.decline", response: "#/$defs/empty" },
|
|
2402
|
+
{ method: "POST", path: "/v1/filler/stake-bindings", auth: "bearer", request: "#/$defs/stakeBindingRequest", response: "#/$defs/empty" },
|
|
2403
|
+
{ method: "GET", path: "/v1/filler/quotes", auth: "bearer", query: "#/$defs/quoteListQuery", response: "#/$defs/quoteList" },
|
|
2404
|
+
{ method: "GET", path: "/v1/filler/stats", auth: "bearer", response: "#/$defs/fillerStats" },
|
|
2405
|
+
{ method: "GET", path: "/v1/filler/penalties", auth: "bearer", query: "#/$defs/pageQuery", response: "#/$defs/penaltyList" },
|
|
2406
|
+
{ method: "GET", path: "/v1/filler/attestations/{orderHash}", auth: "bearer", response: "messages.schema.json#/$defs/settle.attestations" },
|
|
2407
|
+
{ method: "GET", path: "/v1/draws/{orderHash}", auth: "none", response: "records.schema.json#/$defs/drawRecord" },
|
|
2408
|
+
{ method: "GET", path: "/v1/draws/epochs/{id}", auth: "none", response: "records.schema.json#/$defs/epochRecord" },
|
|
2409
|
+
{ method: "GET", path: "/v1/gateway", auth: "none", response: "records.schema.json#/$defs/gatewayInfo" }
|
|
2410
|
+
],
|
|
2411
|
+
"x-error-status": {
|
|
2412
|
+
BAD_REQUEST: 400,
|
|
2413
|
+
UNAUTHENTICATED: 401,
|
|
2414
|
+
UNSUPPORTED_VERSION: 400,
|
|
2415
|
+
UNSUPPORTED_TYPE: 400,
|
|
2416
|
+
BAD_SIGNATURE: 422,
|
|
2417
|
+
STALE_MESSAGE: 400,
|
|
2418
|
+
REPLAYED_MESSAGE: 409,
|
|
2419
|
+
TICKET_REFUSED: 409,
|
|
2420
|
+
UNKNOWN_REQUEST: 404,
|
|
2421
|
+
UNKNOWN_TICKET: 404,
|
|
2422
|
+
TICKET_CLOSED: 409,
|
|
2423
|
+
NOT_ELIGIBLE: 403,
|
|
2424
|
+
RATE_LIMITED: 429,
|
|
2425
|
+
INTERNAL: 500,
|
|
2426
|
+
ATTESTATIONS_NOT_READY: 404
|
|
2427
|
+
},
|
|
2428
|
+
$defs: {
|
|
2429
|
+
errorBody: { $ref: "messages.schema.json#/$defs/errorS2F" },
|
|
2430
|
+
empty: { type: "object", description: "no fields in v1; receivers ignore unknown ones (V-2)" },
|
|
2431
|
+
authToken: {
|
|
2432
|
+
type: "object",
|
|
2433
|
+
required: ["token", "expiresAt"],
|
|
2434
|
+
properties: { token: { type: "string", minLength: 1 }, expiresAt: { $ref: "messages.schema.json#/$defs/timeMs" } }
|
|
2435
|
+
},
|
|
2436
|
+
pageQuery: {
|
|
2437
|
+
type: "object",
|
|
2438
|
+
properties: { cursor: { type: "string", minLength: 1 }, limit: { type: "string", pattern: "^([1-9][0-9]?|100)$", description: "1..100, default 50" } }
|
|
2439
|
+
},
|
|
2440
|
+
ticketListQuery: {
|
|
2441
|
+
allOf: [{ $ref: "#/$defs/pageQuery" }],
|
|
2442
|
+
type: "object",
|
|
2443
|
+
properties: { status: { enum: ["OFFERED", "ISSUED"], description: "a request filter: the gateway owns the list, so it is closed" } }
|
|
2444
|
+
},
|
|
2445
|
+
quoteListQuery: {
|
|
2446
|
+
allOf: [{ $ref: "#/$defs/pageQuery" }],
|
|
2447
|
+
type: "object",
|
|
2448
|
+
properties: { since: { type: "string", pattern: "^(0|[1-9][0-9]*)$", description: "unix ms" } }
|
|
2449
|
+
},
|
|
2450
|
+
ticketList: {
|
|
2451
|
+
type: "object",
|
|
2452
|
+
required: ["items", "nextCursor"],
|
|
2453
|
+
properties: {
|
|
2454
|
+
items: {
|
|
2455
|
+
type: "array",
|
|
2456
|
+
items: { oneOf: [{ $ref: "messages.schema.json#/$defs/ticket.offer" }, { $ref: "messages.schema.json#/$defs/ticket.issued" }] }
|
|
2457
|
+
},
|
|
2458
|
+
nextCursor: { type: ["string", "null"] }
|
|
2459
|
+
}
|
|
2460
|
+
},
|
|
2461
|
+
stakeBindingRequest: {
|
|
2462
|
+
type: "object",
|
|
2463
|
+
description: "sig = StakeBinding{partnerId, stakingAddress, chainId, nonce} by the staking address; the body carries the filler envelope and msgSig like every request body",
|
|
2464
|
+
allOf: [{ $ref: "messages.schema.json#/$defs/f2sEnvelope" }],
|
|
2465
|
+
required: ["partnerId", "stakingAddress", "chainId", "nonce", "sig"],
|
|
2466
|
+
properties: {
|
|
2467
|
+
partnerId: { $ref: "messages.schema.json#/$defs/fillerId" },
|
|
2468
|
+
stakingAddress: { $ref: "messages.schema.json#/$defs/address" },
|
|
2469
|
+
chainId: { $ref: "messages.schema.json#/$defs/uintDec256" },
|
|
2470
|
+
nonce: { $ref: "messages.schema.json#/$defs/uintDec64" },
|
|
2471
|
+
sig: { $ref: "messages.schema.json#/$defs/sig65" }
|
|
2472
|
+
}
|
|
2473
|
+
},
|
|
2474
|
+
quoteRecord: {
|
|
2475
|
+
type: "object",
|
|
2476
|
+
required: ["quote", "ack", "status"],
|
|
2477
|
+
properties: {
|
|
2478
|
+
quote: { $ref: "messages.schema.json#/$defs/quote" },
|
|
2479
|
+
ack: { $ref: "messages.schema.json#/$defs/quote.ack" },
|
|
2480
|
+
status: { anyOf: [{ enum: ["COUNTED", "LATE", "SHORT_TTL", "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }] }
|
|
2481
|
+
}
|
|
2482
|
+
},
|
|
2483
|
+
quoteList: {
|
|
2484
|
+
type: "object",
|
|
2485
|
+
required: ["items", "nextCursor"],
|
|
2486
|
+
properties: { items: { type: "array", items: { $ref: "#/$defs/quoteRecord" } }, nextCursor: { type: ["string", "null"] } }
|
|
2487
|
+
},
|
|
2488
|
+
fillerStats: {
|
|
2489
|
+
type: "object",
|
|
2490
|
+
required: ["won", "delivered", "noShow", "reliability", "capacityUsd", "inFlightUsd"],
|
|
2491
|
+
properties: {
|
|
2492
|
+
won: { type: "integer", minimum: 0 },
|
|
2493
|
+
delivered: { type: "integer", minimum: 0 },
|
|
2494
|
+
noShow: { type: "integer", minimum: 0 },
|
|
2495
|
+
reliability: { type: "integer", minimum: 0, maximum: 1e4, description: "basis points" },
|
|
2496
|
+
capacityUsd: { $ref: "messages.schema.json#/$defs/intDecUsd" },
|
|
2497
|
+
inFlightUsd: { $ref: "messages.schema.json#/$defs/intDecUsd" }
|
|
2498
|
+
}
|
|
2499
|
+
},
|
|
2500
|
+
penaltyRecord: {
|
|
2501
|
+
type: "object",
|
|
2502
|
+
required: ["violationId", "code", "step", "at", "details"],
|
|
2503
|
+
properties: {
|
|
2504
|
+
violationId: { type: "string", minLength: 1 },
|
|
2505
|
+
code: { type: "string", minLength: 1 },
|
|
2506
|
+
step: { $ref: "messages.schema.json#/$defs/penaltyStep" },
|
|
2507
|
+
orderHash: { $ref: "messages.schema.json#/$defs/bytes32" },
|
|
2508
|
+
attempt: { $ref: "messages.schema.json#/$defs/uint32" },
|
|
2509
|
+
at: { $ref: "messages.schema.json#/$defs/timeMs" },
|
|
2510
|
+
details: { type: "object" }
|
|
2511
|
+
}
|
|
2512
|
+
},
|
|
2513
|
+
penaltyList: {
|
|
2514
|
+
type: "object",
|
|
2515
|
+
required: ["items", "nextCursor"],
|
|
2516
|
+
properties: { items: { type: "array", items: { $ref: "#/$defs/penaltyRecord" } }, nextCursor: { type: ["string", "null"] } }
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
};
|
|
2520
|
+
|
|
2521
|
+
// src/protocol/schemas.ts
|
|
2522
|
+
var PROTOCOL_SCHEMAS = { messages: messages_schema_default, rest: rest_schema_default, records: records_schema_default };
|
|
2523
|
+
var ASYNCAPI = asyncapi_default;
|
|
2524
|
+
var SCHEMA_VOCABULARY = ["x-direction", "x-endpoints", "x-error-status"];
|
|
2525
|
+
var MESSAGE_DIRECTIONS = Object.fromEntries(
|
|
2526
|
+
Object.entries(messages_schema_default.$defs).filter(([, def]) => def["x-direction"]).map(([type, def]) => [type, def["x-direction"]])
|
|
2527
|
+
);
|
|
2528
|
+
var REST_ENDPOINTS = rest_schema_default["x-endpoints"];
|
|
2529
|
+
function messageSchemaRef(type, direction) {
|
|
2530
|
+
const def = direction && MESSAGE_DIRECTIONS[type] === "both" ? `${type}${direction}` : type;
|
|
2531
|
+
return `${messages_schema_default.$id}#/$defs/${def}`;
|
|
2532
|
+
}
|
|
2533
|
+
var ENVELOPE = /* @__PURE__ */ new Set(["type", "id", "fillerId", "sentAt", "sig", "re"]);
|
|
2534
|
+
function settleAttestationsPayload(frame) {
|
|
2535
|
+
return Object.fromEntries(Object.entries(frame).filter(([k]) => !ENVELOPE.has(k)));
|
|
2536
|
+
}
|
|
2537
|
+
function settleAttestationsPayloadHash(frame) {
|
|
2538
|
+
return toHex(keccak(utf8ToBytes(jcs(settleAttestationsPayload(frame)))));
|
|
2539
|
+
}
|
|
2540
|
+
var isCantonSource = (sourceChainId) => sourceChainId.startsWith("canton:");
|
|
2541
|
+
function settleAttestationsErrors(payload) {
|
|
2542
|
+
const errors = [];
|
|
2543
|
+
if (payload.attempt !== payload.proof.attempt) errors.push(`attempt ${payload.attempt} differs from proof.attempt ${payload.proof.attempt}`);
|
|
2544
|
+
if (payload.setId !== payload.proof.setId) errors.push(`setId ${payload.setId} differs from proof.setId ${payload.proof.setId}`);
|
|
2545
|
+
if (payload.orderHash.toLowerCase() !== payload.proof.orderHash.toLowerCase()) errors.push("orderHash differs from proof.orderHash");
|
|
2546
|
+
if (payload.signatures.length < payload.threshold) errors.push(`${payload.signatures.length} signatures, fewer than threshold ${payload.threshold}`);
|
|
2547
|
+
const signers = payload.signatures.map((s) => s.signer.toLowerCase());
|
|
2548
|
+
for (let i = 1; i < signers.length; i++) {
|
|
2549
|
+
if (signers[i] <= signers[i - 1]) {
|
|
2550
|
+
errors.push(`signers not strictly ascending at index ${i}`);
|
|
2551
|
+
break;
|
|
2552
|
+
}
|
|
2553
|
+
}
|
|
2554
|
+
return errors;
|
|
2555
|
+
}
|
|
2556
|
+
function settleSigs(payload) {
|
|
2557
|
+
if (isCantonSource(payload.sourceChainId)) throw new TypeError(`${payload.sourceChainId} is a Canton source: use cantonSigEntries`);
|
|
2558
|
+
return payload.signatures.map((s) => s.signature);
|
|
2559
|
+
}
|
|
2560
|
+
function cantonSigEntries(payload) {
|
|
2561
|
+
if (!isCantonSource(payload.sourceChainId)) throw new TypeError(`${payload.sourceChainId} is not a Canton source: use settleSigs`);
|
|
2562
|
+
return payload.signatures.map((s) => ({ pubKey: s.pubKey.slice(2).toLowerCase(), sig: s.signature.slice(2).toLowerCase() }));
|
|
2563
|
+
}
|
|
50
2564
|
|
|
51
2565
|
// src/generated/meta.ts
|
|
52
2566
|
var CONTRACTS_RELEASE = {
|
|
53
2567
|
"version": "1.4.0-dev",
|
|
54
2568
|
"releaseChannel": "dev",
|
|
55
|
-
"updatedAt": "2026-07-24T19:55:00Z"
|
|
2569
|
+
"updatedAt": "2026-07-24T19:55:00Z",
|
|
2570
|
+
"commit": "8c7d36f6a4f1cb76e6d5098c4f4b18367d46e350"
|
|
2571
|
+
};
|
|
2572
|
+
var BUILD_HASHES = {
|
|
2573
|
+
"HTLC": {
|
|
2574
|
+
"creationHexSha256": "93a991d3a6451f7c3f02dfb70b365a48d29bebccc7f16d8dbe3d56d3dfee0af1",
|
|
2575
|
+
"runtimeHexSha256": "40ab52456c3b5a04365fc1fad837eb79bbe4b85c8dbd990f549468ae48f97e3a",
|
|
2576
|
+
"creationHexLength": 14976,
|
|
2577
|
+
"runtimeHexLength": 14686
|
|
2578
|
+
},
|
|
2579
|
+
"FeeVault": {
|
|
2580
|
+
"creationHexSha256": "1c97d27c8d3e584f879bb57549d75ef10394a56a298eaf4a772516b9316e2248",
|
|
2581
|
+
"runtimeHexSha256": "0631177a64cde0829c2cec8426c08a507564f7d8b084e0237d724ed63faea0e9",
|
|
2582
|
+
"creationHexLength": 13176,
|
|
2583
|
+
"runtimeHexLength": 10968
|
|
2584
|
+
},
|
|
2585
|
+
"MultiBalanceChecker": {
|
|
2586
|
+
"creationHexSha256": "c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423",
|
|
2587
|
+
"runtimeHexSha256": "93a1f0aa251715cc6a1b6a472f10762463b5c24668886630cbc6da5632e5739b",
|
|
2588
|
+
"creationHexLength": 2456,
|
|
2589
|
+
"runtimeHexLength": 2394
|
|
2590
|
+
},
|
|
2591
|
+
"CancoreRouter": {
|
|
2592
|
+
"creationHexSha256": "615b6fb47a4255df9f7fdec963811cdfbefb53166645cd19466fa268df7fb39d",
|
|
2593
|
+
"runtimeHexSha256": "dec1f5d541c6b383b95b6c53e278123cc3844bdeff3f977a166fb6e9cbf86343",
|
|
2594
|
+
"creationHexLength": 43102,
|
|
2595
|
+
"runtimeHexLength": 36984
|
|
2596
|
+
},
|
|
2597
|
+
"CNRXStaking": {
|
|
2598
|
+
"creationHexSha256": "dfda056ee22b593e2f2e1fc4e679fbb9dc34b04964f389b46914402c422b40fb",
|
|
2599
|
+
"runtimeHexSha256": "d11534242f166e52f4ad063b5b6b59146e31634d3932f7ad63db05d83a1485f6",
|
|
2600
|
+
"creationHexLength": 7412,
|
|
2601
|
+
"runtimeHexLength": 6240
|
|
2602
|
+
},
|
|
2603
|
+
"PointsClaim": {
|
|
2604
|
+
"creationHexSha256": "0f29890b609f7e15ef4dbcda17a7f2cd7482d016a0057a5f6c4270d7780ff38d",
|
|
2605
|
+
"runtimeHexSha256": "f2b10c4ec8458c0d6ab0f465481e645524f618f7a3327822e8ae5d3fd42fa46c",
|
|
2606
|
+
"creationHexLength": 14300,
|
|
2607
|
+
"runtimeHexLength": 11504
|
|
2608
|
+
},
|
|
2609
|
+
"BurnMintTokenPool": {
|
|
2610
|
+
"creationHexSha256": "b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416",
|
|
2611
|
+
"runtimeHexSha256": "c9aaa6a40ef4f0caadeb66f0a9adc68b1191949e9e0bdb420f331132bf651c3a",
|
|
2612
|
+
"creationHexLength": 41756,
|
|
2613
|
+
"runtimeHexLength": 39936
|
|
2614
|
+
},
|
|
2615
|
+
"CNRX": {
|
|
2616
|
+
"creationHexSha256": "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95",
|
|
2617
|
+
"runtimeHexSha256": "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948",
|
|
2618
|
+
"creationHexLength": 21266,
|
|
2619
|
+
"runtimeHexLength": 17374
|
|
2620
|
+
}
|
|
56
2621
|
};
|
|
57
2622
|
var BYTECODE_HASHES = {
|
|
58
2623
|
"HTLC": {
|
|
59
|
-
"bytecodeHash": "
|
|
60
|
-
"deployedBytecodeHash": "
|
|
61
|
-
"bytecodeLength":
|
|
62
|
-
"deployedBytecodeLength":
|
|
2624
|
+
"bytecodeHash": "93a991d3a6451f7c3f02dfb70b365a48d29bebccc7f16d8dbe3d56d3dfee0af1",
|
|
2625
|
+
"deployedBytecodeHash": "40ab52456c3b5a04365fc1fad837eb79bbe4b85c8dbd990f549468ae48f97e3a",
|
|
2626
|
+
"bytecodeLength": 14976,
|
|
2627
|
+
"deployedBytecodeLength": 14686
|
|
63
2628
|
},
|
|
64
2629
|
"FeeVault": {
|
|
65
|
-
"bytecodeHash": "
|
|
66
|
-
"deployedBytecodeHash": "
|
|
67
|
-
"bytecodeLength":
|
|
68
|
-
"deployedBytecodeLength":
|
|
2630
|
+
"bytecodeHash": "1c97d27c8d3e584f879bb57549d75ef10394a56a298eaf4a772516b9316e2248",
|
|
2631
|
+
"deployedBytecodeHash": "0631177a64cde0829c2cec8426c08a507564f7d8b084e0237d724ed63faea0e9",
|
|
2632
|
+
"bytecodeLength": 13176,
|
|
2633
|
+
"deployedBytecodeLength": 10968
|
|
69
2634
|
},
|
|
70
2635
|
"MultiBalanceChecker": {
|
|
71
2636
|
"bytecodeHash": "c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423",
|
|
@@ -73,17 +2638,35 @@ var BYTECODE_HASHES = {
|
|
|
73
2638
|
"bytecodeLength": 2456,
|
|
74
2639
|
"deployedBytecodeLength": 2394
|
|
75
2640
|
},
|
|
76
|
-
"
|
|
77
|
-
"bytecodeHash": "
|
|
78
|
-
"deployedBytecodeHash": "
|
|
79
|
-
"bytecodeLength":
|
|
80
|
-
"deployedBytecodeLength":
|
|
2641
|
+
"CancoreRouter": {
|
|
2642
|
+
"bytecodeHash": "615b6fb47a4255df9f7fdec963811cdfbefb53166645cd19466fa268df7fb39d",
|
|
2643
|
+
"deployedBytecodeHash": "dec1f5d541c6b383b95b6c53e278123cc3844bdeff3f977a166fb6e9cbf86343",
|
|
2644
|
+
"bytecodeLength": 43102,
|
|
2645
|
+
"deployedBytecodeLength": 36984
|
|
2646
|
+
},
|
|
2647
|
+
"CNRXStaking": {
|
|
2648
|
+
"bytecodeHash": "dfda056ee22b593e2f2e1fc4e679fbb9dc34b04964f389b46914402c422b40fb",
|
|
2649
|
+
"deployedBytecodeHash": "d11534242f166e52f4ad063b5b6b59146e31634d3932f7ad63db05d83a1485f6",
|
|
2650
|
+
"bytecodeLength": 7412,
|
|
2651
|
+
"deployedBytecodeLength": 6240
|
|
2652
|
+
},
|
|
2653
|
+
"PointsClaim": {
|
|
2654
|
+
"bytecodeHash": "0f29890b609f7e15ef4dbcda17a7f2cd7482d016a0057a5f6c4270d7780ff38d",
|
|
2655
|
+
"deployedBytecodeHash": "f2b10c4ec8458c0d6ab0f465481e645524f618f7a3327822e8ae5d3fd42fa46c",
|
|
2656
|
+
"bytecodeLength": 14300,
|
|
2657
|
+
"deployedBytecodeLength": 11504
|
|
81
2658
|
},
|
|
82
2659
|
"BurnMintTokenPool": {
|
|
83
2660
|
"bytecodeHash": "b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416",
|
|
84
2661
|
"deployedBytecodeHash": "c9aaa6a40ef4f0caadeb66f0a9adc68b1191949e9e0bdb420f331132bf651c3a",
|
|
85
2662
|
"bytecodeLength": 41756,
|
|
86
2663
|
"deployedBytecodeLength": 39936
|
|
2664
|
+
},
|
|
2665
|
+
"CNRX": {
|
|
2666
|
+
"bytecodeHash": "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95",
|
|
2667
|
+
"deployedBytecodeHash": "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948",
|
|
2668
|
+
"bytecodeLength": 21266,
|
|
2669
|
+
"deployedBytecodeLength": 17374
|
|
87
2670
|
}
|
|
88
2671
|
};
|
|
89
2672
|
|
|
@@ -97,6 +2680,6 @@ function describeRevert(selectorOrData, tables) {
|
|
|
97
2680
|
return void 0;
|
|
98
2681
|
}
|
|
99
2682
|
|
|
100
|
-
export { BYTECODE_HASHES, CONTRACTS_RELEASE, DEPLOYMENTS, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, PERMIT2_ADDRESS, deploymentOf, describeRevert, feeClaimDomain };
|
|
2683
|
+
export { ASYNCAPI, BUILD_HASHES, 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_ID_PATTERN, FILLER_KEY_REGISTRATION_TYPES, FILLER_MESSAGE_TYPES, 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, TICKET_REFUSED_REASONS, cantonSigEntries, deploymentOf, describeRevert, drawValue, drawWinner, encodeType, evmAddressFromRepayTo, feeClaimDomain, fillProofDomain, fillerEnvelopeError, fillerIdHash, fillerMessageBodyHash, firstRoundAtOrAfter, gatewayBodyHash, hashDomain, hashFillProof, hashFillTicket, hashFillerKeyRegistration, hashFillerMessage, hashFillerQuote, hashStruct, hashTicketIntent, hashTypedData, isCantonSource, isEoaSignature, isEvmRepayTo, jcs, messageIdRetainUntil, messageSchemaRef, repayToFromEvm, repayToFromParty, requestIdHash, routerDomain, settleAttestationsErrors, settleAttestationsPayload, settleAttestationsPayloadHash, settleSigs, typeHash };
|
|
101
2684
|
//# sourceMappingURL=index.js.map
|
|
102
2685
|
//# sourceMappingURL=index.js.map
|