@exodus/hardware-wallets 1.1.1 → 1.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [1.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hardware-wallets@1.1.2...@exodus/hardware-wallets@1.2.0) (2024-08-16)
7
+
8
+ ### Features
9
+
10
+ - add getAvailableDevices ([#8474](https://github.com/ExodusMovement/exodus-hydra/issues/8474)) ([377ef0d](https://github.com/ExodusMovement/exodus-hydra/commit/377ef0d2c4e25ac33085c638ec7bbfe5dff74efd))
11
+
12
+ ## [1.1.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hardware-wallets@1.1.1...@exodus/hardware-wallets@1.1.2) (2024-08-13)
13
+
14
+ ### Bug Fixes
15
+
16
+ - add require device for ([#8333](https://github.com/ExodusMovement/exodus-hydra/issues/8333)) ([102f065](https://github.com/ExodusMovement/exodus-hydra/commit/102f065d66f00e0501986aeb53d90435f1e51adc))
17
+
6
18
  ## [1.1.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hardware-wallets@1.1.0...@exodus/hardware-wallets@1.1.1) (2024-08-12)
7
19
 
8
20
  ### Bug Fixes
@@ -9,6 +9,10 @@ declare const hardwareWalletsApiDefinition: {
9
9
  }) => {
10
10
  hardwareWallets: {
11
11
  isDeviceConnected: () => Promise<boolean>;
12
+ getAvailableDevices: () => Promise<{
13
+ model: ("blue" | "nanoS" | "nanoSP" | "nanoX" | "stax" | "europa") | ("1" | "t" | "Safe 3" | "Safe 5") | "unknown";
14
+ name: string;
15
+ }[]>;
12
16
  listUseableAssetNames: () => Promise<string[]>;
13
17
  scanForDevices: () => Promise<void>;
14
18
  canAccessAsset: ({ assetName }: import("../module/interfaces.js").CanAccessAssetParams) => Promise<boolean>;
package/lib/api/index.js CHANGED
@@ -19,6 +19,7 @@ const createHardwareWalletsApi = ({ hardwareWallets, restoreProgressTracker, txL
19
19
  return {
20
20
  hardwareWallets: {
21
21
  isDeviceConnected: hardwareWallets.isDeviceConnected,
22
+ getAvailableDevices: hardwareWallets.getAvailableDevices,
22
23
  listUseableAssetNames: hardwareWallets.listUseableAssetNames,
23
24
  scanForDevices: hardwareWallets.scanForDevices,
24
25
  canAccessAsset: hardwareWallets.canAccessAsset,
package/lib/index.d.ts CHANGED
@@ -11,6 +11,10 @@ declare const hardwareWallets: () => {
11
11
  }) => {
12
12
  hardwareWallets: {
13
13
  isDeviceConnected: () => Promise<boolean>;
14
+ getAvailableDevices: () => Promise<{
15
+ model: ("blue" | "nanoS" | "nanoSP" | "nanoX" | "stax" | "europa") | ("1" | "t" | "Safe 3" | "Safe 5") | "unknown";
16
+ name: string;
17
+ }[]>;
14
18
  listUseableAssetNames: () => Promise<string[]>;
15
19
  scanForDevices: () => Promise<void>;
16
20
  canAccessAsset: ({ assetName }: import("./module/interfaces.js").CanAccessAssetParams) => Promise<boolean>;
@@ -1,6 +1,6 @@
1
1
  import { WalletAccount } from '@exodus/models';
2
2
  import Emitter from '@exodus/wild-emitter';
3
- import type { HardwareSignerProvider, CanAccessAssetParams, CreateParams, StoreSyncedKeysParams, ScanParams, SyncParams, EnsureApplicationIsOpenedParams, SignTransactionParams, ScanResult, SyncedKeysId } from './interfaces.js';
3
+ import type { HardwareSignerProvider, CanAccessAssetParams, CreateParams, StoreSyncedKeysParams, ScanParams, SyncParams, EnsureApplicationIsOpenedParams, SignTransactionParams, ScanResult, SyncedKeysId, RequireDeviceForParams } from './interfaces.js';
4
4
  import type { HardwareWalletDiscovery, SignMessageParams } from '@exodus/hw-common';
5
5
  import type { Atom } from '@exodus/atoms';
6
6
  import type { IPublicKeyStore } from '@exodus/public-key-store';
@@ -25,6 +25,10 @@ export declare class HardwareWallets implements HardwareSignerProvider {
25
25
  signMessage: ({ assetName, derivationPath, message }: SignMessageParams) => Promise<any>;
26
26
  isDeviceConnected: () => Promise<boolean>;
27
27
  scanForDevices: () => Promise<void>;
28
+ getAvailableDevices: () => Promise<{
29
+ model: ("blue" | "nanoS" | "nanoSP" | "nanoX" | "stax" | "europa") | ("1" | "t" | "Safe 3" | "Safe 5") | "unknown";
30
+ name: string;
31
+ }[]>;
28
32
  canAccessAsset: ({ assetName }: CanAccessAssetParams) => Promise<boolean>;
29
33
  listUseableAssetNames: () => Promise<string[]>;
30
34
  ensureApplicationIsOpened: ({ assetName }: EnsureApplicationIsOpenedParams) => Promise<void>;
@@ -32,6 +36,10 @@ export declare class HardwareWallets implements HardwareSignerProvider {
32
36
  sync: ({ accountIndex }: SyncParams) => Promise<SyncedKeysId>;
33
37
  addPublicKeysToWalletAccount: ({ walletAccountName, syncedKeysId, }: StoreSyncedKeysParams) => Promise<void>;
34
38
  create: ({ syncedKeysId }: CreateParams) => Promise<void>;
39
+ requireDeviceFor: ({ walletAccount }: RequireDeviceForParams) => Promise<{
40
+ signTransaction: ({ baseAssetName, unsignedTx, walletAccount }: SignTransactionParams) => Promise<any>;
41
+ signMessage: ({ assetName, derivationPath, message }: SignMessageParams) => Promise<any>;
42
+ }>;
35
43
  }
36
44
  declare const hardwareWalletsModuleDefinition: {
37
45
  readonly id: "hardwareWallets";
@@ -118,6 +118,13 @@ export class HardwareWallets {
118
118
  this.#ledgerDiscovery.stopScan(true);
119
119
  return this.#ledgerDiscovery.scan();
120
120
  };
121
+ getAvailableDevices = async () => {
122
+ const devices = await this.#ledgerDiscovery.list();
123
+ return devices.map((device) => ({
124
+ model: device.model,
125
+ name: device.name,
126
+ }));
127
+ };
121
128
  canAccessAsset = async ({ assetName }) => {
122
129
  const asset = this.#assetsModule.getAsset(assetName);
123
130
  const device = await this.#ledgerDiscovery.getFirstDevice();
@@ -295,6 +302,12 @@ export class HardwareWallets {
295
302
  await this.#walletAccounts.setActive(walletAccountName);
296
303
  await this.addPublicKeysToWalletAccount({ walletAccountName, syncedKeysId });
297
304
  };
305
+ requireDeviceFor = async ({ walletAccount }) => {
306
+ return {
307
+ signTransaction: this.signTransaction,
308
+ signMessage: this.signMessage,
309
+ };
310
+ };
298
311
  }
299
312
  const createHardwareWalletsModule = (opts) => new HardwareWallets(opts);
300
313
  const hardwareWalletsModuleDefinition = {
@@ -119,4 +119,7 @@ export interface FetchBalanceParams {
119
119
  address: string;
120
120
  }
121
121
  export type FetchBalanceResult = any | null;
122
+ export interface RequireDeviceForParams {
123
+ walletAccount: WalletAccount;
124
+ }
122
125
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/hardware-wallets",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "An Exodus SDK feature that provides a high level abstraction for interacting with hardware wallet devices",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -40,5 +40,5 @@
40
40
  "@exodus/logger": "^1.2.2",
41
41
  "@exodus/public-key-store": "^1.2.2"
42
42
  },
43
- "gitHead": "7b677da738335fdc10685fdfab0084f60d21a828"
43
+ "gitHead": "c01ac6f4a75a5af1e5f83c2cba4fe2b34d6617ef"
44
44
  }