feat: add tsdoc for dapp-sdk - #2204
Conversation
Signed-off-by: Marc Juchli <marc.juchli@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Adds a TypeDoc-based documentation pipeline for @canton-network/dapp-sdk, including TSDoc annotations/grouping in the SDK and a generated Markdown reference page under docs/.
Changes:
- Add TypeDoc + plugins and yarn packageExtensions to support Markdown/frontmatter output.
- Introduce a docs-specific TS config and a docs entrypoint for generating the “SDK Methods” reference.
- Expand/organize TSDoc in
sdk.tsand commit the generateddocs/dapp-sdk/reference/sdk-methods.md.
Reviewed changes
Copilot reviewed 9 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
yarn.lock |
Locks newly added TypeDoc and plugin dependencies. |
sdk/dapp-sdk/tsconfig.json |
Excludes docs/test files from the main SDK TS build. |
sdk/dapp-sdk/tsconfig.docs.json |
Adds a docs-only TS/TypeDoc configuration for generating reference output. |
sdk/dapp-sdk/src/sdk.ts |
Adds/updates TSDoc comments and grouping for SDK APIs. |
sdk/dapp-sdk/src/sdk-methods.docs.ts |
Adds a TypeDoc entry module to document the intended public “SDK Methods” surface. |
sdk/dapp-sdk/src/index.ts |
Exposes SDK APIs from the package entrypoint and adds a type export. |
sdk/dapp-sdk/package.json |
Adds a docs script and TypeDoc devDependencies. |
package.json |
Adds a root script to regenerate the dapp-sdk reference docs. |
docs/dapp-sdk/reference/sdk-methods.md |
Updates the generated Markdown reference for SDK methods. |
.yarnrc.yml |
Adds Yarn packageExtensions to ensure TypeDoc plugins/peers resolve correctly. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| export type { DappSDKConnectOptions } from './sdk' | ||
| export { | ||
| init, | ||
| connect, | ||
| disconnect, | ||
| isConnected, | ||
| status, | ||
| listAccounts, | ||
| prepareExecute, | ||
| prepareExecuteAndWait, | ||
| ledgerApi, | ||
| open, | ||
| getConnectedProvider, | ||
| onStatusChanged, | ||
| onAccountsChanged, | ||
| onConnected, | ||
| onTxChanged, | ||
| removeOnStatusChanged, | ||
| removeOnAccountsChanged, | ||
| removeOnConnected, | ||
| removeOnTxChanged, | ||
| } from './sdk' |
| removeOnAccountsChanged, | ||
| removeOnConnected, | ||
| removeOnTxChanged, | ||
| } from './sdk' | ||
| export type { DappSDKConnectOptions } from './sdk' |
Signed-off-by: Marc Juchli <marc.juchli@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 10 changed files in this pull request and generated no new comments.
Suppressed comments (3)
sdk/dapp-sdk/src/sdk-methods.docs.ts:39
- The docs entrypoint (
sdk-methods.docs.ts) doesn’t exportonMessageSignature/removeOnMessageSignature, so the generated reference docs omit these SDK event APIs even though they’re exported from./sdk.
open,
getConnectedProvider,
onStatusChanged,
onAccountsChanged,
onConnected,
onTxChanged,
removeOnStatusChanged,
removeOnAccountsChanged,
removeOnConnected,
removeOnTxChanged,
} from './sdk'
sdk/dapp-sdk/src/index.ts:71
sdk.tsnow exportsonMessageSignature/removeOnMessageSignature, but they are not re-exported from the package entrypoint (src/index.ts). As-is, consumers importing from@canton-network/dapp-sdkwon’t be able to use these new event helpers.
removeOnAccountsChanged,
removeOnConnected,
removeOnTxChanged,
} from './sdk'
export type { DappSDKConnectOptions } from './sdk'
sdk/dapp-sdk/src/sdk-methods.docs.ts:6
sdk-methods.docs.tsclaims the reference covers “requesting signatures”, but the generated docs don’t expose any signature API (e.g.DappSDK.signMessage). Either export a signature entrypoint (for exampleDappSDK/dappSDK) from this docs module so Typedoc includessignMessage, or adjust the package docs text to match what’s actually documented.
/**
* High-level dApp SDK methods for discovering wallets, connecting users,
* reading parties, requesting signatures, and submitting transactions.
Signed-off-by: Marc Juchli <marc.juchli@digitalasset.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 15 changed files in this pull request and generated no new comments.
Suppressed comments (4)
sdk/dapp-sdk/src/sdk-methods.docs.ts:39
sdk-methods.docs.tsis meant to be the TypeDoc entrypoint for the public module-level SDK API, but it doesn't re-exportonMessageSignature/removeOnMessageSignatureeven though they are exported from./sdk. This causes the generated reference docs to omit the message-signature event APIs.
export {
init,
connect,
disconnect,
isConnected,
status,
listAccounts,
prepareExecute,
prepareExecuteAndWait,
ledgerApi,
open,
getConnectedProvider,
onStatusChanged,
onAccountsChanged,
onConnected,
onTxChanged,
removeOnStatusChanged,
removeOnAccountsChanged,
removeOnConnected,
removeOnTxChanged,
} from './sdk'
sdk/dapp-sdk/src/index.ts:71
./sdkexportsonMessageSignature/removeOnMessageSignature, but they aren't re-exported from the package entrypoint (src/index.ts). If these APIs are intended to be public (they have TSDoc groups and are available as module-level helpers insdk.ts), they should be exported here as well so consumers can import them from@canton-network/dapp-sdk.
export {
DappSDK,
sdk as dappSDK,
init,
connect,
disconnect,
isConnected,
status,
listAccounts,
prepareExecute,
prepareExecuteAndWait,
ledgerApi,
open,
getConnectedProvider,
onStatusChanged,
onAccountsChanged,
onConnected,
onTxChanged,
removeOnStatusChanged,
removeOnAccountsChanged,
removeOnConnected,
removeOnTxChanged,
} from './sdk'
export type { DappSDKConnectOptions } from './sdk'
sdk/dapp-sdk/src/sdk.ts:753
- The module-level
connect(options)wrapper reimplements connection logic (init(options)thenconnect()), and even notes via TODO that it can diverge fromsdk.connect(options)behavior. To keep wrapper behavior identical to the class API and avoid extrainit()calls, delegate directly tosdk.connect(options)when options are provided.
if (options) {
return sdk.init(options).then(() => sdk.connect())
}
return sdk.connect()
scripts/src/docs-update-sdk-reference.ts:48
docs-update-sdk-reference.tsassumes the generated markdown file already exists and will throw a low-signal error if it doesn't (e.g. when adding a new SDK reference for the first time, or if the file was accidentally deleted). Handling ENOENT here would give clearer behavior and keep the script focused on “drift detection”.
const outputPath = path.join(repoRoot, ref.output)
const existing = await readFile(outputPath, { encoding: 'utf-8' })
No description provided.