@cancore/contracts 0.2.0-rc.3 → 0.2.0-rc.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +125 -28
- package/dist/{chunk-VODZRADO.js → chunk-IAPV7XWJ.js} +2 -2
- package/dist/chunk-IAPV7XWJ.js.map +1 -0
- package/dist/index.d.ts +412 -82
- package/dist/index.js +694 -160
- package/dist/index.js.map +1 -1
- package/dist/networks.d.ts +1 -1
- package/dist/networks.js +1 -1
- package/package.json +1 -1
- package/spec/protocol/asyncapi.json +265 -27
- package/spec/protocol/messages.schema.json +135 -24
- package/spec/protocol/records.schema.json +3 -2
- package/spec/protocol/rest.schema.json +7 -4
- 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 +12 -12
- package/spec/protocol/typed-data/GatewayMessage.json +12 -9
- package/spec/protocol/typed-data/TicketIntent.json +57 -9
- package/spec/protocol/typed-data/TicketReceipt.json +2 -2
- package/spec/protocol/vectors/messages.json +190 -10
- package/spec/protocol/vectors/settle-attestations.json +542 -0
- package/spec/typed-data/FillProof.json +61 -33
- package/spec/typed-data/FillTicket.json +45 -13
- package/dist/chunk-VODZRADO.js.map +0 -1
package/README.md
CHANGED
|
@@ -18,8 +18,8 @@ need one dependency, `@noble/hashes`.
|
|
|
18
18
|
| --- | --- | --- |
|
|
19
19
|
| `@cancore/contracts/abi` | `HTLC_ABI`, `FEE_VAULT_ABI`, `CNRX_ABI`, `IHTLC_ABI`, `IBURN_MINT_ERC20_ABI`, `IPERMIT2_ABI`, `MULTI_BALANCE_CHECKER_ABI`, `CANCORE_ROUTER_ABI`, `ICANCORE_ROUTER_ABI`, `ATTESTOR_SET_ABI`, `CNRX_STAKING_ABI`, `POINTS_CLAIM_ABI`; an `*_ERRORS` table for each contract that declares custom errors | `Cancore-io/evm-contracts/abi/*.json` — the reviewed snapshots that repository keeps in lock-step with its compiled contracts; `CNRX` and `IBurnMintERC20` from `evm-contracts/vendor/*.json`, a build of `cancore-token-evm` vendored there |
|
|
20
20
|
| `@cancore/contracts/networks` | `NETWORKS`, `networkOf`, `networkKindOf`, `networkByChainId` | the chain ids the Cancore API uses |
|
|
21
|
-
| `@cancore/contracts` (filler protocol v1) | EIP-712 types and domains of the intent rail, `hashTypedData` / `jcs` / `gatewayBodyHash` / `requestIdHash`, `drawValue` / `drawWinner` / `firstRoundAtOrAfter`, wire message types and enums, `FILLER_GATEWAYS` | `docs/intents/protocol.md` and `auction-and-draw.md` in Cancore-io/meta; `CancoreRouter.sol` for the code types |
|
|
22
|
-
| `@cancore/contracts` | all of the above, plus `DEPLOYMENTS` / `deploymentOf`, `FEE_CLAIM_TYPES` / `feeClaimDomain`, `FILL_PROOF_TYPES` / `fillProofDomain` / `FillProof`, `BYTECODE_HASHES
|
|
21
|
+
| `@cancore/contracts` (filler protocol v1) | EIP-712 types and domains of the intent rail, `hashTypedData` / `jcs` / `gatewayBodyHash` / `fillerMessageBodyHash` / `requestIdHash`, one digest helper per settlement type (`hashFillTicket`, `hashFillerQuote`, `hashTicketIntent`, `hashFillerMessage`, `hashFillerKeyRegistration`), `fillerIdHash` / `repayToFromEvm` / `repayToFromParty` / `isEvmRepayTo` / `evmAddressFromRepayTo`, `isEoaSignature`, `fillerEnvelopeError`, `drawValue` / `drawWinner` / `firstRoundAtOrAfter`, wire message types and enums, `FILLER_GATEWAYS` | `docs/intents/protocol.md` and `auction-and-draw.md` in Cancore-io/meta; `CancoreRouter.sol` for the code types |
|
|
22
|
+
| `@cancore/contracts` | all of the above, plus `DEPLOYMENTS` / `deploymentOf`, `FEE_CLAIM_TYPES` / `feeClaimDomain`, `FILL_PROOF_TYPES` / `fillProofDomain` / `hashFillProof` / `FillProof`, `BUILD_HASHES` (and its deprecated alias `BYTECODE_HASHES`), `CONTRACTS_RELEASE`, `describeRevert` | the contracts repository's `version.json` and bytecode hashes; the FeeVault contract's own struct and domain; `evm-contracts/abi/typed-data/FillProof.json` for the router's `FillProof` |
|
|
23
23
|
|
|
24
24
|
The ABIs and selector tables are **generated**, never edited: `npm run sync` reads a checkout
|
|
25
25
|
of `evm-contracts` (`EVM_CONTRACTS_DIR`) and rewrites `spec/abi/*.json` and
|
|
@@ -66,10 +66,13 @@ type hash is the router's `ORDER_TYPEHASH`. Router addresses are not in this pac
|
|
|
66
66
|
## FillProof: what attestors sign
|
|
67
67
|
|
|
68
68
|
`CancoreRouter.settle(order, proof, sigs)` pays a filler out only against k attestor
|
|
69
|
-
signatures over one EIP-712 `FillProof`, in the domain of the order's **source** router
|
|
69
|
+
signatures over one EIP-712 `FillProof`, in the domain of the order's **source** router, and
|
|
70
|
+
pays `proof.repayTo`. Twelve fields: `fillerId` (`keccak256(utf8(fillerId))`) and `repayTo`
|
|
71
|
+
(encoded for the source chain) come from the delivery — `Filled` on an EVM destination, the
|
|
72
|
+
`DeliveryReceipt` on a Canton one — and sit before `attempt` and `setId`.
|
|
70
73
|
|
|
71
74
|
```ts
|
|
72
|
-
import { FILL_PROOF_TYPES, fillProofDomain, PROOF_KIND_ATTESTATION } from '@cancore/contracts';
|
|
75
|
+
import { FILL_PROOF_TYPES, fillProofDomain, hashFillProof, PROOF_KIND_ATTESTATION } from '@cancore/contracts';
|
|
73
76
|
|
|
74
77
|
const signature = await wallet.signTypedData({
|
|
75
78
|
domain: fillProofDomain(sourceChainId, sourceRouter),
|
|
@@ -80,10 +83,14 @@ const signature = await wallet.signTypedData({
|
|
|
80
83
|
```
|
|
81
84
|
|
|
82
85
|
This repository keeps golden vectors for the schema in `spec/typed-data/FillProof.json` (shipped
|
|
83
|
-
in the package since 0.2.0, under `@cancore/contracts/spec/*`)
|
|
84
|
-
`
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
in the package since 0.2.0, under `@cancore/contracts/spec/*`), each with its `domainSeparator`,
|
|
87
|
+
`structHash` and digest, and the file's `typeHash`. The twelve-field file is written here ahead
|
|
88
|
+
of the router (`scripts/gen-protocol-vectors.mjs`): evm-contracts takes it byte for byte into
|
|
89
|
+
`abi/typed-data/FillProof.json` and checks every vector against the router's own `hashFillProof`
|
|
90
|
+
(CAN-2140); canton-contracts takes the Canton-source vector into its `FillProofVerify` vectors.
|
|
91
|
+
From then on the schema is synced from evm-contracts like the ABIs. Until then, do not run
|
|
92
|
+
`scripts/sync-typed-data.mjs` against an evm-contracts checkout that still has the eleven-field
|
|
93
|
+
struct: it would overwrite this file with the old one.
|
|
87
94
|
|
|
88
95
|
## Filler protocol v1 (RC)
|
|
89
96
|
|
|
@@ -93,31 +100,41 @@ breaking protocol change is `0.3`.
|
|
|
93
100
|
|
|
94
101
|
```ts
|
|
95
102
|
import {
|
|
96
|
-
|
|
103
|
+
gatewayBodyHash, hashFillerMessage, hashTicketIntent, repayToFromEvm, fillerIdHash,
|
|
97
104
|
} from '@cancore/contracts';
|
|
98
105
|
|
|
99
|
-
// what the filler
|
|
100
|
-
const
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
106
|
+
// what the filler's message key signs to take an offered ticket: its delivery key and payout address
|
|
107
|
+
const intentDigest = hashTicketIntent({
|
|
108
|
+
orderHash, attempt, validFrom, validUntil,
|
|
109
|
+
fillerId: 'acme',
|
|
110
|
+
deliveryKey, // the address that will send fill (zero for a Canton destination)
|
|
111
|
+
repayTo: repayToFromEvm(payout), // EVM source; repayToFromParty(partyId) for a Canton source
|
|
105
112
|
});
|
|
106
113
|
|
|
114
|
+
// what msgSig of EVERY filler → filler-gateway message is over: FillerMessage{bodyHash}
|
|
115
|
+
const msgDigest = hashFillerMessage(message); // bodyHash = keccak256(JCS(message without msgSig))
|
|
116
|
+
|
|
107
117
|
// what every S→F frame's `sig` is over: GatewayMessage{bodyHash} in the same domain
|
|
108
118
|
const bodyHash = gatewayBodyHash(frame); // keccak256(JCS(frame without sig))
|
|
119
|
+
|
|
120
|
+
fillerIdHash('acme'); // the on-chain fillerId of FillTicket, Filled, FillProof, Settled
|
|
109
121
|
```
|
|
110
122
|
|
|
111
123
|
`hashTypedData` encodes flat structs (address, bool, bytes, bytesN, string, uintN) and throws on
|
|
112
124
|
anything else; it takes wire values as they come — decimal strings, numbers or bigints. There
|
|
113
|
-
is no signing in this package: hand the digest to your own secp256k1 key.
|
|
125
|
+
is no signing in this package: hand the digest to your own secp256k1 key. The filler signs
|
|
126
|
+
everything with one message key, an EOA: 65 bytes `r ‖ s ‖ v`, low-s, `v ∈ {27, 28}`, no
|
|
127
|
+
EIP-1271 — `isEoaSignature` checks that shape before recovery. A message key is registered
|
|
128
|
+
with `FillerKeyRegistration` signed by that key, at onboarding and, with the new key, at a
|
|
129
|
+
manual key change by Cancore staff; there is no key-rotation type or message.
|
|
114
130
|
|
|
115
131
|
| Types | Domain | Status |
|
|
116
132
|
| --- | --- | --- |
|
|
117
|
-
| `
|
|
133
|
+
| `TicketReceipt`, `StakeBinding`, `FillerAuth`, `GatewayMessage` | `CancoreFillerProtocol` v1 | v1 RC — vectors in `spec/protocol/typed-data/` |
|
|
134
|
+
| `FillerQuote` (`string fillerId`), `TicketIntent` (with `fillerId`, `deliveryKey`, `repayTo`), `FillerMessage`, `FillerKeyRegistration` | `CancoreFillerProtocol` v1 | settlement design (variant A), next RC — vectors in `spec/protocol/typed-data/` |
|
|
118
135
|
| `Order` (11 fields, with `createdAt`), `Quote` | `CancoreRouter` v1, source router | router code; provisional copies in `spec/typed-data/` until evm-contracts publishes them |
|
|
119
|
-
| `FillTicket` | `CancoreFillTicket` v1 |
|
|
120
|
-
| `FillProof` | `CancoreRouter` v1, source router |
|
|
136
|
+
| `FillTicket` (`orderHash`, `fillerId`, `deliveryKey`, `repayTo`, `attempt`, `validFrom`, `validUntil`) | `CancoreFillTicket` v1 | variant A, written here ahead of the router (CAN-2140) |
|
|
137
|
+
| `FillProof` (twelve fields) | `CancoreRouter` v1, source router | variant A, written here ahead of the router (above) |
|
|
121
138
|
|
|
122
139
|
Golden vectors are generated with ethers by `scripts/gen-protocol-vectors.mjs` from the literal
|
|
123
140
|
inputs in `scripts/protocol-fixtures.mjs`, and checked by this package's own encoder too. The
|
|
@@ -131,11 +148,12 @@ drand quicknet rounds.
|
|
|
131
148
|
|
|
132
149
|
| File (`@cancore/contracts/spec/protocol/…`) | Holds |
|
|
133
150
|
| --- | --- |
|
|
134
|
-
| `messages.schema.json` | one `$def` per WebSocket frame type (
|
|
151
|
+
| `messages.schema.json` | one `$def` per WebSocket frame type (23), `x-direction` S2F / F2S / both, and the primitives they share |
|
|
135
152
|
| `rest.schema.json` | REST fallback bodies; `x-endpoints` (method, path, auth, request/response), `x-error-status` |
|
|
136
153
|
| `records.schema.json` | the draw record, the epoch record, `GET /v1/gateway` |
|
|
137
154
|
| `asyncapi.json` | AsyncAPI 3.0: channel `/v1`, the gateway's send/receive operations, examples |
|
|
138
155
|
| `vectors/messages.json`, `vectors/records.json` | valid example frames and fixture records (hashes real, `sig` a placeholder: r = s = 0, v = 27) |
|
|
156
|
+
| `vectors/settle-attestations.json` | `settle.attestations` golden vectors: EVM and Canton source, real TEST-key signatures, the pushed frame and the REST body with one payload, and schema-valid payloads a filler must refuse |
|
|
139
157
|
|
|
140
158
|
The same objects are exported as `PROTOCOL_SCHEMAS`, `ASYNCAPI`, `MESSAGE_DIRECTIONS` and
|
|
141
159
|
`REST_ENDPOINTS`, with TypeScript shapes of every frame (`TicketOffer`, `QuoteAck`, …) and the
|
|
@@ -152,16 +170,48 @@ ajv.validate(messageSchemaRef(frame.type, 'S2F'), frame); // errors name the fie
|
|
|
152
170
|
```
|
|
153
171
|
|
|
154
172
|
The schemas describe what a v1 **sender** emits: lowercase hex, uint64 and wider as decimal
|
|
155
|
-
strings,
|
|
173
|
+
strings, times in milliseconds, every frame with `id`, `fillerId` and `sentAt`, every S→F frame
|
|
174
|
+
signed with `sig` and every F→S frame — `ticket.decline`, a declining `quote.reconfirm.reply`,
|
|
175
|
+
`fill.reported`, `pong` and `error` included — with `msgSig` (`f2sEnvelope`); REST request
|
|
176
|
+
bodies carry the same envelope. `fillerEnvelopeError` runs the key-free checks of §3.4 (shape of
|
|
177
|
+
`msgSig`, the session's `fillerId`, freshness, `id`); recovering `msgSig` against the registered
|
|
178
|
+
message key and refusing a replayed `id` stay with the receiver, which keeps an accepted `id` until
|
|
179
|
+
`messageIdRetainUntil(sentAt, receivedAt, maxMessageAgeMs)` — freshness is symmetric, so a sender
|
|
180
|
+
clock running ahead keeps a message fresh past `receivedAt + maxMessageAgeMs`. The `repayToEvm` definition
|
|
181
|
+
refuses a `repayTo` with non-zero top 12 bytes, for a receiver that knows the source is EVM. No
|
|
156
182
|
object is closed: a receiver ignores unknown fields and a taker ignores unknown S→F types
|
|
157
183
|
(V-2), so check a frame of an unknown type against `s2fEnvelope` and skip it. Every enum is
|
|
158
184
|
open the same way: the known values, or any UPPER_SNAKE value added within v1, which a receiver
|
|
159
185
|
treats as `OTHER`/generic; a `ticket.issued` of an unknown `form` is checked on its common fields
|
|
160
|
-
only. `ping
|
|
161
|
-
|
|
186
|
+
only. `ping`, `pong` and `error` go both ways: the gateway's copy carries `sig` (`pingS2F`), the
|
|
187
|
+
filler's `msgSig` (`pingF2S`); the second argument of `messageSchemaRef` picks one.
|
|
162
188
|
`scripts/gen-protocol-docs.mjs` derives the examples, records and the AsyncAPI document from
|
|
163
189
|
the schemas and the vectors.
|
|
164
190
|
|
|
191
|
+
### Attestation signatures for `settle`
|
|
192
|
+
|
|
193
|
+
Once filler-gateway holds at least `threshold` verified attestor signatures over a filler's
|
|
194
|
+
`FillProof`, it pushes `settle.attestations` to that filler and serves the same payload on
|
|
195
|
+
`GET /v1/filler/attestations/{orderHash}` (404 `ATTESTATIONS_NOT_READY` before that, 404
|
|
196
|
+
`UNKNOWN_TICKET` when the filler holds no ticket on the order); the filler node submits `settle`
|
|
197
|
+
itself (protocol §3.5, §3.6, §10 D-N). `proof` is the `FillProof` the source router hashes,
|
|
198
|
+
field for field (`FILL_PROOF_TYPES`); variant A of protocol §3.3 (`fillerId`, `repayTo`) replaces
|
|
199
|
+
it together with the router's struct. A signature entry follows `sourceChainId`: `{signer, signature}` with a
|
|
200
|
+
65-byte signature on an EVM source, `{signer, pubKey, signature}` with the DER public key and a
|
|
201
|
+
minimal DER signature on a Canton source, as `SwapIntent_SettleWithProof` takes them.
|
|
202
|
+
|
|
203
|
+
```ts
|
|
204
|
+
import { settleAttestationsErrors, settleAttestationsPayload, settleAttestationsPayloadHash, settleSigs } from '@cancore/contracts';
|
|
205
|
+
|
|
206
|
+
const payload = settleAttestationsPayload(frame); // the same from WebSocket and REST
|
|
207
|
+
settleAttestationsErrors(payload); // [] or what the schema cannot state: threshold, signer order, ids
|
|
208
|
+
settleAttestationsPayloadHash(frame); // dedupe the two channels
|
|
209
|
+
settleSigs(payload); // EVM: the sigs of settle(order, proof, sigs); Canton: cantonSigEntries(payload)
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
Recover every signer and check it against `attestationSetFor(orderHash)` with your own
|
|
213
|
+
secp256k1 library (T-7). `scripts/gen-settle-attestations.mjs` writes the vectors.
|
|
214
|
+
|
|
165
215
|
`FILLER_GATEWAYS` is where the gateway key and the ticket signers of each environment are
|
|
166
216
|
published. It is empty in the RC: no gateway key exists yet.
|
|
167
217
|
|
|
@@ -180,7 +230,7 @@ decode against the same table.
|
|
|
180
230
|
## Deployments
|
|
181
231
|
|
|
182
232
|
```ts
|
|
183
|
-
import { DEPLOYMENTS, deploymentOf,
|
|
233
|
+
import { DEPLOYMENTS, deploymentOf, BUILD_HASHES } from '@cancore/contracts';
|
|
184
234
|
|
|
185
235
|
const { htlc, htlcBlock } = deploymentOf('mainnet', 'arbitrum')!;
|
|
186
236
|
```
|
|
@@ -188,11 +238,13 @@ const { htlc, htlcBlock } = deploymentOf('mainnet', 'arbitrum')!;
|
|
|
188
238
|
Three environments, three independent deployments: what is on Sepolia for the dev stand is
|
|
189
239
|
not what is on Sepolia for testnet. `htlcBlock` is the floor for an event scan.
|
|
190
240
|
|
|
191
|
-
`
|
|
192
|
-
`scripts/tools/check-bytecode-match.mjs`: `
|
|
241
|
+
`BUILD_HASHES` pins the build each release was made from, as `evm-contracts` records it in
|
|
242
|
+
`scripts/tools/check-bytecode-match.mjs`: `creationHexSha256` and `runtimeHexSha256` are sha256
|
|
193
243
|
of the UTF-8 text of the artifact's `0x`-prefixed hex (creation and runtime code) — not
|
|
194
|
-
keccak256, and not of the bytes — and `
|
|
195
|
-
of that text, `0x` included.
|
|
244
|
+
keccak256, and not of the bytes — and `creationHexLength` / `runtimeHexLength` are the length
|
|
245
|
+
of that text, `0x` included. `BYTECODE_HASHES` is the same data under the old field names
|
|
246
|
+
(`bytecodeHash`, `deployedBytecodeHash`, `bytecodeLength`, `deployedBytecodeLength`); it is
|
|
247
|
+
deprecated and goes before `0.2.0`. It is not a hash of `eth_getCode`: a contract with
|
|
196
248
|
immutables (`CancoreRouter`, `FeeVault`) never matches one, so checking a live deployment
|
|
197
249
|
against it means rebuilding the release, not hashing the address. `CONTRACTS_RELEASE` names the
|
|
198
250
|
release.
|
|
@@ -241,6 +293,10 @@ EVM_CONTRACTS_DIR=../evm-contracts npm run sync # then review the diff and rel
|
|
|
241
293
|
EVM_CONTRACTS_DIR=../evm-contracts node scripts/sync.mjs
|
|
242
294
|
```
|
|
243
295
|
|
|
296
|
+
`EVM_CONTRACTS_DIR` must be the root of a clean git checkout of `evm-contracts`: the sync records
|
|
297
|
+
its `HEAD` as `CONTRACTS_RELEASE.commit` and refuses a directory that is not a checkout root or
|
|
298
|
+
has uncommitted changes, so the release cannot name a commit its data did not come from.
|
|
299
|
+
|
|
244
300
|
It reads `abi/*.json` except the two manifests (`bytecode-hashes.json`, `versions.json`) and
|
|
245
301
|
`vendor/*.json` (the `.abi` field), and refuses to run when `spec/abi/` holds a snapshot the
|
|
246
302
|
source no longer has — dropping a published ABI is a decision, not a side effect of a sync.
|
|
@@ -252,6 +308,47 @@ Full documentation: <https://docs.cancore.io/sdk/contracts>
|
|
|
252
308
|
|
|
253
309
|
## Changes
|
|
254
310
|
|
|
311
|
+
- Unreleased (next RC) — the settlement design of variant A (protocol.md §3.3, §3.4, §3.15,
|
|
312
|
+
§3.16; CAN-2139). **Breaking within the RC line**: every digest of the changed types changes.
|
|
313
|
+
- `FillTicket` is `(orderHash, bytes32 fillerId, address deliveryKey, bytes32 repayTo, attempt,
|
|
314
|
+
validFrom, validUntil)`; `FillProof` has twelve fields, `fillerId` and `repayTo` in place of
|
|
315
|
+
`address filler`; `TicketIntent` adds `string fillerId`, `deliveryKey`, `repayTo`;
|
|
316
|
+
`FillerQuote` names `string fillerId` instead of `address filler`. Type hashes:
|
|
317
|
+
`FillTicket` `0x3b13cc38…73ec82`, `FillProof` `0xc37e18cd…2419ae`.
|
|
318
|
+
- New types `FillerMessage(bytes32 bodyHash)` (the envelope signature `msgSig` of every filler
|
|
319
|
+
message) and `FillerKeyRegistration(string fillerId,address messageKey,uint64 issuedAt)`
|
|
320
|
+
(proof of possession of the message key, also for a manual key change by staff). No
|
|
321
|
+
key-rotation type, no `key.rotate` message, no refund-redirect type.
|
|
322
|
+
- Helpers: `hashFillTicket`, `hashFillProof`, `hashFillerQuote`, `hashTicketIntent`,
|
|
323
|
+
`hashFillerMessage`, `hashFillerKeyRegistration`, `fillerMessageBodyHash`, `fillerIdHash`,
|
|
324
|
+
`repayToFromEvm`, `repayToFromParty`, `isEvmRepayTo`, `evmAddressFromRepayTo`,
|
|
325
|
+
`isEoaSignature`, `fillerEnvelopeError`, `messageIdRetainUntil`.
|
|
326
|
+
- Schemas: every F→S frame carries `id`, `fillerId`, `sentAt`, `msgSig` (`f2sEnvelope`), as does
|
|
327
|
+
the stake-binding REST body; every S→F frame carries `id`; `error` goes both ways
|
|
328
|
+
(`errorS2F`, `errorF2S`); `quote` drops `filler`; `ticket.intent` adds `deliveryKey`,
|
|
329
|
+
`repayTo`; the issued EVM ticket is the seven-field `FillTicket` and the Canton form adds
|
|
330
|
+
`repayTo`; error codes `STALE_MESSAGE`, `REPLAYED_MESSAGE`, `TICKET_REFUSED` with
|
|
331
|
+
`reason` (`TICKET_REFUSED_REASONS`); `repayToEvm`, `fillerKeyRegistration` definitions;
|
|
332
|
+
`sig65` refuses an `s` with its top bit set; `GET /v1/gateway` returns `maxMessageAgeMs`.
|
|
333
|
+
- Vectors for every new and changed type; `FillProof.json` is written here ahead of the
|
|
334
|
+
router (see «FillProof: what attestors sign»).
|
|
335
|
+
- Unreleased (CAN-2018) — filler-gateway → filler `settle.attestations` and `GET /v1/filler/attestations/{orderHash}`
|
|
336
|
+
(protocol §3.5, §3.6, §10 D-N): the frame schema with the router's `FillProof` and the EVM and
|
|
337
|
+
Canton signature entries, the REST endpoint, the error code `ATTESTATIONS_NOT_READY` (404), an
|
|
338
|
+
AsyncAPI message, golden vectors (`spec/protocol/vectors/settle-attestations.json`), the
|
|
339
|
+
`SettleAttestations` types and the helpers `settleAttestationsPayload`,
|
|
340
|
+
`settleAttestationsPayloadHash`, `settleAttestationsErrors`, `settleSigs`, `cantonSigEntries`.
|
|
341
|
+
Additive only (V-2): no existing frame, type or vector changes.
|
|
342
|
+
- `0.2.0-rc.6` — `auth.response` gains an optional `nonce` (bytes32): the `auth.challenge` nonce it
|
|
343
|
+
answers, so filler-gateway's REST login (`POST /v1/filler/auth`) finds the challenge without trying
|
|
344
|
+
every live one. Additive only (V-2); the `FillerAuth` type and every digest are unchanged.
|
|
345
|
+
- `0.2.0-rc.5` — `CONTRACTS_RELEASE.commit`: the evm-contracts commit the data was synced from.
|
|
346
|
+
The sync takes it from the checkout's `HEAD` and refuses a directory that is not a clean
|
|
347
|
+
checkout root. Additive only.
|
|
348
|
+
- `0.2.0-rc.4` — adds `BUILD_HASHES`: the release's build hashes under names that say what they
|
|
349
|
+
are (`creationHexSha256`, `runtimeHexSha256`, `creationHexLength`, `runtimeHexLength`).
|
|
350
|
+
`BYTECODE_HASHES` keeps the same values under the old names, deprecated, and is removed before
|
|
351
|
+
`0.2.0`. Additive only.
|
|
255
352
|
- `0.2.0-rc.3` — adds the `CNRXStaking` and `PointsClaim` ABIs with their error tables
|
|
256
353
|
(`CNRX_STAKING_ABI`, `CNRX_STAKING_ERRORS`, `POINTS_CLAIM_ABI`, `POINTS_CLAIM_ERRORS`). The
|
|
257
354
|
generator now splits an acronym of two or more capitals from the word after it, which renames
|
|
@@ -88,5 +88,5 @@ function networkByChainId(chainId) {
|
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf };
|
|
91
|
-
//# sourceMappingURL=chunk-
|
|
92
|
-
//# sourceMappingURL=chunk-
|
|
91
|
+
//# sourceMappingURL=chunk-IAPV7XWJ.js.map
|
|
92
|
+
//# sourceMappingURL=chunk-IAPV7XWJ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/networks.ts"],"names":[],"mappings":";AA6BO,IAAM,QAAA,GAA8C;AAAA,EACzD,MAAA,EAAQ,EAAE,EAAA,EAAI,QAAA,EAAU,MAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,OAAA,EAAS,KAAA,EAAM;AAAA,EACvE,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IAAY,IAAA,EAAM,KAAA;AAAA,IAAO,IAAA,EAAM,UAAA;AAAA,IAAY,OAAA,EAAS,CAAA;AAAA,IAAG,WAAA,EAAa,sBAAA;AAAA,IACxE,gBAAgB,EAAE,IAAA,EAAM,SAAS,MAAA,EAAQ,KAAA,EAAO,UAAU,EAAA,EAAG;AAAA,IAAG,OAAA,EAAS;AAAA,GAC3E;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IAAW,IAAA,EAAM,KAAA;AAAA,IAAO,IAAA,EAAM,SAAA;AAAA,IAAW,OAAA,EAAS,QAAA;AAAA,IAAU,WAAA,EAAa,8BAAA;AAAA,IAC7E,gBAAgB,EAAE,IAAA,EAAM,eAAe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SAAS,iBAAiB,OAAA,EAAsC;AACrE,EAAA,OAAO,MAAA,CAAO,OAAO,QAAQ,CAAA,CAAE,KAAK,CAAC,CAAA,KAAM,CAAA,CAAE,OAAA,KAAY,OAAO,CAAA;AAClE","file":"chunk-IAPV7XWJ.js","sourcesContent":["/**\n * `@cancore/contracts/networks` — the chains Cancore settles on, by the ids the\n * API uses (`sourceNetwork`, `targetNetwork` in an order are these keys).\n *\n * Three kinds, because three address formats and three signing models:\n * `evm` (0x…, EIP-155 chain id), `tron` (base58, same Solidity, no chain id in\n * the EVM sense), `canton` (party ids, no addresses at all). A caller that\n * branches on `kind` instead of on the id keeps working when a chain is added.\n *\n * Contract addresses live next door in `DEPLOYMENTS`, keyed by environment —\n * dev, testnet and mainnet each have their own HTLC. `BUILD_HASHES` (from `.`)\n * pins the build of a release, not what an address runs (see `DEPLOYMENTS`).\n */\n\nexport type NetworkKind = 'evm' | 'tron' | 'canton';\n\nexport interface Network {\n /** The id the Cancore API uses for this chain. */\n id: string;\n kind: NetworkKind;\n name: string;\n /** EIP-155 chain id; absent for Tron and Canton. */\n chainId?: number;\n /** Where a transaction or address of this chain can be looked at. */\n explorerUrl?: string;\n nativeCurrency?: { name: string; symbol: string; decimals: number };\n testnet: boolean;\n}\n\nexport const NETWORKS: Readonly<Record<string, Network>> = {\n canton: { id: 'canton', kind: 'canton', name: 'Canton', testnet: false },\n ethereum: {\n id: 'ethereum', kind: 'evm', name: 'Ethereum', chainId: 1, explorerUrl: 'https://etherscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n sepolia: {\n id: 'sepolia', kind: 'evm', name: 'Sepolia', chainId: 11155111, explorerUrl: 'https://sepolia.etherscan.io',\n nativeCurrency: { name: 'Sepolia ETH', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n bnb: {\n id: 'bnb', kind: 'evm', name: 'BNB Chain', chainId: 56, explorerUrl: 'https://bscscan.com',\n nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 }, testnet: false,\n },\n bnb_testnet: {\n id: 'bnb_testnet', kind: 'evm', name: 'BNB Testnet', chainId: 97, explorerUrl: 'https://testnet.bscscan.com',\n nativeCurrency: { name: 'Test BNB', symbol: 'tBNB', decimals: 18 }, testnet: true,\n },\n arbitrum: {\n id: 'arbitrum', kind: 'evm', name: 'Arbitrum One', chainId: 42161, explorerUrl: 'https://arbiscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n arbitrum_sepolia: {\n id: 'arbitrum_sepolia', kind: 'evm', name: 'Arbitrum Sepolia', chainId: 421614, explorerUrl: 'https://sepolia.arbiscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n robinhood: {\n id: 'robinhood', kind: 'evm', name: 'Robinhood Chain', chainId: 4663, explorerUrl: 'https://robinhoodchain.blockscout.com',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n robinhood_testnet: {\n id: 'robinhood_testnet', kind: 'evm', name: 'Robinhood Testnet', chainId: 46630, explorerUrl: 'https://explorer.testnet.chain.robinhood.com',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n tron_nile: { id: 'tron_nile', kind: 'tron', name: 'Tron Nile', explorerUrl: 'https://nile.tronscan.org', testnet: true },\n tron_shasta: { id: 'tron_shasta', kind: 'tron', name: 'Tron Shasta', explorerUrl: 'https://shasta.tronscan.org', testnet: true },\n};\n\n/** `eth` is an older alias of `ethereum` still seen in order payloads. */\nexport const NETWORK_ALIASES: Readonly<Record<string, string>> = { eth: 'ethereum' };\n\nexport function networkOf(id: string): Network | undefined {\n return NETWORKS[NETWORK_ALIASES[id] ?? id];\n}\n\nexport function networkKindOf(id: string): NetworkKind | undefined {\n return networkOf(id)?.kind;\n}\n\n/** The network for an EIP-155 chain id, e.g. from a wallet's `eth_chainId`. */\nexport function networkByChainId(chainId: number): Network | undefined {\n return Object.values(NETWORKS).find((n) => n.chainId === chainId);\n}\n"]}
|