@cancore/contracts 0.2.0-rc.21 → 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/README.md CHANGED
@@ -352,7 +352,7 @@ On any difference it does not sign. The kind of a leg is closed: an unknown kind
352
352
  `preapprovals`, the party's live transfer preapprovals),
353
353
  `/holdings`, `/delivery-orders`, and `/intents/{orderHash}` — the live Canton-source `SwapIntent`
354
354
  naming the party as its filler, with its committed allocation, which the node checks before
355
- `ticket.receipt` (V-C1…V-C6; 404 `UNKNOWN_TICKET` when none names it). Refusals: `CANTON_NOT_READY` (409), `CANTON_REFUSED` (422),
355
+ `ticket.receipt` (V-C1…V-C7; 404 `UNKNOWN_TICKET` when none names it). Refusals: `CANTON_NOT_READY` (409), `CANTON_REFUSED` (422),
356
356
  `CANTON_UNAVAILABLE` (503, retry), `OPERATION_EXPIRED` (410, prepare again), plus
357
357
  `UNKNOWN_TICKET`, `TICKET_CLOSED` and `NOT_ELIGIBLE` for an operation on someone else's ticket or party.
358
358
 
@@ -465,6 +465,17 @@ Full documentation: <https://docs.cancore.io/sdk/contracts>
465
465
 
466
466
  ## Changes
467
467
 
468
+ - `0.2.0-rc.23` — the recipient of a Canton delivery (CAN-1867): decline reason
469
+ `RECIPIENT_NOT_READY` — the recipient of the order no longer accepts its instrument, so the filler
470
+ refuses the Canton-form ticket before `ticket.receipt` (never a violation of the filler). REST read
471
+ `GET /v1/filler/canton/recipient-readiness/{orderHash}` (`CantonRecipientReadiness`;
472
+ `$defs/cantonRecipientReadiness`): Cancore's read of that recipient's transfer preapproval for the
473
+ party's live `DeliveryOrder`, which the party cannot read on its own participant (V-R1). Additive.
474
+ - `0.2.0-rc.22` — `CantonIntent.settlementFactory` (CAN-3408): the settlement factory the owner
475
+ approved into the `SwapIntent` (CAN-3340) and `live`, whether it is still the registry's current
476
+ one, as settle reads it (`CantonSettlementFactory`; `$defs/cantonIntent.settlementFactory`).
477
+ Optional on the wire, so a filler-gateway without it still validates; the filler node refuses
478
+ the ticket without it (V-C7). Additive.
468
479
  - `0.2.0-rc.21` — Base (CAN-3260): `NETWORKS.base` (8453) and `NETWORKS.base_sepolia` (84532),
469
480
  and the Base Sepolia HTLC and MultiBalanceChecker of the dev stand in `DEPLOYMENTS.devnet` and
470
481
  of the stage stand in `DEPLOYMENTS.testnet` (two independent deploys), and the Base mainnet HTLC
package/dist/index.d.ts CHANGED
@@ -914,7 +914,7 @@ type WireAsset = Hex | {
914
914
  admin: string;
915
915
  id: string;
916
916
  };
917
- 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"];
917
+ 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", "RECIPIENT_NOT_READY"];
918
918
  declare const ERROR_CODES: readonly ["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", "CANTON_NOT_READY", "CANTON_REFUSED", "CANTON_UNAVAILABLE", "OPERATION_EXPIRED", "ROUTE_NOT_APPROVED"];
919
919
  /** HTTP status of each error code on the REST fallback. */
920
920
  declare const ERROR_HTTP_STATUS: Readonly<Record<ErrorCode, number>>;
@@ -1563,10 +1563,16 @@ interface CantonAllocation {
1563
1563
  settlementDeadline: DecString | null;
1564
1564
  legs: CantonAllocationLeg[];
1565
1565
  }
1566
+ /** The settlement factory the owner approved into the `SwapIntent` (CAN-3340), and whether it is still the registry's. */
1567
+ interface CantonSettlementFactory {
1568
+ contractId: string;
1569
+ /** The cid is the registry's current settlement factory, read as settle reads it (CAN-3408). */
1570
+ live: boolean;
1571
+ }
1566
1572
  /**
1567
1573
  * `GET /v1/filler/canton/intents/{orderHash}`: the live Canton-source `SwapIntent` naming the party as its
1568
1574
  * filler, as that party sees it, and its committed allocation (null when not live). The node checks it
1569
- * before `ticket.receipt` (fillers.md V-C1…V-C6) and recomputes `orderHash` from these fields itself.
1575
+ * before `ticket.receipt` (fillers.md V-C1…V-C7) and recomputes `orderHash` from these fields itself.
1570
1576
  */
1571
1577
  interface CantonIntent {
1572
1578
  intentCid: string;
@@ -1597,6 +1603,23 @@ interface CantonIntent {
1597
1603
  orderCreatedAt: DecString;
1598
1604
  allocationCid: string;
1599
1605
  allocation: CantonAllocation | null;
1606
+ /** Absent from a filler-gateway before CAN-3408: V-C7 refuses then, as for a factory that is not live. */
1607
+ settlementFactory?: CantonSettlementFactory | null;
1608
+ }
1609
+ /**
1610
+ * `GET /v1/filler/canton/recipient-readiness/{orderHash}`: whether the recipient of the party's live `DeliveryOrder`
1611
+ * for `orderHash` accepts its instrument through the order's `validUntil` — Cancore's read of the recipient's transfer
1612
+ * preapproval, the one trading's pre-ticket checks use. The party cannot read it on its own participant. The node
1613
+ * refuses a Canton-form ticket with `RECIPIENT_NOT_READY` when `ready` is false (fillers.md V-R1).
1614
+ */
1615
+ interface CantonRecipientReadiness {
1616
+ orderHash: Hex;
1617
+ deliveryOrderCid: string;
1618
+ recipient: string;
1619
+ asset: CantonAsset;
1620
+ ready: boolean;
1621
+ /** Why not; null when ready. Open (V-2): an unknown value reads as not ready. */
1622
+ reason: 'RECIPIENT_NOT_READY' | 'INSTRUMENT_NOT_SUPPORTED' | (string & {}) | null;
1600
1623
  }
1601
1624
  interface DrawAttempt {
1602
1625
  attempt: number;
@@ -1995,4 +2018,4 @@ declare const BYTECODE_HASHES: {
1995
2018
  declare function describeRevert(selectorOrData: string, tables: ReadonlyArray<Readonly<Record<string, string>>>): string | undefined;
1996
2019
 
1997
2020
  export { ASYNCAPI, BPS, BUILD_HASHES, BYTECODE_HASHES, CANTON_LEG_KINDS, CANTON_OPS, CANTON_ORIGIN_ID, CANTON_PARTICIPANTS, CANTON_REGISTRY_STATES, CANTON_SOURCE_ANCHOR, CANTON_TICKET_RECEIPT_TYPES, CANTON_TRANSFER_OUTCOMES, 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 };
1998
- export type { AttestationCanton, AttestationEvm, AttestationsResponse, AuthChallenge, AuthOk, AuthResponse, AuthToken, CantonAllocation, CantonAllocationLeg, CantonAsset, CantonDeliveryOrder, CantonDeliveryOrderList, CantonHolding, CantonHoldingList, CantonIntent, CantonLeg, CantonLegKind, CantonLegTopology, CantonLegTransaction, CantonNetwork, CantonOp, CantonOpParams, CantonOpResult, CantonOpSummary, CantonParty, CantonPreapproval, CantonPrepare, CantonPrepared, CantonRegistryState, CantonSignature, CantonSourceIntent, CantonSourceOrder, CantonSubmit, CantonSubmitted, CantonTicketReceipt, ChallengeQuery, DecString, DeclineReason, DeploymentEnv, DrawAttempt, DrawCandidate, DrawClosedBy, DrawOutcome, DrawRecord, EpochLeaf, EpochRecord, EpochWeights, ErrorCode, ErrorF2S, ErrorMessage, EvmDeployment, ExemptReason, ExpiredResult, F2SBase, F2SEnvelope, F2SMessage, FeeClaim, FeeSplit, FillProof, FillProofJson, FillReported, FillTicket, FillerAuth, FillerCloseCode, FillerEnvelopeContext, FillerGateway, FillerKeyRegistration, FillerMessage, FillerQuote, FillerStats, GatewayInfo, GatewayMessage, Hex, JsonSchema, JsonValue, MessageDirection, Order, OrderDomain, OrderJson, OrderSettled, Page, PenaltyApplied, PenaltyList, PenaltyRecord, PenaltyStep, PermitWitness, Ping, PingF2S, PingS2F, Pong, PongF2S, PongS2F, Quote, QuoteAck, QuoteAckStatus, QuoteFinalStatus, QuoteList, QuoteMessage, QuoteReconfirm, QuoteReconfirmReply, QuoteRecord, QuoteRequest, RestEndpoint, RouteRef, RoutesSet, RoutesState, S2FBase, S2FMessage, SettleAttestations, SettleAttestationsPayload, SignedFillerKeyRegistration, StakeBinding, StakeBindingRequest, TicketDecline, TicketExpired, TicketIntent, TicketIntentAck, TicketIntentMessage, TicketIssued, TicketIssuedCanton, TicketIssuedEvm, TicketJson, TicketList, TicketOffer, TicketReceipt, TicketReceiptCanton, TicketReceiptEvm, TicketReceiptMessage, TicketRefusedReason, TimeMs, TypedDataDomain, TypedDataInput, TypedDataTypes, TypedField, TypedValue, UintLike, UnsignedErrorBody, WireAsset };
2021
+ export type { AttestationCanton, AttestationEvm, AttestationsResponse, AuthChallenge, AuthOk, AuthResponse, AuthToken, CantonAllocation, CantonAllocationLeg, CantonAsset, CantonDeliveryOrder, CantonDeliveryOrderList, CantonHolding, CantonHoldingList, CantonIntent, CantonLeg, CantonLegKind, CantonLegTopology, CantonLegTransaction, CantonNetwork, CantonOp, CantonOpParams, CantonOpResult, CantonOpSummary, CantonParty, CantonPreapproval, CantonPrepare, CantonPrepared, CantonRecipientReadiness, CantonRegistryState, CantonSettlementFactory, CantonSignature, CantonSourceIntent, CantonSourceOrder, CantonSubmit, CantonSubmitted, CantonTicketReceipt, ChallengeQuery, DecString, DeclineReason, DeploymentEnv, DrawAttempt, DrawCandidate, DrawClosedBy, DrawOutcome, DrawRecord, EpochLeaf, EpochRecord, EpochWeights, ErrorCode, ErrorF2S, ErrorMessage, EvmDeployment, ExemptReason, ExpiredResult, F2SBase, F2SEnvelope, F2SMessage, FeeClaim, FeeSplit, FillProof, FillProofJson, FillReported, FillTicket, FillerAuth, FillerCloseCode, FillerEnvelopeContext, FillerGateway, FillerKeyRegistration, FillerMessage, FillerQuote, FillerStats, GatewayInfo, GatewayMessage, Hex, JsonSchema, JsonValue, MessageDirection, Order, OrderDomain, OrderJson, OrderSettled, Page, PenaltyApplied, PenaltyList, PenaltyRecord, PenaltyStep, PermitWitness, Ping, PingF2S, PingS2F, Pong, PongF2S, PongS2F, Quote, QuoteAck, QuoteAckStatus, QuoteFinalStatus, QuoteList, QuoteMessage, QuoteReconfirm, QuoteReconfirmReply, QuoteRecord, QuoteRequest, RestEndpoint, RouteRef, RoutesSet, RoutesState, S2FBase, S2FMessage, SettleAttestations, SettleAttestationsPayload, SignedFillerKeyRegistration, StakeBinding, StakeBindingRequest, TicketDecline, TicketExpired, TicketIntent, TicketIntentAck, TicketIntentMessage, TicketIssued, TicketIssuedCanton, TicketIssuedEvm, TicketJson, TicketList, TicketOffer, TicketReceipt, TicketReceiptCanton, TicketReceiptEvm, TicketReceiptMessage, TicketRefusedReason, TimeMs, TypedDataDomain, TypedDataInput, TypedDataTypes, TypedField, TypedValue, UintLike, UnsignedErrorBody, WireAsset };
package/dist/index.js CHANGED
@@ -745,7 +745,8 @@ var DECLINE_REASONS = [
745
745
  "ESCROW_MISMATCH",
746
746
  "PROOF_WINDOW_TOO_SHORT",
747
747
  "SKEW_MARGIN_TOO_SHORT",
748
- "DRAW_MISMATCH"
748
+ "DRAW_MISMATCH",
749
+ "RECIPIENT_NOT_READY"
749
750
  ];
750
751
  var ERROR_CODES = [
751
752
  "BAD_REQUEST",
@@ -2535,7 +2536,7 @@ var messages_schema_default = {
2535
2536
  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]`" },
2536
2537
  declineReason: {
2537
2538
  anyOf: [
2538
- { 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"] },
2539
+ { 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"] },
2539
2540
  { $ref: "#/$defs/futureEnumValue" }
2540
2541
  ]
2541
2542
  },
@@ -3579,6 +3580,7 @@ var rest_schema_default = {
3579
3580
  { method: "GET", path: "/v1/filler/canton/holdings", auth: "bearer", query: "#/$defs/pageQuery", response: "#/$defs/cantonHoldingList" },
3580
3581
  { method: "GET", path: "/v1/filler/canton/delivery-orders", auth: "bearer", query: "#/$defs/pageQuery", response: "#/$defs/cantonDeliveryOrderList" },
3581
3582
  { method: "GET", path: "/v1/filler/canton/intents/{orderHash}", auth: "bearer", response: "#/$defs/cantonIntent" },
3583
+ { method: "GET", path: "/v1/filler/canton/recipient-readiness/{orderHash}", auth: "bearer", response: "#/$defs/cantonRecipientReadiness" },
3582
3584
  { method: "GET", path: "/v1/filler/routes", auth: "bearer", response: "messages.schema.json#/$defs/routes.state" },
3583
3585
  { method: "POST", path: "/v1/filler/routes", auth: "bearer", request: "messages.schema.json#/$defs/routes.set", response: "messages.schema.json#/$defs/routes.state" }
3584
3586
  ],
@@ -3781,9 +3783,22 @@ var rest_schema_default = {
3781
3783
  required: ["items", "nextCursor"],
3782
3784
  properties: { items: { type: "array", items: { $ref: "#/$defs/cantonDeliveryOrder" } }, nextCursor: { type: ["string", "null"] } }
3783
3785
  },
3786
+ cantonRecipientReadiness: {
3787
+ type: "object",
3788
+ 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",
3789
+ required: ["orderHash", "deliveryOrderCid", "recipient", "asset", "ready", "reason"],
3790
+ properties: {
3791
+ orderHash: { $ref: "messages.schema.json#/$defs/bytes32" },
3792
+ deliveryOrderCid: { type: "string", minLength: 1 },
3793
+ recipient: { type: "string", minLength: 1, description: "DeliveryOrder.recipient" },
3794
+ asset: { $ref: "messages.schema.json#/$defs/cantonAsset", description: "DeliveryOrder.instrumentId" },
3795
+ ready: { type: "boolean" },
3796
+ reason: { anyOf: [{ enum: ["RECIPIENT_NOT_READY", "INSTRUMENT_NOT_SUPPORTED", null] }, { $ref: "messages.schema.json#/$defs/futureEnumValue" }], description: "why not; null when ready" }
3797
+ }
3798
+ },
3784
3799
  cantonIntent: {
3785
3800
  type: "object",
3786
- 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\u2026V-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",
3801
+ 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\u2026V-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",
3787
3802
  required: ["intentCid", "templateId", "orderHash", "owner", "operator", "filler", "fillerId", "requestId", "asset", "amount", "destination", "minReceived", "feeRate", "fillDeadline", "refundAfter", "orderCreatedAt", "allocationCid", "allocation"],
3788
3803
  properties: {
3789
3804
  intentCid: { type: "string", minLength: 1 },
@@ -3819,6 +3834,17 @@ var rest_schema_default = {
3819
3834
  allocation: {
3820
3835
  anyOf: [{ $ref: "#/$defs/cantonAllocation" }, { type: "null" }],
3821
3836
  description: "the contract allocationCid names, by its AllocationV2 view; null when it is not live"
3837
+ },
3838
+ settlementFactory: {
3839
+ anyOf: [
3840
+ {
3841
+ type: "object",
3842
+ required: ["contractId", "live"],
3843
+ properties: { contractId: { type: "string", minLength: 1 }, live: { type: "boolean" } }
3844
+ },
3845
+ { type: "null" }
3846
+ ],
3847
+ 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"
3822
3848
  }
3823
3849
  }
3824
3850
  },