@exodus/hw-ledger 3.2.0 → 3.3.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 +6 -0
- package/lib/module/assets/ethereum.js +11 -4
- package/lib/module/assets/utils/bip322.d.ts +1 -1
- package/lib/module/assets/utils/bip322.js +1 -1
- package/lib/module/assets/utils/psbt.js +1 -1
- package/lib/module/device.d.ts +1 -0
- package/lib/module/device.js +9 -0
- package/package.json +10 -11
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,12 @@
|
|
|
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
|
+
## [3.3.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.2.0...@exodus/hw-ledger@3.3.0) (2024-10-22)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- support cancelling an action on the ledger device ([#10105](https://github.com/ExodusMovement/exodus-hydra/issues/10105)) ([f1c1fbf](https://github.com/ExodusMovement/exodus-hydra/commit/f1c1fbff6ec70b7ddc68dd700ffb556b673b7a5a))
|
|
11
|
+
|
|
6
12
|
## [3.2.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@3.1.0...@exodus/hw-ledger@3.2.0) (2024-10-21)
|
|
7
13
|
|
|
8
14
|
### Features
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import secp256k1 from '@exodus/secp256k1';
|
|
1
|
+
import * as secp256k1 from '@exodus/crypto/secp256k1';
|
|
2
2
|
import * as ethers from '@exodus/ethersproject-transactions';
|
|
3
3
|
import AppEth, { ledgerService } from '@exodus/ledgerhq-hw-app-eth';
|
|
4
4
|
import { TypedDataUtils, SignTypedDataVersion } from '@metamask/eth-sig-util';
|
|
@@ -36,13 +36,20 @@ async function createHandler(transport) {
|
|
|
36
36
|
},
|
|
37
37
|
getXPub: async (params) => {
|
|
38
38
|
const { publicKey, chainCode } = await app.getAddress(params.derivationPath.replace('m/', ''), false, true);
|
|
39
|
-
const compressedPublicKey =
|
|
39
|
+
const compressedPublicKey = secp256k1.publicKeyConvert({
|
|
40
|
+
publicKey: Buffer.from(publicKey, 'hex'),
|
|
41
|
+
compressed: true,
|
|
42
|
+
format: 'buffer',
|
|
43
|
+
});
|
|
40
44
|
return buildFauxXPUB(compressedPublicKey, Buffer.from(chainCode, 'hex'));
|
|
41
45
|
},
|
|
42
46
|
getPublicKey: async (params) => {
|
|
43
47
|
const { publicKey } = await app.getAddress(params.derivationPath.replace('m/', ''));
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
return secp256k1.publicKeyConvert({
|
|
49
|
+
publicKey: Buffer.from(publicKey, 'hex'),
|
|
50
|
+
compressed: true,
|
|
51
|
+
format: 'buffer',
|
|
52
|
+
});
|
|
46
53
|
},
|
|
47
54
|
signTransaction: async (params) => {
|
|
48
55
|
assert(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import * as bitcoin from '@exodus/bitcoinjs
|
|
1
|
+
import * as bitcoin from '@exodus/bitcoinjs';
|
|
2
2
|
export declare function buildBip322PSBT(message: string, address: string): bitcoin.Psbt;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as bitcoin from '@exodus/bitcoinjs
|
|
1
|
+
import * as bitcoin from '@exodus/bitcoinjs';
|
|
2
2
|
import { BIP322, Address } from '@exodus/bip322-js';
|
|
3
3
|
export function buildBip322PSBT(message, address) {
|
|
4
4
|
const scriptPubKey = Address.convertAdressToScriptPubkey(address);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import assert from 'minimalistic-assert';
|
|
2
2
|
import { DefaultWalletPolicy, WalletPolicy } from '@exodus/ledger-bitcoin';
|
|
3
|
-
import { payments, address as baddress } from '@exodus/bitcoinjs
|
|
3
|
+
import { payments, address as baddress } from '@exodus/bitcoinjs';
|
|
4
4
|
import { buildBip44PathFromNumber, assertBip44PathNumber, splitBip44PathToNumber, splitBip44DerivationPath, } from './derivation-paths';
|
|
5
5
|
export function assertPsbtOnlyHasAllowedDerivationPaths(psbt, masterFingerprint, derivationPaths) {
|
|
6
6
|
for (let i = 0; i < psbt.getGlobalInputCount(); i++) {
|
package/lib/module/device.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ export declare class LedgerDevice implements HardwareWalletDevice {
|
|
|
10
10
|
#private;
|
|
11
11
|
constructor({ transportFactory, descriptor, walletPolicyAtom }: Dependencies);
|
|
12
12
|
get descriptor(): HardwareWalletDescriptor;
|
|
13
|
+
cancelAction: () => Promise<void>;
|
|
13
14
|
ensureApplicationIsOpened: (baseAssetName: string) => Promise<void>;
|
|
14
15
|
listSupportedAssetNames: () => Promise<string[]>;
|
|
15
16
|
listInstalledAssetNames: () => Promise<string[]>;
|
package/lib/module/device.js
CHANGED
|
@@ -7,6 +7,7 @@ export class LedgerDevice {
|
|
|
7
7
|
#transportFactory;
|
|
8
8
|
#descriptor;
|
|
9
9
|
#walletPolicyAtom;
|
|
10
|
+
#cancelPendingAction;
|
|
10
11
|
constructor({ transportFactory, descriptor, walletPolicyAtom }) {
|
|
11
12
|
this.#transportFactory = transportFactory;
|
|
12
13
|
this.#descriptor = descriptor;
|
|
@@ -17,6 +18,7 @@ export class LedgerDevice {
|
|
|
17
18
|
}
|
|
18
19
|
#runInSession = async (operation, expectErrorWhenClosing = false) => {
|
|
19
20
|
const transport = await this.#transportFactory.open(this.#descriptor.internalDescriptor);
|
|
21
|
+
this.#cancelPendingAction = async () => transport.close();
|
|
20
22
|
try {
|
|
21
23
|
return await operation(transport);
|
|
22
24
|
}
|
|
@@ -24,6 +26,7 @@ export class LedgerDevice {
|
|
|
24
26
|
throw transformToCommonError(err);
|
|
25
27
|
}
|
|
26
28
|
finally {
|
|
29
|
+
this.#cancelPendingAction = undefined;
|
|
27
30
|
if (expectErrorWhenClosing) {
|
|
28
31
|
await transport.close().catch((err) => {
|
|
29
32
|
console.warn(`caught error while closing ledger transport but was expected = `, err);
|
|
@@ -64,6 +67,12 @@ export class LedgerDevice {
|
|
|
64
67
|
return handler.quitApplication();
|
|
65
68
|
});
|
|
66
69
|
};
|
|
70
|
+
cancelAction = async () => {
|
|
71
|
+
if (this.#cancelPendingAction) {
|
|
72
|
+
await this.#cancelPendingAction();
|
|
73
|
+
await this.#quitApplication();
|
|
74
|
+
}
|
|
75
|
+
};
|
|
67
76
|
ensureApplicationIsOpened = async (baseAssetName) => {
|
|
68
77
|
const { applications } = this.#getAssetApplication(baseAssetName);
|
|
69
78
|
const supportedApplicationNames = applications.map(({ applicationName }) => applicationName);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/hw-ledger",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "The ledger module",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -22,24 +22,24 @@
|
|
|
22
22
|
"build": "run -T tsc --build tsconfig.build.json",
|
|
23
23
|
"build:watch": "run -T tsc --build tsconfig.build.json && run -T tsc --build -w tsconfig.build.json",
|
|
24
24
|
"clean": "run -T tsc --build --clean",
|
|
25
|
-
"test": "run -T
|
|
25
|
+
"test": "RUN_TESTS=unit run -T exodus-test --jest --esbuild",
|
|
26
26
|
"zemu:install": "docker pull zondax/builder-zemu:speculos-745fe46f81cfc18114b94a37beaefb58a09c0fcd",
|
|
27
|
-
"test:integration": "yarn zemu:install && run -T exodus-test --jest --esbuild",
|
|
27
|
+
"test:integration": "yarn zemu:install && RUN_TESTS=integration run -T exodus-test --jest --esbuild",
|
|
28
28
|
"lint": "run -T eslint .",
|
|
29
29
|
"lint:fix": "yarn lint --fix",
|
|
30
30
|
"prepublishOnly": "yarn run -T build --scope @exodus/hw-ledger"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@exodus/atoms": "^9.0.0",
|
|
34
|
-
"@exodus/bip322-js": "^1.1
|
|
35
|
-
"@exodus/bitcoinjs
|
|
34
|
+
"@exodus/bip322-js": "^1.2.1",
|
|
35
|
+
"@exodus/bitcoinjs": "^1.1.0",
|
|
36
|
+
"@exodus/crypto": "^1.0.0-rc.14",
|
|
36
37
|
"@exodus/ethersproject-transactions": "^5.4.2-exodus.0",
|
|
37
|
-
"@exodus/hw-common": "^3.
|
|
38
|
+
"@exodus/hw-common": "^3.1.0",
|
|
38
39
|
"@exodus/ledger-bitcoin": "^0.2.3-exodus.3",
|
|
39
40
|
"@exodus/ledgerhq-devices": "^8.1.0-exodus.3",
|
|
40
41
|
"@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
|
|
41
42
|
"@exodus/redux-dependency-injection": "^4.0.0",
|
|
42
|
-
"@exodus/secp256k1": "^4.0.2-exodus.0",
|
|
43
43
|
"@ledgerhq/hw-app-solana": "^7.0.10",
|
|
44
44
|
"@ledgerhq/hw-transport": "^6.28.5",
|
|
45
45
|
"@metamask/eth-sig-util": "^4.0.1",
|
|
@@ -56,14 +56,13 @@
|
|
|
56
56
|
"@types/bs58": "^4.0.1",
|
|
57
57
|
"@types/bs58check": "^2.1.0",
|
|
58
58
|
"@types/minimalistic-assert": "^1.0.1",
|
|
59
|
-
"@types/secp256k1": "^4.0.3",
|
|
60
59
|
"@types/semver": "^7.3.5",
|
|
61
60
|
"@zondax/zemu": "^0.43.1",
|
|
62
61
|
"bitcoinjs-lib": "^6.1.3",
|
|
63
62
|
"ecpair": "^2.1.0",
|
|
63
|
+
"p-defer": "^4.0.1",
|
|
64
64
|
"redux": "^4.2.1",
|
|
65
|
-
"tiny-secp256k1": "^2.2.3"
|
|
66
|
-
"ts-jest": "^29.0.3"
|
|
65
|
+
"tiny-secp256k1": "^2.2.3"
|
|
67
66
|
},
|
|
68
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "6a40d50082582568d68206d8926737eea560fa50"
|
|
69
68
|
}
|