Skip to main content

Crate canton_token

Crate canton_token 

Source
Expand description

Canton Network token-standard workflows (CIP-56 and CIP-0112).

The token-standard types are generated from the Splice DARs and live in the canton-splice-api-token-* crates. This crate is the workflow over them: resolving a factory, asking a registry for a choice context, attaching the contracts it says to disclose, and exercising the choice.

Nothing here re-declares a Daml type. That would duplicate the code generator and go stale on the next Splice release; the Holding this crate names is the same Rust type an application reads out of the ledger.

§Why a registry is involved at all

A transfer is exercised through an interface, and only the registry knows what reference data that choice needs — its own configuration contracts, the rules for an instrument, the current round. So the client asks for a choice context and gets back both the data to pass in and the contracts the participant must be shown. Those contracts are usually invisible to the submitting party, which is exactly what explicit disclosure is for.

The registry’s API is off-ledger HTTP, specified by the token standard’s OpenAPI documents.

Re-exports§

pub use transfer::TokenCommand;
pub use transfer::accept;
pub use transfer::reject;
pub use transfer::transfer;
pub use transfer::withdraw;

Modules§

allocation
Allocations: reserving holdings now so a third party can settle later.
holdings
Which holdings a party has, read from the ledger.
transfer
CIP-56 transfers: resolve the factory, take its context, exercise the choice.
types
The generated token-standard types this crate’s API is written in terms of, re-exported so they can be named without depending on each generated crate directly.
v2
CIP-0112 — the V2 token standard.

Structs§

ChoiceContext
A choice context, ready to be used against either transport.
ChoiceContextRequest
A request for a choice context.
FactoryWithContext
A factory contract together with the context for exercising its choice.
Holding
The V1 Holding interface, at the root because it is the type a caller reaches for first. Everything else is under types. Marker for the Daml interface Holding (held via ContractId).
Instrument
An instrument the registry issues.
RegistryClient
A client for one registry’s off-ledger API.
RegistryInfo
What a registry says about itself.
WireChoiceContext
What a registry returns for a choice.
WireDisclosedContract
A contract the participant must be shown for a choice to resolve.

Enums§

AllocationChoice
The choices an allocation offers.
AllocationInstructionChoice
The choices a V2 allocation instruction offers.
TransferInstructionChoice
The choices a transfer instruction offers, as the registry paths name them.
TransferKind
How a transfer will be carried out, as the registry decides.