fix: add JsCommands schema stub in openrpc-dapp-api.json#1726
Open
alleneubank wants to merge 1 commit into
Open
fix: add JsCommands schema stub in openrpc-dapp-api.json#1726alleneubank wants to merge 1 commit into
alleneubank wants to merge 1 commit into
Conversation
The components.schemas.JsCommands entry is still the placeholder introduced in canton-network#40 ("Api spec placeholders", 2025-06-05): "JsCommands": { "title": "JsCommands", "type": "object", "description": "Structure representing JS commands for transaction execution", "additionalProperties": true } This stub has never been filled in, even though PRs canton-network#904, canton-network#1259, canton-network#1339, and canton-network#1609 have all touched JsPrepareSubmissionRequest. It contradicts four other parts of this same repo: 1. Canton Ledger API — api-specs/ledger-api/3.4.12/openapi.yaml lines 4736-4751 define JsCommands.commands as a required, non-empty type: array whose items are $ref Command. 2. SDK docs — docs/dapp-building/dapp-sdk/usage.md:205 shows { commands: [ { CreateCommand: {...} } ] }. 3. Canonical example — examples/ping/src/commands/createPingCommand.ts:9 builds commands: [ { CreateCommand: {...} } ]. 4. Upstream runtime — wallet-gateway/remote/src/dapp-api/controller.ts:243 accesses params.commands?.[0], only valid if commands is an array. This patch replaces the stub with: - Four named variant schemas (CreateCommand, ExerciseCommand, CreateAndExerciseCommand, ExerciseByKeyCommand), each a one-key object with opaque inner shape (additionalProperties: true, description defers to Canton Ledger API). - A Command oneOf tagged-union referencing the four variants. - JsCommands redefined as an array of Command, minItems: 1. The oneOf discriminated union path is what generated clients need to emit a clean z.union([...]) with openapi-zod-client (rather than the superRefine fallback the default json-schema-to-zod path produces). Severity: blocks CIP-0103 interop for any wallet that generates its JSON-RPC validators from the published OpenRPC spec. Downstream fix verified in 0xsend/canton-monorepo#2810 (Send Canton Wallet webext), with a CIP-0103 conformance Playwright spec driving the upstream examples/ping dApp against a patched wallet. Staging fork: 0xsend/wallet-gateway (private, for pre-upstream review). This commit targets the detached pin f30e464 to match the canton-monorepo work-dir reference. Sealed-by-rl-review: a3261c182921581712ca124f0018bfcd45c04f48 (diff-range, 6 commits) Signed-off-by: Allen <allen@send.it> --- Squashed commits --- 5c24ca75 Fix JsCommands schema stub in openrpc-dapp-api.json dcf81def fix(review-fix-up): address major-1 schema titles 513ce47c fix(review-fix-up): address major-2 generated commands dbf68f5d fix(review-fix-up): address major-1: refresh dapp clients a1dcb80d fix(review-fix-up): address major-1: sync dapp openrpc schemas a3261c18 fix(review-fix-up): address major-2: accept command arrays
mjuchli-da
reviewed
May 18, 2026
Contributor
mjuchli-da
left a comment
There was a problem hiding this comment.
Apologies for the delayed review:
I generally support defining the schema more specifically, and in the case of JsCommands, it is well worth it, given that the type is technically defined over in the OpenApi specification of the ledger api.
I want to ensure this does not block other CIP-compliant wallets, including Wallet Connect, for now (it shouldn't). @alexmatson-da will check and do the final approval.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the
JsCommandsplaceholder inapi-specs/openrpc-dapp-api.jsonwith a properly-typed schema. Single commit (5c24ca75),api-specs/openrpc-dapp-api.jsononly.This is the upstream candidate for
canton-network/wallet-gateway(renamed fromhyperledger-labs/splice-wallet-kernel). Opening on the private fork first for structured review before upstreaming.Why
The
components.schemas.JsCommandsentry has been a placeholder since #40 ("Api spec placeholders", 2025-06-05):Verified still in this state on
canton-network/wallet-gateway:main(bd545745).Playground Link
This stub contradicts four other parts of this same repo:
api-specs/ledger-api/3.4.12/openapi.yaml(and 3.5.1) defineJsCommands.commandsas a required, non-emptytype: arraywhose items are$ref: Command.docs/dapp-building/dapp-sdk/usage.md:205shows{ commands: [ { CreateCommand: {...} } ] }.examples/ping/src/commands/createPingCommand.ts:9buildscommands: [ { CreateCommand: {...} } ].wallet-gateway/remote/src/dapp-api/controller.ts:243accessesparams.commands?.[0], only valid ifcommandsis an array.PRs #904, #1259, #1339, and #1609 all touched
JsPrepareSubmissionRequestwithout filling this in.What changes
CreateCommand,ExerciseCommand,CreateAndExerciseCommand,ExerciseByKeyCommand), each a one-key tagged object. Inner shapes left opaque (additionalProperties: true) — the description defers to the Canton Ledger API to avoid drift.CommandoneOftagged-union referencing the four variants.JsCommandsredefined asarray of Command, minItems: 1.The
oneOfdiscriminated-union path is what generated clients need to emit a cleanz.union([...])withopenapi-zod-client(the defaultjson-schema-to-zodpath produces asuperRefinefallback otherwise).Naming note (not a bug)
The dApp API uses
JsCommandsas the inner array (array<Command>), with the wrapper object beingJsPrepareSubmissionRequest = {commandId, commands: $ref JsCommands, actAs, ...}. The Ledger API uses the same nameJsCommandsfor the outer wrapper{commandId, commands: array<Command>, actAs, ...}. Same logical content, different nesting level. Our patch preserves the existing dApp-API structure (matchesJsPrepareSubmissionRequest's pre-existing reference ofcommands: $ref JsCommands), so this is consistent — not introduced by this PR. Worth verifying in review.Severity
Blocks CIP-0103 interop for any wallet that generates its JSON-RPC validators from the published OpenRPC spec.
Downstream verification
Verified via Send Canton Wallet webext, with a CIP-0103 conformance Playwright spec driving the upstream
examples/pingdApp against a patched wallet.Base
Rebased onto
canton-network/wallet-gateway:main(bd545745). Fork'smainsynced from oldhyperledger-labs/splice-wallet-kernel(62 commits behind canonical) to current canton-network/wallet-gateway tip on 2026-05-08.Review focus
oneOfshapes match whatwallet-gateway/remote/src/dapp-api/controller.tsactually accepts at runtime?openapi-zod-clientemits cleanz.union([z.object({CreateCommand: ...}), ...])from thisoneOf, not asuperRefinefallback.JsCommandsarray-vs-wrapper-object naming inconsistency between dApp API and Ledger API a deliberate layering choice or worth raising upstream?