Repository: LedgerHQ/device-sdk-ts
Pull request #761: 📝 (docs) [NO-ISSUE]: Updating docs for DMK changes (connect useCase)
Author: login: fAnselmi-Ledger
Created: 2025-03-28T16:33:22Z | Merged: 2025-03-28T16:59:04Z

<!--
Thank you for your contribution! 👍
Please make sure to read CONTRIBUTING.md if you have not already. Pull Requests that do not comply with the rules will be arbitrarily closed.
-->

### 📝 Description

updated docs 

<!--
| Before        | After         |
| ------------- | ------------- |
|               |               |
-->

### ❓ Context

<!--- If you are a Ledger employee, please include the relevant ticket number, if applicable (e.g., [JIRA-123] for Jira or #123 for a GitHub issue), [NO-ISSUE] if not.-->

- **JIRA or GitHub link**: [NO-ISSUE]

<!--- If the PR related to an issue, please include the issue link. -->

- **Feature**:

### ✅ Checklist

Pull Requests must pass CI checks and undergo code review. Set the PR as Draft if it is not yet ready for review.

- [ ] **Covered by automatic tests** <!-- if not, please explain. (Feature must be tested / Bugfix must bring non-regression) -->
- [ ] **Changeset is provided** <!-- Please provide a changeset -->
- [ ] **Documentation is up-to-date** <!-- Please ensure all relevant documentation (README, API docs, etc.) has been updated -->
- [ ] **Impact of the changes:** <!-- Please take some time to list the impact & what specific areas Quality Assurance (QA) should focus on -->
  - _list of the changes_

---

### 🧐 Checklist for the PR Reviewers

<!-- Please do not edit this if you are the PR author -->

- [ ] **The code aligns with the requirements** described in the linked JIRA or GitHub issue.
- [ ] **The PR description clearly documents the changes** made and explains any technical trade-offs or design decisions.
- [ ] **There are no undocumented trade-offs**, technical debt, or maintainability issues.
- [ ] **The PR has been tested** thoroughly, and any potential edge cases have been considered and handled.
- [ ] **Any new dependencies** have been justified and documented.



Diff:
diff --git a/apps/docs/pages/docs/beginner/discover_and_connect.mdx b/apps/docs/pages/docs/beginner/discover_and_connect.mdx
index 52ed42d8d..86eaa8dd2 100644
--- a/apps/docs/pages/docs/beginner/discover_and_connect.mdx
+++ b/apps/docs/pages/docs/beginner/discover_and_connect.mdx
@@ -19,18 +19,38 @@ Before starting this tutorial, make sure you have initialized the DMK instance a
 
 Let's start the discovery process:
 
+- **Discovery**: `dmk.startDiscovering()`
+  - Returns an observable which will emit a new `DiscoveredDevice` for every scanned device.
+  - The `DiscoveredDevice` objects contain information about the device model.
+  - Use one of these values to connect to a given discovered device.
+- **Connection**:
+
+```ts
+dmk.connect({
+  deviceId: device.id,
+  {
+    isRefresherDisabled: boolean;
+    pollingInterval?: number;
+  }
+})
+```
+
+- Returns a Promise resolving in a device session identifier `DeviceSessionId`.
+- **Keep this device session identifier to further interact with the device.**
+- Then, `dmk.getConnectedDevice({ sessionId })` returns the `ConnectedDevice`, which contains information about the device model and its name.
+
 ```ts
 // Start discovering devices
 const discoverySubscription = dmk.startDiscovering({}).subscribe({
   next: (device) => {
-    // This function is called whenever a new device is found
-    console.log(`Found device: ${device.id}`);
-    console.log(`Device model: ${device.deviceModel.model}`);
-
-    // At this point, you could:
-    // - Connect to the device automatically
-    // - Add it to a list of available devices for the user to choose from
-    // - Filter devices based on model or other criteria
+    dmk
+    .connect({
+      deviceId: device.id,
+      { isRefresherDisabled: true }
+    })
+    .then((sessionId) => {
+      const connectedDevice = dmk.getConnectedDevice({ sessionId });
+    });
   },
   error: (error) => {
     console.error("Discovery error:", error);
diff --git a/packages/device-management-kit/README.md b/packages/device-management-kit/README.md
index 74a41a076..32cd06dbc 100644
--- a/packages/device-management-kit/README.md
+++ b/packages/device-management-kit/README.md
@@ -88,15 +88,31 @@ There are two steps to connecting to a device:
   - Returns an observable which will emit a new `DiscoveredDevice` for every scanned device.
   - The `DiscoveredDevice` objects contain information about the device model.
   - Use one of these values to connect to a given discovered device.
-- **Connection**: `dmk.connect({ deviceId: device.id })`
-  - Returns a Promise resolving in a device session identifier `DeviceSessionId`.
-  - **Keep this device session identifier to further interact with the device.**
-  - Then, `dmk.getConnectedDevice({ sessionId })` returns the `ConnectedDevice`, which contains information about the device model and its name.
+- **Connection**:
+
+```ts
+dmk.connect({
+  deviceId: device.id,
+  {
+    isRefresherDisabled: boolean;
+    pollingInterval?: number;
+  }
+  })
+```
+
+- Returns a Promise resolving in a device session identifier `DeviceSessionId`.
+- **Keep this device session identifier to further interact with the device.**
+- Then, `dmk.getConnectedDevice({ sessionId })` returns the `ConnectedDevice`, which contains information about the device model and its name.
 
 ```ts
 dmk.startDiscovering().subscribe({
   next: (device) => {
-    dmk.connect({ deviceId: device.id }).then((sessionId) => {
+    dmk
+    .connect({
+      deviceId: device.id,
+      { isRefresherDisabled: true }
+    })
+    .then((sessionId) => {
       const connectedDevice = dmk.getConnectedDevice({ sessionId });
     });
   },


Reviews:
user: login: copilot-pull-request-reviewer[bot]
body: ## Pull Request Overview

This pull request updates the DMK documentation to reflect recent changes in the connection configuration for devices. The changes include revised code examples showing new options for the dmk.connect API call.

<details>
<summary>Files not reviewed (1)</summary>

* **apps/docs/pages/docs/beginner/discover_and_connect.mdx**: Language not supported
</details>



state: COMMENTED
author_association: CONTRIBUTOR
submitted_at: 2025-03-28T16:34:18Z
user: login: aussedatlo
state: APPROVED
author_association: CONTRIBUTOR
submitted_at: 2025-03-28T16:42:47Z

Review comments:
diff_hunk: @@ -88,15 +88,27 @@ There are two steps to connecting to a device:
   - Returns an observable which will emit a new `DiscoveredDevice` for every scanned device.
   - The `DiscoveredDevice` objects contain information about the device model.
   - Use one of these values to connect to a given discovered device.
-- **Connection**: `dmk.connect({ deviceId: device.id })`
+- **Connection**:
+  `dmk.connect({ 
+  deviceId: device.id, 
+  {
+    isRefresherDisabled: boolean;
+    pollingInterval?: number;
+  }
path: packages/device-management-kit/README.md
user: login: Copilot
body: An object literal is unexpectedly inserted without a key. Merge the configuration options into the outer object passed to dmk.connect (e.g., deviceId, isRefresherDisabled, and pollingInterval as key-value pairs).
```suggestion
  isRefresherDisabled: boolean,
  pollingInterval?: number
```
created_at: 2025-03-28T16:34:17Z
author_association: CONTRIBUTOR
diff_hunk: @@ -88,15 +88,27 @@ There are two steps to connecting to a device:
   - Returns an observable which will emit a new `DiscoveredDevice` for every scanned device.
   - The `DiscoveredDevice` objects contain information about the device model.
   - Use one of these values to connect to a given discovered device.
-- **Connection**: `dmk.connect({ deviceId: device.id })`
+- **Connection**:
+  `dmk.connect({ 
+  deviceId: device.id, 
+  {
+    isRefresherDisabled: boolean;
+    pollingInterval?: number;
+  }
+})`
   - Returns a Promise resolving in a device session identifier `DeviceSessionId`.
   - **Keep this device session identifier to further interact with the device.**
   - Then, `dmk.getConnectedDevice({ sessionId })` returns the `ConnectedDevice`, which contains information about the device model and its name.
 
 ```ts
 dmk.startDiscovering().subscribe({
   next: (device) => {
-    dmk.connect({ deviceId: device.id }).then((sessionId) => {
+    dmk
+    .connect({
+      deviceId: device.id,
+      { isRefresherDisabled: true }
path: packages/device-management-kit/README.md
user: login: Copilot
body: The extra object literal is syntactically incorrect; it should be removed and the property incorporated directly into the connect method's parameter object.
```suggestion
      isRefresherDisabled: true
```
created_at: 2025-03-28T16:34:18Z
author_association: CONTRIBUTOR

PR comments:
user: login: vercel[bot]
created_at: 2025-03-28T16:33:26Z
body: [vc]: #Qtv/Bu0+yHtQQIufvh0ikO6ZzyTPWASF+EPUA+yZUds=:eyJpc01vbm9yZXBvIjp0cnVlLCJ0eXBlIjoiZ2l0aHViIiwicHJvamVjdHMiOlt7Im5hbWUiOiJkZXZpY2Utc2RrLXRzLXNhbXBsZSIsInJvb3REaXJlY3RvcnkiOiJhcHBzL3NhbXBsZSIsImluc3BlY3RvclVybCI6Imh0dHBzOi8vdmVyY2VsLmNvbS9sZWRnZXJocS9kZXZpY2Utc2RrLXRzLXNhbXBsZS85aUVkeUNlcHBlSjdiQjUxTGdndWdTeEtSZXBxIiwicHJldmlld1VybCI6IiIsIm5leHRDb21taXRTdGF0dXMiOiJDQU5DRUxFRCIsImxpdmVGZWVkYmFjayI6eyJyZXNvbHZlZCI6MCwidW5yZXNvbHZlZCI6MCwidG90YWwiOjAsImxpbmsiOiIifX0seyJuYW1lIjoiZG9jLWRldmljZS1tYW5hZ2VtZW50LWtpdCIsInJvb3REaXJlY3RvcnkiOiJhcHBzL2RvY3MiLCJpbnNwZWN0b3JVcmwiOiJodHRwczovL3ZlcmNlbC5jb20vbGVkZ2VyaHEvZG9jLWRldmljZS1tYW5hZ2VtZW50LWtpdC81eTFGeU53TFBtS0pmTkR5ZDM4Qm9oVmVraXVEIiwicHJldmlld1VybCI6ImRvYy1kZXZpY2UtbWFuYWdlbWVudC1raXQtZ2l0LWZlYXQtbm8taXNzdWUtdXBkLTYzYTJhMy1sZWRnZXJocS52ZXJjZWwuYXBwIiwibmV4dENvbW1pdFN0YXR1cyI6IklHTk9SRUQiLCJsaXZlRmVlZGJhY2siOnsicmVzb2x2ZWQiOjAsInVucmVzb2x2ZWQiOjAsInRvdGFsIjowLCJsaW5rIjoiIn19XX0=
**The latest updates on your projects**. Learn more about [Vercel for Git ↗︎](https://vercel.link/github-learn-more)

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **device-sdk-ts-sample** | 🛑 Canceled ([Inspect](https://vercel.com/ledgerhq/device-sdk-ts-sample/9iEdyCeppeJ7bB51LggugSxKRepq)) |  |  | Mar 28, 2025 4:52pm |

<details><summary>1 Skipped Deployment</summary>

| Name | Status | Preview | Comments | Updated (UTC) |
| :--- | :----- | :------ | :------- | :------ |
| **doc-device-management-kit** | ⬜️ Ignored ([Inspect](https://vercel.com/ledgerhq/doc-device-management-kit/5y1FyNwLPmKJfNDyd38BohVekiuD)) | [Visit Preview](https://doc-device-management-kit-git-feat-no-issue-upd-63a2a3-ledgerhq.vercel.app) |  | Mar 28, 2025 4:52pm |
</details>



author_association: NONE
user: login: github-actions[bot]
created_at: 2025-03-28T16:44:04Z
body: 
<!--
  0 failure: 
  0 warning: 
  1 messages
  
  DangerID: danger-id-Danger;
-->



<table>
  <thead>
    <tr>
      <th width="50"></th>
      <th width="100%" data-danger-table="true">Messages</th>
    </tr>
  </thead>
  <tbody><tr>
      <td>⚠️</td>
      <td> No changeset file found. Please make sure this is intended or add a changeset file.</td>
    </tr>
  </tbody>
</table>


<p align="right">
  Generated by :no_entry_sign: <a href="https://danger.systems/js">dangerJS</a> against 452d285f28a6b8f90021401defc14c1b03db926a
</p>

author_association: CONTRIBUTOR