Skip to content

Releases

v0.8.1: matching failures on gRPC and JSON, ProblemDetails middleware 🛡️

Choose a tag to compare

@github-actions github-actions released this 15 Nov 21:51
Immutable release. Only release title and notes can be modified.
ca748b9

🚀 Canton .NET SDK: 0.8.1

TL;DR: a small hardening release on the 0.8 line ✅: a malformed or degenerate answer from a participant now fails the same way on the gRPC and JSON clients ✅, point reads and the flattened transaction tree agree on which contracts a transaction created and archived ✅, and Canton.Ledger.AspNetCore gains a middleware for hosts that already own their exception handling ✅. It changes some observable behaviour and removes no API, so read the upgrade notes below before bumping.

💥 Upgrading from 0.8.0

⚠️ Bump every package to 0.8.1 together, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared.

  • ⏱️ A zero or negative per-call timeout is now a caller error. The call throws ArgumentOutOfRangeException for the timeout parameter before anything is sent, on both clients, the writer helpers and FakeLedgerClient. Timeout.InfiniteTimeSpan applies no SDK-side deadline on both transports. If a test passed TimeSpan.Zero and expected a DeadlineExceeded, pass a small positive value instead.
  • 🧮 Point reads and the updates page list the ACS-delta contracts only. GetUpdateByOffsetAsync, GetUpdateByIdAsync and GetUpdatesPageAsync no longer report a contract created and archived in the same transaction as created. To see every create, read the TreeEvent.Created nodes of GetUpdateTreeByOffsetAsync. TransactionTree.ToTransactionResult() follows the same rule, so Single<T>() works on such a transaction.
  • 🧯 Canton.Ledger.AspNetCore answers 409 Conflict for a command rejected with LOCAL_VERDICT_INACTIVE_CONTRACTS, where it answered 404. A 400 no longer carries the participant's message, only a fixed detail and the Daml error id; set LedgerProblemOptions.IncludeLedgerErrorMessages in development to get the message back.
  • 🔢 DamlNumeric serialises as {"Value":"1234.5678"} in its System.Text.Json form, a canonical string instead of a JSON number, so a Numeric that decimal cannot hold no longer throws. A payload you cached in the old form no longer reads. DamlJsonSerializer and the Ledger API wire forms are unchanged.
  • 🔤 REST boolean query parameters are sent as True or False, as Refit does by default. The participant reads them case-insensitively, so uploads behave as before.

Coming from before 0.8.0? See the [0.8.0] section of the CHANGELOG first.

✨ Highlights

  • 🧱 app.UseCantonLedgerProblemDetails(): answers a ledger failure as ProblemDetails without taking over the host's exception handling. It catches only LedgerOperationException and lets every other exception reach your own handler, so a contended 409 is logged as the response it became.
    app.UseCantonLedgerProblemDetails();
  • 🧭 Malformed input fails in band: a bad update offset, a checkpoint offset or an oversized reassignment counter no longer throws out of SubscribeAsync. An update surfaces as one Unclassified with UnclassifiedKind.DecodeFailure and the stream keeps going, and a malformed checkpoint ends the stream with a terminal StreamError.
  • 🤝 One error shape on both transports: a missing contract id and an unset Daml value are reported as MalformedResponseException on gRPC and on the JSON Ledger API.
  • 🟰 Structural equality for lists and maps: a list or map inside Tuple2, Optional, Either, Map, Set, NonEmpty or a generated generic record now compares by content, so two decodes of the same payload are Equals. Regenerate your bindings to pick it up.
  • 🗂️ Supported Daml-LF input is published: Daml-LF 2.1 to 2.4 and 2.5-rc1, each proven by a conformance fixture in CI, listed in the cross-version matrix.

🐛 Fixed

  • 💾 A TransactionResult cached as JSON and read back is equal to the original and keeps its node numbering and requested interfaces, so Single<I>() on an interface works on it.
  • 🔁 A retry configuration that passes startup validation now builds a working client: Retry:MaxRetryAttempts of 0 sends each call once instead of throwing.
  • 🎲 ClientCredentialsProvider jitters its token-failure cooldown, so applications that lost their identity provider together do not all fetch a token at the same moment.

The full list is in the CHANGELOG.

📦 What's in the release

All 17 SDK packages ship on the single 0.8.1 version line, with the dpm codegen-cs component at oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.8.1. The Splice.* bindings stay generated from Splice 0.10.0 and the Daml.Finance.* bindings from Daml Finance 2.10.0, each versioned after its DAR. The Daml SDK stays at 3.7.1.

🔗 Links

v0.8.0: Canton 3.7, Splice 0.10.0 bindings, Daml SDK 3.7.1 🚀

Choose a tag to compare

@github-actions github-actions released this 07 Nov 14:26
Immutable release. Only release title and notes can be modified.
366abcb

🚀 Canton .NET SDK: 0.8.0

TL;DR: Canton 3.7: the clients target Canton 3.7.1 and support Canton 3.7 only. External-party onboarding accepts protocol version 37's v31 topology transactions. Canton 3.6 users stay on 0.7.x. 0.8.0 is a breaking release that opens the Canton 3.7 line on Canton 3.7.1 ✅, ships the Splice.* bindings for Splice 0.10.0 ✅ and moves to Daml SDK 3.7.1 ✅. Read the upgrade notes below before bumping.

💥 Upgrading from 0.7.1

⚠️ Bump every package to 0.8.0 together, install the new Daml SDK with dpm install 3.7.1, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared. Anything compiled against an earlier package must be rebuilt, or it throws MissingMethodException.

  • 🌐 Canton 3.7 only. The vendored gRPC protos and JSON Ledger API spec move to Canton 3.7.1, and running the clients against an older participant is untested and unsupported. If your participant runs Canton 3.6, stay on 0.7.x.
  • 🗑️ GetPreferredPackageVersion is gone from both raw tiers, because Canton 3.7 deletes the RPC and its route. Call GetPreferredPackages instead. The experimental REST IInteractiveSubmissionApi is gone too.
  • 🧩 Interfaces gained members. ICantonLedgerClient gains GetEventsByContractIdAsync<TInterface, TView> and the raw REST IStateServiceApi gains ConvertRecordTimeToOffset. A type that implements either outside the SDK must add them.
  • 📸 Snapshot reads take a timeout and an unreadable-rows policy. QueryActiveAsync<TInterface, TView> and the SnapshotAsync/SnapshotActiveAsync extensions gain timeout and unreadableRows before the CancellationToken, and return an ActiveSnapshot<TRow>. A call that passes the token by position must name it: cancellationToken: token.
  • 🏷️ OneOrThrow, OneOrThrowAsync and ThrowIfError take no operation name. Delete the string argument: the outcome now carries the template and choice that produced it.
  • 🔤 Two DamlErrorCategory members take Canton's names: MaliciousOrFaultyBehaviour is now SecurityAlert and AuthorizationChecksFailed is now InsufficientPermission. The numeric values are unchanged, and there is no alias.
  • 🧬 The generated TryCreateAsync takes workflowId, commandId and timeout before configure. A call that passes configure by position must name it (configure: ...).
  • 🧪 Test doubles changed shape. RecordedSubmission.Commands, Reassignment and Execution gain a trailing Timeout member, CompletionStreamEvent.Checkpoint gains SynchronizerTimes, and WithSubmissionOutcome, WithThrowingCallFailure and CompletionEvents.Checkpoint changed signature. Update positional constructions and deconstructions, then rebuild your test assemblies.
  • 🆔 Conformance packages have new identities. The corpus in Daml.Codegen.Testing.Conformance is rebuilt on Daml SDK 3.7.1 with new package names and ids, and IConformanceProbe carries the real package id and name of its DAR. Take ids from the generated types, never from literals.

Coming from before 0.7.1? See the [0.7.1] and [0.7.0] sections of the CHANGELOG first.

✨ Highlights

  • 🌐 The Canton 3.7 Ledger API on both raw tiers: ConvertRecordTimeToOffset, ReassignmentCosts, IncludeIncompleteReassignments on active-contract requests, the validation package overrides on UnassignCommand, and ProtocolVersion on external-party topology requests.
  • 🧺 CommandBatch: submit several typed commands as one atomic transaction and read each command's typed result back.
    var batch = new CommandBatch();
    var ended = batch.Add(Connection.ChoiceDisconnect, connectionId, new Connection.Disconnect(actor));
    var link = batch.AddCreate(new InviteLink(...));
    var results = (await client.TrySubmitBatchAsync(batch, actor)).OneOrThrow();
    ContractId<InviteLink> created = results.Get(link);
  • 🛟 RecoverAsync: resolves a write that failed with CommitState.Unknown into committed, rejected or lost, by reading the completion stream.
  • 🧱 New package Canton.Ledger.AspNetCore: AddCantonLedgerProblemDetails() answers a failed ledger command as RFC 9457 ProblemDetails (409 for contention, 202 for a command that committed), and ProducesLedgerProblems() declares those responses in your OpenAPI document.
  • 🪙 Splice Token Standard, typed end to end: Splice.Api.Token.Registry.Client is a typed client for registries' off-ledger API, and CreatedEventBlob.Decode reads a disclosed contract's signatories, observers and typed payload before you use it.
  • 🏗️ Richer generated code: keyed templates get Try<Choice>ByKeyAsync, every archivable template and interface implements IArchivable<TSelf>, and a module's top-level literal values become public const fields.

🐛 Fixed

  • 🔐 External-party onboarding decodes the v31 topology transactions a protocol version 37 synchronizer returns, as well as v30, instead of refusing them.
  • 🔀 A snapshot that holds a contract with a reassignment in flight returns that contract once instead of throwing.
  • 🛑 Generating a second DAR into an output directory another package already fills now stops with a clear error instead of deleting the first package's bindings.

The full list is in the CHANGELOG.

📦 What's in the release

All 17 SDK packages ship on the single 0.8.0 version line, including the newly published Canton.Ledger.AspNetCore, with the dpm codegen-cs component at oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.8.0. The Splice.* bindings are generated from Splice 0.10.0 and the Daml.Finance.* bindings from Daml Finance 2.10.0, each versioned after its DAR.

🔗 Links

v0.7.1: MSBuild codegen published, safer telemetry, sturdier test kit 🧰

Choose a tag to compare

@github-actions github-actions released this 23 Oct 17:49
Immutable release. Only release title and notes can be modified.
6d1c90a

🚀 Canton .NET SDK: 0.7.1

TL;DR: a hardening release on the 0.7 line ✅: Daml.Codegen.CSharp.MSBuild is now published, so bindings generate at dotnet build time with no JDK needed ✅, and telemetry hides party, user and contract ids unless you opt in ✅. It also removes some API surface, so read the upgrade notes below before bumping.

💥 Upgrading from 0.7.0

⚠️ Bump every package to 0.7.1 together, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared. Anything compiled against an earlier Daml.Runtime must be rebuilt, or it throws MissingMethodException.

  • 🗑️ Daml.Runtime.Grpc is gone. Its DamlValueConverter now lives inside Canton.Ledger.Grpc.Client as an internal type. Reference Canton.Ledger.Grpc.Client instead: it converts values for you on every submission, query and subscription. If you called the converter directly, use the generated Canton.Ledger.Grpc proto types and your own mapping.
  • 🔢 DamlNumeric.Scale is removed, along with the scale constructor parameter. new DamlNumeric(1.5m) recompiles unchanged and behaves as before; new DamlNumeric(1.5m, 10) no longer compiles.
  • 🧬 Generated bindings must be regenerated. The hidden DamlRecord.GetOptionalField(string), GetOptionalChainField(string) and GetTypeParameterField<T>(string, ...) overloads are replaced by position-aware ones.
  • 📦 NuGet ids of generated projects changed. The id is now derived one hyphen-separated part at a time: token_utils gives Token_utils, a.b gives A_u002eb, and a part starting with a digit is escaped. a-b still gives A.B. Update any package reference that used a changed id. Generation now stops with an error if two packages would share an id.
  • 🔧 DeserializeRecord(string, JsonSerializerOptions?) is removed (it never read its options). Call DeserializeRecord(json) or DeserializeRecord(json, limits).
  • 🚩 dar2intermediate takes -v, not -V, for verbosity. A script that passed -V 2 must pass -v 2.
  • 🔭 Telemetry is private by default. The canton.user_id span tag, ids in the admin log lines and exception messages are hidden unless EmitPartyAndContractSpanTags is true. A dashboard or log query that matches on those ids finds nothing until you set it. The option now exists on the gRPC, JSON and PQS clients.
  • ⏱️ The JSON client's timeout is per attempt, as on the gRPC client, and defaults to 30 seconds through the new RestLedgerClientOptions.Timeout. With retries on, one call can take longer than a single timeout; pass a CancellationToken for a hard cap.
  • 🕒 Daml Time from JSON must be in the ledger's form: at most six fractional digits and a trailing Z. Other forms now throw JsonException.
  • 🧪 The conformance kit is stricter. Your seeded client may now fail stream checks it used to pass: seed an event after the first position, and keep a live subscription open until its token is cancelled. The richtypes and defaulttarget test packages also changed name and package id, and RichRecord gained fields.
  • 📉 Smaller changes: ExerciseCommand.ForInterface<TInterface> is removed (use ExerciseCommand.For<TOwner>), VerbosityConsoleLoggerProvider is now internal, a blank contract id is refused at construction, and OpenTelemetry 1.20.0 and Refit 16.4.0 are the new minimums.

Coming from before 0.7.0? See the [0.7.0] section of the CHANGELOG first.

✨ Highlights

  • 🏗️ MSBuild codegen is published: add <DamlArchive Include="contracts.dar" /> and bindings generate at build time. The default Standalone mode needs no JDK; Dpm mode runs dpm codegen-cs and pins the bundle by digest. Regenerating also deletes files the new run no longer emits.
  • 🆔 ContractIdAs<T>(): turns the string contract id on a raw CreatedContract, ExercisedEvent or tree event into a checked ContractId<T>, matching templates by package name so an upgraded package still resolves.
    var cid = created.ContractIdAs<Iou>();
  • 🧾 FakeLedgerClient.Submissions: every write the fake received, in call order, so a test can assert the right parties, payload and choice arguments went out.
  • 🏭 More testing factories: CompletionEvents, InterfaceEvents and InterfaceLedgerEvents in Canton.Ledger.Testing, so you stage streams without naming record constructors.
  • 🔒 Telemetry privacy defaults: ids and exception messages stay out of spans, logs and health checks unless you opt in.
  • 💸 PaidTrafficCost: TransactionResult and TransactionTree now report the confirmation traffic cost the submitting participant paid.

🐛 Fixed

  • 🔁 The JSON client now retries an attempt that exceeds its timeout; before, one deadline covered the whole call and the retry never ran.
  • 🧱 Codegen with IncludeDependencies no longer also references a package whose types it already emits, so no type exists twice, and it now stops with a clear error on higher-kinded types, invalid RootFilter patterns and unsupported Daml-LF minors instead of emitting broken bindings.
  • 📖 A non-verbose gRPC GetContract (as Canton 3.5.18 answers) now decodes by position, and GetContractAsync<T> makes one call instead of two.

The full list is in the CHANGELOG.

📦 What's in the release

Every package ships on the single 0.7.1 version line, including the newly published Daml.Codegen.CSharp.MSBuild.

🔗 Links

v0.7.0 — Canton 3.6, with verified signing 🚀

Choose a tag to compare

@github-actions github-actions released this 14 Oct 18:41
Immutable release. Only release title and notes can be modified.
2353005

🚀 Canton .NET SDK — 0.7.0

TL;DR — the stable release for Canton 3.6 ✅: the ledger clients now verify what a participant tells them before you sign it or trust it ✅, and one failure contract covers both transports ✅. On Canton 3.5, stay on 0.6.x.

✨ Highlights

  • 🧭 Canton 3.6: the protos and JSON Ledger API spec are pinned at Canton 3.6.1, and the release is tested against LocalNet 0.9.1 (Splice 0.9.1) and PQS 3.6.0. Codegen runs on Daml SDK 3.6.0.
  • 🔐 Prepared transactions are verified: PrepareSubmissionAsync recomputes the transaction hash on both transports (hashing schemes V2 and V3). It refuses a mismatch, or a V4 hash it cannot verify, before you sign, and there is no option to skip the check. GenerateExternalPartyTopologyAsync decodes the onboarding topology and fails closed unless it is exactly what Canton 3.6 generates for your request. AllocateExternalPartyAsync derives the expected party from the onboarding transactions and refuses any other.
  • 🏷️ Templates by package name: submitted commands address #<package-name>:Module:Entity, and a result matches a generated template by package name. A contract created under an earlier version of a package still matches after an upgrade. CommandsSubmission.WithPackageIdSelectionPreference pins a version when you need one.
  • 🛟 One failure contract: on both transports, a token that cannot be fetched is reported as NotCommitted with a TokenAcquisitionException, and a retried write whose outcome is unknown is Unknown. LedgerOperationException.CommandId and ExerciseOutcome<T>.CommandId name the command to look up on the completion stream:
    catch (LedgerOperationException ex) when (ex.CommitState == CommitState.Unknown)
    {
        var commandId = ex.CommandId; // look it up on CompletionStreamAsync before resubmitting
    }
  • 🧯 Token failures back off instead of retrying: ClientCredentialsProvider cools down after a failed token fetch (TokenFailureCooldownOptions, on by default, 500 ms doubling to 30 s), so an identity provider that is down isn't hit by every call. Calls inside the window fail at once as NotCommitted, and the cooldown never re-sends a command.
  • 🌐 Safer HTTP and supply chain: the JSON Ledger API client caps response bodies (MaxResponseBodyBytes) and finishes bounded reads, and neither client follows redirects. The release pipeline pins the Daml SDK manifest and the damlc and daml-script components by SHA-256. It also verifies the Splice and Daml.Finance bundles by SHA-256 before generating from them.

💥 Upgrading from 0.6.0

⚠️ Move to Canton 3.6 first. Then bump every package to 0.7.0 together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs) and regenerate.

  • 🧩 PrepareSubmissionAsync takes hashingSchemeVersion before timeout. Name timeout: if you pass it positionally, and add the parameter to your own ICantonLedgerClient implementations.
  • 🗑️ GetPreferredPackageVersionAsync and PackagePreference are removed: use GetPreferredPackagesAsync. PackageStatus.Unrecognized, HashFunction.Unrecognized and SynchronizerPermissionLevel.Unrecognized are removed too. An unknown value now raises LedgerOperationException classified UndecodableBody.
  • 🏷️ CreatedContract, ExercisedEvent and the command records gain PackageName. Code that builds them by hand, test-double inputs included, must set it.
  • 🔒 PrepareSubmissionAsync refuses a participant that answers with a hashing scheme other than V2 or V3, V4 included. AllocateExternalPartyAsync throws ArgumentException before sending anything when the onboarding transactions aren't the single PartyToParticipant transaction that GenerateExternalPartyTopologyAsync returned.
  • 🔑 A token that cannot be acquired is now a LedgerOperationException (NotCommitted) carrying a TokenAcquisitionException, on gRPC as well as REST. Catch that instead of the token provider's own exception. The token cooldown is on by default: set ClientCredentialsOptions.TokenFailureCooldown.Enabled = false to fetch on every call again.
  • 🔁 ExerciseOutcome<T> equality includes CommandId. A retried write rejected for anything other than DUPLICATE_COMMAND now comes back from a Try* call as InfraError, so match that as well as DamlError. An InfraError on a write means the outcome is unknown: look the CommandId up on CompletionStreamAsync, and don't resubmit.
  • 🔀 The OAuth2 and JSON clients no longer follow redirects: point TokenEndpoint and HttpAddress at the final URL.
  • 📌 Every Microsoft.Extensions.* dependency moves to 10.0.13. Raise any explicit lower pin, or the restore reports a downgrade.
  • 🏷️ The conformance packages are rebuilt on Daml SDK 3.6.0, and the default-target package moves to Daml-LF 2.3.

Already on 0.7.0-preview.1? 0.7.0 is the same code plus the Microsoft.Extensions.* 10.0.13 move. Change the version, and raise any explicit Microsoft.Extensions.* pin below 10.0.13.

Every change, with the exact members, is in the CHANGELOG sections for 0.7.0 and 0.7.0-preview.1.

🐛 Fixed

  • GetDisclosureAsync returns null only for CONTRACT_EVENTS_NOT_FOUND. Any other not-found rejection now raises LedgerOperationException.
  • A bounded SubscribeAsync read over the JSON Ledger API no longer ends early on a sparse filter.
  • The gRPC client no longer replays AllocatePartyAsync, CreateUserAsync and the other non-idempotent admin writes under Retry.

The full list is in the CHANGELOG.

🙏 Thanks

Thank you to the Rust SDK team for #82 through #91, which drove much of the 0.7 line.

📦 What's in the release

16 core packages are at 0.7.0. 33 Splice packages are at *.19 (Splice 0.9.1, e.g. Splice.Api.Token.Holding.V2 1.0.0.19), and 8 Daml.Finance packages are at *.18 (Daml Finance 2.10.0, e.g. Daml.Finance.Interface.Holding.V4 4.0.0.18). All of them are on nuget.org. The codegen also ships as oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.7.0.

Version
.NET 10 (net10.0)
Canton 3.6.x; protos and JSON Ledger API spec pinned at 3.6.1
Daml SDK 3.6.0
Splice bindings built from Splice 0.9.1
Daml Finance bindings built from Daml Finance 2.10.0

The SDK is pre-1.0: under SemVer 0.x, a release may change the public API without a major-version bump.

📖 Full changelog: https://github.com/peacefulstudio/canton-dotnet-sdk/blob/v0.7.0/CHANGELOG.md
🔍 Compare: v0.6.0...v0.7.0
🐛 Questions and bugs: GitHub issues

v0.7.0-preview.1

v0.7.0-preview.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 13 Oct 22:32
Immutable release. Only release title and notes can be modified.
a241d7a

🚀 Canton .NET SDK — 0.7.0-preview.1

TL;DR — the SDK now targets Canton 3.6 ✅ and the ledger clients verify what a participant tells them before you sign or trust it ✅. Preview, pre-1.0 SemVer: the API can still move between previews.

✨ Highlights

  • 🧭 Canton 3.6: protos and JSON Ledger API spec at Canton 3.6.1, tested against LocalNet 0.9.1 (Splice 0.9.1) and PQS 3.6.0. On Canton 3.5, stay on 0.6.x.
  • 🔐 Prepared transactions are verified: PrepareSubmissionAsync recomputes the transaction hash on both transports (hashing schemes V2 and V3) and refuses a mismatch, or a V4 hash it cannot verify, before you sign; there is no option to skip the check. GenerateExternalPartyTopologyAsync decodes the onboarding topology and fails closed unless it is exactly what Canton 3.6 generates for your request, and AllocateExternalPartyAsync derives the expected party from the onboarding transactions and refuses any other.
  • 🏷️ Templates by package name: submitted commands address #<package-name>:Module:Entity, and a result matches a generated template by package name, so a contract created under an earlier version of a package still matches after an upgrade. CommandsSubmission.WithPackageIdSelectionPreference pins a version when you need one.
  • 🛟 One failure contract: a token that cannot be fetched is reported as NotCommitted with a TokenAcquisitionException on both transports, a retried write whose outcome is unknown is Unknown, and LedgerOperationException.CommandId / ExerciseOutcome<T>.CommandId name the command to look up on the completion stream:
    catch (LedgerOperationException ex) when (ex.CommitState == CommitState.Unknown)
    {
        var commandId = ex.CommandId; // look it up on CompletionStreamAsync before resubmitting
    }
  • 🧯 Token failures back off, they do not retry: ClientCredentialsProvider now cools down after a failed token fetch (TokenFailureCooldownOptions, on by default, 500 ms doubling to 30 s), so an identity provider that is down is not hit by every call. Calls inside the window fail at once as NotCommitted; the cooldown never re-sends a command. Thanks to the Rust SDK team's review for #89.
  • 📌 Supply-chain pinning: the release pipeline pins the Daml SDK manifest and the damlc and daml-script components by sha256 and verifies the Splice and Daml.Finance bundles by SHA-256 before generating from them (#91).
  • 🌐 Safer HTTP: the JSON Ledger API client caps response bodies (MaxResponseBodyBytes), finishes bounded reads, and neither client follows redirects. Raw calls are not replayed by the opt-in retry pipeline unless you allow it.

💥 Upgrading from 0.6.0

⚠️ Bump every package to 0.7.0-preview.1 together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate.

  • 🧩 PrepareSubmissionAsync takes hashingSchemeVersion before timeout: name timeout: if you pass it positionally, and add the parameter to your own ICantonLedgerClient implementations.
  • 🗑️ GetPreferredPackageVersionAsync and PackagePreference are removed: use GetPreferredPackagesAsync. PackageStatus.Unrecognized, HashFunction.Unrecognized and SynchronizerPermissionLevel.Unrecognized are removed: an unknown value now raises LedgerOperationException classified UndecodableBody.
  • 🏷️ CreatedContract, ExercisedEvent and the command records gain PackageName. Code that builds them by hand, including test-double inputs, must set it.
  • 🔒 PrepareSubmissionAsync refuses a participant that answers with a hashing scheme other than V2 or V3, V4 included, and AllocateExternalPartyAsync throws ArgumentException before sending anything when the onboarding transactions are not the single PartyToParticipant transaction GenerateExternalPartyTopologyAsync returned.
  • 🔑 A token that cannot be acquired is now a LedgerOperationException (NotCommitted) carrying a TokenAcquisitionException, on gRPC as well as REST: catch that instead of the token provider's own exception. The token cooldown is on by default; set ClientCredentialsOptions.TokenFailureCooldown.Enabled = false to fetch on every call again.
  • 🔁 ExerciseOutcome<T> equality includes CommandId. A retried write rejected for anything but DUPLICATE_COMMAND now comes back as InfraError from a Try* call: match it as well as DamlError. If you map outcomes to HTTP, an InfraError on a write means the outcome is unknown: answer 202, look the CommandId up on CompletionStreamAsync and do not resubmit (the Appendix A.11 request handler in the proposal-as-shipped page does exactly this).
  • 🔀 The OAuth2 and JSON clients no longer follow redirects: point TokenEndpoint and HttpAddress at the final URL.
  • 🏷️ Conformance packages rebuilt on Daml SDK 3.6.0: richtypes-hf9ffaa5ee2ff → richtypes-ha8d30776aa45, contractkeys-h4fd930e5658f → contractkeys-hcc6e8a4f16d9, and the default-target package moves to Daml-LF 2.3.

Every change, with the exact members, is in the CHANGELOG.

🐛 Fixed

  • GetDisclosureAsync returns null only for CONTRACT_EVENTS_NOT_FOUND; any other not-found rejection now raises LedgerOperationException.
  • A bounded SubscribeAsync read over the JSON Ledger API no longer ends early on a sparse filter.
  • A retried submission whose DUPLICATE_COMMAND rejection points at another command's transaction no longer resolves to that transaction.
  • The gRPC client no longer replays AllocatePartyAsync, CreateUserAsync and the other non-idempotent admin writes under Retry.

The full list is in the CHANGELOG.

🙏 Thanks

Thank you to the Rust SDK team for #82 through #91, which drove much of this release.

📦 What's in the release

16 core packages at 0.7.0-preview.1, 33 Splice packages at *.18-preview.1 (Splice 0.9.1, LocalNet v0.9.1-1; the Splice DARs are byte-identical to 0.9.0, so the generated code is unchanged) and 8 Daml.Finance packages at *.17-preview.1 (Daml Finance 2.10.0), all on nuget.org. The codegen also ships as oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.7.0-preview.1.

📖 Full changelog: https://github.com/peacefulstudio/canton-dotnet-sdk/blob/v0.7.0-preview.1/CHANGELOG.md
🔍 Compare: v0.6.0...v0.7.0-preview.1

v0.6.0 — first stable release 🚀

Choose a tag to compare

@github-actions github-actions released this 07 Oct 14:14
Immutable release. Only release title and notes can be modified.
268e147

🚀 Canton .NET SDK — 0.6.0

The Canton .NET SDK lets you build .NET applications on a Canton/Daml ledger with full type safety. dpm codegen-cs turns a Daml .dar archive into strongly-typed C#: records for every template and data type, typed choices, and Try…Async methods that create contracts and exercise choices. One transport-neutral ICantonLedgerClient then submits them over gRPC or the JSON Ledger API, with a PQS client, authentication, OpenTelemetry tracing and in-memory test doubles alongside.

0.6.0 is the first stable release. It's for .NET teams building applications on Canton.

📦 What's included

All 16 NuGet packages share version 0.6.0 with the dpm codegen-cs component. They publish together; upgrade them together.

Role Packages
Codegen oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.6.0 (the dpm component); Daml.Codegen.CSharp (the emitter as a library); Daml.Codegen.Intermediate (the Intermediate DAR contract it consumes)
Runtime Daml.Runtime (the types generated code compiles against); Daml.Runtime.Grpc (proto Value ⇄ DamlValue conversion)
Ledger clients Canton.Ledger.Grpc.Client (the default transport); Canton.Ledger.Rest.Client (the same surface over the JSON Ledger API); Canton.Ledger.Pqs.Client (typed queries over the Participant Query Store)
Abstractions and plumbing Daml.Ledger.Abstractions (ILedgerClient); Canton.Ledger.Abstractions (ICantonLedgerClient, IAdminClient, IPqsClient); Canton.Ledger.Kernel (token providers, telemetry naming, opt-in retries)
Observability Canton.Ledger.OpenTelemetry: one AddCantonLedgerInstrumentation() call
Raw Ledger API Canton.Ledger.Grpc (gRPC stubs); Canton.Ledger.Rest (raw JSON Ledger API surface)
Testing Canton.Ledger.Testing (FakeLedgerClient, FakeAdminClient, FakePqsClient); Daml.Ledger.Abstractions.Testing.Conformance (xUnit suite for any ILedgerClient); Daml.Codegen.Testing.Conformance (the conformance corpus, not for production)

Ready-made bindings: Splice.* packages generated from the Splice 0.8.4 DARs (each at its DAR version with a .17 suffix, e.g. Splice.Api.Token.Holding.V1 1.0.0.17), and 8 Daml.Finance.* packages from Daml Finance 2.10.0 (each at its DAR version with a .16 suffix, e.g. Daml.Finance.Util.V4 4.0.0.16).

Canton.Ledger.Rest, the raw JSON Ledger API surface, is experimental and marked CANTONREST001.

🏁 Getting started

Add the component to your daml.yaml (components: replaces the sdk-version: key). It decodes the DAR with a bundled JVM helper, so a JDK must be on PATH. Set DPM_AUTO_INSTALL=true so dpm fetches it on first use.

components:
  - oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.6.0
dpm build -o iou.dar
dpm codegen-cs --dar ./iou.dar --out ./Generated

dotnet add package Daml.Runtime --version 0.6.0
dotnet add package Daml.Ledger.Abstractions --version 0.6.0
dotnet add package Canton.Ledger.Grpc.Client --version 0.6.0
dotnet add package Microsoft.Extensions.DependencyInjection

Then connect, create an Iou, transfer it, and read what the new owner holds (using the sample Iou model):

using Canton.Ledger.Abstractions;
using Canton.Ledger.Grpc.Client;
using Daml.Ledger.Abstractions.Extensions;
using Daml.Runtime.Contracts;
using Daml.Runtime.Outcomes;
using Iou;
using Microsoft.Extensions.DependencyInjection;
using IouContract = Iou.Iou;

var services = new ServiceCollection();
services.AddLedgerClient(options => options.GrpcAddress = "https://localhost:5001");
services.AddAdminClient(options => options.GrpcAddress = "https://localhost:5001");

await using var provider = services.BuildServiceProvider();
var ledger = provider.GetRequiredService<ICantonLedgerClient>();
var admin = provider.GetRequiredService<IAdminClient>();

var alice = (await admin.AllocatePartyAsync("alice")).Party;
var bob = (await admin.AllocatePartyAsync("bob")).Party;

var created = await ledger.TryCreateAsync(
    new IouContract(Issuer: alice, Owner: bob, Currency: "USD", Amount: 100m));
var iouId = created switch
{
    ExerciseOutcome<ContractId<IouContract>>.One ok => ok.Result,
    _ => throw new InvalidOperationException(created.ToString()),
};

var transferred = await iouId.TryTransferAsync(
    ledger, new IouContract.Transfer(NewOwner: alice), bob);
if (transferred is not ExerciseOutcome<ContractId<IouContract>>.One)
    throw new InvalidOperationException(transferred.ToString());

foreach (var iou in await ledger.SnapshotAsync<IouContract>(alice))
    Console.WriteLine($"{iou.Id}: {iou.Data.Amount} {iou.Data.Currency} from {iou.Data.Issuer}");

Prefer the JSON Ledger API? Reference Canton.Ledger.Rest.Client and register services.AddRestLedgerClient(options => options.HttpAddress = "http://localhost:7575") instead. Everything else stays the same. The full walkthrough, with the sample Daml model, is in the README.

🧩 Supported versions

Version
.NET 10 (net10.0)
Canton 3.5.x; protos and JSON Ledger API spec pinned at 3.5.19. The REST client needs 3.5.10 or later
Daml SDK 3.5.2
Splice bindings built from Splice 0.8.4
Daml Finance bindings built from Daml Finance 2.10.0
dpm codegen-cs platforms linux-amd64, linux-arm64, darwin-arm64, windows-amd64 (JDK on PATH)

The SDK is pre-1.0: under SemVer 0.x, a release may change the public API without a major-version bump. The CHANGELOG records every change.


📚 Docs: README · code generation · ledger clients · DAR to NuGet · configuration · Canton versions
📖 Full changelog: CHANGELOG.md — 0.6.0
🐛 Questions and bugs: GitHub issues
🤝 Building on Canton? Peaceful Studio, which maintains this SDK, also offers consulting: write to info@peaceful.studio.

Packages, dpm bundles, the Intermediate DAR proto and SHA256SUMS are attached below.

Already on 0.6.0-preview.4? 0.6.0 contains exactly the same code: change the version and you're done.

v0.6.0-preview.4

v0.6.0-preview.4 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 07 Oct 08:01
Immutable release. Only release title and notes can be modified.
v0.6.0-preview.4
80c5ff4

🚀 Canton .NET SDK — 0.6.0-preview.4

The Canton .NET SDK builds .NET applications on a Canton/Daml ledger with full type safety: dpm codegen-cs turns a Daml .dar into strongly-typed C#, and one transport-neutral ICantonLedgerClient submits and reads over gRPC or the JSON Ledger API, with a PQS client, OpenTelemetry tracing and test doubles alongside.

This preview is about trusting the answers you get back: one failure contract on both transports 🧭, disclosure reads by contract id 🔓, choice results exactly as your Daml returns them 🎯, self-registering generated code 📇, and a long list of gRPC/REST parity, retry-safety and PQS fixes. It is still a preview, with 12 breaking changes; the upgrade guide below covers each one.

✨ Highlights

  • 🧭 One failure contract, both transports. Throwing calls raise LedgerOperationException, Try* calls return an ExerciseOutcome<T>, streams end with a terminal StreamError, and only your own cancellation throws OperationCanceledException. No more RpcException vs HttpRequestException; CommitState tells you whether a retry is safe:
    try { await ledger.GetLedgerEndAsync(); }
    catch (LedgerOperationException ex) when (ex.CommitState == CommitState.NotCommitted)
    {
        Console.WriteLine($"{ex.Status} / {ex.Category}: safe to retry");
    }
  • 🔓 Explicit disclosure by contract id. GetDisclosureAsync<T> returns the contract id, template id and created-event blob to attach to a submission, or null when the submitter can't see the contract. T can be a template or an interface, so a Token Standard holding reached as ContractId<IHolding> works too:
    var disclosure = await ledger.GetDisclosureAsync(holdingId, alice);
    if (disclosure is not null)
        submission = submission.WithDisclosedContracts(disclosure);
  • 🎯 Choice results that match your Daml. A choice returning ContractId T gives you ExerciseOutcome<ContractId<T>>, read from the choice's own result rather than guessed from created contracts. Hand-built TryExerciseAsync<TResult> now decodes records, variants, enums, Optional, tuples and collections through the generated choice descriptor, and hand-written bindings can call ExerciseOutcomeProjection.ProjectChoiceResult.
  • 📇 Self-registering generated code. Each generated package registers its templates, interfaces and choices on first use, and the JSON Ledger API client decodes through that registry. A node with no binding is carried as raw Daml-LF JSON (DamlUndecodedJson) instead of failing the whole transaction.
  • 🔁 Safer retries. A REST retry whose first attempt committed but lost its response now returns the committed transaction, as gRPC does. A DUPLICATE_COMMAND rejection reports CommitState.Committed and SUBMISSION_ALREADY_IN_FLIGHT reports Unknown, so you are never told to resubmit a command that already ran.
  • 🔍 PQS you can test against. FakePqsClient now evaluates the PqsFilter it gets with the same semantics as the SQL PqsClient runs, and pages in the same order. Filter.Where accepts == / != on an Optional enum field:
    var buys = await pqs.QueryAsync<Order>(Filter.Where<Order>(o => o.MaybeSide == Side.Buy));
  • 🧱 Codegen that compiles more Daml. Daml.Runtime.Stdlib ships the rest of the Daml standard library (Tuple4 to Tuple20, Ordering, Validation, Month …), generated references are global::-qualified, and a Daml name colliding with a .NET or generated member compiles (with a trailing _ and a warning) or stops codegen with an error naming both declarations.

⚠️ Upgrading from 0.6.0-preview.3

Bump every package to 0.6.0-preview.4 together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate your bindings. Regenerated code does not compile against an older Daml.Runtime, and an older Canton.Ledger.Pqs.Client next to this Canton.Ledger.Abstractions throws MissingMethodException on its first filtered query.

1. Regenerate every binding, including dependencies

  • REST decoding needs bindings from this codegen. The JSON Ledger API client no longer scans loaded assemblies. A payload whose binding came from an earlier codegen arrives as DamlUndecodedJson. Regenerate everything you read over REST, Splice.Api.Token.* included, or move to the *.16-preview.4 Splice and *.15-preview.4 Daml.Finance packages.
  • DamlLfJsonDecoders.OptionalField / OptionalChainField are removed, with no shim. Bindings from an earlier codegen (such as older Splice.* packages) throw MissingMethodException until regenerated, as do those calling the changed generic-record helpers (ReadTuple2, GetTypeParameterField, Tuple2.FromRecord …).

2. Catch LedgerOperationException, not transport exceptions

Before After
catch (RpcException) (gRPC) catch (LedgerOperationException). Status is TransportStatus.Grpc(code) and InnerException is the RpcException
catch (HttpRequestException) / catch (TaskCanceledException) (REST) catch (LedgerOperationException) with Status = NoResponse
catch (MalformedResponseException) catch (LedgerOperationException) with Status = UndecodableBody; read InnerException
catch (HttpRequestException) around a REST await foreach handle the terminal StreamError arm inside the loop

Branch on Category and CommitState, which mean the same on both transports: a failed read is always NotCommitted, a write that got no answer is Unknown, and a REST write applied but unreadable is CommittedUndecodable (Try*) or Committed (throwing): don't resubmit it. REST GetConnectedSynchronizersAsync now throws on a null body instead of returning an empty list.

Two category mappings changed too: InvalidGivenCurrentSystemStateSeekAfterEnd → gRPC OutOfRange, and MaliciousOrFaultyBehaviour → gRPC InvalidArgument / HTTP 400. Update code that matched the old codes.

3. Drop the generated <Choice>Result wrappers

Template choices that return contract ids now return exactly what the choice returned, and the <Choice>Result records, their FromCreatedContracts factory and the Decode<Choice>Result helpers are gone.

Before After
ExerciseOutcome<ReserveResult> ExerciseOutcome<ContractId<Ticket>>
outcome.Result.Ticket outcome.Result
result.Ephemeral on a tuple result result._2

Optional (ContractId T) becomes ContractId<T>?, and [ContractId T] becomes IReadOnlyList<ContractId<T>>. These exercisers no longer return Many or None, so remove those arms. A committed transaction with no matching exercise now throws InvalidOperationException.

4. Hand-built TryExerciseAsync<TResult> and ExerciseResult<T>

  • The exercise is matched by contract id, choice and template/interface (package id ignored), not by choice name alone.
  • A transaction with no exercised event for the command throws InvalidOperationException instead of returning CommittedUndecodable (exercised events dropped, or ACS_DELTA requested).
  • A result that decodes to null (Optional None, unit) is One(null), not None.
  • Variant, enum, generic and collection results that were CommittedUndecodable now decode to One. Use TResult = DamlValue to keep the raw value.

5. Renames and narrowed APIs

  • DamlErrorCategory.InvalidGivenCurrentSystemStateSeekDifferentResource → InvalidGivenCurrentSystemStateSeekAfterEnd (value 12 unchanged, no alias). Update persisted or configured names too.
  • GeneratedTypeReaders.TryGetRecordReader, TryGetKeyDescriptor and TryGetChoice are no longer public. Decode through the generated descriptor instead (Choice<TOwner, TArg, TResult>.ResultDecoder, IHasKey<TSelf, TKey>.Key). ForRecord / ForKey / ForChoices are unchanged.

6. Untyped records read from JSON

A DamlRecord read from Daml-LF JSON holds only the fields the payload sent, as on gRPC: trailing None fields are no longer filled in, so read them with GetOptionalField / GetOptionalChainField. Calling a generic FromRecord / FromVariant / __ReadDamlLfJson or Tuple2.FromRecord yourself? Pass the new per-type-parameter "omitted field" argument. Typed reads are unchanged.

7. Custom clients, fakes and the conformance kit

  • Implementing ICantonLedgerClient yourself? Add GetDisclosureAsync<T>. Fakes stage it with FakeLedgerClientBuilder.WithDisclosure.
  • FakePqsClient honours filters. Staged contracts the filter doesn't match are no longer returned, and QueryOneAsync<T>(filter) returns null when none match. Stage the contracts your test expects to match. Paged queries now order by contract id before slicing, like PqsClient.
  • Conformance kit: LedgerClientConformanceTests<TProbe> requires TProbe : IImplements<IConformanceProbe> (add it in a partial declaration), and your client must serve the seeded rows through interface reads too.
  • To test failure handling, stage a failure with FakeLedgerClientBuilder.WithThrowingCallFailure, built with the new LedgerOperationException constructor that takes a Status and CommitState.

🐛 Notable fixes

  • REST EstimateTrafficCostAsync no longer fails with HTTP 400 on every call.
  • Stream events without their own offset are reported at their transaction's offset, not offset 0, so resuming no longer replays the whole ledger.
  • The first REST call no longer reports CommittedUndecodable just because the binding's assembly wasn't loaded yet.
  • OneOrThrow / OneOrThrowAsync report None and Many as Committed, so a catch site won't resubmit a command that ran.
  • Nested Optional values serialize correctly (Some None is [[]], not null), and REST commands use the same Daml-LF JSON writer as DamlJsonSerializer.
  • Daml types named like .NET types (Task, Version, `Time...
Read more

v0.6.0-preview.3 — Ledger API and PQS, on the road to M2 🏁

Choose a tag to compare

@github-actions github-actions released this 01 Oct 08:02
Immutable release. Only release title and notes can be modified.
f02a0d5

🚀 Canton .NET SDK — 0.6.0-preview.3

TL;DR — on the road to Milestone 2 🏁. Ledger API ✅: ledger reads, admin calls and the external-signing flow now have typed C# methods on gRPC and REST. PQS ✅: filter queries with plain C# predicates over your generated types. 🎉

✨ Highlights

  • 📖 Typed ledger reads: GetContractAsync<T>, GetEventsByContractIdAsync<T>, paged GetActiveContractsPageAsync<T> / GetUpdatesPageAsync, GetCompletionsAsync, GetLatestPrunedOffsetsAsync.
  • 🔍 Filter.Where<T> turns a C# predicate into parameterized PQS SQL, typed by each field's Daml type:
    await pqs.QueryAsync<Invoice>(Filter.Where<Invoice>(i => i.Amount > 100m && i.Status == InvoiceStatus.Open));
  • 🔑 External signing: prepare, execute and allocate external parties without the raw gRPC channel. You sign the hash yourself; the SDK holds no key.
  • 🛠️ Typed admin calls: user and party updates (field-masked), identity provider configs, package vetting, pruning, command status and the participant clock.
  • 🧪 Test doubles: FakeLedgerClientBuilder / FakeAdminClientBuilder can stage every new call, including external signing (WithPreparedSubmission, WithExternalPartyTopology and the rest).

💥 Upgrading from 0.6.0-preview.2

⚠️ Bump every package to 0.6.0-preview.3 together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate.

  • 🧩 Implementers of ICantonLedgerClient add 12 members and implementers of IAdminClient add 19, all listed in the CHANGELOG.
  • 🔢 Filter.Field parses its value as the field's Daml type: a value that doesn't parse throws ArgumentException when the filter is built, and so does a selector that stops on a record, variant, list or map field. Select a leaf field instead.
  • 🏷️ Conformance packages renamed: richtypes-hd117e68b37cc → richtypes-hecd531570c32, contractkeys-h61a17c769e62 → contractkeys-h4fd930e5658f.
  • 🔄 DamlValueExtensions.AsOptional returns the DamlOptional level of a DamlOptionalChain instead of throwing.
  • 🌐 The REST client throws NotSupportedException for GetTimeAsync, SetTimeAsync, PruneAsync, UpdatePartyIdentityProviderIdAsync, GetCommandStatusAsync and DeleteUserAsync with an identity provider id: the JSON Ledger API has no route for them.

Coming from older versions? See the 0.6.0-preview.2 and 0.6.0-preview.1 notes.

🐛 Fixed

  • A generated Try{Choice}Async no longer returns CommittedUndecodable when a tuple result ends in None.
  • gRPC reads decode Optional (Optional a) fields.
  • --include-dependencies no longer aborts on the daml-prim / daml-stdlib LibraryModules collision.

The full list is in the CHANGELOG.

📦 What's in the release

16 core packages at 0.6.0-preview.3, 33 Splice packages at *.15-preview.3 (Splice 0.8.4) and 8 Daml.Finance packages at *.14-preview.3, all on nuget.org. The codegen also ships as oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.6.0-preview.3.

📖 Full changelog: https://github.com/peacefulstudio/canton-dotnet-sdk/blob/v0.6.0-preview.3/CHANGELOG.md
🔍 Compare: v0.6.0-preview.2...v0.6.0-preview.3

v0.6.0-preview.2

v0.6.0-preview.2 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Sep 10:34
Immutable release. Only release title and notes can be modified.
c013dc6

🚀 Canton .NET SDK — 0.6.0-preview.2

TL;DR — the explicit-disclosure release: typed active-contract reads can return each contract ready for disclosure, and every generated submit helper takes a configure hook to add it (or a deduplication period, synchronizer id or minimum ledger time) to the submission. It also fixes both known issues from 0.6.0-preview.1: a record whose trailing Optional field is None now decodes, and Try{Choice}Async no longer throws after committing for a choice that does not return a contract id. All 16 packages share one version. Regenerated Splice (33 packages, *.14-preview.2, Splice 0.8.2) and Daml.Finance (8 packages, *.13-preview.2) bindings ship alongside. Source-breaking in three places: the generated submit helpers, the active-contract reads and two raw REST wire properties. Regenerate your bindings as part of the upgrade. 🎉

✨ Highlights

  • configure on every generated submit helper and generic submit extension 🔧 — Func<CommandsSubmission, CommandsSubmission>? configure = null receives the submission the helper built and returns the one to submit, e.g. s => s.WithDisclosedContracts(holding.Disclosure!). A hook that returns null or changes the command list throws InvalidOperationException before anything is submitted; the submitter's act-as and read-as parties replace any set on the returned submission. Leaving it null submits exactly what the helper submitted before.
  • Active-contract reads can return contracts ready for explicit disclosure 🔑 — pass includeDisclosure: true to SubscribeActiveAsync, SnapshotActiveAsync or QueryActiveAsync<TInterface, TView>, and each result carries a Disclosure you can pass straight to CommandsSubmission.WithDisclosedContracts. Without the flag, Disclosure is null and the request is unchanged.
  • DisclosedContract.SynchronizerId routes a submission to the synchronizer that holds the disclosed contract; left null, the participant chooses, as before.
  • IPqsClient.FetchByIdAsync<TInterface, TView> fetches one active contract implementing a Daml interface by its contract id and projects the interface view into TView.
  • IAdminClient.UploadDarAsync / ValidateDarAsync overloads with a required synchronizerId, for a participant connected to more than one synchronizer. The existing overloads are unchanged.

💥 Upgrading from 0.6.0-preview.1

Bump every package to 0.6.0-preview.2 together, regenerate, then work through the list. ⚠️

Coming from 0.5.0-preview.3? Work through the 0.6.0-preview.1 upgrade notes first.

Clear the dpm component cache first. dpm caches dpm-codegen-cs by name, not by version, so after you bump the components: pin an existing machine keeps running the old emitter; a zero Generated/ diff is the symptom. Delete ~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs (or under $DPM_HOME) before regenerating.

  • Name the CancellationToken where you pass it positionally. Generated submit helpers and the generic submit extensions take configure immediately before it: every generated Try{Choice}Async (on a ContractId<T>, a fetched contract and an interface) and TryCreateAsync, plus SingleCommandExtensions.TrySubmitSingleAsync, CreateByExercise.TryCreateOneByExerciseAsync, TryCreateManyByExerciseAsync, CreateOneByExerciseAsync, CreateManyByExerciseAsync and the void ThrowingExercise.ExerciseAsync. Write cancellationToken: token; a call that already names the token is unaffected. Regenerate any checked-in generated code.
  • Active-contract reads gain bool includeDisclosure = false before the cancellation token. This covers ILedgerStreamer.SubscribeActiveAsync (both overloads), StreamerSnapshot.SnapshotActiveAsync (both overloads) and ICantonLedgerClient.QueryActiveAsync<TInterface, TView>. Name the token where you passed it positionally, e.g. SubscribeActiveAsync<T>(submitter, null, cancellationToken: ct).
  • A generated Try{Choice}Async for a choice returning ContractIds reports the contracts the choice returned, including ones its submitter is no stakeholder of. It used to build its result from the creates the submitter is a stakeholder of, so a choice creating a contract for another party came back as ExerciseOutcome.None after the command had committed. It now reads the ids from the choice's own exercise result, through tuples (in component order), Optionals and lists; an absent Optional or an empty list projects as absent or empty even when the transaction created another contract of that template. Review any code that treated None as "the choice created nothing I can see", and regenerate.
  • Two Canton.Ledger.Rest raw wire properties are renamed. Raw.Commands.Commands1 is now Commands.CommandList and Raw.Signature.Signature1 is now Signature.Value. The JSON wire names are unchanged.
  • Implementers update their types. IAdminClient: add the two synchronizerId overloads. IPqsClient: add FetchByIdAsync<TInterface, TView>. ILedgerStreamer: add includeDisclosure to both SubscribeActiveAsync overloads, and likewise in subclasses of the conformance kit's NotSupportedLedgerClient that override them.
  • Conformance packages renamed. The richtypes and contractkeys packages in Daml.Codegen.Testing.Conformance carry a content-addressed PackageName (<base>-h<hash12>) instead of the fixed name, and contractkeys gains a Disclosure.Offer template. Update any assertion against either literal package name or id.

🐛 Fixed

  • A record whose trailing Optional field is None now decodes on both transports. The Ledger API leaves out a trailing None field in create arguments, exercise results and the active contract set, and generated readers used to refuse such a payload as undecodable. A declared Optional field that is absent decodes as None, as does a generic record's type-parameter field or a Tuple2/Tuple3 component whose instantiation is Optional; every other field is still required. Regenerate to pick up the fix.
  • ILedgerWriter.TrySubmitAndWaitForTransactionAsync returns the transaction's exercised events. A generated Try{Choice}Async for a choice that does not return a ContractId, such as a nonconsuming Decimal choice, threw InvalidOperationException after the command had committed, and a caller that retried on it submitted twice. CreatedContracts and ArchivedContractIds keep their ACS-delta meaning. The exception for a choice whose exercise is not found now names both causes.

📦 What's in the release

dotnet add package Canton.Ledger.Grpc.Client --version 0.6.0-preview.2

All 57 packages are on nuget.org. Attached below: the 16 core .nupkg/.snupkg pairs, the Splice and Daml.Finance .nupkg files, daml-dar-to-proto-0.6.0-preview.2.jar, intermediate_dar-0.6.0-preview.2.proto, intermediate-fixtures-0.6.0-preview.2.tar.gz and SHA256SUMS, plus dpm-codegen-cs bundles for darwin-arm64, linux-amd64, linux-arm64 and windows-amd64. The codegen also ships as the dpm component oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.6.0-preview.2.


📖 Full changelog: https://github.com/peacefulstudio/canton-dotnet-sdk/blob/v0.6.0-preview.2/CHANGELOG.md
🔍 Compare: v0.6.0-preview.1...v0.6.0-preview.2

v0.6.0-preview.1

v0.6.0-preview.1 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Sep 10:34
Immutable release. Only release title and notes can be modified.
v0.6.0-preview.1
26ec921

🚀 Canton .NET SDK — 0.6.0-preview.1

TL;DR — the first release of the combined Canton .NET SDK. The Canton.Ledger.* clients now ship next to the Daml.* packages, and all 16 share one version. The repository is renamed from daml-codegen-csharp to canton-dotnet-sdk; package ids are unchanged and old links redirect. Regenerated Splice (33 packages, *.13-preview.1, Splice 0.8.2) and Daml.Finance (8 packages, *.12-preview.1) bindings ship alongside. Verified end to end against a LocalNet over gRPC, JSON API and PQS. Breaking for most consumers: regenerate your bindings as part of the upgrade. 🎉

✨ Highlights

  • One SDK, one version 📦 — one number to bump, no more matching two version lines.
  • CommandsSubmission.WithDeduplicationPeriod on gRPC and REST — set how long the participant rejects a resubmission as DUPLICATE_COMMAND.
  • REST parity 🌐 — AddRestLedgerClient also registers an IAdminClient over the JSON Ledger API, so administration no longer needs gRPC; REST submissions now encode DA.Map and Optional (Optional a).
  • Typed TransportStatus — Grpc, Http, NoResponse or UndecodableBody replaces a bare int StatusCode, so a gRPC code, an HTTP status and "no response at all" can no longer be confused.
  • One value-equal ContractId<T> 🔑 — the id you build and the id the ledger returns now compare equal.
  • Honest method names — every generated method returning ExerciseOutcome<T> is Try…Async; chain OneOrThrowAsync for the throwing style.
  • Variants round-trip through System.Text.Json with a leading "$case" discriminator, no AddDamlConverters() needed.
  • Standalone release artifacts 🧰 — the daml-dar-to-proto jar reports its real --version and ships with the proto, fixtures and SHA256SUMS.

💥 Upgrading from 0.5.0-preview.3

Bump every package to 0.6.0-preview.1 together, regenerate, then work through the tables. ⚠️

Clear the dpm component cache first. dpm caches dpm-codegen-cs by name, not by version, so after you bump the components: pin an existing machine keeps running the old emitter; a zero Generated/ diff is the symptom. Delete ~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs (or under $DPM_HOME) before regenerating.

Generated code: before After
new Iou.ContractId(s) new ContractId<Iou>(s) (now sealed)
Iou.Contract.FromCreatedEvent(ev) Contract<Iou>.FromCreatedEvent(ev, Iou.FromRecord)
ExerciseArchive() contractId.ArchiveCommand()
CreateAsync · {Choice}Async · ArchiveAsync TryCreateAsync · Try{Choice}Async · TryArchiveAsync
ExerciseOutcome<Unit> · Unit.Value ExerciseOutcome<DamlUnit> · DamlUnit.Instance
ContractIdentifiers.Iou TemplateExtensions.GetTemplateId<Iou>()
--contract-identifiers remove it: now an unrecognized option
Runtime and clients: before After
party.Id · synchronizerId.Id .Value
event ChoiceName as string ChoiceName: compare with new ChoiceName(...) or read .Value
error.StatusCode == (int)StatusCode.Unavailable error.Status is TransportStatus.Grpc { StatusCode: GrpcStatusCode.Unavailable }
REST == 503 / == 408 is TransportStatus.NoResponse
long completion and point-read offsets LedgerOffset (LedgerOffset.At(value), .Value)
Completion.DeduplicationOffset / DeduplicationDuration Completion.DeduplicationPeriod, a Daml.Runtime.Commands union
IAdminClient string ids, "" primary party Party / SynchronizerId, null for none
catch (RpcException) around IAdminClient catch (LedgerOperationException); drop pageSize:
  • Shared DI channel. IAdminClient is no longer IDisposable; every client resolved from one container shares one gRPC channel, closed when the container is disposed. Dispose the service provider, not the ledger client.
  • Sealed types. The admin records, the seven UserRight subtypes and the four client options types are sealed (CS0509); RetryPipelineFactory, LedgerActivitySource and TokenProviderExtensions are internal.
  • Google.Protobuf is pinned back to 3.35.1. 3.36.0–3.36.2 has a thread-safety race in file-descriptor initialization (upstream issue) that can leave a generated *Reflection type throwing TypeInitializationException for good. The dependency is a floor: if something pulls in 3.36.0–3.36.2, pin 3.35.1 yourself.
  • Also: the reflection DAMLRT0001 reader is removed (use ReadRecord<T> or the new ReadVariant<T>); a bare null limits argument to DamlJsonSerializer.Deserialize is now ambiguous, so drop it; Canton.Ledger.OpenTelemetry drops its Npgsql.OpenTelemetry reference; a serialized StreamError writes a nested "Status", and logs carry {Status}.

🐛 Fixed

  • A Numeric 0 field the participant writes as "42." now decodes on both transports.

⚠️ Known issues

Both are present since 0.5.0-preview.3 and will be fixed in 0.6.0-preview.2.

  • REST: a record whose last field(s) are None fails to decode. The JSON Ledger API omits trailing None optionals, and the generated reader requires the field. The command still commits; the result comes back CommittedUndecodable. gRPC is unaffected.
  • Generated Try{Choice}Async throws for choices that do not return a contract id. The submission does not request exercised events, so the wrapper throws InvalidOperationException after the command has committed. Do not retry on it. Workaround: TrySubmitAndWaitForTransactionTreeAsync with ToTransactionResult().

📦 What's in the release

dotnet add package Canton.Ledger.Grpc.Client --version 0.6.0-preview.1

All 57 packages are on nuget.org. Attached below: the 16 core .nupkg/.snupkg pairs, the Splice and Daml.Finance .nupkg files, daml-dar-to-proto-0.6.0-preview.1.jar, intermediate_dar-0.6.0-preview.1.proto, intermediate-fixtures-0.6.0-preview.1.tar.gz and SHA256SUMS, plus dpm-codegen-cs bundles for darwin-arm64, linux-amd64, linux-arm64 and windows-amd64. The codegen also ships as the dpm component oci://ghcr.io/peacefulstudio/dpm-codegen-cs:0.6.0-preview.1.


📖 Full changelog: https://github.com/peacefulstudio/canton-dotnet-sdk/blob/v0.6.0-preview.1/CHANGELOG.md
🔍 Compare: v0.5.0-preview.3...v0.6.0-preview.1