You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This commit was created on GitHub.com and signed with GitHub’s verified signature.
fix: USDCx registry — match DA hosted token-standard API shape (#276)
* fix: USDCx registry — match DA hosted token-standard API shape
The Splice transfer-factory endpoint hosted by DA's utilities API
(api.utilities.digitalasset-dev.com) mounts the registry per-registrar
under /api/token-standard/v0/registrars/{registrar}/, and expects the
on-ledger choice arguments wrapped in `choiceArguments` with a structured
`instrumentId` plus `executeBefore`/`requestedAt`/`extraArgs` fields.
The SDK was emitting the legacy unprefixed path with a flat body, so
transfers against the deployed devnet failed with `registry returned
404` from nginx. The local devstack happened to register the legacy
path, masking the bug. Update both the SDK client and the devstack
sidecar to the spec-conformant shape, and reuse the registry call's
requestedAt/executeBefore in the on-ledger TransferFactory_Transfer
choice so the timestamps stay consistent.
* fix: unwrap nested choiceContext envelope from DA's registry response
DA's hosted token-standard registry returns the AnyValue choice context
and disclosed contracts both nested inside `choiceContext` (mirroring
the receiver-side AcceptContextResponse shape):
{ "factoryId": ..., "transferKind": ...,
"choiceContext": { "choiceContextData": {"values": {...}},
"disclosedContracts": [...] } }
The previous PR fixed the request side but left the SDK's RegistryResponse
expecting a flat shape (choiceContext = AnyValue map directly,
disclosedContracts at top-level). Against DA's response that would put
the whole {choiceContextData, disclosedContracts} object into
ChoiceContext and leave DisclosedContracts null; ConvertAnyValueChoiceContext
finds no `values` key at that level, falls through to ConvertChoiceContext,
which fails with "json: cannot unmarshal object into Go value of type string".
GetTransferFactory now decodes into a wire struct and lifts choiceContextData
and disclosedContracts back into the flat RegistryResponse the downstream
converters expect. The local devstack mock is updated to emit the same
nested shape, so it actually exercises the unwrap path.
Also URL-escape the registrar party in the request path so future party IDs
with reserved characters don't silently misroute (Gemini's review).
Diagnosis and fix by salindne.
* Update pkg/cantonsdk/token/client.go
Co-authored-by: Sebastian Lindner <33971232+salindne@users.noreply.github.com>
* fix: strip trailing whitespace from comment (gofmt)
---------
Co-authored-by: Sebastian Lindner <33971232+salindne@users.noreply.github.com>