Skip to content

Serve the registry HTTP API over the Canton JSON Ledger API #30

Closed

Description

@lmcorbalan

User story / Problem statement

As a wallet or a standard client, I want to discover instruments and fetch the choice context for a transfer or allocation over HTTP, so that I can transact against this token without knowing anything about its concrete Daml templates.

Expected outcome

A running service exposes the CN Token Standard Registry HTTP API over the Canton JSON Ledger API. Metadata endpoints list and resolve instruments. Factory and choice-context endpoints return the contract disclosures and context values a client needs to exercise a standard choice. Admin endpoints let the operator drive propose-accept registration.

Acceptance criteria

  • A self-contained registry/ TypeScript package that does not touch the Daml package
  • Metadata endpoints: /info, list instruments, get instrument by id
  • Transfer factory plus accept, reject, and withdraw choice-context endpoints
  • Allocation factory plus execute-transfer, withdraw, and cancel choice-context endpoints
  • Admin propose, accept, and reject endpoints, with off-ledger (admin, instrumentId) uniqueness and a 409 backstop on ambiguous reads
  • A ledger client covering active-contract queries and command submission
  • Every response validates against the vendored OpenAPI schemas in tests
  • Async route rejections cannot hang a request, and configuration errors surface clearly

Technical notes

NodeNext ESM, so every relative import in src/ needs a .js extension. Choice contexts are full fidelity, not empty: the direct-transfer path carries the preapproval contract id and discloses the preapproval, allocation cancel carries the expire-lock signal, and the instruction and allocation choices disclose the escrow LockedToken. createdEventBlob and synchronizerId come from the active-contracts query.

The single most error-prone detail: InstrumentConfig payloads expose the id as instrumentId (Text), while the standard InstrumentId value type carries .admin and .id. These are different shapes and must not be conflated.

Additional context

Part of #21. Implemented by #7.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpriority: highMust be addressed in current sprint

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions