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