Repository navigation
Releases
v0.8.1: matching failures on gRPC and JSON, ProblemDetails middleware 🛡️
🚀 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 to0.8.1together, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared.
- ⏱️ A zero or negative per-call
timeoutis now a caller error. The call throwsArgumentOutOfRangeExceptionfor thetimeoutparameter before anything is sent, on both clients, the writer helpers andFakeLedgerClient.Timeout.InfiniteTimeSpanapplies no SDK-side deadline on both transports. If a test passedTimeSpan.Zeroand expected aDeadlineExceeded, pass a small positive value instead. - 🧮 Point reads and the updates page list the ACS-delta contracts only.
GetUpdateByOffsetAsync,GetUpdateByIdAsyncandGetUpdatesPageAsyncno longer report a contract created and archived in the same transaction as created. To see every create, read theTreeEvent.Creatednodes ofGetUpdateTreeByOffsetAsync.TransactionTree.ToTransactionResult()follows the same rule, soSingle<T>()works on such a transaction. - 🧯
Canton.Ledger.AspNetCoreanswers409 Conflictfor a command rejected withLOCAL_VERDICT_INACTIVE_CONTRACTS, where it answered404. A400no longer carries the participant's message, only a fixed detail and the Daml error id; setLedgerProblemOptions.IncludeLedgerErrorMessagesin development to get the message back. - 🔢
DamlNumericserialises as{"Value":"1234.5678"}in itsSystem.Text.Jsonform, a canonical string instead of a JSON number, so a Numeric thatdecimalcannot hold no longer throws. A payload you cached in the old form no longer reads.DamlJsonSerializerand the Ledger API wire forms are unchanged. - 🔤 REST boolean query parameters are sent as
TrueorFalse, 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 asProblemDetailswithout taking over the host's exception handling. It catches onlyLedgerOperationExceptionand lets every other exception reach your own handler, so a contended409is 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 oneUnclassifiedwithUnclassifiedKind.DecodeFailureand the stream keeps going, and a malformed checkpoint ends the stream with a terminalStreamError. - 🤝 One error shape on both transports: a missing contract id and an unset Daml value are reported as
MalformedResponseExceptionon gRPC and on the JSON Ledger API. - 🟰 Structural equality for lists and maps: a list or map inside
Tuple2,Optional,Either,Map,Set,NonEmptyor a generated generic record now compares by content, so two decodes of the same payload areEquals. 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
TransactionResultcached as JSON and read back is equal to the original and keeps its node numbering and requested interfaces, soSingle<I>()on an interface works on it. - 🔁 A retry configuration that passes startup validation now builds a working client:
Retry:MaxRetryAttemptsof0sends each call once instead of throwing. - 🎲
ClientCredentialsProviderjitters 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 🚀
🚀 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 to0.8.0together, install the new Daml SDK withdpm 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 throwsMissingMethodException.
- 🌐 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.
- 🗑️
GetPreferredPackageVersionis gone from both raw tiers, because Canton 3.7 deletes the RPC and its route. CallGetPreferredPackagesinstead. The experimental RESTIInteractiveSubmissionApiis gone too. - 🧩 Interfaces gained members.
ICantonLedgerClientgainsGetEventsByContractIdAsync<TInterface, TView>and the raw RESTIStateServiceApigainsConvertRecordTimeToOffset. 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 theSnapshotAsync/SnapshotActiveAsyncextensions gaintimeoutandunreadableRowsbefore theCancellationToken, and return anActiveSnapshot<TRow>. A call that passes the token by position must name it:cancellationToken: token. - 🏷️
OneOrThrow,OneOrThrowAsyncandThrowIfErrortake no operation name. Delete the string argument: the outcome now carries the template and choice that produced it. - 🔤 Two
DamlErrorCategorymembers take Canton's names:MaliciousOrFaultyBehaviouris nowSecurityAlertandAuthorizationChecksFailedis nowInsufficientPermission. The numeric values are unchanged, and there is no alias. - 🧬 The generated
TryCreateAsynctakesworkflowId,commandIdandtimeoutbeforeconfigure. A call that passesconfigureby position must name it (configure: ...). - 🧪 Test doubles changed shape.
RecordedSubmission.Commands,ReassignmentandExecutiongain a trailingTimeoutmember,CompletionStreamEvent.CheckpointgainsSynchronizerTimes, andWithSubmissionOutcome,WithThrowingCallFailureandCompletionEvents.Checkpointchanged signature. Update positional constructions and deconstructions, then rebuild your test assemblies. - 🆔 Conformance packages have new identities. The corpus in
Daml.Codegen.Testing.Conformanceis rebuilt on Daml SDK 3.7.1 with new package names and ids, andIConformanceProbecarries 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,IncludeIncompleteReassignmentson active-contract requests, the validation package overrides onUnassignCommand, andProtocolVersionon 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 withCommitState.Unknowninto committed, rejected or lost, by reading the completion stream. - 🧱 New package
Canton.Ledger.AspNetCore:AddCantonLedgerProblemDetails()answers a failed ledger command as RFC 9457ProblemDetails(409for contention,202for a command that committed), andProducesLedgerProblems()declares those responses in your OpenAPI document. - 🪙 Splice Token Standard, typed end to end:
Splice.Api.Token.Registry.Clientis a typed client for registries' off-ledger API, andCreatedEventBlob.Decodereads 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 implementsIArchivable<TSelf>, and a module's top-level literal values becomepublic constfields.
🐛 Fixed
- 🔐 External-party onboarding decodes the
v31topology transactions a protocol version 37 synchronizer returns, as well asv30, 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 🧰
🚀 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 to0.7.1together, then regenerate your bindings. Delete the generated directory once so files from before the upgrade are cleared. Anything compiled against an earlierDaml.Runtimemust be rebuilt, or it throwsMissingMethodException.
- 🗑️
Daml.Runtime.Grpcis gone. ItsDamlValueConverternow lives insideCanton.Ledger.Grpc.Clientas an internal type. ReferenceCanton.Ledger.Grpc.Clientinstead: it converts values for you on every submission, query and subscription. If you called the converter directly, use the generatedCanton.Ledger.Grpcproto types and your own mapping. - 🔢
DamlNumeric.Scaleis removed, along with thescaleconstructor 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)andGetTypeParameterField<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_utilsgivesToken_utils,a.bgivesA_u002eb, and a part starting with a digit is escaped.a-bstill givesA.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). CallDeserializeRecord(json)orDeserializeRecord(json, limits). - 🚩
dar2intermediatetakes-v, not-V, for verbosity. A script that passed-V 2must pass-v 2. - 🔭 Telemetry is private by default. The
canton.user_idspan tag, ids in the admin log lines and exception messages are hidden unlessEmitPartyAndContractSpanTagsistrue. 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
timeoutis per attempt, as on the gRPC client, and defaults to 30 seconds through the newRestLedgerClientOptions.Timeout. With retries on, one call can take longer than a singletimeout; pass aCancellationTokenfor 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 throwJsonException. - 🧪 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
richtypesanddefaulttargettest packages also changed name and package id, andRichRecordgained fields. - 📉 Smaller changes:
ExerciseCommand.ForInterface<TInterface>is removed (useExerciseCommand.For<TOwner>),VerbosityConsoleLoggerProvideris now internal, a blank contract id is refused at construction, andOpenTelemetry1.20.0 andRefit16.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 defaultStandalonemode needs no JDK;Dpmmode runsdpm codegen-csand pins the bundle by digest. Regenerating also deletes files the new run no longer emits. - 🆔
ContractIdAs<T>(): turns the string contract id on a rawCreatedContract,ExercisedEventor tree event into a checkedContractId<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,InterfaceEventsandInterfaceLedgerEventsinCanton.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:TransactionResultandTransactionTreenow 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
IncludeDependenciesno 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, invalidRootFilterpatterns 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, andGetContractAsync<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 🚀
🚀 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:
PrepareSubmissionAsyncrecomputes the transaction hash on both transports (hashing schemesV2andV3). It refuses a mismatch, or aV4hash it cannot verify, before you sign, and there is no option to skip the check.GenerateExternalPartyTopologyAsyncdecodes the onboarding topology and fails closed unless it is exactly what Canton 3.6 generates for your request.AllocateExternalPartyAsyncderives 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.WithPackageIdSelectionPreferencepins a version when you need one. - 🛟 One failure contract: on both transports, a token that cannot be fetched is reported as
NotCommittedwith aTokenAcquisitionException, and a retried write whose outcome is unknown isUnknown.LedgerOperationException.CommandIdandExerciseOutcome<T>.CommandIdname 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:
ClientCredentialsProvidercools 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 asNotCommitted, 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 thedamlcanddaml-scriptcomponents 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 to0.7.0together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs) and regenerate.
- 🧩
PrepareSubmissionAsynctakeshashingSchemeVersionbeforetimeout. Nametimeout:if you pass it positionally, and add the parameter to your ownICantonLedgerClientimplementations. - 🗑️
GetPreferredPackageVersionAsyncandPackagePreferenceare removed: useGetPreferredPackagesAsync.PackageStatus.Unrecognized,HashFunction.UnrecognizedandSynchronizerPermissionLevel.Unrecognizedare removed too. An unknown value now raisesLedgerOperationExceptionclassifiedUndecodableBody. - 🏷️
CreatedContract,ExercisedEventand the command records gainPackageName. Code that builds them by hand, test-double inputs included, must set it. - 🔒
PrepareSubmissionAsyncrefuses a participant that answers with a hashing scheme other thanV2orV3,V4included.AllocateExternalPartyAsyncthrowsArgumentExceptionbefore sending anything when the onboarding transactions aren't the singlePartyToParticipanttransaction thatGenerateExternalPartyTopologyAsyncreturned. - 🔑 A token that cannot be acquired is now a
LedgerOperationException(NotCommitted) carrying aTokenAcquisitionException, on gRPC as well as REST. Catch that instead of the token provider's own exception. The token cooldown is on by default: setClientCredentialsOptions.TokenFailureCooldown.Enabled = falseto fetch on every call again. - 🔁
ExerciseOutcome<T>equality includesCommandId. A retried write rejected for anything other thanDUPLICATE_COMMANDnow comes back from aTry*call asInfraError, so match that as well asDamlError. AnInfraErroron a write means the outcome is unknown: look theCommandIdup onCompletionStreamAsync, and don't resubmit. - 🔀 The OAuth2 and JSON clients no longer follow redirects: point
TokenEndpointandHttpAddressat the final URL. - 📌 Every
Microsoft.Extensions.*dependency moves to10.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
GetDisclosureAsyncreturnsnullonly forCONTRACT_EVENTS_NOT_FOUND. Any other not-found rejection now raisesLedgerOperationException.- A bounded
SubscribeAsyncread over the JSON Ledger API no longer ends early on a sparse filter. - The gRPC client no longer replays
AllocatePartyAsync,CreateUserAsyncand the other non-idempotent admin writes underRetry.
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
🚀 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:
PrepareSubmissionAsyncrecomputes the transaction hash on both transports (hashing schemesV2andV3) and refuses a mismatch, or aV4hash it cannot verify, before you sign; there is no option to skip the check.GenerateExternalPartyTopologyAsyncdecodes the onboarding topology and fails closed unless it is exactly what Canton 3.6 generates for your request, andAllocateExternalPartyAsyncderives 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.WithPackageIdSelectionPreferencepins a version when you need one. - 🛟 One failure contract: a token that cannot be fetched is reported as
NotCommittedwith aTokenAcquisitionExceptionon both transports, a retried write whose outcome is unknown isUnknown, andLedgerOperationException.CommandId/ExerciseOutcome<T>.CommandIdname 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:
ClientCredentialsProvidernow 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 asNotCommitted; 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
damlcanddaml-scriptcomponents 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 to0.7.0-preview.1together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate.
- 🧩
PrepareSubmissionAsynctakeshashingSchemeVersionbeforetimeout: nametimeout:if you pass it positionally, and add the parameter to your ownICantonLedgerClientimplementations. - 🗑️
GetPreferredPackageVersionAsyncandPackagePreferenceare removed: useGetPreferredPackagesAsync.PackageStatus.Unrecognized,HashFunction.UnrecognizedandSynchronizerPermissionLevel.Unrecognizedare removed: an unknown value now raisesLedgerOperationExceptionclassifiedUndecodableBody. - 🏷️
CreatedContract,ExercisedEventand the command records gainPackageName. Code that builds them by hand, including test-double inputs, must set it. - 🔒
PrepareSubmissionAsyncrefuses a participant that answers with a hashing scheme other thanV2orV3,V4included, andAllocateExternalPartyAsyncthrowsArgumentExceptionbefore sending anything when the onboarding transactions are not the singlePartyToParticipanttransactionGenerateExternalPartyTopologyAsyncreturned. - 🔑 A token that cannot be acquired is now a
LedgerOperationException(NotCommitted) carrying aTokenAcquisitionException, on gRPC as well as REST: catch that instead of the token provider's own exception. The token cooldown is on by default; setClientCredentialsOptions.TokenFailureCooldown.Enabled = falseto fetch on every call again. - 🔁
ExerciseOutcome<T>equality includesCommandId. A retried write rejected for anything butDUPLICATE_COMMANDnow comes back asInfraErrorfrom aTry*call: match it as well asDamlError. If you map outcomes to HTTP, anInfraErroron a write means the outcome is unknown: answer202, look theCommandIdup onCompletionStreamAsyncand 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
TokenEndpointandHttpAddressat 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
GetDisclosureAsyncreturnsnullonly forCONTRACT_EVENTS_NOT_FOUND; any other not-found rejection now raisesLedgerOperationException.- A bounded
SubscribeAsyncread over the JSON Ledger API no longer ends early on a sparse filter. - A retried submission whose
DUPLICATE_COMMANDrejection points at another command's transaction no longer resolves to that transaction. - The gRPC client no longer replays
AllocatePartyAsync,CreateUserAsyncand the other non-idempotent admin writes underRetry.
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 🚀
🚀 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.0dpm 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.DependencyInjectionThen 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
🚀 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 anExerciseOutcome<T>, streams end with a terminalStreamError, and only your own cancellation throwsOperationCanceledException. No moreRpcExceptionvsHttpRequestException;CommitStatetells 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, ornullwhen the submitter can't see the contract.Tcan be a template or an interface, so a Token Standard holding reached asContractId<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 Tgives youExerciseOutcome<ContractId<T>>, read from the choice's own result rather than guessed from created contracts. Hand-builtTryExerciseAsync<TResult>now decodes records, variants, enums,Optional, tuples and collections through the generated choice descriptor, and hand-written bindings can callExerciseOutcomeProjection.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_COMMANDrejection reportsCommitState.CommittedandSUBMISSION_ALREADY_IN_FLIGHTreportsUnknown, so you are never told to resubmit a command that already ran. - 🔍 PQS you can test against.
FakePqsClientnow evaluates thePqsFilterit gets with the same semantics as the SQLPqsClientruns, and pages in the same order.Filter.Whereaccepts==/!=on anOptionalenum field:var buys = await pqs.QueryAsync<Order>(Filter.Where<Order>(o => o.MaybeSide == Side.Buy));
- 🧱 Codegen that compiles more Daml.
Daml.Runtime.Stdlibships the rest of the Daml standard library (Tuple4toTuple20,Ordering,Validation,Month…), generated references areglobal::-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.4together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate your bindings. Regenerated code does not compile against an olderDaml.Runtime, and an olderCanton.Ledger.Pqs.Clientnext to thisCanton.Ledger.AbstractionsthrowsMissingMethodExceptionon 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.4Splice and*.15-preview.4Daml.Finance packages. DamlLfJsonDecoders.OptionalField/OptionalChainFieldare removed, with no shim. Bindings from an earlier codegen (such as olderSplice.*packages) throwMissingMethodExceptionuntil 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
InvalidOperationExceptioninstead of returningCommittedUndecodable(exercised events dropped, orACS_DELTArequested). - A result that decodes to
null(OptionalNone, unit) isOne(null), notNone. - Variant, enum, generic and collection results that were
CommittedUndecodablenow decode toOne. UseTResult=DamlValueto 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,TryGetKeyDescriptorandTryGetChoiceare no longer public. Decode through the generated descriptor instead (Choice<TOwner, TArg, TResult>.ResultDecoder,IHasKey<TSelf, TKey>.Key).ForRecord/ForKey/ForChoicesare 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
ICantonLedgerClientyourself? AddGetDisclosureAsync<T>. Fakes stage it withFakeLedgerClientBuilder.WithDisclosure. FakePqsClienthonours filters. Staged contracts the filter doesn't match are no longer returned, andQueryOneAsync<T>(filter)returnsnullwhen none match. Stage the contracts your test expects to match. Paged queries now order by contract id before slicing, likePqsClient.- Conformance kit:
LedgerClientConformanceTests<TProbe>requiresTProbe : IImplements<IConformanceProbe>(add it in apartialdeclaration), 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 newLedgerOperationExceptionconstructor that takes aStatusandCommitState.
🐛 Notable fixes
- REST
EstimateTrafficCostAsyncno 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
CommittedUndecodablejust because the binding's assembly wasn't loaded yet. OneOrThrow/OneOrThrowAsyncreportNoneandManyasCommitted, so a catch site won't resubmit a command that ran.- Nested
Optionalvalues serialize correctly (Some Noneis[[]], notnull), and REST commands use the same Daml-LF JSON writer asDamlJsonSerializer. - Daml types named like .NET types (
Task,Version, `Time...
v0.6.0-preview.3 — Ledger API and PQS, on the road to M2 🏁
🚀 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>, pagedGetActiveContractsPageAsync<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/FakeAdminClientBuildercan stage every new call, including external signing (WithPreparedSubmission,WithExternalPartyTopologyand the rest).
💥 Upgrading from 0.6.0-preview.2
⚠️ Bump every package to0.6.0-preview.3together, clear the dpm cache (~/.dpm/cache/components/ghcr.io/peacefulstudio/dpm-codegen-cs), then regenerate.
- 🧩 Implementers of
ICantonLedgerClientadd 12 members and implementers ofIAdminClientadd 19, all listed in the CHANGELOG. - 🔢
Filter.Fieldparses its value as the field's Daml type: a value that doesn't parse throwsArgumentExceptionwhen 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.AsOptionalreturns theDamlOptionallevel of aDamlOptionalChaininstead of throwing. - 🌐 The REST client throws
NotSupportedExceptionforGetTimeAsync,SetTimeAsync,PruneAsync,UpdatePartyIdentityProviderIdAsync,GetCommandStatusAsyncandDeleteUserAsyncwith 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}Asyncno longer returnsCommittedUndecodablewhen a tuple result ends inNone. - gRPC reads decode
Optional (Optional a)fields. --include-dependenciesno longer aborts on thedaml-prim/daml-stdlibLibraryModulescollision.
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
🚀 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
configureon every generated submit helper and generic submit extension 🔧 —Func<CommandsSubmission, CommandsSubmission>? configure = nullreceives the submission the helper built and returns the one to submit, e.g.s => s.WithDisclosedContracts(holding.Disclosure!). A hook that returnsnullor changes the command list throwsInvalidOperationExceptionbefore anything is submitted; the submitter's act-as and read-as parties replace any set on the returned submission. Leaving itnullsubmits exactly what the helper submitted before.- Active-contract reads can return contracts ready for explicit disclosure 🔑 — pass
includeDisclosure: truetoSubscribeActiveAsync,SnapshotActiveAsyncorQueryActiveAsync<TInterface, TView>, and each result carries aDisclosureyou can pass straight toCommandsSubmission.WithDisclosedContracts. Without the flag,Disclosureisnulland the request is unchanged. DisclosedContract.SynchronizerIdroutes a submission to the synchronizer that holds the disclosed contract; leftnull, 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 intoTView.IAdminClient.UploadDarAsync/ValidateDarAsyncoverloads with a requiredsynchronizerId, 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.2together, 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
CancellationTokenwhere you pass it positionally. Generated submit helpers and the generic submit extensions takeconfigureimmediately before it: every generatedTry{Choice}Async(on aContractId<T>, a fetched contract and an interface) andTryCreateAsync, plusSingleCommandExtensions.TrySubmitSingleAsync,CreateByExercise.TryCreateOneByExerciseAsync,TryCreateManyByExerciseAsync,CreateOneByExerciseAsync,CreateManyByExerciseAsyncand the voidThrowingExercise.ExerciseAsync. WritecancellationToken: token; a call that already names the token is unaffected. Regenerate any checked-in generated code. - Active-contract reads gain
bool includeDisclosure = falsebefore the cancellation token. This coversILedgerStreamer.SubscribeActiveAsync(both overloads),StreamerSnapshot.SnapshotActiveAsync(both overloads) andICantonLedgerClient.QueryActiveAsync<TInterface, TView>. Name the token where you passed it positionally, e.g.SubscribeActiveAsync<T>(submitter, null, cancellationToken: ct). - A generated
Try{Choice}Asyncfor a choice returningContractIds 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 asExerciseOutcome.Noneafter 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 absentOptionalor an empty list projects as absent or empty even when the transaction created another contract of that template. Review any code that treatedNoneas "the choice created nothing I can see", and regenerate. - Two
Canton.Ledger.Restraw wire properties are renamed.Raw.Commands.Commands1is nowCommands.CommandListandRaw.Signature.Signature1is nowSignature.Value. The JSON wire names are unchanged. - Implementers update their types.
IAdminClient: add the twosynchronizerIdoverloads.IPqsClient: addFetchByIdAsync<TInterface, TView>.ILedgerStreamer: addincludeDisclosureto bothSubscribeActiveAsyncoverloads, and likewise in subclasses of the conformance kit'sNotSupportedLedgerClientthat override them. - Conformance packages renamed. The
richtypesandcontractkeyspackages inDaml.Codegen.Testing.Conformancecarry a content-addressedPackageName(<base>-h<hash12>) instead of the fixed name, andcontractkeysgains aDisclosure.Offertemplate. Update any assertion against either literal package name or id.
🐛 Fixed
- A record whose trailing
Optionalfield isNonenow decodes on both transports. The Ledger API leaves out a trailingNonefield in create arguments, exercise results and the active contract set, and generated readers used to refuse such a payload as undecodable. A declaredOptionalfield that is absent decodes asNone, as does a generic record's type-parameter field or aTuple2/Tuple3component whose instantiation isOptional; every other field is still required. Regenerate to pick up the fix. ILedgerWriter.TrySubmitAndWaitForTransactionAsyncreturns the transaction's exercised events. A generatedTry{Choice}Asyncfor a choice that does not return aContractId, such as a nonconsumingDecimalchoice, threwInvalidOperationExceptionafter the command had committed, and a caller that retried on it submitted twice.CreatedContractsandArchivedContractIdskeep 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.2All 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
🚀 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.WithDeduplicationPeriodon gRPC and REST — set how long the participant rejects a resubmission asDUPLICATE_COMMAND.- REST parity 🌐 —
AddRestLedgerClientalso registers anIAdminClientover the JSON Ledger API, so administration no longer needs gRPC; REST submissions now encodeDA.MapandOptional (Optional a). - Typed
TransportStatus—Grpc,Http,NoResponseorUndecodableBodyreplaces a bareint 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>isTry…Async; chainOneOrThrowAsyncfor the throwing style. - Variants round-trip through
System.Text.Jsonwith a leading"$case"discriminator, noAddDamlConverters()needed. - Standalone release artifacts 🧰 — the
daml-dar-to-protojar reports its real--versionand ships with the proto, fixtures andSHA256SUMS.
💥 Upgrading from 0.5.0-preview.3
Bump every package to
0.6.0-preview.1together, 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.
IAdminClientis no longerIDisposable; 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
UserRightsubtypes and the four client options types aresealed(CS0509);RetryPipelineFactory,LedgerActivitySourceandTokenProviderExtensionsareinternal. Google.Protobufis pinned back to3.35.1. 3.36.0–3.36.2 has a thread-safety race in file-descriptor initialization (upstream issue) that can leave a generated*Reflectiontype throwingTypeInitializationExceptionfor good. The dependency is a floor: if something pulls in 3.36.0–3.36.2, pin3.35.1yourself.- Also: the reflection
DAMLRT0001reader is removed (useReadRecord<T>or the newReadVariant<T>); a barenulllimits argument toDamlJsonSerializer.Deserializeis now ambiguous, so drop it;Canton.Ledger.OpenTelemetrydrops itsNpgsql.OpenTelemetryreference; a serializedStreamErrorwrites a nested"Status", and logs carry{Status}.
🐛 Fixed
- A
Numeric 0field 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
Nonefails to decode. The JSON Ledger API omits trailingNoneoptionals, and the generated reader requires the field. The command still commits; the result comes backCommittedUndecodable. gRPC is unaffected. - Generated
Try{Choice}Asyncthrows for choices that do not return a contract id. The submission does not request exercised events, so the wrapper throwsInvalidOperationExceptionafter the command has committed. Do not retry on it. Workaround:TrySubmitAndWaitForTransactionTreeAsyncwithToTransactionResult().
📦 What's in the release
dotnet add package Canton.Ledger.Grpc.Client --version 0.6.0-preview.1All 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