@exodus/hw-ledger 2.8.0 → 2.9.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 +12 -0
- package/lib/atoms/index.d.ts +2 -2
- package/lib/atoms/index.js +2 -2
- package/lib/index.d.ts +4 -4
- package/lib/index.js +2 -2
- package/lib/plugin/index.d.ts +4 -3
- package/lib/plugin/index.js +5 -9
- package/lib/redux/index.d.ts +8 -8
- package/lib/redux/index.js +2 -2
- package/lib/redux/initial-state.d.ts +5 -1
- package/lib/redux/initial-state.js +1 -1
- package/lib/redux/selectors/bluetoothScanning.d.ts +2 -2
- package/lib/redux/selectors/bluetoothScanning.js +3 -2
- package/lib/redux/selectors/bluetoothStatus.d.ts +9 -0
- package/lib/redux/selectors/bluetoothStatus.js +8 -0
- package/lib/redux/selectors/index.d.ts +5 -5
- package/lib/redux/selectors/index.js +2 -2
- package/package.json +4 -2
- package/lib/redux/selectors/bluetoothEnabled.d.ts +0 -9
- package/lib/redux/selectors/bluetoothEnabled.js +0 -7
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.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.8.1...@exodus/hw-ledger@2.9.0) (2024-07-16)
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
- **hw-ledger:** expose bluetooth status to clients ([#7848](https://github.com/ExodusMovement/exodus-hydra/issues/7848)) ([36943b1](https://github.com/ExodusMovement/exodus-hydra/commit/36943b194c286a07c44dd78bd3a1f03324c87ce8))
|
|
11
|
+
|
|
12
|
+
## [2.8.1](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.8.0...@exodus/hw-ledger@2.8.1) (2024-07-10)
|
|
13
|
+
|
|
14
|
+
### Bug Fixes
|
|
15
|
+
|
|
16
|
+
- **ledger:** fix selectors ([#7744](https://github.com/ExodusMovement/exodus-hydra/issues/7744)) ([11ad709](https://github.com/ExodusMovement/exodus-hydra/commit/11ad7098314c1a7dee014765bfc0500d9636b4df))
|
|
17
|
+
|
|
6
18
|
## [2.8.0](https://github.com/ExodusMovement/exodus-hydra/compare/@exodus/hw-ledger@2.7.0...@exodus/hw-ledger@2.8.0) (2024-07-10)
|
|
7
19
|
|
|
8
20
|
### Features
|
package/lib/atoms/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
readonly id: "
|
|
1
|
+
export declare const bluetoothStatusAtomDefinition: {
|
|
2
|
+
readonly id: "bluetoothStatusAtom";
|
|
3
3
|
readonly type: "atom";
|
|
4
4
|
readonly factory: () => import("@exodus/atoms").Atom<boolean>;
|
|
5
5
|
readonly dependencies: readonly [];
|
package/lib/atoms/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createInMemoryAtom } from '@exodus/atoms';
|
|
2
|
-
export const
|
|
3
|
-
id: '
|
|
2
|
+
export const bluetoothStatusAtomDefinition = {
|
|
3
|
+
id: 'bluetoothStatusAtom',
|
|
4
4
|
type: 'atom',
|
|
5
5
|
factory: () => createInMemoryAtom({ defaultValue: false }),
|
|
6
6
|
dependencies: [],
|
package/lib/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
3
3
|
readonly id: "hardwareWalletLedger";
|
|
4
4
|
readonly definitions: readonly [{
|
|
5
5
|
readonly definition: {
|
|
6
|
-
readonly id: "
|
|
6
|
+
readonly id: "bluetoothStatusAtom";
|
|
7
7
|
readonly type: "atom";
|
|
8
8
|
readonly factory: () => import("libraries/atoms/lib").Atom<boolean>;
|
|
9
9
|
readonly dependencies: readonly [];
|
|
@@ -19,10 +19,10 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
19
19
|
readonly definition: {
|
|
20
20
|
readonly id: "hardwareWalletLedgerPlugin";
|
|
21
21
|
readonly type: "plugin";
|
|
22
|
-
readonly factory: ({ logger, transportsFactories,
|
|
22
|
+
readonly factory: ({ logger, transportsFactories, bluetoothStatusAtom, bluetoothScanningAtom, port, }: {
|
|
23
23
|
logger: import("./shared/types").Logger;
|
|
24
24
|
transportsFactories: import("./module/types").TransportFactories;
|
|
25
|
-
|
|
25
|
+
bluetoothStatusAtom: import("libraries/atoms/lib").Atom<import("./redux/initial-state").BluetoothStatus>;
|
|
26
26
|
bluetoothScanningAtom: import("libraries/atoms/lib").Atom<boolean>;
|
|
27
27
|
port: import("./shared/types").Port;
|
|
28
28
|
}) => {
|
|
@@ -30,7 +30,7 @@ declare const hardwareWalletLedger: ({ bluetoothScannerTimeout, }?: Partial<HwLe
|
|
|
30
30
|
onLoad: () => void;
|
|
31
31
|
onStop: () => void;
|
|
32
32
|
};
|
|
33
|
-
readonly dependencies: readonly ["logger", "transportsFactories", "
|
|
33
|
+
readonly dependencies: readonly ["logger", "transportsFactories", "bluetoothStatusAtom", "bluetoothScanningAtom", "port"];
|
|
34
34
|
};
|
|
35
35
|
}, {
|
|
36
36
|
readonly definition: {
|
package/lib/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { bluetoothStatusAtomDefinition, bluetoothScanningAtomDefinition } from './atoms';
|
|
2
2
|
import ledgerDiscoveryDefinition from './module';
|
|
3
3
|
import hardwareWalletLedgerPluginDefinition from './plugin';
|
|
4
4
|
const hardwareWalletLedger = ({ bluetoothScannerTimeout = 10000, } = {}) => {
|
|
@@ -6,7 +6,7 @@ const hardwareWalletLedger = ({ bluetoothScannerTimeout = 10000, } = {}) => {
|
|
|
6
6
|
id: 'hardwareWalletLedger',
|
|
7
7
|
definitions: [
|
|
8
8
|
{
|
|
9
|
-
definition:
|
|
9
|
+
definition: bluetoothStatusAtomDefinition,
|
|
10
10
|
},
|
|
11
11
|
{
|
|
12
12
|
definition: bluetoothScanningAtomDefinition,
|
package/lib/plugin/index.d.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import type { Atom } from '@exodus/atoms';
|
|
2
2
|
import type { TransportFactories } from '../module/types';
|
|
3
3
|
import type { Logger, Port } from '../shared/types';
|
|
4
|
+
import { BluetoothStatus } from '../redux/initial-state';
|
|
4
5
|
declare const hardwareWalletLedgerPluginDefinition: {
|
|
5
6
|
readonly id: "hardwareWalletLedgerPlugin";
|
|
6
7
|
readonly type: "plugin";
|
|
7
|
-
readonly factory: ({ logger, transportsFactories,
|
|
8
|
+
readonly factory: ({ logger, transportsFactories, bluetoothStatusAtom, bluetoothScanningAtom, port, }: {
|
|
8
9
|
logger: Logger;
|
|
9
10
|
transportsFactories: TransportFactories;
|
|
10
|
-
|
|
11
|
+
bluetoothStatusAtom: Atom<BluetoothStatus>;
|
|
11
12
|
bluetoothScanningAtom: Atom<boolean>;
|
|
12
13
|
port: Port;
|
|
13
14
|
}) => {
|
|
@@ -15,6 +16,6 @@ declare const hardwareWalletLedgerPluginDefinition: {
|
|
|
15
16
|
onLoad: () => void;
|
|
16
17
|
onStop: () => void;
|
|
17
18
|
};
|
|
18
|
-
readonly dependencies: readonly ["logger", "transportsFactories", "
|
|
19
|
+
readonly dependencies: readonly ["logger", "transportsFactories", "bluetoothStatusAtom", "bluetoothScanningAtom", "port"];
|
|
19
20
|
};
|
|
20
21
|
export default hardwareWalletLedgerPluginDefinition;
|
package/lib/plugin/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createAtomObserver } from '@exodus/atoms';
|
|
2
|
-
const createHardwareWalletLedgerPlugin = ({ logger, transportsFactories,
|
|
2
|
+
const createHardwareWalletLedgerPlugin = ({ logger, transportsFactories, bluetoothStatusAtom, bluetoothScanningAtom, port, }) => {
|
|
3
3
|
let subscription;
|
|
4
4
|
const observers = [
|
|
5
|
-
createAtomObserver({ atom:
|
|
5
|
+
createAtomObserver({ atom: bluetoothStatusAtom, port, event: 'bluetoothStatus' }),
|
|
6
6
|
createAtomObserver({ atom: bluetoothScanningAtom, port, event: 'bluetoothScanning' }),
|
|
7
7
|
];
|
|
8
8
|
observers.forEach((observer) => observer.register());
|
|
@@ -13,17 +13,13 @@ const createHardwareWalletLedgerPlugin = ({ logger, transportsFactories, bluetoo
|
|
|
13
13
|
return;
|
|
14
14
|
if (transportsFactories.bluetooth.observeState) {
|
|
15
15
|
subscription = transportsFactories.bluetooth.observeState({
|
|
16
|
-
next: (
|
|
17
|
-
bluetoothEnabledAtom.set(!!e.available);
|
|
18
|
-
},
|
|
16
|
+
next: ({ type, available }) => bluetoothStatusAtom.set({ type, available }),
|
|
19
17
|
error: (error) => logger.error(error),
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
20
|
else if (transportsFactories.bluetooth.observeAvailability) {
|
|
23
21
|
subscription = transportsFactories.bluetooth.observeAvailability({
|
|
24
|
-
next: (available) => {
|
|
25
|
-
bluetoothEnabledAtom.set(available);
|
|
26
|
-
},
|
|
22
|
+
next: (available) => bluetoothStatusAtom.set({ type: 'Unknown', available }),
|
|
27
23
|
error: (error) => logger.error(error),
|
|
28
24
|
});
|
|
29
25
|
}
|
|
@@ -51,7 +47,7 @@ const hardwareWalletLedgerPluginDefinition = {
|
|
|
51
47
|
dependencies: [
|
|
52
48
|
'logger',
|
|
53
49
|
'transportsFactories',
|
|
54
|
-
'
|
|
50
|
+
'bluetoothStatusAtom',
|
|
55
51
|
'bluetoothScanningAtom',
|
|
56
52
|
'port',
|
|
57
53
|
],
|
package/lib/redux/index.d.ts
CHANGED
|
@@ -4,26 +4,26 @@ declare const exchangeReduxDefinition: {
|
|
|
4
4
|
readonly type: "redux-module";
|
|
5
5
|
readonly initialState: LedgerHardwareWalletState;
|
|
6
6
|
readonly eventReducers: {
|
|
7
|
-
readonly
|
|
8
|
-
|
|
7
|
+
readonly bluetoothStatus: (state: LedgerHardwareWalletState, payload: boolean) => {
|
|
8
|
+
bluetoothStatus: boolean;
|
|
9
9
|
bluetoothScanning: boolean;
|
|
10
10
|
};
|
|
11
11
|
readonly bluetoothScanning: (state: LedgerHardwareWalletState, payload: boolean) => {
|
|
12
12
|
bluetoothScanning: boolean;
|
|
13
|
-
|
|
13
|
+
bluetoothStatus: import("./initial-state").BluetoothStatus;
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
16
|
readonly selectorDefinitions: ({
|
|
17
|
-
readonly id: "
|
|
18
|
-
readonly resultFunction: (
|
|
17
|
+
readonly id: "bluetoothStatus";
|
|
18
|
+
readonly resultFunction: (state: LedgerHardwareWalletState) => import("./initial-state").BluetoothStatus;
|
|
19
19
|
readonly dependencies: readonly [{
|
|
20
|
-
readonly selector:
|
|
20
|
+
readonly selector: string;
|
|
21
21
|
}];
|
|
22
22
|
} | {
|
|
23
23
|
readonly id: "bluetoothScanning";
|
|
24
|
-
readonly resultFunction: (
|
|
24
|
+
readonly resultFunction: (state: LedgerHardwareWalletState) => boolean;
|
|
25
25
|
readonly dependencies: readonly [{
|
|
26
|
-
readonly selector:
|
|
26
|
+
readonly selector: string;
|
|
27
27
|
}];
|
|
28
28
|
})[];
|
|
29
29
|
};
|
package/lib/redux/index.js
CHANGED
|
@@ -6,9 +6,9 @@ const exchangeReduxDefinition = {
|
|
|
6
6
|
type: 'redux-module',
|
|
7
7
|
initialState,
|
|
8
8
|
eventReducers: {
|
|
9
|
-
|
|
9
|
+
bluetoothStatus: (state, payload) => ({
|
|
10
10
|
...state,
|
|
11
|
-
|
|
11
|
+
bluetoothStatus: payload,
|
|
12
12
|
}),
|
|
13
13
|
bluetoothScanning: (state, payload) => ({
|
|
14
14
|
...state,
|
|
@@ -1,5 +1,9 @@
|
|
|
1
|
+
export type BluetoothStatus = {
|
|
2
|
+
type: 'Unknown' | 'Resetting' | 'Unsupported' | 'Unauthorized' | 'PoweredOff' | 'PoweredOn';
|
|
3
|
+
available: boolean;
|
|
4
|
+
};
|
|
1
5
|
export type LedgerHardwareWalletState = {
|
|
2
|
-
|
|
6
|
+
bluetoothStatus: BluetoothStatus;
|
|
3
7
|
bluetoothScanning: boolean;
|
|
4
8
|
};
|
|
5
9
|
declare const initialState: LedgerHardwareWalletState;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { LedgerHardwareWalletState } from '../initial-state';
|
|
2
2
|
declare const bluetoothScanningSelectorDefinition: {
|
|
3
3
|
readonly id: "bluetoothScanning";
|
|
4
|
-
readonly resultFunction: (
|
|
4
|
+
readonly resultFunction: (state: LedgerHardwareWalletState) => boolean;
|
|
5
5
|
readonly dependencies: readonly [{
|
|
6
|
-
readonly selector:
|
|
6
|
+
readonly selector: string;
|
|
7
7
|
}];
|
|
8
8
|
};
|
|
9
9
|
export default bluetoothScanningSelectorDefinition;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
|
|
1
|
+
import { MY_STATE } from '@exodus/redux-dependency-injection';
|
|
2
|
+
const resultFunction = (state) => state.bluetoothScanning;
|
|
2
3
|
const bluetoothScanningSelectorDefinition = {
|
|
3
4
|
id: 'bluetoothScanning',
|
|
4
5
|
resultFunction,
|
|
5
|
-
dependencies: [{ selector:
|
|
6
|
+
dependencies: [{ selector: MY_STATE }],
|
|
6
7
|
};
|
|
7
8
|
export default bluetoothScanningSelectorDefinition;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { LedgerHardwareWalletState } from '../initial-state';
|
|
2
|
+
declare const bluetoothStatusSelectorDefinition: {
|
|
3
|
+
readonly id: "bluetoothStatus";
|
|
4
|
+
readonly resultFunction: (state: LedgerHardwareWalletState) => import("../initial-state").BluetoothStatus;
|
|
5
|
+
readonly dependencies: readonly [{
|
|
6
|
+
readonly selector: string;
|
|
7
|
+
}];
|
|
8
|
+
};
|
|
9
|
+
export default bluetoothStatusSelectorDefinition;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { MY_STATE } from '@exodus/redux-dependency-injection';
|
|
2
|
+
const resultFunction = (state) => state.bluetoothStatus;
|
|
3
|
+
const bluetoothStatusSelectorDefinition = {
|
|
4
|
+
id: 'bluetoothStatus',
|
|
5
|
+
resultFunction,
|
|
6
|
+
dependencies: [{ selector: MY_STATE }],
|
|
7
|
+
};
|
|
8
|
+
export default bluetoothStatusSelectorDefinition;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
declare const ledgerSelectors: ({
|
|
2
|
-
readonly id: "
|
|
3
|
-
readonly resultFunction: (
|
|
2
|
+
readonly id: "bluetoothStatus";
|
|
3
|
+
readonly resultFunction: (state: import("../initial-state").LedgerHardwareWalletState) => import("../initial-state").BluetoothStatus;
|
|
4
4
|
readonly dependencies: readonly [{
|
|
5
|
-
readonly selector:
|
|
5
|
+
readonly selector: string;
|
|
6
6
|
}];
|
|
7
7
|
} | {
|
|
8
8
|
readonly id: "bluetoothScanning";
|
|
9
|
-
readonly resultFunction: (
|
|
9
|
+
readonly resultFunction: (state: import("../initial-state").LedgerHardwareWalletState) => boolean;
|
|
10
10
|
readonly dependencies: readonly [{
|
|
11
|
-
readonly selector:
|
|
11
|
+
readonly selector: string;
|
|
12
12
|
}];
|
|
13
13
|
})[];
|
|
14
14
|
export default ledgerSelectors;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import bluetoothStatusSelectorDefinition from './bluetoothStatus';
|
|
2
2
|
import bluetoothScanningSelectorDefinition from './bluetoothScanning';
|
|
3
|
-
const ledgerSelectors = [
|
|
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": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "The ledger module",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -39,6 +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": "^3.0.0",
|
|
42
43
|
"@exodus/secp256k1": "^4.0.2-exodus.0",
|
|
43
44
|
"@ledgerhq/hw-app-solana": "^7.0.10",
|
|
44
45
|
"@ledgerhq/hw-transport": "^6.28.5",
|
|
@@ -66,9 +67,10 @@
|
|
|
66
67
|
"ecpair": "^2.1.0",
|
|
67
68
|
"istanbul-combine": "^0.3.0",
|
|
68
69
|
"jest-when": "^3.5.2",
|
|
70
|
+
"redux": "^4.2.1",
|
|
69
71
|
"tiny-secp256k1": "^2.2.3",
|
|
70
72
|
"ts-jest": "^29.0.3",
|
|
71
73
|
"typescript": "^4.7.3"
|
|
72
74
|
},
|
|
73
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "03f1666538fa7d596c729b77a380f891f7e747e4"
|
|
74
76
|
}
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import type { LedgerHardwareWalletState } from '../initial-state';
|
|
2
|
-
declare const bluetoothEnabledSelectorDefinition: {
|
|
3
|
-
readonly id: "bluetoothEnabled";
|
|
4
|
-
readonly resultFunction: (bluetoothEnabled: LedgerHardwareWalletState) => LedgerHardwareWalletState;
|
|
5
|
-
readonly dependencies: readonly [{
|
|
6
|
-
readonly selector: "bluetoothEnabled";
|
|
7
|
-
}];
|
|
8
|
-
};
|
|
9
|
-
export default bluetoothEnabledSelectorDefinition;
|