@cancore/contracts 0.2.0-rc.20 → 0.2.0-rc.23

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/dist/networks.js CHANGED
@@ -1,3 +1,3 @@
1
- export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-IAPV7XWJ.js';
1
+ export { NETWORKS, NETWORK_ALIASES, networkByChainId, networkKindOf, networkOf } from './chunk-ZCQZ34HG.js';
2
2
  //# sourceMappingURL=networks.js.map
3
3
  //# sourceMappingURL=networks.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cancore/contracts",
3
- "version": "0.2.0-rc.20",
3
+ "version": "0.2.0-rc.23",
4
4
  "type": "module",
5
5
  "description": "The Cancore EVM contracts as data: the ABIs of the Cancore EVM contracts and their custom-error selectors, the EIP-712 FeeClaim voucher and FillProof, the network registry; and the filler protocol v1: EIP-712 types and domains, hashing helpers, JSON Schemas, AsyncAPI, golden vectors.",
6
6
  "exports": {
@@ -34,18 +34,36 @@
34
34
  "bugs": {
35
35
  "url": "https://github.com/Cancore-io/sdk/issues"
36
36
  },
37
- "keywords": ["canton", "cancore", "abi", "htlc", "evm", "eip-712", "contracts", "filler-protocol", "asyncapi", "json-schema"],
38
- "files": ["dist", "spec", "README.md", "LICENSE"],
39
- "publishConfig": { "access": "public" },
40
- "engines": { "node": ">=20" },
37
+ "keywords": [
38
+ "canton",
39
+ "cancore",
40
+ "abi",
41
+ "htlc",
42
+ "evm",
43
+ "eip-712",
44
+ "contracts",
45
+ "filler-protocol",
46
+ "asyncapi",
47
+ "json-schema"
48
+ ],
49
+ "files": [
50
+ "dist",
51
+ "spec",
52
+ "README.md",
53
+ "LICENSE"
54
+ ],
55
+ "publishConfig": {
56
+ "access": "public"
57
+ },
58
+ "engines": {
59
+ "node": ">=26"
60
+ },
61
+ "dependencies": {
62
+ "@noble/hashes": "^1.8.0"
63
+ },
41
64
  "scripts": {
42
65
  "build": "tsup",
43
- "prepack": "tsup --silent",
44
- "prepublishOnly": "npm run build",
45
66
  "sync": "node scripts/sync.mjs && node scripts/sync-typed-data.mjs",
46
67
  "vectors": "node scripts/gen-protocol-vectors.mjs && node scripts/gen-settle-attestations.mjs && node scripts/gen-protocol-docs.mjs && node scripts/gen-router-vectors.mjs"
47
- },
48
- "dependencies": {
49
- "@noble/hashes": "^1.8.0"
50
68
  }
51
- }
69
+ }
@@ -66,7 +66,7 @@
66
66
  "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]`" },
67
67
  "declineReason": {
68
68
  "anyOf": [
69
- { "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"] },
69
+ { "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", "RECIPIENT_NOT_READY"] },
70
70
  { "$ref": "#/$defs/futureEnumValue" }
71
71
  ]
72
72
  },
@@ -24,6 +24,7 @@
24
24
  { "method": "GET", "path": "/v1/filler/canton/holdings", "auth": "bearer", "query": "#/$defs/pageQuery", "response": "#/$defs/cantonHoldingList" },
25
25
  { "method": "GET", "path": "/v1/filler/canton/delivery-orders", "auth": "bearer", "query": "#/$defs/pageQuery", "response": "#/$defs/cantonDeliveryOrderList" },
26
26
  { "method": "GET", "path": "/v1/filler/canton/intents/{orderHash}", "auth": "bearer", "response": "#/$defs/cantonIntent" },
27
+ { "method": "GET", "path": "/v1/filler/canton/recipient-readiness/{orderHash}", "auth": "bearer", "response": "#/$defs/cantonRecipientReadiness" },
27
28
  { "method": "GET", "path": "/v1/filler/routes", "auth": "bearer", "response": "messages.schema.json#/$defs/routes.state" },
28
29
  { "method": "POST", "path": "/v1/filler/routes", "auth": "bearer", "request": "messages.schema.json#/$defs/routes.set", "response": "messages.schema.json#/$defs/routes.state" }
29
30
  ],
@@ -209,9 +210,22 @@
209
210
  "required": ["items", "nextCursor"],
210
211
  "properties": { "items": { "type": "array", "items": { "$ref": "#/$defs/cantonDeliveryOrder" } }, "nextCursor": { "type": ["string", "null"] } }
211
212
  },
213
+ "cantonRecipientReadiness": {
214
+ "type": "object",
215
+ "description": "Whether the recipient of the caller party's live DeliveryOrder for orderHash accepts its instrument through the order's validUntil: Cancore's read of the recipient's transfer preapproval, the read trading's pre-ticket checks use. The node refuses a Canton-form ticket with RECIPIENT_NOT_READY when ready is false (fillers.md V-R1). 404 UNKNOWN_TICKET when no live DeliveryOrder with this orderHash names the party; 409 CANTON_NOT_READY when the fillerId has no party; 503 CANTON_UNAVAILABLE when the ledger cannot be read",
216
+ "required": ["orderHash", "deliveryOrderCid", "recipient", "asset", "ready", "reason"],
217
+ "properties": {
218
+ "orderHash": { "$ref": "messages.schema.json#/$defs/bytes32" },
219
+ "deliveryOrderCid": { "type": "string", "minLength": 1 },
220
+ "recipient": { "type": "string", "minLength": 1, "description": "DeliveryOrder.recipient" },
221
+ "asset": { "$ref": "messages.schema.json#/$defs/cantonAsset", "description": "DeliveryOrder.instrumentId" },
222
+ "ready": { "type": "boolean" },
223
+ "reason": { "anyOf": [{ "enum": ["RECIPIENT_NOT_READY", "INSTRUMENT_NOT_SUPPORTED", null] }, { "$ref": "messages.schema.json#/$defs/futureEnumValue" }], "description": "why not; null when ready" }
224
+ }
225
+ },
212
226
  "cantonIntent": {
213
227
  "type": "object",
214
- "description": "A live SwapIntent of a Canton source that names the caller's party as its filler, as that party sees it (an observer), with its committed allocation as the operator reads it (an executor). What the node checks before ticket.receipt (fillers.md V-C1…V-C6); the node recomputes orderHash from these fields itself. 404 UNKNOWN_TICKET when no live SwapIntent with this orderHash names the party; 409 CANTON_NOT_READY when the fillerId has no party",
228
+ "description": "A live SwapIntent of a Canton source that names the caller's party as its filler, as that party sees it (an observer), with its committed allocation as the operator reads it (an executor). What the node checks before ticket.receipt (fillers.md V-C1…V-C7); the node recomputes orderHash from these fields itself. 404 UNKNOWN_TICKET when no live SwapIntent with this orderHash names the party; 409 CANTON_NOT_READY when the fillerId has no party",
215
229
  "required": ["intentCid", "templateId", "orderHash", "owner", "operator", "filler", "fillerId", "requestId", "asset", "amount", "destination", "minReceived", "feeRate", "fillDeadline", "refundAfter", "orderCreatedAt", "allocationCid", "allocation"],
216
230
  "properties": {
217
231
  "intentCid": { "type": "string", "minLength": 1 },
@@ -247,6 +261,17 @@
247
261
  "allocation": {
248
262
  "anyOf": [{ "$ref": "#/$defs/cantonAllocation" }, { "type": "null" }],
249
263
  "description": "the contract allocationCid names, by its AllocationV2 view; null when it is not live"
264
+ },
265
+ "settlementFactory": {
266
+ "anyOf": [
267
+ {
268
+ "type": "object",
269
+ "required": ["contractId", "live"],
270
+ "properties": { "contractId": { "type": "string", "minLength": 1 }, "live": { "type": "boolean" } }
271
+ },
272
+ { "type": "null" }
273
+ ],
274
+ "description": "SwapIntent.settlementFactoryCid, the factory settle runs (CAN-3340), and whether it is the registry's current settlement factory, read as settle reads it (CAN-3408). The node refuses the ticket (V-C7) when it is not live, null or absent"
250
275
  }
251
276
  }
252
277
  },
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/networks.ts"],"names":[],"mappings":";AA6BO,IAAM,QAAA,GAA8C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AQ,KAAA,EAAO,UAAU,EAAA,EAAG;AAAA,IAAG,OAAA,EAAS;AAAA,GAC3E;AAAA,EACA,SAAA,EAAW,EAAE,EAAA,EAAI,WAAA,EAAa,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,WAAA,EAAa,WAAA,EAAa,2BAAA,EAA6B,OAAA,EAAS,IAAA,EAAK;AAAA,EACvH,WAAA,EAAa,EAAE,EAAA,EAAI,aAAA,EAAe,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,aAAA,EAAe,WAAA,EAAa,6BAAA,EAA+B,OAAA,EAAS,IAAA;AAC5H;AAGO,IAAM,eAAA,GAAoD,EAAE,GAAA,EAAK,UAAA;AAEjE,SAAS,UAAU,EAAA,EAAiC;AACzD,EAAA,OAAO,QAAA,CAAS,eAAA,CAAgB,EAAE,CAAA,IAAK,EAAE,CAAA;AAC3C;AAEO,SAAS,cAAc,EAAA,EAAqC;AACjE,EAAA,OAAO,SAAA,CAAU,EAAE,CAAA,EAAG,IAAA;AACxB;AAGO,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"]}