docs(connect): document the gateway, WalletConnect and ledger route contracts - #201
docs(connect): document the gateway, WalletConnect and ledger route contracts#201fernandomg wants to merge 3 commits into
Conversation
- architecture: Remote gateway section, #2 leaves Deferred - README: configure a gateway, restore and lock contracts, local recipe - CantonConnectConfig: example with a RemoteAdapter - coming-from-wagmi: connectors row
- architecture: WalletConnect section, networkId must match the wallet's chain - README: configure WalletConnect, network id and lock rules, pairing - CantonConnectConfig: first example shows networkId and walletConnectProjectId - coming-from-wagmi: networkId clause on the connectors row
- architecture: Ledger reads section, both spellings side by side - README: the rule once under Usage, gateway subsection points at it - useLedger: prose states the rule, example uses path - coming-from-wagmi: read hooks row notes the templated route
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
🟡 Changes recommended
The README and architecture.md give contradictory statements about whether useWalletStatus().isLocked can become true over WalletConnect, which should be reconciled before this documentation is published.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This documentation-only PR closes #2 by documenting the Wallet Gateway (remote RemoteAdapter), WalletConnect, and the Canton JSON API "templated route" contract across the surfaces a canton-connect consumer reads. No code changes: the SDK already supports all three paths through additionalAdapters, so the work is to make the configuration, restore/lock/networkId rules, and the ledgerApi route rule discoverable in the README, JSDoc, the wagmi comparison, and the architecture seam. It also drops the now-implemented "Remote / Wallet Gateway" item from the architecture Deferred list.
Changes:
- Adds README + architecture sections for configuring a gateway and WalletConnect, including restore/lock/
networkIdbehavior and a local gateway recipe. - Expands the
CantonConnectConfiganduseLedgerJSDoc examples to showwalletConnectProjectId, aRemoteAdapter, and the templatedpath-based ledger route. - Adds/updates
coming-from-wagmi.mdrows for connectors and read hooks.
File summaries
| File | Description |
|---|---|
canton-connect/src/types.ts |
Extends CantonConnectConfig JSDoc with a WalletConnect example and a RemoteAdapter gateway example (stays within docs-check caps). |
canton-connect/src/hooks/useLedger.ts |
Documents the templated-route rule and updates the @example to use resource + path. |
canton-connect/README.md |
Adds "Connecting through a Wallet Gateway" and "Connecting through WalletConnect" sections plus the ledger route rule. |
canton-connect/coming-from-wagmi.md |
Adds a connectors row and updates the read-hook row to reflect the templated route. |
canton-connect/architecture.md |
Adds Remote gateway, WalletConnect, and Ledger reads seams; removes the gateway item from Deferred. |
One issue worth reconciling: the README states useWalletStatus().isLocked "never turns true" over WalletConnect, while the newly added architecture.md says it "stays false until the wallet answers a request again" (implying it can become true). These two consumer-facing docs contradict each other for the WalletConnect case.
Review details
- Files reviewed: 5/5 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| wallet-service advertises `canton:localnet`. A wallet lock never crosses the relay, so | ||
| `useWalletStatus().isLocked` never turns true on one, and restore after a reload is silent: the |
Summary
Closes #2
canton-connect connects through a Wallet Gateway and through WalletConnect with no library change, but nothing said so: a developer had to guess the configuration, learn by trial that a reload restores only a gateway registered at startup, and hit the gateway refusing a ledger route spelled with the value inline. Both paths were walked end to end (connect, reload, lock, disconnect, popup checks, a real transaction) and every finding is now on the surfaces a consumer reads: the README, the config and hook JSDoc, the wagmi comparison, the architecture seam.
Changes
CantonConnectConfigexamples shownetworkId,walletConnectProjectIdand aRemoteAdapteruseLedgerprose states the route rule and its example usespathDeviations
Acceptance criteria
additionalAdaptersconnects, reloads with the session intact, locks, disconnects, and sends a transaction, each step recordeduseWalletStatusbehavior on lock is decided and documentedcanton-connect/architecture.mdlists the gateway as supported, with the configuration and the local recipeTest plan
Automated tests
pnpm lint,pnpm -C canton-connect typecheck,pnpm docs:check(compiles every example): all green on the branch.Manual verification
feat/frontend-walletconnect: the demo with WalletConnect in its picker, on top of this branch.VITE_WC_PROJECT_IDin the root.env(a free Reown project id) and bring the stack up withscripts/dev-stack.sh up.pnpm devin its repo, same id in its.env.local) and, for the gateway,npx @canton-network/wallet-gateway-remote@1.10.0 -c config.jsonwith the config shape from the README.Breaking changes
None.
Checklist
docs:check)Screenshots
Screen.Recording.2026-09-09.at.20.34.06.mov