@exodus/hw-ledger 2.9.1 → 2.9.3
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 +12 -0
- package/lib/atoms/index.d.ts +2 -0
- package/lib/atoms/index.js +2 -0
- package/lib/index.d.ts +4 -0
- package/lib/module/assets/applications.d.ts +23 -0
- package/lib/module/assets/applications.js +27 -0
- package/lib/module/assets/basemainnet.d.ts +1 -0
- package/lib/module/assets/basemainnet.js +2 -6
- package/lib/module/assets/bitcoin.d.ts +1 -0
- package/lib/module/assets/bitcoin.js +2 -6
- package/lib/module/assets/ethereum.d.ts +1 -0
- package/lib/module/assets/ethereum.js +2 -6
- package/lib/module/assets/index.d.ts +2 -1
- package/lib/module/assets/index.js +14 -2
- package/lib/module/assets/matic.d.ts +1 -0
- package/lib/module/assets/matic.js +2 -7
- package/lib/module/assets/solana.d.ts +1 -0
- package/lib/module/assets/solana.js +2 -6
- package/lib/module/device.js +6 -6
- package/lib/module/discovery.d.ts +1 -0
- package/lib/module/discovery.js +1 -0
- package/lib/plugin/index.d.ts +1 -0
- package/lib/plugin/index.js +1 -0
- package/package.json +4 -4
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
|
+
## [2.9.3](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.9.2...@exodus/hw-ledger@2.9.3) (2024-08-08)
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
- **ledger:** properly order asset names array ([#7915](https://github.com/ExodusMovement/exodus-hydra/issues/7915)) ([e982d63](https://github.com/ExodusMovement/exodus-hydra/commit/e982d639354234bf93ae27e5f06876895a88aab0))
|
|
11
|
+
|
|
12
|
+
## [2.9.2](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.9.1...@exodus/hw-ledger@2.9.2) (2024-07-25)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- migrate definitions ([#8030](https://github.com/ExodusMovement/exodus-hydra/issues/8030)) ([d2dfde5](https://github.com/ExodusMovement/exodus-hydra/commit/d2dfde55dfa843eb52842f64b3aac3a6f9a59069))
|
|
17
|
+
|
|
6
18
|
## [2.9.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.9.0...@exodus/hw-ledger@2.9.1) (2024-07-18)
|
|
7
19
|
|
|
8
20
|
**Note:** Version bump only for package @exodus/hw-ledger
|
package/lib/atoms/index.d.ts
CHANGED
|
@@ -3,10 +3,12 @@ export declare const bluetoothStatusAtomDefinition: {
|
|
|
3
3
|
readonly type: "atom";
|
|
4
4
|
readonly factory: () => import("@exodus/atoms").Atom<boolean>;
|
|
5
5
|
readonly dependencies: readonly [];
|
|
6
|
+
readonly public: true;
|
|
6
7
|
};
|
|
7
8
|
export declare const bluetoothScanningAtomDefinition: {
|
|
8
9
|
readonly id: "bluetoothScanningAtom";
|
|
9
10
|
readonly type: "atom";
|
|
10
11
|
readonly factory: () => import("@exodus/atoms").Atom<boolean>;
|
|
11
12
|
readonly dependencies: readonly [];
|
|
13
|
+
readonly public: true;
|
|
12
14
|
};
|
package/lib/atoms/index.js
CHANGED
|
@@ -4,10 +4,12 @@ export const bluetoothStatusAtomDefinition = {
|
|
|
4
4
|
type: 'atom',
|
|
5
5
|
factory: () => createInMemoryAtom({ defaultValue: false }),
|
|
6
6
|
dependencies: [],
|
|
7
|
+
public: true,
|
|
7
8
|
};
|
|
8
9
|
export const bluetoothScanningAtomDefinition = {
|
|
9
10
|
id: 'bluetoothScanningAtom',
|
|
10
11
|
type: 'atom',
|
|
11
12
|
factory: () => createInMemoryAtom({ defaultValue: false }),
|
|
12
13
|
dependencies: [],
|
|
14
|
+
public: true,
|
|
13
15
|
};
|
package/lib/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
7
7
|
readonly type: "atom";
|
|
8
8
|
readonly factory: () => import("libraries/atoms/lib").Atom<boolean>;
|
|
9
9
|
readonly dependencies: readonly [];
|
|
10
|
+
readonly public: true;
|
|
10
11
|
};
|
|
11
12
|
}, {
|
|
12
13
|
readonly definition: {
|
|
@@ -14,6 +15,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
14
15
|
readonly type: "atom";
|
|
15
16
|
readonly factory: () => import("libraries/atoms/lib").Atom<boolean>;
|
|
16
17
|
readonly dependencies: readonly [];
|
|
18
|
+
readonly public: true;
|
|
17
19
|
};
|
|
18
20
|
}, {
|
|
19
21
|
readonly definition: {
|
|
@@ -31,6 +33,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
31
33
|
onStop: () => void;
|
|
32
34
|
};
|
|
33
35
|
readonly dependencies: readonly ["logger", "transportsFactories", "bluetoothStatusAtom", "bluetoothScanningAtom", "port"];
|
|
36
|
+
readonly public: true;
|
|
34
37
|
};
|
|
35
38
|
}, {
|
|
36
39
|
readonly definition: {
|
|
@@ -38,6 +41,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
38
41
|
readonly type: "module";
|
|
39
42
|
readonly factory: (deps: import("./module").Dependencies) => import("./module").LedgerDiscovery;
|
|
40
43
|
readonly dependencies: readonly ["config", "logger", "transportsFactories", "bluetoothScanningAtom"];
|
|
44
|
+
readonly public: true;
|
|
41
45
|
};
|
|
42
46
|
readonly config: {
|
|
43
47
|
readonly bluetoothScannerTimeout: number;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare const applications: {
|
|
2
|
+
Bitcoin: {
|
|
3
|
+
applicationName: string;
|
|
4
|
+
supportedVersions: string;
|
|
5
|
+
primaryAssetName: string;
|
|
6
|
+
};
|
|
7
|
+
Solana: {
|
|
8
|
+
applicationName: string;
|
|
9
|
+
supportedVersions: string;
|
|
10
|
+
primaryAssetName: string;
|
|
11
|
+
};
|
|
12
|
+
Ethereum: {
|
|
13
|
+
applicationName: string;
|
|
14
|
+
supportedVersions: string;
|
|
15
|
+
primaryAssetName: string;
|
|
16
|
+
};
|
|
17
|
+
Polygon: {
|
|
18
|
+
applicationName: string;
|
|
19
|
+
supportedVersions: string;
|
|
20
|
+
primaryAssetName: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
export default applications;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
const Bitcoin = {
|
|
2
|
+
applicationName: 'Bitcoin',
|
|
3
|
+
supportedVersions: '^2.1.2',
|
|
4
|
+
primaryAssetName: 'bitcoin',
|
|
5
|
+
};
|
|
6
|
+
const Solana = {
|
|
7
|
+
applicationName: 'Solana',
|
|
8
|
+
supportedVersions: '^1.4.0',
|
|
9
|
+
primaryAssetName: 'solana',
|
|
10
|
+
};
|
|
11
|
+
const Ethereum = {
|
|
12
|
+
applicationName: 'Ethereum',
|
|
13
|
+
supportedVersions: '^1.10.0',
|
|
14
|
+
primaryAssetName: 'ethereum',
|
|
15
|
+
};
|
|
16
|
+
const Polygon = {
|
|
17
|
+
applicationName: 'Polygon',
|
|
18
|
+
supportedVersions: '^1.10.0',
|
|
19
|
+
primaryAssetName: 'matic',
|
|
20
|
+
};
|
|
21
|
+
const applications = {
|
|
22
|
+
Bitcoin,
|
|
23
|
+
Solana,
|
|
24
|
+
Ethereum,
|
|
25
|
+
Polygon,
|
|
26
|
+
};
|
|
27
|
+
export default applications;
|
|
@@ -2,6 +2,7 @@ declare const metadata: {
|
|
|
2
2
|
applications: {
|
|
3
3
|
applicationName: string;
|
|
4
4
|
supportedVersions: string;
|
|
5
|
+
primaryAssetName: string;
|
|
5
6
|
}[];
|
|
6
7
|
handler: (transport: import("@ledgerhq/hw-transport").default) => Promise<import("libraries/hw-common/lib").HardwareWalletAssetHandler>;
|
|
7
8
|
};
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
+
import applications from './applications';
|
|
1
2
|
import ethereum from './ethereum';
|
|
2
3
|
const metadata = {
|
|
3
|
-
applications: [
|
|
4
|
-
{
|
|
5
|
-
applicationName: 'Ethereum',
|
|
6
|
-
supportedVersions: '^1.10.0',
|
|
7
|
-
},
|
|
8
|
-
],
|
|
4
|
+
applications: [applications.Ethereum],
|
|
9
5
|
handler: ethereum.handler,
|
|
10
6
|
};
|
|
11
7
|
export default metadata;
|
|
@@ -5,6 +5,7 @@ import { splitBip44DerivationPath } from './utils';
|
|
|
5
5
|
import assert from 'minimalistic-assert';
|
|
6
6
|
import { assertPsbtOnlyHasAllowedDerivationPaths, tagPsbtWithDerivationPaths, getWalletPolicy, derivationPathsToWalletPolicy, addDummyInputs, } from './utils/psbt';
|
|
7
7
|
import { buildBip322PSBT } from './utils/bip322';
|
|
8
|
+
import applications from './applications';
|
|
8
9
|
async function createHandler(transport) {
|
|
9
10
|
const app = new AppClient(transport);
|
|
10
11
|
const getAddress = async (params) => {
|
|
@@ -103,12 +104,7 @@ async function createHandler(transport) {
|
|
|
103
104
|
};
|
|
104
105
|
}
|
|
105
106
|
const metadata = {
|
|
106
|
-
applications: [
|
|
107
|
-
{
|
|
108
|
-
applicationName: 'Bitcoin',
|
|
109
|
-
supportedVersions: '^2.1.2',
|
|
110
|
-
},
|
|
111
|
-
],
|
|
107
|
+
applications: [applications.Bitcoin],
|
|
112
108
|
handler: createHandler,
|
|
113
109
|
};
|
|
114
110
|
export default metadata;
|
|
@@ -5,6 +5,7 @@ import { TypedDataUtils, SignTypedDataVersion, } from '@metamask/eth-sig-util';
|
|
|
5
5
|
import assert from 'minimalistic-assert';
|
|
6
6
|
import { buildFauxXPUB } from './utils';
|
|
7
7
|
import { RequiresBlindSigningError } from '../errors';
|
|
8
|
+
import applications from './applications';
|
|
8
9
|
function hashEIP712Message(typedData) {
|
|
9
10
|
const version = SignTypedDataVersion.V4;
|
|
10
11
|
const { sanitizeData, hashStruct } = TypedDataUtils;
|
|
@@ -137,12 +138,7 @@ async function createHandler(transport) {
|
|
|
137
138
|
};
|
|
138
139
|
}
|
|
139
140
|
const metadata = {
|
|
140
|
-
applications: [
|
|
141
|
-
{
|
|
142
|
-
applicationName: 'Ethereum',
|
|
143
|
-
supportedVersions: '^1.10.0',
|
|
144
|
-
},
|
|
145
|
-
],
|
|
141
|
+
applications: [applications.Ethereum],
|
|
146
142
|
handler: createHandler,
|
|
147
143
|
};
|
|
148
144
|
export default metadata;
|
|
@@ -4,11 +4,12 @@ type HandlerFactory = (transport: Transport) => Promise<HardwareWalletAssetHandl
|
|
|
4
4
|
type AssetMetadata = {
|
|
5
5
|
applications: {
|
|
6
6
|
applicationName: string;
|
|
7
|
+
primaryAssetName: string;
|
|
7
8
|
supportedVersions: string;
|
|
8
9
|
}[];
|
|
9
10
|
handler: HandlerFactory;
|
|
10
11
|
};
|
|
11
12
|
export declare const assetApplications: Record<string, AssetMetadata>;
|
|
12
13
|
export declare const supportedBaseAssetNames: string[];
|
|
13
|
-
export declare const
|
|
14
|
+
export declare const applicationNameToBaseAssetNames: Record<string, string[]>;
|
|
14
15
|
export {};
|
|
@@ -3,6 +3,7 @@ import basemainnet from './basemainnet';
|
|
|
3
3
|
import ethereum from './ethereum';
|
|
4
4
|
import matic from './matic';
|
|
5
5
|
import solana from './solana';
|
|
6
|
+
import applications from './applications';
|
|
6
7
|
export const assetApplications = {
|
|
7
8
|
basemainnet,
|
|
8
9
|
bitcoin,
|
|
@@ -11,7 +12,18 @@ export const assetApplications = {
|
|
|
11
12
|
ethereum,
|
|
12
13
|
};
|
|
13
14
|
export const supportedBaseAssetNames = Object.keys(assetApplications);
|
|
14
|
-
export const
|
|
15
|
-
|
|
15
|
+
export const applicationNameToBaseAssetNames = Object.entries(assetApplications).reduce((mapping, [assetName, metadata]) => {
|
|
16
|
+
for (const { applicationName } of metadata.applications) {
|
|
17
|
+
if (!Array.isArray(mapping[applicationName])) {
|
|
18
|
+
mapping[applicationName] = [];
|
|
19
|
+
}
|
|
20
|
+
const isPrimaryAssetForApplication = applications[applicationName]?.primaryAssetName === assetName;
|
|
21
|
+
if (isPrimaryAssetForApplication) {
|
|
22
|
+
mapping[applicationName].unshift(assetName);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
mapping[applicationName].push(assetName);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
16
28
|
return mapping;
|
|
17
29
|
}, Object.create(null));
|
|
@@ -2,6 +2,7 @@ declare const metadata: {
|
|
|
2
2
|
applications: {
|
|
3
3
|
applicationName: string;
|
|
4
4
|
supportedVersions: string;
|
|
5
|
+
primaryAssetName: string;
|
|
5
6
|
}[];
|
|
6
7
|
handler: (transport: import("@ledgerhq/hw-transport").default) => Promise<import("libraries/hw-common/lib").HardwareWalletAssetHandler>;
|
|
7
8
|
};
|
|
@@ -1,12 +1,7 @@
|
|
|
1
|
+
import applications from './applications';
|
|
1
2
|
import ethereum from './ethereum';
|
|
2
3
|
const metadata = {
|
|
3
|
-
applications: [
|
|
4
|
-
{
|
|
5
|
-
applicationName: 'Polygon',
|
|
6
|
-
supportedVersions: '^1.10.0',
|
|
7
|
-
},
|
|
8
|
-
...ethereum.applications,
|
|
9
|
-
],
|
|
4
|
+
applications: [applications.Polygon, applications.Ethereum],
|
|
10
5
|
handler: ethereum.handler,
|
|
11
6
|
};
|
|
12
7
|
export default metadata;
|
|
@@ -3,6 +3,7 @@ import assert from 'minimalistic-assert';
|
|
|
3
3
|
import bs58 from 'bs58';
|
|
4
4
|
import { XPubUnsupportedError } from '@exodus/hw-common';
|
|
5
5
|
import { RequiresBlindSigningError } from '../errors';
|
|
6
|
+
import applications from './applications';
|
|
6
7
|
async function createHandler(transport) {
|
|
7
8
|
const app = new AppSolana(transport);
|
|
8
9
|
const getAddress = async (params) => {
|
|
@@ -63,12 +64,7 @@ async function createHandler(transport) {
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
const metadata = {
|
|
66
|
-
applications: [
|
|
67
|
-
{
|
|
68
|
-
applicationName: 'Solana',
|
|
69
|
-
supportedVersions: '^1.4.0',
|
|
70
|
-
},
|
|
71
|
-
],
|
|
67
|
+
applications: [applications.Solana],
|
|
72
68
|
handler: createHandler,
|
|
73
69
|
};
|
|
74
70
|
export default metadata;
|
package/lib/module/device.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import semver from 'semver';
|
|
2
2
|
import { AssetUnsupportedError, DeviceLockedError, DeviceConnectionError, UserRefusedError, } from '@exodus/hw-common';
|
|
3
|
-
import {
|
|
3
|
+
import { applicationNameToBaseAssetNames, assetApplications, supportedBaseAssetNames, } from './assets';
|
|
4
4
|
import applicationFactory from './management/application';
|
|
5
5
|
import { UnsupportedVersionError, ApplicationNotFoundError } from './errors';
|
|
6
6
|
export class LedgerDevice {
|
|
@@ -105,16 +105,16 @@ export class LedgerDevice {
|
|
|
105
105
|
const installedApplications = await this.#listApplications();
|
|
106
106
|
const installedAssets = [];
|
|
107
107
|
installedApplications.forEach(({ name: applicationName }) => {
|
|
108
|
-
const
|
|
109
|
-
if (
|
|
110
|
-
installedAssets.push(
|
|
108
|
+
const assetNames = applicationNameToBaseAssetNames[applicationName];
|
|
109
|
+
if (assetNames)
|
|
110
|
+
installedAssets.push(...assetNames);
|
|
111
111
|
});
|
|
112
112
|
return installedAssets;
|
|
113
113
|
};
|
|
114
114
|
listUseableAssetNames = async () => {
|
|
115
115
|
const { name: applicationName } = await this.#getInformation();
|
|
116
|
-
const
|
|
117
|
-
return
|
|
116
|
+
const assetNames = applicationNameToBaseAssetNames[applicationName];
|
|
117
|
+
return assetNames || [];
|
|
118
118
|
};
|
|
119
119
|
getAddress = async (params) => {
|
|
120
120
|
await this.ensureApplicationIsOpened(params.assetName);
|
|
@@ -21,5 +21,6 @@ declare const _default: {
|
|
|
21
21
|
readonly type: "module";
|
|
22
22
|
readonly factory: (deps: Dependencies) => LedgerDiscovery;
|
|
23
23
|
readonly dependencies: readonly ["config", "logger", "transportsFactories", "bluetoothScanningAtom"];
|
|
24
|
+
readonly public: true;
|
|
24
25
|
};
|
|
25
26
|
export default _default;
|
package/lib/module/discovery.js
CHANGED
package/lib/plugin/index.d.ts
CHANGED
|
@@ -17,5 +17,6 @@ declare const hardwareWalletLedgerPluginDefinition: {
|
|
|
17
17
|
onStop: () => void;
|
|
18
18
|
};
|
|
19
19
|
readonly dependencies: readonly ["logger", "transportsFactories", "bluetoothStatusAtom", "bluetoothScanningAtom", "port"];
|
|
20
|
+
readonly public: true;
|
|
20
21
|
};
|
|
21
22
|
export default hardwareWalletLedgerPluginDefinition;
|
package/lib/plugin/index.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/hw-ledger",
|
|
3
|
-
"version": "2.9.
|
|
3
|
+
"version": "2.9.3",
|
|
4
4
|
"description": "The ledger module",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "run -T tsc --build tsconfig.build.json",
|
|
23
|
-
"build:watch": "run -T tsc --build tsconfig.build.json && (concurrently 'tsc --build -w tsconfig.build.json')",
|
|
23
|
+
"build:watch": "run -T tsc --build tsconfig.build.json && (concurrently 'run -T tsc --build -w tsconfig.build.json')",
|
|
24
24
|
"clean": "run -T tsc --build --clean",
|
|
25
25
|
"test": "run -T jest --testMatch='**/*.unit.test.js' --coverageDirectory coverage/unit",
|
|
26
26
|
"zemu:install": "docker pull zondax/builder-zemu:speculos-745fe46f81cfc18114b94a37beaefb58a09c0fcd",
|
|
@@ -39,7 +39,7 @@
|
|
|
39
39
|
"@exodus/ledgerhq-devices": "^8.1.0-exodus.3",
|
|
40
40
|
"@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
|
|
41
41
|
"@exodus/module": "^1.2.2",
|
|
42
|
-
"@exodus/redux-dependency-injection": "^
|
|
42
|
+
"@exodus/redux-dependency-injection": "^4.0.0",
|
|
43
43
|
"@exodus/secp256k1": "^4.0.2-exodus.0",
|
|
44
44
|
"@ledgerhq/hw-app-solana": "^7.0.10",
|
|
45
45
|
"@ledgerhq/hw-transport": "^6.28.5",
|
|
@@ -71,5 +71,5 @@
|
|
|
71
71
|
"tiny-secp256k1": "^2.2.3",
|
|
72
72
|
"ts-jest": "^29.0.3"
|
|
73
73
|
},
|
|
74
|
-
"gitHead": "
|
|
74
|
+
"gitHead": "221ffd05e9aa1c0ee82f3b8123b91d692066fa88"
|
|
75
75
|
}
|