@exodus/hw-ledger 3.9.1 → 4.0.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.
Files changed (41) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/lib/index.d.ts +6 -6
  3. package/lib/index.js +3 -3
  4. package/lib/module/assets/basemainnet.d.ts +1 -1
  5. package/lib/module/assets/basemainnet.js +2 -2
  6. package/lib/module/assets/bitcoin.d.ts +1 -1
  7. package/lib/module/assets/bitcoin.js +11 -11
  8. package/lib/module/assets/ethereum.d.ts +1 -1
  9. package/lib/module/assets/ethereum.js +14 -9
  10. package/lib/module/assets/index.d.ts +1 -1
  11. package/lib/module/assets/index.js +8 -8
  12. package/lib/module/assets/matic.d.ts +1 -1
  13. package/lib/module/assets/matic.js +2 -2
  14. package/lib/module/assets/ripple.d.ts +1 -1
  15. package/lib/module/assets/ripple.js +3 -2
  16. package/lib/module/assets/solana.d.ts +1 -1
  17. package/lib/module/assets/solana.js +5 -3
  18. package/lib/module/assets/tronmainnet.d.ts +1 -1
  19. package/lib/module/assets/tronmainnet.js +4 -2
  20. package/lib/module/assets/utils/index.d.ts +3 -3
  21. package/lib/module/assets/utils/index.js +3 -3
  22. package/lib/module/assets/utils/psbt.d.ts +2 -2
  23. package/lib/module/assets/utils/psbt.js +1 -1
  24. package/lib/module/device.d.ts +1 -1
  25. package/lib/module/device.js +3 -3
  26. package/lib/module/discovery.d.ts +3 -3
  27. package/lib/module/discovery.js +3 -3
  28. package/lib/module/index.d.ts +2 -2
  29. package/lib/module/index.js +2 -2
  30. package/lib/module/management/application.d.ts +2 -2
  31. package/lib/module/types.d.ts +3 -2
  32. package/lib/plugin/index.d.ts +3 -3
  33. package/lib/redux/index.d.ts +3 -3
  34. package/lib/redux/index.js +3 -3
  35. package/lib/redux/initial-state.d.ts +1 -1
  36. package/lib/redux/selectors/bluetoothScanning.d.ts +1 -1
  37. package/lib/redux/selectors/bluetoothStatus.d.ts +2 -2
  38. package/lib/redux/selectors/index.d.ts +2 -2
  39. package/lib/redux/selectors/index.js +2 -2
  40. package/package.json +18 -4
  41. package/redux.js +2 -0
package/CHANGELOG.md CHANGED
@@ -3,6 +3,34 @@
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
+ ## [4.0.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.9.2...@exodus/hw-ledger@4.0.0) (2026-06-09)
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ - **hw-ledger:** migrate to native ESM (#16981)
11
+
12
+ ### Bug Fixes
13
+
14
+ - **hw-ledger:** disambiguate ERC-20 vs NFT clear-signing with an isNft hint ([#17014](https://github.com/ExodusMovement/exodus-hydra/issues/17014)) ([723a0e4](https://github.com/ExodusMovement/exodus-hydra/commit/723a0e4a845ef9463ba6994f52005ee4f5d1faca))
15
+
16
+ ### Code Refactoring
17
+
18
+ - **hw-ledger:** migrate to native ESM ([#16981](https://github.com/ExodusMovement/exodus-hydra/issues/16981)) ([2a37eef](https://github.com/ExodusMovement/exodus-hydra/commit/2a37eef2d30e86b59d9dfd70b3ec2f8727986d5c))
19
+
20
+ ## [3.9.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.9.1...@exodus/hw-ledger@3.9.2) (2026-05-28)
21
+
22
+ ### Features
23
+
24
+ - **typescript:** enable erasableSyntaxOnly across the monorepo ([#16435](https://github.com/ExodusMovement/exodus-hydra/issues/16435)) ([6055ee5](https://github.com/ExodusMovement/exodus-hydra/commit/6055ee57210c9b9a6a67dc0d7b8821077da121e0))
25
+
26
+ ### Bug Fixes
27
+
28
+ - **hw-ledger:** unblock nodenext + flip tsconfig ([#16857](https://github.com/ExodusMovement/exodus-hydra/issues/16857)) ([7af2daa](https://github.com/ExodusMovement/exodus-hydra/commit/7af2daa5c2dcd964759d8461494a60ce5a4fd55d))
29
+
30
+ ### Performance Improvements
31
+
32
+ - **hw-ledger:** reuse Speculos simulator per describe block ([#16129](https://github.com/ExodusMovement/exodus-hydra/issues/16129)) ([7b333bd](https://github.com/ExodusMovement/exodus-hydra/commit/7b333bd99c37689dffff1b1d2f9feeb105b1aba2))
33
+
6
34
  ## [3.9.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.9.0...@exodus/hw-ledger@3.9.1) (2026-04-15)
7
35
 
8
36
  ### Bug Fixes
package/lib/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { HwLedgerConfig } from './module/types';
1
+ import type { HwLedgerConfig } from './module/types.js';
2
2
  declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLedgerConfig>) => {
3
3
  readonly id: "hardwareWalletLedger";
4
4
  readonly definitions: readonly [{
5
5
  readonly definition: {
6
6
  readonly id: "bluetoothStatusAtom";
7
7
  readonly type: "atom";
8
- readonly factory: () => import("@exodus/atoms").Atom<import("./atoms").BluetoothStatus>;
8
+ readonly factory: () => import("@exodus/atoms").Atom<import("./atoms/index.js").BluetoothStatus>;
9
9
  readonly dependencies: readonly [];
10
10
  readonly public: true;
11
11
  };
@@ -32,10 +32,10 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
32
32
  readonly id: "hardwareWalletLedgerPlugin";
33
33
  readonly type: "plugin";
34
34
  readonly factory: ({ bluetoothStatusAtom, bluetoothScanningAtom, ledgerDiscovery, port, }: {
35
- bluetoothStatusAtom: import("@exodus/atoms").Atom<import("./atoms").BluetoothStatus>;
35
+ bluetoothStatusAtom: import("@exodus/atoms").Atom<import("./atoms/index.js").BluetoothStatus>;
36
36
  bluetoothScanningAtom: import("@exodus/atoms").Atom<boolean>;
37
- ledgerDiscovery: import("./module").LedgerDiscovery;
38
- port: import("./shared/types").Port;
37
+ ledgerDiscovery: import("./module/discovery.js").LedgerDiscovery;
38
+ port: import("./shared/types.js").Port;
39
39
  }) => {
40
40
  onUnlock: () => void;
41
41
  onLoad: () => void;
@@ -48,7 +48,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
48
48
  readonly definition: {
49
49
  readonly id: "ledgerDiscovery";
50
50
  readonly type: "module";
51
- readonly factory: (deps: import("./module").Dependencies) => import("./module").LedgerDiscovery;
51
+ readonly factory: (deps: import("./module/discovery.js").Dependencies) => import("./module/discovery.js").LedgerDiscovery;
52
52
  readonly dependencies: readonly ["config", "logger", "transportsFactories", "bluetoothStatusAtom", "bluetoothScanningAtom", "walletPolicyAtom"];
53
53
  readonly public: true;
54
54
  };
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { bluetoothStatusAtomDefinition, bluetoothScanningAtomDefinition, walletPolicyAtomDefinition, } from './atoms';
2
- import ledgerDiscoveryDefinition from './module';
3
- import hardwareWalletLedgerPluginDefinition from './plugin';
1
+ import { bluetoothStatusAtomDefinition, bluetoothScanningAtomDefinition, walletPolicyAtomDefinition, } from './atoms/index.js';
2
+ import ledgerDiscoveryDefinition from './module/index.js';
3
+ import hardwareWalletLedgerPluginDefinition from './plugin/index.js';
4
4
  const hardwareWalletLedger = ({ bluetoothScannerTimeout = 10_000, } = {}) => {
5
5
  return {
6
6
  id: 'hardwareWalletLedger',
@@ -4,6 +4,6 @@ declare const metadata: {
4
4
  supportedVersions: string;
5
5
  primaryAssetName: string;
6
6
  }[];
7
- handler: (transport: import("@ledgerhq/hw-transport").default) => Promise<import("@exodus/hw-common").HardwareWalletAssetHandler>;
7
+ handler: (transport: import("../types.js").Transport) => Promise<import("@exodus/hw-common").HardwareWalletAssetHandler>;
8
8
  };
9
9
  export default metadata;
@@ -1,5 +1,5 @@
1
- import applications from './applications';
2
- import ethereum from './ethereum';
1
+ import applications from './applications.js';
2
+ import ethereum from './ethereum.js';
3
3
  const metadata = {
4
4
  applications: [applications.Ethereum],
5
5
  handler: ethereum.handler,
@@ -1,5 +1,5 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { Atom } from '@exodus/atoms';
2
+ import type { Transport } from '../types.js';
3
3
  import type { Bytes, HardwareWalletAssetHandler } from '@exodus/hw-common';
4
4
  export interface BitcoinMessage {
5
5
  rawMessage?: Bytes;
@@ -1,11 +1,11 @@
1
1
  import { fromBase58 } from '@exodus/bytes/base58.js';
2
2
  import { AppClient, PsbtV2 } from '@exodus/ledger-bitcoin';
3
3
  import { BIP322 } from '@exodus/bip322-js';
4
- import { splitBip44DerivationPath } from './utils';
4
+ import { splitBip44DerivationPath } from './utils/index.js';
5
5
  import assert from 'minimalistic-assert';
6
- import { assertPsbtOnlyHasAllowedDerivationPaths, tagPsbtWithDerivationPaths, getWalletPolicy, getMultisigWalletPolicy, derivationPathsToWalletPolicy, addDummyInputs, } from './utils/psbt';
7
- import { buildBip322PSBT } from './utils/bip322';
8
- import applications from './applications';
6
+ import { assertPsbtOnlyHasAllowedDerivationPaths, tagPsbtWithDerivationPaths, getWalletPolicy, getMultisigWalletPolicy, derivationPathsToWalletPolicy, addDummyInputs, } from './utils/psbt.js';
7
+ import { buildBip322PSBT } from './utils/bip322.js';
8
+ import applications from './applications.js';
9
9
  async function createHandler(transport, walletPolicyAtom) {
10
10
  const app = new AppClient(transport);
11
11
  const getAddress = async (params) => {
@@ -118,13 +118,13 @@ async function createHandler(transport, walletPolicyAtom) {
118
118
  const registerWalletPolicy = async (walletPolicy) => {
119
119
  const walletPolicies = (await walletPolicyAtom?.get()) ?? {};
120
120
  const id = walletPolicy.getId().toString('hex');
121
- let hmac = walletPolicies[id];
122
- if (!hmac) {
123
- const [, h] = await app.registerWallet(walletPolicy);
124
- hmac = h;
125
- const updatedPolicies = { ...walletPolicies, [id]: hmac };
126
- await walletPolicyAtom?.set(updatedPolicies);
127
- }
121
+ const cached = walletPolicies[id];
122
+ if (cached)
123
+ return cached;
124
+ const [, hmac] = await app.registerWallet(walletPolicy);
125
+ assert(hmac, 'app.registerWallet returned no HMAC');
126
+ const updatedPolicies = { ...walletPolicies, [id]: hmac };
127
+ await walletPolicyAtom?.set(updatedPolicies);
128
128
  return hmac;
129
129
  };
130
130
  return {
@@ -1,5 +1,5 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { HardwareWalletAssetHandler } from '@exodus/hw-common';
2
+ import type { Transport } from '../types.js';
3
3
  declare function createHandler(transport: Transport): Promise<HardwareWalletAssetHandler>;
4
4
  declare const metadata: {
5
5
  applications: {
@@ -1,11 +1,12 @@
1
1
  import * as secp256k1 from '@exodus/crypto/secp256k1';
2
2
  import * as ethers from '@exodus/ethersproject-transactions';
3
- import AppEth, { ledgerService } from '@exodus/ledgerhq-hw-app-eth';
3
+ import AppEthImport, { ledgerService } from '@exodus/ledgerhq-hw-app-eth';
4
4
  import { TypedDataUtils, SignTypedDataVersion } from '@exodus/ethereumjs/eth-sig-util';
5
5
  import assert from 'minimalistic-assert';
6
- import { buildFauxXPUB } from './utils';
7
- import { RequiresBlindSigningError } from '../errors';
8
- import applications from './applications';
6
+ import { buildFauxXPUB } from './utils/index.js';
7
+ import { RequiresBlindSigningError } from '../errors.js';
8
+ import applications from './applications.js';
9
+ const AppEth = (AppEthImport.default ?? AppEthImport);
9
10
  function hashEIP712Message(typedData) {
10
11
  const version = SignTypedDataVersion.V4;
11
12
  const { sanitizeData, hashStruct } = TypedDataUtils;
@@ -73,20 +74,23 @@ async function createHandler(transport) {
73
74
  delete deserializedTransaction.s;
74
75
  delete deserializedTransaction.v;
75
76
  const serializedTransactionHex = ethers.serialize(deserializedTransaction).slice(2);
76
- const signTransaction = async ({ derivationPath, serializedTransactionHex, withNFT = true, }) => {
77
+ const signTransaction = async ({ derivationPath, serializedTransactionHex, erc20 = true, nft = true, }) => {
77
78
  const resolution = await ledgerService.resolveTransaction(serializedTransactionHex, app.loadConfig, {
78
79
  externalPlugins: true,
79
- erc20: true,
80
- nft: withNFT,
80
+ erc20,
81
+ nft,
81
82
  });
82
83
  return app.signTransaction(derivationPath, serializedTransactionHex, resolution);
83
84
  };
85
+ const resolveErc20 = params.isNft === undefined ? true : !params.isNft;
86
+ const resolveNft = params.isNft ?? true;
84
87
  let response = null;
85
88
  try {
86
89
  response = await signTransaction({
87
90
  derivationPath: params.derivationPaths[0],
88
91
  serializedTransactionHex,
89
- withNFT: true,
92
+ erc20: resolveErc20,
93
+ nft: resolveNft,
90
94
  });
91
95
  }
92
96
  catch (err) {
@@ -94,7 +98,8 @@ async function createHandler(transport) {
94
98
  response = await signTransaction({
95
99
  derivationPath: params.derivationPaths[0],
96
100
  serializedTransactionHex,
97
- withNFT: false,
101
+ erc20: resolveErc20,
102
+ nft: false,
98
103
  });
99
104
  }
100
105
  else if (err.name === 'EthAppPleaseEnableContractData') {
@@ -1,6 +1,6 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { HardwareWalletAssetHandler } from '@exodus/hw-common';
3
2
  import type { Atom } from '@exodus/atoms';
3
+ import type { Transport } from '../types.js';
4
4
  type HandlerFactory = (transport: Transport, walletPolicyAtom?: Atom<Record<string, Buffer>>) => Promise<HardwareWalletAssetHandler>;
5
5
  type AssetMetadata = {
6
6
  applications: {
@@ -1,11 +1,11 @@
1
- import bitcoin from './bitcoin';
2
- import basemainnet from './basemainnet';
3
- import ethereum from './ethereum';
4
- import matic from './matic';
5
- import ripple from './ripple';
6
- import solana from './solana';
7
- import tronmainnet from './tronmainnet';
8
- import applications from './applications';
1
+ import bitcoin from './bitcoin.js';
2
+ import basemainnet from './basemainnet.js';
3
+ import ethereum from './ethereum.js';
4
+ import matic from './matic.js';
5
+ import ripple from './ripple.js';
6
+ import solana from './solana.js';
7
+ import tronmainnet from './tronmainnet.js';
8
+ import applications from './applications.js';
9
9
  export const assetApplications = {
10
10
  basemainnet,
11
11
  bitcoin,
@@ -4,6 +4,6 @@ declare const metadata: {
4
4
  supportedVersions: string;
5
5
  primaryAssetName: string;
6
6
  }[];
7
- handler: (transport: import("@ledgerhq/hw-transport").default) => Promise<import("@exodus/hw-common").HardwareWalletAssetHandler>;
7
+ handler: (transport: import("../types.js").Transport) => Promise<import("@exodus/hw-common").HardwareWalletAssetHandler>;
8
8
  };
9
9
  export default metadata;
@@ -1,5 +1,5 @@
1
- import applications from './applications';
2
- import ethereum from './ethereum';
1
+ import applications from './applications.js';
2
+ import ethereum from './ethereum.js';
3
3
  const metadata = {
4
4
  applications: [applications.Polygon, applications.Ethereum],
5
5
  handler: ethereum.handler,
@@ -1,5 +1,5 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { HardwareWalletAssetHandler } from '@exodus/hw-common';
2
+ import type { Transport } from '../types.js';
3
3
  declare function createHandler(transport: Transport): Promise<HardwareWalletAssetHandler>;
4
4
  declare const metadata: {
5
5
  applications: {
@@ -1,8 +1,9 @@
1
- import AppXrp from '@ledgerhq/hw-app-xrp';
1
+ import AppXrpImport from '@ledgerhq/hw-app-xrp';
2
2
  import assert from 'minimalistic-assert';
3
3
  import { XPubUnsupportedError, SignMessageUnsupportedError } from '@exodus/hw-common';
4
4
  import binaryCodec from '@exodus/ripple-binary-codec';
5
- import applications from './applications';
5
+ import applications from './applications.js';
6
+ const AppXrp = (AppXrpImport.default ?? AppXrpImport);
6
7
  async function createHandler(transport) {
7
8
  const app = new AppXrp(transport);
8
9
  const getAddress = async (params) => {
@@ -1,5 +1,5 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { HardwareWalletAssetHandler } from '@exodus/hw-common';
2
+ import type { Transport } from '../types.js';
3
3
  declare function createHandler(transport: Transport): Promise<HardwareWalletAssetHandler>;
4
4
  declare const metadata: {
5
5
  applications: {
@@ -1,9 +1,11 @@
1
- import AppSolana from '@ledgerhq/hw-app-solana';
1
+ import AppSolanaImport from '@ledgerhq/hw-app-solana';
2
2
  import assert from 'minimalistic-assert';
3
3
  import { toBase58 } from '@exodus/bytes/base58.js';
4
4
  import { XPubUnsupportedError } from '@exodus/hw-common';
5
- import { RequiresBlindSigningError } from '../errors';
6
- import applications from './applications';
5
+ import { RequiresBlindSigningError } from '../errors.js';
6
+ import applications from './applications.js';
7
+ const AppSolana = (AppSolanaImport.default ??
8
+ AppSolanaImport);
7
9
  async function createHandler(transport) {
8
10
  const app = new AppSolana(transport);
9
11
  const getAddress = async (params) => {
@@ -1,5 +1,5 @@
1
- import type Transport from '@ledgerhq/hw-transport';
2
1
  import type { Bytes, HardwareWalletAssetHandler } from '@exodus/hw-common';
2
+ import type { Transport } from '../types.js';
3
3
  export interface TronMessage {
4
4
  rawMessage?: Bytes;
5
5
  TIP712Message?: {
@@ -1,8 +1,10 @@
1
- import AppTron from '@ledgerhq/hw-app-trx';
1
+ import AppTronImport from '@ledgerhq/hw-app-trx';
2
2
  import assert from 'minimalistic-assert';
3
3
  import { XPubUnsupportedError } from '@exodus/hw-common';
4
4
  import * as secp256k1 from '@exodus/crypto/secp256k1';
5
- import applications from './applications';
5
+ import applications from './applications.js';
6
+ const AppTron = (AppTronImport.default ??
7
+ AppTronImport);
6
8
  async function createHandler(transport) {
7
9
  const app = new AppTron(transport);
8
10
  const getAddress = async (params) => {
@@ -1,3 +1,3 @@
1
- export * from './derivation-paths';
2
- export * from './xpub';
3
- export * from './psbt';
1
+ export * from './derivation-paths.js';
2
+ export * from './xpub.js';
3
+ export * from './psbt.js';
@@ -1,3 +1,3 @@
1
- export * from './derivation-paths';
2
- export * from './xpub';
3
- export * from './psbt';
1
+ export * from './derivation-paths.js';
2
+ export * from './xpub.js';
3
+ export * from './psbt.js';
@@ -1,9 +1,9 @@
1
1
  import type { PsbtV2 } from '@exodus/ledger-bitcoin';
2
- import { DefaultWalletPolicy, WalletPolicy } from '@exodus/ledger-bitcoin';
2
+ import { WalletPolicy } from '@exodus/ledger-bitcoin';
3
3
  import type { MultisigData } from '@exodus/hw-common';
4
4
  export declare function assertPsbtOnlyHasAllowedDerivationPaths(psbt: PsbtV2, masterFingerprint: string, derivationPaths: string[]): void;
5
5
  export declare function tagPsbtWithDerivationPaths(psbt: PsbtV2, masterFingerprint: string, derivationPathToPublicKeyMap: Record<string, Buffer>, addressToDerivationPathMap?: Record<string, string>): string[];
6
- export declare const getWalletPolicy: (fpr: string, xpub: string, purpose: string, coin: string, account: string) => DefaultWalletPolicy;
6
+ export declare const getWalletPolicy: (fpr: string, xpub: string, purpose: string, coin: string, account: string) => any;
7
7
  export declare const getMultisigWalletPolicy: (fpr: string, xpub: string, purpose: string, coin: string, account: string, multisigData: MultisigData) => WalletPolicy;
8
8
  export declare function derivationPathsToWalletPolicy(fpr: string, app: any, derivationPaths: string[], multisigData?: MultisigData): Promise<WalletPolicy[]>;
9
9
  export declare function addDummyInputs(psbt: PsbtV2): void;
@@ -1,7 +1,7 @@
1
1
  import assert from 'minimalistic-assert';
2
2
  import { DefaultWalletPolicy, WalletPolicy } from '@exodus/ledger-bitcoin';
3
3
  import { payments, address as baddress, Transaction } from '@exodus/bitcoinjs';
4
- import { buildBip44PathFromNumber, assertBip44PathNumber, splitBip44PathToNumber, splitBip44DerivationPath, } from './derivation-paths';
4
+ import { buildBip44PathFromNumber, assertBip44PathNumber, splitBip44PathToNumber, splitBip44DerivationPath, } from './derivation-paths.js';
5
5
  export function assertPsbtOnlyHasAllowedDerivationPaths(psbt, masterFingerprint, derivationPaths) {
6
6
  for (let i = 0; i < psbt.getGlobalInputCount(); i++) {
7
7
  const BIP32_DERIVATION = 6;
@@ -1,5 +1,5 @@
1
1
  import type { EnsureDeviceReadyParams, GetAddressParams, GetPublicKeyParams, GetXPubParams, HardwareWalletDescriptor, HardwareWalletDevice, SignMessageParams, SignTransactionParams } from '@exodus/hw-common';
2
- import type { TransportFactory } from './types';
2
+ import type { TransportFactory } from './types.js';
3
3
  import type { Atom } from '@exodus/atoms';
4
4
  export type Dependencies = {
5
5
  transportFactory: TransportFactory;
@@ -1,8 +1,8 @@
1
1
  import semver from 'semver';
2
2
  import { AssetUnsupportedError, DeviceLockedError, DeviceConnectionError, UserRefusedError, } from '@exodus/hw-common';
3
- import { applicationNameToBaseAssetNames, assetApplications, supportedBaseAssetNames, } from './assets';
4
- import { createApplicationManager as applicationFactory } from './management/application';
5
- import { UnsupportedVersionError, ApplicationNotFoundError } from './errors';
3
+ import { applicationNameToBaseAssetNames, assetApplications, supportedBaseAssetNames, } from './assets/index.js';
4
+ import { createApplicationManager as applicationFactory } from './management/application.js';
5
+ import { UnsupportedVersionError, ApplicationNotFoundError } from './errors.js';
6
6
  export class LedgerDevice {
7
7
  #transportFactory;
8
8
  #descriptor;
@@ -1,8 +1,8 @@
1
- import type { Logger } from '../shared/types';
1
+ import type { Logger } from '../shared/types.js';
2
2
  import type { Atom } from '@exodus/atoms';
3
3
  import type { HardwareWalletDescriptor, HardwareWalletDiscovery } from '@exodus/hw-common';
4
- import type { HwLedgerConfig, TransportFactories } from './types';
5
- import type { BluetoothStatus } from '../atoms';
4
+ import type { HwLedgerConfig, TransportFactories } from './types.js';
5
+ import type { BluetoothStatus } from '../atoms/index.js';
6
6
  export type Dependencies = {
7
7
  config: HwLedgerConfig;
8
8
  logger: Logger;
@@ -1,7 +1,7 @@
1
1
  import { getInfosForServiceUuid, identifyUSBProductId } from '@exodus/ledgerhq-devices';
2
- import { APDU_PORT } from './constants';
3
- import { LedgerDevice } from './device';
4
- import { UnknownTransportError } from './errors';
2
+ import { APDU_PORT } from './constants.js';
3
+ import { LedgerDevice } from './device.js';
4
+ import { UnknownTransportError } from './errors.js';
5
5
  const MODULE_ID = 'ledgerDiscovery';
6
6
  export class LedgerDiscovery {
7
7
  #logger;
@@ -1,2 +1,2 @@
1
- export * from './discovery';
2
- export { default } from './discovery';
1
+ export * from './discovery.js';
2
+ export { default } from './discovery.js';
@@ -1,2 +1,2 @@
1
- export * from './discovery';
2
- export { default } from './discovery';
1
+ export * from './discovery.js';
2
+ export { default } from './discovery.js';
@@ -1,4 +1,4 @@
1
- import type Transport from '@ledgerhq/hw-transport';
1
+ import type { Transport } from '../types.js';
2
2
  export type GetInformationResponse = {
3
3
  name: string;
4
4
  version: string;
@@ -11,7 +11,7 @@ export type ListAppResponse = {
11
11
  blocks?: number;
12
12
  flags?: number;
13
13
  }[];
14
- export declare function createApplicationManager(transport: Transport): Promise<{
14
+ export declare function createApplicationManager(transport: Pick<Transport, 'send'>): Promise<{
15
15
  getInformation: () => Promise<GetInformationResponse>;
16
16
  listApplications: () => Promise<ListAppResponse>;
17
17
  openApplication: (name: string) => Promise<void>;
@@ -1,7 +1,8 @@
1
- import type Transport from '@ledgerhq/hw-transport';
1
+ import type LedgerTransport from '@ledgerhq/hw-transport';
2
2
  import type { TransportTypes } from '@exodus/hw-common';
3
3
  import type { Subscription } from '@ledgerhq/hw-transport';
4
- export type TransportFactory = typeof Transport;
4
+ export type TransportFactory = (typeof LedgerTransport)['default'];
5
+ export type Transport = InstanceType<TransportFactory>;
5
6
  export type TransportFactories = Partial<Record<TransportTypes, TransportFactory>> & {
6
7
  bluetooth?: TransportFactory & {
7
8
  observeAvailability?: (observer: {
@@ -1,7 +1,7 @@
1
1
  import type { Atom } from '@exodus/atoms';
2
- import type { Port } from '../shared/types';
3
- import type { BluetoothStatus } from '../atoms';
4
- import type { LedgerDiscovery } from '../module';
2
+ import type { Port } from '../shared/types.js';
3
+ import type { BluetoothStatus } from '../atoms/index.js';
4
+ import type { LedgerDiscovery } from '../module/index.js';
5
5
  declare const hardwareWalletLedgerPluginDefinition: {
6
6
  readonly id: "hardwareWalletLedgerPlugin";
7
7
  readonly type: "plugin";
@@ -1,4 +1,4 @@
1
- import { type LedgerHardwareWalletState } from './initial-state';
1
+ import { type LedgerHardwareWalletState } from './initial-state.js';
2
2
  declare const exchangeReduxDefinition: {
3
3
  readonly id: "hardwareWalletLedger";
4
4
  readonly type: "redux-module";
@@ -10,12 +10,12 @@ declare const exchangeReduxDefinition: {
10
10
  };
11
11
  readonly bluetoothScanning: (state: LedgerHardwareWalletState, payload: boolean) => {
12
12
  bluetoothScanning: boolean;
13
- bluetoothStatus: import("../atoms").BluetoothStatus;
13
+ bluetoothStatus: import("../atoms/index.js").BluetoothStatus;
14
14
  };
15
15
  };
16
16
  readonly selectorDefinitions: ({
17
17
  readonly id: "bluetoothStatus";
18
- readonly resultFunction: (state: LedgerHardwareWalletState) => import("../atoms").BluetoothStatus;
18
+ readonly resultFunction: (state: LedgerHardwareWalletState) => import("../atoms/index.js").BluetoothStatus;
19
19
  readonly dependencies: readonly [{
20
20
  readonly selector: "$state";
21
21
  }];
@@ -1,6 +1,6 @@
1
- import id from './id';
2
- import initialState from './initial-state';
3
- import selectorDefinitions from './selectors';
1
+ import id from './id.js';
2
+ import initialState from './initial-state.js';
3
+ import selectorDefinitions from './selectors/index.js';
4
4
  const exchangeReduxDefinition = {
5
5
  id,
6
6
  type: 'redux-module',
@@ -1,4 +1,4 @@
1
- import type { BluetoothStatus } from '../atoms';
1
+ import type { BluetoothStatus } from '../atoms/index.js';
2
2
  export type LedgerHardwareWalletState = {
3
3
  bluetoothStatus: BluetoothStatus;
4
4
  bluetoothScanning: boolean;
@@ -1,4 +1,4 @@
1
- import type { LedgerHardwareWalletState } from '../initial-state';
1
+ import type { LedgerHardwareWalletState } from '../initial-state.js';
2
2
  declare const bluetoothScanningSelectorDefinition: {
3
3
  readonly id: "bluetoothScanning";
4
4
  readonly resultFunction: (state: LedgerHardwareWalletState) => boolean;
@@ -1,7 +1,7 @@
1
- import type { LedgerHardwareWalletState } from '../initial-state';
1
+ import type { LedgerHardwareWalletState } from '../initial-state.js';
2
2
  declare const bluetoothStatusSelectorDefinition: {
3
3
  readonly id: "bluetoothStatus";
4
- readonly resultFunction: (state: LedgerHardwareWalletState) => import("../../atoms").BluetoothStatus;
4
+ readonly resultFunction: (state: LedgerHardwareWalletState) => import("../../atoms/index.js").BluetoothStatus;
5
5
  readonly dependencies: readonly [{
6
6
  readonly selector: "$state";
7
7
  }];
@@ -1,12 +1,12 @@
1
1
  declare const ledgerSelectors: ({
2
2
  readonly id: "bluetoothStatus";
3
- readonly resultFunction: (state: import("../initial-state").LedgerHardwareWalletState) => import("../../atoms").BluetoothStatus;
3
+ readonly resultFunction: (state: import("../initial-state.js").LedgerHardwareWalletState) => import("../../atoms/index.js").BluetoothStatus;
4
4
  readonly dependencies: readonly [{
5
5
  readonly selector: "$state";
6
6
  }];
7
7
  } | {
8
8
  readonly id: "bluetoothScanning";
9
- readonly resultFunction: (state: import("../initial-state").LedgerHardwareWalletState) => boolean;
9
+ readonly resultFunction: (state: import("../initial-state.js").LedgerHardwareWalletState) => boolean;
10
10
  readonly dependencies: readonly [{
11
11
  readonly selector: "$state";
12
12
  }];
@@ -1,4 +1,4 @@
1
- import bluetoothStatusSelectorDefinition from './bluetoothStatus';
2
- import bluetoothScanningSelectorDefinition from './bluetoothScanning';
1
+ import bluetoothStatusSelectorDefinition from './bluetoothStatus.js';
2
+ import bluetoothScanningSelectorDefinition from './bluetoothScanning.js';
3
3
  const ledgerSelectors = [bluetoothStatusSelectorDefinition, bluetoothScanningSelectorDefinition];
4
4
  export default ledgerSelectors;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@exodus/hw-ledger",
3
- "version": "3.9.1",
3
+ "version": "4.0.0",
4
4
  "description": "The ledger module",
5
5
  "author": "Exodus Movement, Inc.",
6
6
  "repository": {
@@ -13,8 +13,21 @@
13
13
  "url": "https://github.com/ExodusMovement/exodus-hydra/issues?q=is%3Aissue+is%3Aopen+label%3Ahw-ledger"
14
14
  },
15
15
  "main": "lib/index.js",
16
+ "type": "module",
17
+ "exports": {
18
+ ".": "./lib/index.js",
19
+ "./redux": "./lib/redux/index.js",
20
+ "./redux/index.js": "./lib/redux/index.js",
21
+ "./lib/redux": "./lib/redux/index.js",
22
+ "./lib/module/assets": "./lib/module/assets/index.js",
23
+ "./lib/module/assets/applications": "./lib/module/assets/applications.js",
24
+ "./lib/module/assets/*": "./lib/module/assets/*.js",
25
+ "./lib/module/assets/*.js": "./lib/module/assets/*.js",
26
+ "./package.json": "./package.json"
27
+ },
16
28
  "files": [
17
29
  "lib",
30
+ "redux.js",
18
31
  "./README.md",
19
32
  "./CHANGELOG.md"
20
33
  ],
@@ -23,6 +36,7 @@
23
36
  "build:watch": "run -T tsc -w -p tsconfig.build.json",
24
37
  "clean": "run -T tsc --build --clean",
25
38
  "test": "run -T exodus-test --jest --esbuild",
39
+ "typecheck": "run -T tsc -p tsconfig.json --noEmit",
26
40
  "zemu:install": "docker pull zondax/builder-zemu:speculos-ef9610662dc90a1eeddba7c991e3ef7c53c4e258",
27
41
  "test:integration": "yarn zemu:install && RUN_TESTS=integration run test",
28
42
  "lint": "run -T eslint .",
@@ -41,8 +55,8 @@
41
55
  "@exodus/ledger-bitcoin": "^0.2.3-exodus.6",
42
56
  "@exodus/ledgerhq-devices": "^8.1.0-exodus.3",
43
57
  "@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
44
- "@exodus/redux-dependency-injection": "^4.0.0",
45
- "@exodus/ripple-binary-codec": "^0.2.6",
58
+ "@exodus/redux-dependency-injection": "^5.0.0",
59
+ "@exodus/ripple-binary-codec": "^0.3.0",
46
60
  "@exodus/storage-interface": "^1.0.0",
47
61
  "@ledgerhq/hw-app-solana": "^7.0.10",
48
62
  "@ledgerhq/hw-app-trx": "^6.29.4",
@@ -66,5 +80,5 @@
66
80
  "access": "public",
67
81
  "provenance": false
68
82
  },
69
- "gitHead": "dd67667f6d9e59c554300dfa9b3acfef228eb6d8"
83
+ "gitHead": "f12f42d2a4062112458a94a2026fcf3cc1913fc6"
70
84
  }
package/redux.js ADDED
@@ -0,0 +1,2 @@
1
+ // eslint-disable-next-line import/no-unresolved -- shim re-exports built artifact
2
+ export { default } from './lib/redux/index.js'