@cancore/contracts 0.1.0 → 0.2.0-rc.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +168 -9
- package/dist/abi.d.ts +6086 -1675
- package/dist/abi.js +1 -1
- package/dist/chunk-NV5IUURP.js +9252 -0
- package/dist/chunk-NV5IUURP.js.map +1 -0
- package/dist/{chunk-CIBYXHSX.js → chunk-VODZRADO.js} +2 -2
- package/dist/chunk-VODZRADO.js.map +1 -0
- package/dist/index.d.ts +849 -28
- package/dist/index.js +2065 -16
- package/dist/index.js.map +1 -1
- package/dist/networks.d.ts +2 -2
- package/dist/networks.js +1 -1
- package/package.json +10 -8
- package/spec/abi/AttestorSet.json +476 -0
- package/spec/abi/CNRX.json +1294 -0
- package/spec/abi/CNRXStaking.json +510 -0
- package/spec/abi/CancoreRouter.json +2564 -0
- package/spec/abi/FeeVault.json +604 -0
- package/spec/abi/HTLC.json +717 -0
- package/spec/abi/IBurnMintERC20.json +252 -0
- package/spec/abi/ICancoreRouter.json +1226 -0
- package/spec/abi/IHTLC.json +382 -0
- package/spec/abi/IPermit2.json +150 -0
- package/spec/abi/MultiBalanceChecker.json +34 -0
- package/spec/abi/PointsClaim.json +791 -0
- package/spec/protocol/asyncapi.json +1050 -0
- package/spec/protocol/messages.schema.json +414 -0
- package/spec/protocol/records.schema.json +93 -0
- package/spec/protocol/rest.schema.json +115 -0
- package/spec/protocol/typed-data/FillerAuth.json +58 -0
- package/spec/protocol/typed-data/FillerQuote.json +75 -0
- package/spec/protocol/typed-data/GatewayMessage.json +90 -0
- package/spec/protocol/typed-data/StakeBinding.json +75 -0
- package/spec/protocol/typed-data/TicketIntent.json +65 -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 +343 -0
- package/spec/protocol/vectors/records.json +81 -0
- package/spec/typed-data/FillProof.json +199 -0
- package/spec/typed-data/FillTicket.json +83 -0
- package/spec/typed-data/Order.json +141 -0
- package/spec/typed-data/Quote.json +69 -0
- package/spec/vectors/canton-order.json +67 -0
- package/dist/chunk-CIBYXHSX.js.map +0 -1
- package/dist/chunk-ZSX67S72.js +0 -3423
- package/dist/chunk-ZSX67S72.js.map +0 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
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 './abi.js';
|
|
1
|
+
export { ATTESTOR_SET_ABI, ATTESTOR_SET_ERRORS, CANCORE_ROUTER_ABI, CANCORE_ROUTER_ERRORS, CNRX_ABI, CNRX_ERRORS, CNRX_STAKING_ABI, CNRX_STAKING_ERRORS, FEE_VAULT_ABI, FEE_VAULT_ERRORS, HTLC_ABI, HTLC_ERRORS, IBURN_MINT_ERC20_ABI, ICANCORE_ROUTER_ABI, ICANCORE_ROUTER_ERRORS, IHTLC_ABI, IPERMIT2_ABI, MULTI_BALANCE_CHECKER_ABI, POINTS_CLAIM_ABI, POINTS_CLAIM_ERRORS } from './abi.js';
|
|
2
2
|
export { NETWORKS, NETWORK_ALIASES, Network, NetworkKind, networkByChainId, networkKindOf, networkOf } from './networks.js';
|
|
3
3
|
|
|
4
4
|
/**
|
|
@@ -10,9 +10,10 @@ export { NETWORKS, NETWORK_ALIASES, Network, NetworkKind, networkByChainId, netw
|
|
|
10
10
|
* the backend of that period talks to; `htlcBlock` is where to start an event
|
|
11
11
|
* scan, not before.
|
|
12
12
|
*
|
|
13
|
-
* `BYTECODE_HASHES`
|
|
14
|
-
*
|
|
15
|
-
*
|
|
13
|
+
* `BYTECODE_HASHES` pins the build of each release: sha256 of the UTF-8 text of
|
|
14
|
+
* the artifact's 0x-prefixed hex, not keccak256 and not over `eth_getCode`, so it
|
|
15
|
+
* identifies what was built rather than proving what an address runs
|
|
16
|
+
* (immutables alone change runtime code).
|
|
16
17
|
*/
|
|
17
18
|
type DeploymentEnv = 'mainnet' | 'testnet' | 'devnet';
|
|
18
19
|
interface EvmDeployment {
|
|
@@ -29,13 +30,50 @@ declare const DEPLOYMENTS: Readonly<Record<DeploymentEnv, readonly EvmDeployment
|
|
|
29
30
|
declare const PERMIT2_ADDRESS: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
30
31
|
declare function deploymentOf(env: DeploymentEnv, network: string): EvmDeployment | undefined;
|
|
31
32
|
|
|
32
|
-
/**
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
33
|
+
/** `FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,address filler,uint32 attempt,uint32 setId)` — from evm-contracts/abi/typed-data/FillProof.json. */
|
|
34
|
+
declare const FILL_PROOF_TYPES: {
|
|
35
|
+
readonly FillProof: readonly [{
|
|
36
|
+
readonly name: "kind";
|
|
37
|
+
readonly type: "uint8";
|
|
38
|
+
}, {
|
|
39
|
+
readonly name: "orderHash";
|
|
40
|
+
readonly type: "bytes32";
|
|
41
|
+
}, {
|
|
42
|
+
readonly name: "destination";
|
|
43
|
+
readonly type: "bytes32";
|
|
44
|
+
}, {
|
|
45
|
+
readonly name: "fillRef";
|
|
46
|
+
readonly type: "bytes32";
|
|
47
|
+
}, {
|
|
48
|
+
readonly name: "recipient";
|
|
49
|
+
readonly type: "bytes32";
|
|
50
|
+
}, {
|
|
51
|
+
readonly name: "outputAsset";
|
|
52
|
+
readonly type: "bytes32";
|
|
53
|
+
}, {
|
|
54
|
+
readonly name: "amountDelivered";
|
|
55
|
+
readonly type: "uint256";
|
|
56
|
+
}, {
|
|
57
|
+
readonly name: "filledAt";
|
|
58
|
+
readonly type: "uint64";
|
|
59
|
+
}, {
|
|
60
|
+
readonly name: "filler";
|
|
61
|
+
readonly type: "address";
|
|
62
|
+
}, {
|
|
63
|
+
readonly name: "attempt";
|
|
64
|
+
readonly type: "uint32";
|
|
65
|
+
}, {
|
|
66
|
+
readonly name: "setId";
|
|
67
|
+
readonly type: "uint32";
|
|
68
|
+
}];
|
|
69
|
+
};
|
|
70
|
+
declare const FILL_PROOF_TYPE_STRING = "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,address filler,uint32 attempt,uint32 setId)";
|
|
71
|
+
/** Name and version of the domain; chain id and verifying contract are the deployment's. */
|
|
72
|
+
declare const FILL_PROOF_DOMAIN: {
|
|
73
|
+
readonly name: "CancoreRouter";
|
|
74
|
+
readonly version: "1";
|
|
75
|
+
};
|
|
76
|
+
|
|
39
77
|
declare const FEE_CLAIM_DOMAIN_NAME = "CancoreFeeVault";
|
|
40
78
|
declare const FEE_CLAIM_DOMAIN_VERSION = "1";
|
|
41
79
|
/** `FeeClaim(address token,address to,uint256 amount,uint256 nonce,uint256 deadline)` */
|
|
@@ -72,6 +110,765 @@ declare function feeClaimDomain(chainId: number, verifyingContract: `0x${string}
|
|
|
72
110
|
readonly verifyingContract: `0x${string}`;
|
|
73
111
|
};
|
|
74
112
|
|
|
113
|
+
/** `FillProof.kind` of v1: k-of-n attestor signatures — the only kind `settle` accepts. */
|
|
114
|
+
declare const PROOF_KIND_ATTESTATION = 1;
|
|
115
|
+
/**
|
|
116
|
+
* What the attestors sign and `CancoreRouter.settle` verifies: the fact of a
|
|
117
|
+
* delivery on the destination chain, for one order. Written by hand from the
|
|
118
|
+
* contract's schema (`FILL_PROOF_TYPES`, which is generated); fillProof.test.ts
|
|
119
|
+
* fails to compile if the two stop naming the same fields.
|
|
120
|
+
*/
|
|
121
|
+
interface FillProof {
|
|
122
|
+
kind: number;
|
|
123
|
+
orderHash: `0x${string}`;
|
|
124
|
+
/** bytes32: the destination chain id, left-padded. */
|
|
125
|
+
destination: `0x${string}`;
|
|
126
|
+
/** EVM: the delivery transaction hash; Canton: keccak256 of the update id. */
|
|
127
|
+
fillRef: `0x${string}`;
|
|
128
|
+
recipient: `0x${string}`;
|
|
129
|
+
outputAsset: `0x${string}`;
|
|
130
|
+
/** What arrived, not what was sent. */
|
|
131
|
+
amountDelivered: bigint;
|
|
132
|
+
filledAt: bigint;
|
|
133
|
+
/** The filler's payout address on the source chain. */
|
|
134
|
+
filler: `0x${string}`;
|
|
135
|
+
attempt: number;
|
|
136
|
+
/** The attestor set live when the order opened — `attestationSetFor(orderHash)`, never `currentSetId`. */
|
|
137
|
+
setId: number;
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The typed-data domain of a proof: the order's SOURCE router. `settle`
|
|
141
|
+
* recomputes the digest in its own domain, so a proof never verifies on
|
|
142
|
+
* another chain or another router. A Canton source (Daml settles) is
|
|
143
|
+
* CANTON_ORIGIN_ID = 2^63 + n, above Number.MAX_SAFE_INTEGER: pass a bigint.
|
|
144
|
+
*/
|
|
145
|
+
declare function fillProofDomain(chainId: number | bigint, verifyingContract: `0x${string}`): {
|
|
146
|
+
readonly chainId: number | bigint;
|
|
147
|
+
readonly verifyingContract: `0x${string}`;
|
|
148
|
+
readonly name: "CancoreRouter";
|
|
149
|
+
readonly version: "1";
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
/**
|
|
153
|
+
* The EIP-712 types and domains of the Cancore intent rail, filler protocol v1.
|
|
154
|
+
*
|
|
155
|
+
* Two families. The CODE types (`Order`, `Quote`, `FillTicket`; `FillProof`
|
|
156
|
+
* lives in `../eip712`) are the router's own structs — here they are
|
|
157
|
+
* provisional hand copies of `CancoreRouter.sol` until evm-contracts publishes
|
|
158
|
+
* them under `abi/typed-data` (follow-up F-1); `Order` is pinned by the synced
|
|
159
|
+
* `spec/vectors/canton-order.json`. The PROTOCOL types are off-chain, signed in
|
|
160
|
+
* the `CancoreFillerProtocol` domain, and frozen by this package: a field
|
|
161
|
+
* reordered here is a new protocol major (V-3), and the golden vectors under
|
|
162
|
+
* `spec/protocol/typed-data` fail the moment it happens.
|
|
163
|
+
*/
|
|
164
|
+
type Hex = `0x${string}`;
|
|
165
|
+
/** A wide unsigned integer as the wire carries it (decimal string) or as code holds it. */
|
|
166
|
+
type UintLike = bigint | number | string;
|
|
167
|
+
/** Name and version of the domain every off-chain protocol struct is signed in — no chain id, no verifying contract. */
|
|
168
|
+
declare const FILLER_PROTOCOL_DOMAIN: {
|
|
169
|
+
readonly name: "CancoreFillerProtocol";
|
|
170
|
+
readonly version: "1";
|
|
171
|
+
};
|
|
172
|
+
/** The ticket domain (`CancoreRouter.sol:124-131`): the same ticket verifies on every router and off-chain. */
|
|
173
|
+
declare const FILL_TICKET_DOMAIN: {
|
|
174
|
+
readonly name: "CancoreFillTicket";
|
|
175
|
+
readonly version: "1";
|
|
176
|
+
};
|
|
177
|
+
/** The source-router domain `Order` and `Quote` are hashed in. Canton source: `CANTON_ORIGIN_ID` and the anchor. */
|
|
178
|
+
declare function routerDomain(chainId: UintLike, verifyingContract: Hex): {
|
|
179
|
+
readonly name: "CancoreRouter";
|
|
180
|
+
readonly version: "1";
|
|
181
|
+
readonly chainId: UintLike;
|
|
182
|
+
readonly verifyingContract: `0x${string}`;
|
|
183
|
+
};
|
|
184
|
+
/** `Order(address user,uint64 originChainId,address inputToken,uint256 inputAmount,bytes32 destination,bytes32 outputAsset,uint256 minReceived,bytes32 recipient,uint64 createdAt,uint64 fillDeadline,uint16 feeBps)` */
|
|
185
|
+
declare const ORDER_TYPES: {
|
|
186
|
+
readonly Order: readonly [{
|
|
187
|
+
readonly name: "user";
|
|
188
|
+
readonly type: "address";
|
|
189
|
+
}, {
|
|
190
|
+
readonly name: "originChainId";
|
|
191
|
+
readonly type: "uint64";
|
|
192
|
+
}, {
|
|
193
|
+
readonly name: "inputToken";
|
|
194
|
+
readonly type: "address";
|
|
195
|
+
}, {
|
|
196
|
+
readonly name: "inputAmount";
|
|
197
|
+
readonly type: "uint256";
|
|
198
|
+
}, {
|
|
199
|
+
readonly name: "destination";
|
|
200
|
+
readonly type: "bytes32";
|
|
201
|
+
}, {
|
|
202
|
+
readonly name: "outputAsset";
|
|
203
|
+
readonly type: "bytes32";
|
|
204
|
+
}, {
|
|
205
|
+
readonly name: "minReceived";
|
|
206
|
+
readonly type: "uint256";
|
|
207
|
+
}, {
|
|
208
|
+
readonly name: "recipient";
|
|
209
|
+
readonly type: "bytes32";
|
|
210
|
+
}, {
|
|
211
|
+
readonly name: "createdAt";
|
|
212
|
+
readonly type: "uint64";
|
|
213
|
+
}, {
|
|
214
|
+
readonly name: "fillDeadline";
|
|
215
|
+
readonly type: "uint64";
|
|
216
|
+
}, {
|
|
217
|
+
readonly name: "feeBps";
|
|
218
|
+
readonly type: "uint16";
|
|
219
|
+
}];
|
|
220
|
+
};
|
|
221
|
+
/** `Quote(bytes32 orderHash,uint64 quoteDeadline)` — Cancore's quote signer, source-router domain. */
|
|
222
|
+
declare const QUOTE_TYPES: {
|
|
223
|
+
readonly Quote: readonly [{
|
|
224
|
+
readonly name: "orderHash";
|
|
225
|
+
readonly type: "bytes32";
|
|
226
|
+
}, {
|
|
227
|
+
readonly name: "quoteDeadline";
|
|
228
|
+
readonly type: "uint64";
|
|
229
|
+
}];
|
|
230
|
+
};
|
|
231
|
+
/** `FillTicket(bytes32 orderHash,address filler,uint32 attempt,uint64 validFrom,uint64 validUntil)` — ticket domain. */
|
|
232
|
+
declare const FILL_TICKET_TYPES: {
|
|
233
|
+
readonly FillTicket: readonly [{
|
|
234
|
+
readonly name: "orderHash";
|
|
235
|
+
readonly type: "bytes32";
|
|
236
|
+
}, {
|
|
237
|
+
readonly name: "filler";
|
|
238
|
+
readonly type: "address";
|
|
239
|
+
}, {
|
|
240
|
+
readonly name: "attempt";
|
|
241
|
+
readonly type: "uint32";
|
|
242
|
+
}, {
|
|
243
|
+
readonly name: "validFrom";
|
|
244
|
+
readonly type: "uint64";
|
|
245
|
+
}, {
|
|
246
|
+
readonly name: "validUntil";
|
|
247
|
+
readonly type: "uint64";
|
|
248
|
+
}];
|
|
249
|
+
};
|
|
250
|
+
/** `FillerQuote(bytes32 requestId,address filler,uint256 amountOut,uint64 validUntil,uint64 nonce)` — signed by the quote key. */
|
|
251
|
+
declare const FILLER_QUOTE_TYPES: {
|
|
252
|
+
readonly FillerQuote: readonly [{
|
|
253
|
+
readonly name: "requestId";
|
|
254
|
+
readonly type: "bytes32";
|
|
255
|
+
}, {
|
|
256
|
+
readonly name: "filler";
|
|
257
|
+
readonly type: "address";
|
|
258
|
+
}, {
|
|
259
|
+
readonly name: "amountOut";
|
|
260
|
+
readonly type: "uint256";
|
|
261
|
+
}, {
|
|
262
|
+
readonly name: "validUntil";
|
|
263
|
+
readonly type: "uint64";
|
|
264
|
+
}, {
|
|
265
|
+
readonly name: "nonce";
|
|
266
|
+
readonly type: "uint64";
|
|
267
|
+
}];
|
|
268
|
+
};
|
|
269
|
+
/** `TicketIntent(bytes32 orderHash,uint32 attempt,uint64 validFrom,uint64 validUntil)` — signed by the filler address. */
|
|
270
|
+
declare const TICKET_INTENT_TYPES: {
|
|
271
|
+
readonly TicketIntent: readonly [{
|
|
272
|
+
readonly name: "orderHash";
|
|
273
|
+
readonly type: "bytes32";
|
|
274
|
+
}, {
|
|
275
|
+
readonly name: "attempt";
|
|
276
|
+
readonly type: "uint32";
|
|
277
|
+
}, {
|
|
278
|
+
readonly name: "validFrom";
|
|
279
|
+
readonly type: "uint64";
|
|
280
|
+
}, {
|
|
281
|
+
readonly name: "validUntil";
|
|
282
|
+
readonly type: "uint64";
|
|
283
|
+
}];
|
|
284
|
+
};
|
|
285
|
+
/** `TicketReceipt(bytes32 ticketHash,bytes32 ticketSigHash)` — signed by the filler address. */
|
|
286
|
+
declare const TICKET_RECEIPT_TYPES: {
|
|
287
|
+
readonly TicketReceipt: readonly [{
|
|
288
|
+
readonly name: "ticketHash";
|
|
289
|
+
readonly type: "bytes32";
|
|
290
|
+
}, {
|
|
291
|
+
readonly name: "ticketSigHash";
|
|
292
|
+
readonly type: "bytes32";
|
|
293
|
+
}];
|
|
294
|
+
};
|
|
295
|
+
/** `StakeBinding(string partnerId,address stakingAddress,uint256 chainId,uint64 nonce)` — signed by the staking address. */
|
|
296
|
+
declare const STAKE_BINDING_TYPES: {
|
|
297
|
+
readonly StakeBinding: readonly [{
|
|
298
|
+
readonly name: "partnerId";
|
|
299
|
+
readonly type: "string";
|
|
300
|
+
}, {
|
|
301
|
+
readonly name: "stakingAddress";
|
|
302
|
+
readonly type: "address";
|
|
303
|
+
}, {
|
|
304
|
+
readonly name: "chainId";
|
|
305
|
+
readonly type: "uint256";
|
|
306
|
+
}, {
|
|
307
|
+
readonly name: "nonce";
|
|
308
|
+
readonly type: "uint64";
|
|
309
|
+
}];
|
|
310
|
+
};
|
|
311
|
+
/** `FillerAuth(string fillerId,bytes32 nonce,uint64 expiresAt)` — signed by the quote key. */
|
|
312
|
+
declare const FILLER_AUTH_TYPES: {
|
|
313
|
+
readonly FillerAuth: readonly [{
|
|
314
|
+
readonly name: "fillerId";
|
|
315
|
+
readonly type: "string";
|
|
316
|
+
}, {
|
|
317
|
+
readonly name: "nonce";
|
|
318
|
+
readonly type: "bytes32";
|
|
319
|
+
}, {
|
|
320
|
+
readonly name: "expiresAt";
|
|
321
|
+
readonly type: "uint64";
|
|
322
|
+
}];
|
|
323
|
+
};
|
|
324
|
+
/** `GatewayMessage(bytes32 bodyHash)` — signed by the gateway key; `bodyHash = gatewayBodyHash(message)`. */
|
|
325
|
+
declare const GATEWAY_MESSAGE_TYPES: {
|
|
326
|
+
readonly GatewayMessage: readonly [{
|
|
327
|
+
readonly name: "bodyHash";
|
|
328
|
+
readonly type: "bytes32";
|
|
329
|
+
}];
|
|
330
|
+
};
|
|
331
|
+
interface Order {
|
|
332
|
+
user: Hex;
|
|
333
|
+
originChainId: UintLike;
|
|
334
|
+
inputToken: Hex;
|
|
335
|
+
inputAmount: UintLike;
|
|
336
|
+
destination: Hex;
|
|
337
|
+
outputAsset: Hex;
|
|
338
|
+
minReceived: UintLike;
|
|
339
|
+
recipient: Hex;
|
|
340
|
+
createdAt: UintLike;
|
|
341
|
+
fillDeadline: UintLike;
|
|
342
|
+
feeBps: number | string;
|
|
343
|
+
}
|
|
344
|
+
interface Quote {
|
|
345
|
+
orderHash: Hex;
|
|
346
|
+
quoteDeadline: UintLike;
|
|
347
|
+
}
|
|
348
|
+
interface FillTicket {
|
|
349
|
+
orderHash: Hex;
|
|
350
|
+
filler: Hex;
|
|
351
|
+
attempt: number;
|
|
352
|
+
validFrom: UintLike;
|
|
353
|
+
validUntil: UintLike;
|
|
354
|
+
}
|
|
355
|
+
interface FillerQuote {
|
|
356
|
+
/** `requestIdHash(requestId)`, not the string. */
|
|
357
|
+
requestId: Hex;
|
|
358
|
+
filler: Hex;
|
|
359
|
+
amountOut: UintLike;
|
|
360
|
+
validUntil: UintLike;
|
|
361
|
+
nonce: UintLike;
|
|
362
|
+
}
|
|
363
|
+
interface TicketIntent {
|
|
364
|
+
orderHash: Hex;
|
|
365
|
+
attempt: number;
|
|
366
|
+
validFrom: UintLike;
|
|
367
|
+
validUntil: UintLike;
|
|
368
|
+
}
|
|
369
|
+
interface TicketReceipt {
|
|
370
|
+
/** `hashTypedData` of the `FillTicket` in `FILL_TICKET_DOMAIN`. */
|
|
371
|
+
ticketHash: Hex;
|
|
372
|
+
/** keccak256 of the 65 raw signature bytes. */
|
|
373
|
+
ticketSigHash: Hex;
|
|
374
|
+
}
|
|
375
|
+
interface StakeBinding {
|
|
376
|
+
partnerId: string;
|
|
377
|
+
stakingAddress: Hex;
|
|
378
|
+
chainId: UintLike;
|
|
379
|
+
nonce: UintLike;
|
|
380
|
+
}
|
|
381
|
+
interface FillerAuth {
|
|
382
|
+
fillerId: string;
|
|
383
|
+
nonce: Hex;
|
|
384
|
+
expiresAt: UintLike;
|
|
385
|
+
}
|
|
386
|
+
interface GatewayMessage {
|
|
387
|
+
bodyHash: Hex;
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
interface TypedField {
|
|
391
|
+
readonly name: string;
|
|
392
|
+
readonly type: string;
|
|
393
|
+
}
|
|
394
|
+
type TypedDataTypes = Readonly<Record<string, readonly TypedField[]>>;
|
|
395
|
+
type TypedValue = string | number | bigint | boolean;
|
|
396
|
+
interface TypedDataDomain {
|
|
397
|
+
name?: string;
|
|
398
|
+
version?: string;
|
|
399
|
+
chainId?: UintLike;
|
|
400
|
+
verifyingContract?: Hex | string;
|
|
401
|
+
salt?: Hex | string;
|
|
402
|
+
}
|
|
403
|
+
interface TypedDataInput {
|
|
404
|
+
domain: TypedDataDomain;
|
|
405
|
+
types: TypedDataTypes;
|
|
406
|
+
primaryType: string;
|
|
407
|
+
message: Readonly<Record<string, unknown>>;
|
|
408
|
+
}
|
|
409
|
+
/** A JSON value JCS can canonicalise: numbers are safe integers only. */
|
|
410
|
+
type JsonValue = string | number | boolean | null | readonly JsonValue[] | {
|
|
411
|
+
readonly [key: string]: JsonValue;
|
|
412
|
+
};
|
|
413
|
+
/** `Name(type1 name1,…)` of a flat struct. */
|
|
414
|
+
declare function encodeType(types: TypedDataTypes, primaryType: string): string;
|
|
415
|
+
declare function typeHash(types: TypedDataTypes, primaryType: string): Hex;
|
|
416
|
+
declare function hashStruct(types: TypedDataTypes, primaryType: string, message: Readonly<Record<string, unknown>>): Hex;
|
|
417
|
+
/** The domain separator; `EIP712Domain` lists exactly the members present, in the standard order. */
|
|
418
|
+
declare function hashDomain(domain: TypedDataDomain): Hex;
|
|
419
|
+
/** The EIP-712 digest `keccak256(0x1901 ‖ domainSeparator ‖ hashStruct(message))` — what a signature is over. */
|
|
420
|
+
declare function hashTypedData({ domain, types, primaryType, message }: TypedDataInput): Hex;
|
|
421
|
+
/**
|
|
422
|
+
* RFC 8785 canonical JSON. Keys sorted by UTF-16 code units (`Array#sort`),
|
|
423
|
+
* strings as `JSON.stringify` writes them. Numbers are safe integers only —
|
|
424
|
+
* the wire carries every wider value as a decimal string — so the ECMAScript
|
|
425
|
+
* number serialisation JCS borrows is never exercised beyond integers.
|
|
426
|
+
*/
|
|
427
|
+
declare function jcs(value: unknown): string;
|
|
428
|
+
/** `GatewayMessage.bodyHash`: keccak256 of the JCS text of an S→F message without its `sig`. */
|
|
429
|
+
declare function gatewayBodyHash(message: Readonly<Record<string, unknown>>): Hex;
|
|
430
|
+
/** `FillerQuote.requestId`: keccak256(utf8(requestId)); the id is 1..64 printable ASCII (`Canonical.daml:90-93`). */
|
|
431
|
+
declare function requestIdHash(requestId: string): Hex;
|
|
432
|
+
|
|
433
|
+
interface DrawCandidate {
|
|
434
|
+
fillerId: string;
|
|
435
|
+
/** Decimal string on the wire; the integer weight of auction-and-draw A-11. */
|
|
436
|
+
weight: string | bigint;
|
|
437
|
+
}
|
|
438
|
+
interface DrawOutcome {
|
|
439
|
+
r: bigint;
|
|
440
|
+
winnerFillerId: string;
|
|
441
|
+
}
|
|
442
|
+
/** drand quicknet, the randomness beacon of the draw (auction-and-draw §4). */
|
|
443
|
+
declare const DRAND_QUICKNET: {
|
|
444
|
+
readonly chainHash: "52db9ba70e0cc0f6eaf7803dd07447a1f5477735fd3f661792ba94600c84e971";
|
|
445
|
+
readonly publicKey: "83cf0f2896adee7eb8b5f01fcad3912212c437e0073e911fb90022d3e760183c8c4b450b6a0a6c3ac6a5776a2d1064510d1fec758c921cc22b0e17e63aaf4bcb5ed66304de9cf809bd274ca73bab4af5a6e9c76a4bc09e76eae8991ef5ece45a";
|
|
446
|
+
readonly scheme: "bls-unchained-g1-rfc9380";
|
|
447
|
+
readonly genesisTime: 1692803367;
|
|
448
|
+
readonly period: 3;
|
|
449
|
+
};
|
|
450
|
+
/** The first quicknet round whose time is at or after `unixSeconds` (A-20: `round_k` for `t_k + δ_drand`). */
|
|
451
|
+
declare function firstRoundAtOrAfter(unixSeconds: bigint | number): bigint;
|
|
452
|
+
/** `h = uint256(keccak256(randomness ‖ orderHash ‖ uint32be(attempt)))` — the 68-byte preimage of A-21. */
|
|
453
|
+
declare function drawValue(randomness: Hex | string, orderHash: Hex, attempt: number): bigint;
|
|
454
|
+
/**
|
|
455
|
+
* `r = h mod Σw`; the winner is the first candidate, in ascending UTF-8 byte
|
|
456
|
+
* order of `fillerId` (A-22), whose cumulative weight exceeds `r`. Sorts a copy
|
|
457
|
+
* itself, so a verifier compares the outcome, not the order it was served in.
|
|
458
|
+
*/
|
|
459
|
+
declare function drawWinner(h: bigint, candidates: readonly DrawCandidate[]): DrawOutcome;
|
|
460
|
+
|
|
461
|
+
/** The protocol major this package describes: the `/v1` path and `auth.response.protocolVersion`. */
|
|
462
|
+
declare const PROTOCOL_VERSION = "1";
|
|
463
|
+
interface FillerGateway {
|
|
464
|
+
/** The key every S→F message is signed with (`GatewayMessage`); null until the environment has one. */
|
|
465
|
+
gateway: Hex | null;
|
|
466
|
+
/** Keys that sign `FillTicket`; the same set is registered on every router of the environment. */
|
|
467
|
+
ticketSigners: readonly Hex[];
|
|
468
|
+
}
|
|
469
|
+
/**
|
|
470
|
+
* The published gateway key and ticket signers per environment — the release
|
|
471
|
+
* data a taker checks every S→F signature and every ticket against, and never
|
|
472
|
+
* takes from a gateway message. Empty in the RC: the keys do not exist yet
|
|
473
|
+
* (O-6); the gateway release fills them in. Test keys never appear here.
|
|
474
|
+
*/
|
|
475
|
+
declare const FILLER_GATEWAYS: Readonly<Record<DeploymentEnv, FillerGateway>>;
|
|
476
|
+
|
|
477
|
+
/**
|
|
478
|
+
* The wire shapes of filler protocol v1 — WebSocket frames on `/v1`, REST
|
|
479
|
+
* bodies and the public draw/epoch records — as TypeScript. The JSON Schemas
|
|
480
|
+
* under `spec/protocol/` are normative; schemas.test.ts holds the enums below
|
|
481
|
+
* to them. Encoding (protocol §3.1): uint64 and wider as decimal strings,
|
|
482
|
+
* uint8/16/32 as JSON integers, on-chain times in seconds (decimal string),
|
|
483
|
+
* gateway times in milliseconds (JSON integer), hex lowercase.
|
|
484
|
+
*
|
|
485
|
+
* Receivers ignore unknown fields and unknown S→F types (V-2), so none of
|
|
486
|
+
* these types is closed. The enum types list the known values; the schemas
|
|
487
|
+
* accept any UPPER_SNAKE value besides them, and a receiver treats an unknown
|
|
488
|
+
* one as OTHER/generic (V-2).
|
|
489
|
+
*/
|
|
490
|
+
|
|
491
|
+
/** Unsigned decimal string: uint64 and wider. */
|
|
492
|
+
type DecString = string;
|
|
493
|
+
/** Unix milliseconds, gateway clock. */
|
|
494
|
+
type TimeMs = number;
|
|
495
|
+
/** EVM token address, or a Canton instrument. */
|
|
496
|
+
type WireAsset = Hex | {
|
|
497
|
+
admin: string;
|
|
498
|
+
id: string;
|
|
499
|
+
};
|
|
500
|
+
declare const DECLINE_REASONS: readonly ["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"];
|
|
501
|
+
declare const ERROR_CODES: readonly ["BAD_REQUEST", "UNAUTHENTICATED", "UNSUPPORTED_VERSION", "UNSUPPORTED_TYPE", "BAD_SIGNATURE", "UNKNOWN_REQUEST", "UNKNOWN_TICKET", "TICKET_CLOSED", "NOT_ELIGIBLE", "RATE_LIMITED", "INTERNAL"];
|
|
502
|
+
/** HTTP status of each error code on the REST fallback. */
|
|
503
|
+
declare const ERROR_HTTP_STATUS: Readonly<Record<ErrorCode, number>>;
|
|
504
|
+
declare const EXPIRED_RESULTS: readonly ["FILLED", "NO_SHOW", "NO_SHOW_UNCONFIRMED", "EXEMPT"];
|
|
505
|
+
declare const EXEMPT_REASONS: readonly ["DESTINATION_HALTED", "GATEWAY_FAULT", "REORGED_AFTER_INCLUSION", "RECIPIENT_NOT_READY", "OTHER"];
|
|
506
|
+
/** Verdict at receipt time, on the `quote.ack`. */
|
|
507
|
+
declare const QUOTE_ACK_STATUSES: readonly ["COUNTED", "LATE", "SHORT_TTL"];
|
|
508
|
+
/** Final status of a quote, `GET /v1/filler/quotes`. */
|
|
509
|
+
declare const QUOTE_FINAL_STATUSES: readonly ["COUNTED", "LATE", "SHORT_TTL", "REPLACED", "BAD_SIG", "OUTLIER", "IN_BAND", "OUT_OF_BAND", "WON", "LOST"];
|
|
510
|
+
declare const PENALTY_STEPS: readonly ["L1", "L2", "L3", "L4"];
|
|
511
|
+
declare const DRAW_CLOSED_BY: readonly ["OFFER_TIMEOUT", "OFFER_DECLINE", "TICKET_DECLINE", "TICKET_EXPIRED", "FILLED"];
|
|
512
|
+
declare const TICKET_LIST_STATUSES: readonly ["OFFERED", "ISSUED"];
|
|
513
|
+
type DeclineReason = (typeof DECLINE_REASONS)[number];
|
|
514
|
+
type ErrorCode = (typeof ERROR_CODES)[number];
|
|
515
|
+
type ExpiredResult = (typeof EXPIRED_RESULTS)[number];
|
|
516
|
+
type ExemptReason = (typeof EXEMPT_REASONS)[number];
|
|
517
|
+
type QuoteAckStatus = (typeof QUOTE_ACK_STATUSES)[number];
|
|
518
|
+
type QuoteFinalStatus = (typeof QUOTE_FINAL_STATUSES)[number];
|
|
519
|
+
type PenaltyStep = (typeof PENALTY_STEPS)[number];
|
|
520
|
+
type DrawClosedBy = (typeof DRAW_CLOSED_BY)[number];
|
|
521
|
+
/** `ICancoreRouter.Order` on the wire: every numeric field a decimal string, as `canton-order.json`. */
|
|
522
|
+
interface OrderJson {
|
|
523
|
+
user: Hex;
|
|
524
|
+
originChainId: DecString;
|
|
525
|
+
inputToken: Hex;
|
|
526
|
+
inputAmount: DecString;
|
|
527
|
+
destination: Hex;
|
|
528
|
+
outputAsset: Hex;
|
|
529
|
+
minReceived: DecString;
|
|
530
|
+
recipient: Hex;
|
|
531
|
+
createdAt: DecString;
|
|
532
|
+
fillDeadline: DecString;
|
|
533
|
+
feeBps: DecString;
|
|
534
|
+
}
|
|
535
|
+
/** Every S→F frame: signed by the gateway (`GatewayMessage`), addressed (`fillerId`) and timed (`sentAt`). */
|
|
536
|
+
interface S2FBase {
|
|
537
|
+
type: string;
|
|
538
|
+
/** The addressee. Absent only on `auth.challenge` and on pre-auth `error`. */
|
|
539
|
+
fillerId?: string;
|
|
540
|
+
sentAt: TimeMs;
|
|
541
|
+
sig: Hex;
|
|
542
|
+
/** The F→S `id` this frame answers. */
|
|
543
|
+
re?: string;
|
|
544
|
+
}
|
|
545
|
+
/** Every F→S frame: `id` is unique per connection, ≤ 64 characters. */
|
|
546
|
+
interface F2SBase {
|
|
547
|
+
type: string;
|
|
548
|
+
id: string;
|
|
549
|
+
}
|
|
550
|
+
interface AuthChallenge extends S2FBase {
|
|
551
|
+
type: 'auth.challenge';
|
|
552
|
+
nonce: Hex;
|
|
553
|
+
expiresAt: DecString;
|
|
554
|
+
}
|
|
555
|
+
interface AuthResponse extends F2SBase {
|
|
556
|
+
type: 'auth.response';
|
|
557
|
+
fillerId: string;
|
|
558
|
+
keyAddress: Hex;
|
|
559
|
+
protocolVersion: '1';
|
|
560
|
+
sig: Hex;
|
|
561
|
+
}
|
|
562
|
+
interface AuthOk extends S2FBase {
|
|
563
|
+
type: 'auth.ok';
|
|
564
|
+
fillerId: string;
|
|
565
|
+
heartbeatIntervalMs: number;
|
|
566
|
+
}
|
|
567
|
+
/** Heartbeat from the taker: unsigned, like every F→S frame. */
|
|
568
|
+
interface PingF2S {
|
|
569
|
+
type: 'ping';
|
|
570
|
+
id: string;
|
|
571
|
+
}
|
|
572
|
+
interface PongF2S {
|
|
573
|
+
type: 'pong';
|
|
574
|
+
re: string;
|
|
575
|
+
id?: string;
|
|
576
|
+
}
|
|
577
|
+
/** Heartbeat from the gateway: signed, addressed and timed, like every S→F frame (D-C). */
|
|
578
|
+
interface PingS2F extends S2FBase {
|
|
579
|
+
type: 'ping';
|
|
580
|
+
fillerId: string;
|
|
581
|
+
id: string;
|
|
582
|
+
}
|
|
583
|
+
interface PongS2F extends S2FBase {
|
|
584
|
+
type: 'pong';
|
|
585
|
+
fillerId: string;
|
|
586
|
+
re: string;
|
|
587
|
+
}
|
|
588
|
+
type Ping = PingF2S | PingS2F;
|
|
589
|
+
type Pong = PongF2S | PongS2F;
|
|
590
|
+
interface ErrorMessage extends S2FBase {
|
|
591
|
+
type: 'error';
|
|
592
|
+
code: ErrorCode;
|
|
593
|
+
message: string;
|
|
594
|
+
}
|
|
595
|
+
interface EpochWeights extends S2FBase {
|
|
596
|
+
type: 'epoch.weights';
|
|
597
|
+
epochId: DecString;
|
|
598
|
+
startsAt: DecString;
|
|
599
|
+
endsAt: DecString;
|
|
600
|
+
weightsRoot: Hex;
|
|
601
|
+
}
|
|
602
|
+
interface QuoteRequest extends S2FBase {
|
|
603
|
+
type: 'quote.request';
|
|
604
|
+
requestId: string;
|
|
605
|
+
route: {
|
|
606
|
+
src: string;
|
|
607
|
+
dst: string;
|
|
608
|
+
};
|
|
609
|
+
inputToken: WireAsset;
|
|
610
|
+
/** The total T the maker deposits, input base units. */
|
|
611
|
+
inputAmount: DecString;
|
|
612
|
+
outputAsset: WireAsset;
|
|
613
|
+
feeBps: number;
|
|
614
|
+
fillDeadlineHint: DecString;
|
|
615
|
+
windowCloseAt: TimeMs;
|
|
616
|
+
quoteTtlMs: number;
|
|
617
|
+
imbalanceHint?: {
|
|
618
|
+
dstAsset: WireAsset;
|
|
619
|
+
netFlow24hUsd: string;
|
|
620
|
+
};
|
|
621
|
+
}
|
|
622
|
+
interface QuoteMessage extends F2SBase {
|
|
623
|
+
type: 'quote';
|
|
624
|
+
requestId: string;
|
|
625
|
+
filler: Hex;
|
|
626
|
+
amountOut: DecString;
|
|
627
|
+
validUntil: DecString;
|
|
628
|
+
nonce: DecString;
|
|
629
|
+
sig: Hex;
|
|
630
|
+
}
|
|
631
|
+
interface QuoteAck extends S2FBase {
|
|
632
|
+
type: 'quote.ack';
|
|
633
|
+
requestId: string;
|
|
634
|
+
quoteHash: Hex;
|
|
635
|
+
receivedAt: TimeMs;
|
|
636
|
+
status: QuoteAckStatus;
|
|
637
|
+
}
|
|
638
|
+
interface QuoteReconfirm extends S2FBase {
|
|
639
|
+
type: 'quote.reconfirm';
|
|
640
|
+
orderHash: Hex;
|
|
641
|
+
requestId: string;
|
|
642
|
+
order: OrderJson;
|
|
643
|
+
amountOut: DecString;
|
|
644
|
+
ticketTtl: number;
|
|
645
|
+
replyBy: TimeMs;
|
|
646
|
+
}
|
|
647
|
+
interface QuoteReconfirmReply extends F2SBase {
|
|
648
|
+
type: 'quote.reconfirm.reply';
|
|
649
|
+
orderHash: Hex;
|
|
650
|
+
accept: boolean;
|
|
651
|
+
validUntil?: DecString;
|
|
652
|
+
nonce?: DecString;
|
|
653
|
+
sig?: Hex;
|
|
654
|
+
}
|
|
655
|
+
interface TicketOffer extends S2FBase {
|
|
656
|
+
type: 'ticket.offer';
|
|
657
|
+
orderHash: Hex;
|
|
658
|
+
attempt: number;
|
|
659
|
+
order: OrderJson;
|
|
660
|
+
amountOut: DecString;
|
|
661
|
+
validFrom: DecString;
|
|
662
|
+
validUntil: DecString;
|
|
663
|
+
acceptBy: TimeMs;
|
|
664
|
+
}
|
|
665
|
+
interface TicketIntentMessage extends F2SBase {
|
|
666
|
+
type: 'ticket.intent';
|
|
667
|
+
orderHash: Hex;
|
|
668
|
+
attempt: number;
|
|
669
|
+
validFrom: DecString;
|
|
670
|
+
validUntil: DecString;
|
|
671
|
+
sig: Hex;
|
|
672
|
+
}
|
|
673
|
+
interface TicketDecline extends F2SBase {
|
|
674
|
+
type: 'ticket.decline';
|
|
675
|
+
orderHash: Hex;
|
|
676
|
+
attempt: number;
|
|
677
|
+
reason: DeclineReason;
|
|
678
|
+
detail?: string;
|
|
679
|
+
}
|
|
680
|
+
interface TicketIntentAck extends S2FBase {
|
|
681
|
+
type: 'ticket.intent.ack';
|
|
682
|
+
orderHash: Hex;
|
|
683
|
+
attempt: number;
|
|
684
|
+
intentHash: Hex;
|
|
685
|
+
receivedAt: TimeMs;
|
|
686
|
+
}
|
|
687
|
+
interface TicketJson {
|
|
688
|
+
orderHash: Hex;
|
|
689
|
+
filler: Hex;
|
|
690
|
+
attempt: number;
|
|
691
|
+
validFrom: DecString;
|
|
692
|
+
validUntil: DecString;
|
|
693
|
+
}
|
|
694
|
+
interface TicketIssuedEvm extends S2FBase {
|
|
695
|
+
type: 'ticket.issued';
|
|
696
|
+
form: 'evm';
|
|
697
|
+
orderHash: Hex;
|
|
698
|
+
attempt: number;
|
|
699
|
+
ticket: TicketJson;
|
|
700
|
+
ticketSig: Hex;
|
|
701
|
+
}
|
|
702
|
+
interface TicketIssuedCanton extends S2FBase {
|
|
703
|
+
type: 'ticket.issued';
|
|
704
|
+
form: 'canton';
|
|
705
|
+
orderHash: Hex;
|
|
706
|
+
attempt: number;
|
|
707
|
+
deliveryOrderCid: string;
|
|
708
|
+
validUntil: DecString;
|
|
709
|
+
}
|
|
710
|
+
type TicketIssued = TicketIssuedEvm | TicketIssuedCanton;
|
|
711
|
+
interface TicketReceiptMessage extends F2SBase {
|
|
712
|
+
type: 'ticket.receipt';
|
|
713
|
+
orderHash: Hex;
|
|
714
|
+
attempt: number;
|
|
715
|
+
ticketHash: Hex;
|
|
716
|
+
ticketSigHash: Hex;
|
|
717
|
+
sig: Hex;
|
|
718
|
+
}
|
|
719
|
+
interface FillReported extends F2SBase {
|
|
720
|
+
type: 'fill.reported';
|
|
721
|
+
orderHash: Hex;
|
|
722
|
+
attempt: number;
|
|
723
|
+
txRef: string;
|
|
724
|
+
}
|
|
725
|
+
interface TicketExpired extends S2FBase {
|
|
726
|
+
type: 'ticket.expired';
|
|
727
|
+
orderHash: Hex;
|
|
728
|
+
attempt: number;
|
|
729
|
+
result: ExpiredResult;
|
|
730
|
+
exemptReason?: ExemptReason;
|
|
731
|
+
}
|
|
732
|
+
interface OrderSettled extends S2FBase {
|
|
733
|
+
type: 'order.settled';
|
|
734
|
+
orderHash: Hex;
|
|
735
|
+
payout: DecString;
|
|
736
|
+
fee: DecString;
|
|
737
|
+
penaltyWithheld: DecString;
|
|
738
|
+
txRef: string;
|
|
739
|
+
}
|
|
740
|
+
interface PenaltyApplied extends S2FBase {
|
|
741
|
+
type: 'penalty.applied';
|
|
742
|
+
violationId: string;
|
|
743
|
+
code: string;
|
|
744
|
+
step: PenaltyStep;
|
|
745
|
+
details: Record<string, unknown>;
|
|
746
|
+
}
|
|
747
|
+
type S2FMessage = AuthChallenge | AuthOk | PingS2F | PongS2F | ErrorMessage | EpochWeights | QuoteRequest | QuoteAck | QuoteReconfirm | TicketOffer | TicketIntentAck | TicketIssued | TicketExpired | OrderSettled | PenaltyApplied;
|
|
748
|
+
type F2SMessage = AuthResponse | PingF2S | PongF2S | QuoteMessage | QuoteReconfirmReply | TicketIntentMessage | TicketDecline | TicketReceiptMessage | FillReported;
|
|
749
|
+
interface AuthToken {
|
|
750
|
+
token: string;
|
|
751
|
+
expiresAt: TimeMs;
|
|
752
|
+
}
|
|
753
|
+
interface Page<T> {
|
|
754
|
+
items: T[];
|
|
755
|
+
nextCursor: string | null;
|
|
756
|
+
}
|
|
757
|
+
type TicketList = Page<TicketOffer | TicketIssued>;
|
|
758
|
+
interface QuoteRecord {
|
|
759
|
+
quote: QuoteMessage;
|
|
760
|
+
ack: QuoteAck;
|
|
761
|
+
status: QuoteFinalStatus;
|
|
762
|
+
}
|
|
763
|
+
type QuoteList = Page<QuoteRecord>;
|
|
764
|
+
interface StakeBindingRequest {
|
|
765
|
+
partnerId: string;
|
|
766
|
+
stakingAddress: Hex;
|
|
767
|
+
chainId: DecString;
|
|
768
|
+
nonce: DecString;
|
|
769
|
+
sig: Hex;
|
|
770
|
+
}
|
|
771
|
+
interface FillerStats {
|
|
772
|
+
won: number;
|
|
773
|
+
delivered: number;
|
|
774
|
+
noShow: number;
|
|
775
|
+
reliability: number;
|
|
776
|
+
capacityUsd: string;
|
|
777
|
+
inFlightUsd: string;
|
|
778
|
+
}
|
|
779
|
+
interface PenaltyRecord {
|
|
780
|
+
violationId: string;
|
|
781
|
+
code: string;
|
|
782
|
+
step: PenaltyStep;
|
|
783
|
+
orderHash?: Hex;
|
|
784
|
+
attempt?: number;
|
|
785
|
+
at: TimeMs;
|
|
786
|
+
details: Record<string, unknown>;
|
|
787
|
+
}
|
|
788
|
+
type PenaltyList = Page<PenaltyRecord>;
|
|
789
|
+
interface DrawAttempt {
|
|
790
|
+
attempt: number;
|
|
791
|
+
tBase: DecString;
|
|
792
|
+
closedBy: DrawClosedBy | null;
|
|
793
|
+
drandRound: DecString;
|
|
794
|
+
drandRandomness: Hex;
|
|
795
|
+
drandSignature: Hex;
|
|
796
|
+
candidates: {
|
|
797
|
+
fillerId: string;
|
|
798
|
+
weight: DecString;
|
|
799
|
+
}[];
|
|
800
|
+
r: DecString;
|
|
801
|
+
winnerFillerId: string;
|
|
802
|
+
fallbackReason: 'DRAW_FALLBACK' | null;
|
|
803
|
+
}
|
|
804
|
+
interface DrawRecord {
|
|
805
|
+
orderHash: Hex;
|
|
806
|
+
source: string;
|
|
807
|
+
openRef: string;
|
|
808
|
+
t0: DecString;
|
|
809
|
+
epochId: DecString;
|
|
810
|
+
deltaDrand: number;
|
|
811
|
+
attempts: DrawAttempt[];
|
|
812
|
+
sig: Hex;
|
|
813
|
+
}
|
|
814
|
+
interface EpochLeaf {
|
|
815
|
+
fillerId: string;
|
|
816
|
+
base: DecString;
|
|
817
|
+
tier: number;
|
|
818
|
+
reliabilityBps: number;
|
|
819
|
+
}
|
|
820
|
+
interface EpochRecord {
|
|
821
|
+
epochId: DecString;
|
|
822
|
+
startsAt: DecString;
|
|
823
|
+
endsAt: DecString;
|
|
824
|
+
weightsRoot: Hex;
|
|
825
|
+
leaves: EpochLeaf[];
|
|
826
|
+
stakeSteps: {
|
|
827
|
+
tier: number;
|
|
828
|
+
minStake: DecString;
|
|
829
|
+
step: DecString;
|
|
830
|
+
}[];
|
|
831
|
+
rMinBps: number;
|
|
832
|
+
snapshotBlocks: Record<string, DecString>;
|
|
833
|
+
sig: Hex;
|
|
834
|
+
}
|
|
835
|
+
/** `GET /v1/gateway`: the mirror of `FILLER_GATEWAYS` for one environment. */
|
|
836
|
+
interface GatewayInfo {
|
|
837
|
+
env: string;
|
|
838
|
+
gateway: Hex;
|
|
839
|
+
ticketSigners: Hex[];
|
|
840
|
+
protocolVersion: '1';
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
type JsonSchema = Readonly<Record<string, unknown>>;
|
|
844
|
+
type MessageDirection = 'S2F' | 'F2S' | 'both';
|
|
845
|
+
interface RestEndpoint {
|
|
846
|
+
method: 'GET' | 'POST';
|
|
847
|
+
path: string;
|
|
848
|
+
auth: 'none' | 'bearer';
|
|
849
|
+
/** A `$ref` into rest.schema.json (`#/…`) or a sibling schema (`messages.schema.json#/…`). */
|
|
850
|
+
request?: string;
|
|
851
|
+
query?: string;
|
|
852
|
+
response: string;
|
|
853
|
+
}
|
|
854
|
+
declare const PROTOCOL_SCHEMAS: {
|
|
855
|
+
readonly messages: JsonSchema;
|
|
856
|
+
readonly rest: JsonSchema;
|
|
857
|
+
readonly records: JsonSchema;
|
|
858
|
+
};
|
|
859
|
+
declare const ASYNCAPI: JsonSchema;
|
|
860
|
+
/** The annotation keywords the schemas use; a strict validator must be told they exist. */
|
|
861
|
+
declare const SCHEMA_VOCABULARY: readonly string[];
|
|
862
|
+
/** Frame type → who sends it: S2F gateway to taker, F2S taker to gateway, both. */
|
|
863
|
+
declare const MESSAGE_DIRECTIONS: Readonly<Record<string, MessageDirection>>;
|
|
864
|
+
declare const REST_ENDPOINTS: readonly RestEndpoint[];
|
|
865
|
+
/**
|
|
866
|
+
* The absolute `$ref` of a frame type's schema (or any other `$def` of messages.schema.json).
|
|
867
|
+
* `direction` picks the copy of a type that goes both ways: `ping`/`pong` from the gateway are
|
|
868
|
+
* signed (`pingS2F`), from a taker they are not (`pingF2S`); without it, either copy passes.
|
|
869
|
+
*/
|
|
870
|
+
declare function messageSchemaRef(type: string, direction?: 'S2F' | 'F2S'): string;
|
|
871
|
+
|
|
75
872
|
/** The evm-contracts release these ABIs were taken from. */
|
|
76
873
|
declare const CONTRACTS_RELEASE: {
|
|
77
874
|
readonly version: "1.4.0-dev";
|
|
@@ -79,21 +876,26 @@ declare const CONTRACTS_RELEASE: {
|
|
|
79
876
|
readonly updatedAt: "2026-07-24T19:55:00Z";
|
|
80
877
|
};
|
|
81
878
|
/**
|
|
82
|
-
*
|
|
83
|
-
*
|
|
879
|
+
* Per contract, the compiled creation and runtime bytecode of the release, as
|
|
880
|
+
* evm-contracts scripts/tools/check-bytecode-match.mjs records them: each *Hash is
|
|
881
|
+
* sha256 of the UTF-8 text of the artifact's 0x-prefixed hex (not keccak256, not of the
|
|
882
|
+
* bytes), and each *Length is the length of that text including the 0x. It pins the
|
|
883
|
+
* build a release was made from. It is not a hash of `eth_getCode` — a contract with
|
|
884
|
+
* immutables (CancoreRouter, FeeVault) never matches one — so checking a live
|
|
885
|
+
* deployment against it needs a rebuild, not a lookup.
|
|
84
886
|
*/
|
|
85
887
|
declare const BYTECODE_HASHES: {
|
|
86
888
|
readonly HTLC: {
|
|
87
|
-
readonly bytecodeHash: "
|
|
88
|
-
readonly deployedBytecodeHash: "
|
|
89
|
-
readonly bytecodeLength:
|
|
90
|
-
readonly deployedBytecodeLength:
|
|
889
|
+
readonly bytecodeHash: "93a991d3a6451f7c3f02dfb70b365a48d29bebccc7f16d8dbe3d56d3dfee0af1";
|
|
890
|
+
readonly deployedBytecodeHash: "40ab52456c3b5a04365fc1fad837eb79bbe4b85c8dbd990f549468ae48f97e3a";
|
|
891
|
+
readonly bytecodeLength: 14976;
|
|
892
|
+
readonly deployedBytecodeLength: 14686;
|
|
91
893
|
};
|
|
92
894
|
readonly FeeVault: {
|
|
93
|
-
readonly bytecodeHash: "
|
|
94
|
-
readonly deployedBytecodeHash: "
|
|
95
|
-
readonly bytecodeLength:
|
|
96
|
-
readonly deployedBytecodeLength:
|
|
895
|
+
readonly bytecodeHash: "1c97d27c8d3e584f879bb57549d75ef10394a56a298eaf4a772516b9316e2248";
|
|
896
|
+
readonly deployedBytecodeHash: "0631177a64cde0829c2cec8426c08a507564f7d8b084e0237d724ed63faea0e9";
|
|
897
|
+
readonly bytecodeLength: 13176;
|
|
898
|
+
readonly deployedBytecodeLength: 10968;
|
|
97
899
|
};
|
|
98
900
|
readonly MultiBalanceChecker: {
|
|
99
901
|
readonly bytecodeHash: "c0a0326694f2a1594e332ba06120692cc98bc06c57d6d8981cb3768e01fad423";
|
|
@@ -101,11 +903,23 @@ declare const BYTECODE_HASHES: {
|
|
|
101
903
|
readonly bytecodeLength: 2456;
|
|
102
904
|
readonly deployedBytecodeLength: 2394;
|
|
103
905
|
};
|
|
104
|
-
readonly
|
|
105
|
-
readonly bytecodeHash: "
|
|
106
|
-
readonly deployedBytecodeHash: "
|
|
107
|
-
readonly bytecodeLength:
|
|
108
|
-
readonly deployedBytecodeLength:
|
|
906
|
+
readonly CancoreRouter: {
|
|
907
|
+
readonly bytecodeHash: "615b6fb47a4255df9f7fdec963811cdfbefb53166645cd19466fa268df7fb39d";
|
|
908
|
+
readonly deployedBytecodeHash: "dec1f5d541c6b383b95b6c53e278123cc3844bdeff3f977a166fb6e9cbf86343";
|
|
909
|
+
readonly bytecodeLength: 43102;
|
|
910
|
+
readonly deployedBytecodeLength: 36984;
|
|
911
|
+
};
|
|
912
|
+
readonly CNRXStaking: {
|
|
913
|
+
readonly bytecodeHash: "dfda056ee22b593e2f2e1fc4e679fbb9dc34b04964f389b46914402c422b40fb";
|
|
914
|
+
readonly deployedBytecodeHash: "d11534242f166e52f4ad063b5b6b59146e31634d3932f7ad63db05d83a1485f6";
|
|
915
|
+
readonly bytecodeLength: 7412;
|
|
916
|
+
readonly deployedBytecodeLength: 6240;
|
|
917
|
+
};
|
|
918
|
+
readonly PointsClaim: {
|
|
919
|
+
readonly bytecodeHash: "0f29890b609f7e15ef4dbcda17a7f2cd7482d016a0057a5f6c4270d7780ff38d";
|
|
920
|
+
readonly deployedBytecodeHash: "f2b10c4ec8458c0d6ab0f465481e645524f618f7a3327822e8ae5d3fd42fa46c";
|
|
921
|
+
readonly bytecodeLength: 14300;
|
|
922
|
+
readonly deployedBytecodeLength: 11504;
|
|
109
923
|
};
|
|
110
924
|
readonly BurnMintTokenPool: {
|
|
111
925
|
readonly bytecodeHash: "b5b19721149d9dd63e0650d0a1f95ac82affa4b9c650fdffd375db6ea361e416";
|
|
@@ -113,13 +927,20 @@ declare const BYTECODE_HASHES: {
|
|
|
113
927
|
readonly bytecodeLength: 41756;
|
|
114
928
|
readonly deployedBytecodeLength: 39936;
|
|
115
929
|
};
|
|
930
|
+
readonly CNRX: {
|
|
931
|
+
readonly bytecodeHash: "61b4e114722e99f93aac4bd4ef3cfb7973dd050b66e6ffb326efad29d4cc8c95";
|
|
932
|
+
readonly deployedBytecodeHash: "2b23774e41fb25f820227a50de4f48d7ad79b0bd131c1956aab07c100e0c3948";
|
|
933
|
+
readonly bytecodeLength: 21266;
|
|
934
|
+
readonly deployedBytecodeLength: 17374;
|
|
935
|
+
};
|
|
116
936
|
};
|
|
117
937
|
|
|
118
938
|
/**
|
|
119
939
|
* `@cancore/contracts` — the Cancore EVM contracts as data.
|
|
120
940
|
*
|
|
121
941
|
* ABIs (`./abi`), the network registry (`./networks`), the EIP-712 voucher and
|
|
122
|
-
* the release identity
|
|
942
|
+
* the release identity; and the filler protocol v1 (`./protocol`): its EIP-712
|
|
943
|
+
* types, hashing helpers and wire shapes. What an integrator
|
|
123
944
|
* needs to talk to the contracts without copying files out of our repositories,
|
|
124
945
|
* and what our own frontend, backend and MCP server can stop carrying four
|
|
125
946
|
* separate copies of.
|
|
@@ -128,4 +949,4 @@ declare const BYTECODE_HASHES: {
|
|
|
128
949
|
/** Decode a revert's 4-byte selector into the custom error it names, if it is one of ours. */
|
|
129
950
|
declare function describeRevert(selectorOrData: string, tables: ReadonlyArray<Readonly<Record<string, string>>>): string | undefined;
|
|
130
951
|
|
|
131
|
-
export { BYTECODE_HASHES, CONTRACTS_RELEASE, DEPLOYMENTS, type DeploymentEnv, type EvmDeployment, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, type FeeClaim, PERMIT2_ADDRESS, deploymentOf, describeRevert, feeClaimDomain };
|
|
952
|
+
export { ASYNCAPI, type AuthChallenge, type AuthOk, type AuthResponse, type AuthToken, BYTECODE_HASHES, CONTRACTS_RELEASE, DECLINE_REASONS, DEPLOYMENTS, DRAND_QUICKNET, DRAW_CLOSED_BY, type DecString, type DeclineReason, type DeploymentEnv, type DrawAttempt, type DrawCandidate, type DrawClosedBy, type DrawOutcome, type DrawRecord, ERROR_CODES, ERROR_HTTP_STATUS, EXEMPT_REASONS, EXPIRED_RESULTS, type EpochLeaf, type EpochRecord, type EpochWeights, type ErrorCode, type ErrorMessage, type EvmDeployment, type ExemptReason, type ExpiredResult, type F2SBase, type F2SMessage, FEE_CLAIM_DOMAIN_NAME, FEE_CLAIM_DOMAIN_VERSION, FEE_CLAIM_TYPES, FILLER_AUTH_TYPES, FILLER_GATEWAYS, FILLER_PROTOCOL_DOMAIN, FILLER_QUOTE_TYPES, FILL_PROOF_DOMAIN, FILL_PROOF_TYPES, FILL_PROOF_TYPE_STRING, FILL_TICKET_DOMAIN, FILL_TICKET_TYPES, type FeeClaim, type FillProof, type FillReported, type FillTicket, type FillerAuth, type FillerGateway, type FillerQuote, type FillerStats, GATEWAY_MESSAGE_TYPES, type GatewayInfo, type GatewayMessage, type Hex, type JsonSchema, type JsonValue, MESSAGE_DIRECTIONS, type MessageDirection, ORDER_TYPES, type Order, type OrderJson, type OrderSettled, PENALTY_STEPS, PERMIT2_ADDRESS, PROOF_KIND_ATTESTATION, PROTOCOL_SCHEMAS, PROTOCOL_VERSION, type Page, type PenaltyApplied, type PenaltyList, type PenaltyRecord, type PenaltyStep, type Ping, type PingF2S, type PingS2F, type Pong, type PongF2S, type PongS2F, QUOTE_ACK_STATUSES, QUOTE_FINAL_STATUSES, QUOTE_TYPES, type Quote, type QuoteAck, type QuoteAckStatus, type QuoteFinalStatus, type QuoteList, type QuoteMessage, type QuoteReconfirm, type QuoteReconfirmReply, type QuoteRecord, type QuoteRequest, REST_ENDPOINTS, type RestEndpoint, type S2FBase, type S2FMessage, SCHEMA_VOCABULARY, STAKE_BINDING_TYPES, type StakeBinding, type StakeBindingRequest, TICKET_INTENT_TYPES, TICKET_LIST_STATUSES, TICKET_RECEIPT_TYPES, type TicketDecline, type TicketExpired, type TicketIntent, type TicketIntentAck, type TicketIntentMessage, type TicketIssued, type TicketIssuedCanton, type TicketIssuedEvm, type TicketJson, type TicketList, type TicketOffer, type TicketReceipt, type TicketReceiptMessage, type TimeMs, type TypedDataDomain, type TypedDataInput, type TypedDataTypes, type TypedField, type TypedValue, type UintLike, type WireAsset, deploymentOf, describeRevert, drawValue, drawWinner, encodeType, feeClaimDomain, fillProofDomain, firstRoundAtOrAfter, gatewayBodyHash, hashDomain, hashStruct, hashTypedData, jcs, messageSchemaRef, requestIdHash, routerDomain, typeHash };
|