Skip to content

feat: add tsdoc for dapp-sdk - #2204

Draft
mjuchli-da wants to merge 3 commits into
mainfrom
mjuchli/tsdoc-dapp-sdk
Draft

feat: add tsdoc for dapp-sdk#2204
mjuchli-da wants to merge 3 commits into
mainfrom
mjuchli/tsdoc-dapp-sdk

Conversation

@mjuchli-da

Copy link
Copy Markdown
Contributor

No description provided.

Signed-off-by: Marc Juchli <marc.juchli@digitalasset.com>
@mjuchli-da mjuchli-da self-assigned this Jul 28, 2026
@mjuchli-da
mjuchli-da requested a review from a team as a code owner July 28, 2026 08:11
Copilot AI lite review requested due to automatic review settings July 28, 2026 08:11
@mjuchli-da mjuchli-da added documentation Improvements or additions to documentation dapp-sdk labels Jul 28, 2026
@mjuchli-da mjuchli-da changed the title feat: add tsdoc feat: add tsdoc for dapp-sdk Jul 28, 2026

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts and commit the generated docs/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.

Comment on lines +18 to +39
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'
Comment thread sdk/dapp-sdk/src/index.ts
Comment on lines 67 to +71
removeOnAccountsChanged,
removeOnConnected,
removeOnTxChanged,
} from './sdk'
export type { DappSDKConnectOptions } from './sdk'
@mjuchli-da
mjuchli-da marked this pull request as draft July 28, 2026 08:29
@mjuchli-da mjuchli-da linked an issue Jul 29, 2026 that may be closed by this pull request
Signed-off-by: Marc Juchli <marc.juchli@digitalasset.com>
Copilot AI review requested due to automatic review settings August 4, 2026 09:38

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 export onMessageSignature / 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.ts now exports onMessageSignature/removeOnMessageSignature, but they are not re-exported from the package entrypoint (src/index.ts). As-is, consumers importing from @canton-network/dapp-sdk won’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.ts claims 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 example DappSDK / dappSDK) from this docs module so Typedoc includes signMessage, 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>
Copilot AI review requested due to automatic review settings August 4, 2026 14:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts is meant to be the TypeDoc entrypoint for the public module-level SDK API, but it doesn't re-export onMessageSignature / removeOnMessageSignature even 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

  • ./sdk exports onMessageSignature / 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 in sdk.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) then connect()), and even notes via TODO that it can diverge from sdk.connect(options) behavior. To keep wrapper behavior identical to the class API and avoid extra init() calls, delegate directly to sdk.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.ts assumes 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' })

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dapp-sdk documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JSDocs for dApp and Wallet SDK

2 participants