@exodus/hw-ledger 3.9.0 → 3.9.2
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 +24 -0
- package/lib/atoms/index.d.ts +4 -4
- package/lib/atoms/index.js +10 -7
- package/lib/index.d.ts +10 -10
- package/lib/index.js +14 -9
- package/lib/module/assets/applications.js +3 -1
- package/lib/module/assets/basemainnet.d.ts +1 -1
- package/lib/module/assets/basemainnet.js +10 -5
- package/lib/module/assets/bitcoin.js +42 -37
- package/lib/module/assets/ethereum.js +59 -21
- package/lib/module/assets/index.js +28 -22
- package/lib/module/assets/matic.d.ts +1 -1
- package/lib/module/assets/matic.js +10 -5
- package/lib/module/assets/ripple.js +17 -12
- package/lib/module/assets/solana.js +19 -14
- package/lib/module/assets/tronmainnet.js +50 -12
- package/lib/module/assets/utils/bip322.js +43 -7
- package/lib/module/assets/utils/derivation-paths.js +28 -17
- package/lib/module/assets/utils/index.d.ts +3 -3
- package/lib/module/assets/utils/index.js +19 -3
- package/lib/module/assets/utils/psbt.d.ts +3 -3
- package/lib/module/assets/utils/psbt.js +46 -34
- package/lib/module/assets/utils/xpub.d.ts +1 -1
- package/lib/module/assets/utils/xpub.js +6 -3
- package/lib/module/constants.js +4 -1
- package/lib/module/device.d.ts +2 -2
- package/lib/module/device.js +28 -21
- package/lib/module/discovery.d.ts +3 -3
- package/lib/module/discovery.js +18 -14
- package/lib/module/errors.js +12 -5
- package/lib/module/index.d.ts +2 -2
- package/lib/module/index.js +23 -2
- package/lib/module/management/application.js +5 -2
- package/lib/module/types.js +2 -1
- package/lib/plugin/index.d.ts +3 -3
- package/lib/plugin/index.js +6 -4
- package/lib/redux/id.js +3 -1
- package/lib/redux/index.d.ts +5 -5
- package/lib/redux/index.js +12 -7
- package/lib/redux/initial-state.d.ts +1 -1
- package/lib/redux/initial-state.js +3 -1
- package/lib/redux/selectors/bluetoothScanning.d.ts +2 -2
- package/lib/redux/selectors/bluetoothScanning.js +5 -3
- package/lib/redux/selectors/bluetoothStatus.d.ts +3 -3
- package/lib/redux/selectors/bluetoothStatus.js +5 -3
- package/lib/redux/selectors/index.d.ts +4 -4
- package/lib/redux/selectors/index.js +9 -4
- package/package.json +10 -3
- package/redux.js +2 -0
package/lib/module/device.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.LedgerDevice = void 0;
|
|
7
|
+
const semver_1 = __importDefault(require("semver"));
|
|
8
|
+
const hw_common_1 = require("@exodus/hw-common");
|
|
9
|
+
const index_js_1 = require("./assets/index.js");
|
|
10
|
+
const application_js_1 = require("./management/application.js");
|
|
11
|
+
const errors_js_1 = require("./errors.js");
|
|
12
|
+
class LedgerDevice {
|
|
7
13
|
#transportFactory;
|
|
8
14
|
#descriptor;
|
|
9
15
|
#walletPolicyAtom;
|
|
@@ -38,32 +44,32 @@ export class LedgerDevice {
|
|
|
38
44
|
}
|
|
39
45
|
};
|
|
40
46
|
#getAssetApplication = (assetName) => {
|
|
41
|
-
const handlerFactory = assetApplications[assetName];
|
|
47
|
+
const handlerFactory = index_js_1.assetApplications[assetName];
|
|
42
48
|
if (!handlerFactory)
|
|
43
|
-
throw new AssetUnsupportedError(assetName);
|
|
49
|
+
throw new hw_common_1.AssetUnsupportedError(assetName);
|
|
44
50
|
return handlerFactory;
|
|
45
51
|
};
|
|
46
52
|
#listApplications = async () => {
|
|
47
53
|
return this.#runInSession(async (transport) => {
|
|
48
|
-
const handler = await
|
|
54
|
+
const handler = await (0, application_js_1.createApplicationManager)(transport);
|
|
49
55
|
return handler.listApplications();
|
|
50
56
|
});
|
|
51
57
|
};
|
|
52
58
|
#getInformation = async () => {
|
|
53
59
|
return this.#runInSession(async (transport) => {
|
|
54
|
-
const handler = await
|
|
60
|
+
const handler = await (0, application_js_1.createApplicationManager)(transport);
|
|
55
61
|
return handler.getInformation();
|
|
56
62
|
});
|
|
57
63
|
};
|
|
58
64
|
#openApplication = async (applicationName) => {
|
|
59
65
|
return this.#runInSession(async (transport) => {
|
|
60
|
-
const handler = await
|
|
66
|
+
const handler = await (0, application_js_1.createApplicationManager)(transport);
|
|
61
67
|
return handler.openApplication(applicationName);
|
|
62
68
|
}, true);
|
|
63
69
|
};
|
|
64
70
|
#quitApplication = async () => {
|
|
65
71
|
return this.#runInSession(async (transport) => {
|
|
66
|
-
const handler = await
|
|
72
|
+
const handler = await (0, application_js_1.createApplicationManager)(transport);
|
|
67
73
|
return handler.quitApplication();
|
|
68
74
|
});
|
|
69
75
|
};
|
|
@@ -98,14 +104,14 @@ export class LedgerDevice {
|
|
|
98
104
|
}
|
|
99
105
|
}
|
|
100
106
|
if (!applicationName) {
|
|
101
|
-
throw new ApplicationNotFoundError(supportedApplicationNames);
|
|
107
|
+
throw new errors_js_1.ApplicationNotFoundError(supportedApplicationNames);
|
|
102
108
|
}
|
|
103
109
|
desiredApplicationInfo = await this.#getInformation();
|
|
104
110
|
}
|
|
105
111
|
const { supportedVersions } = applications.find(({ applicationName }) => applicationName === desiredApplicationInfo.name);
|
|
106
|
-
const isSupportedVersion =
|
|
112
|
+
const isSupportedVersion = semver_1.default.satisfies(desiredApplicationInfo.version, supportedVersions);
|
|
107
113
|
if (!isSupportedVersion) {
|
|
108
|
-
throw new UnsupportedVersionError(baseAssetName, desiredApplicationInfo.name, desiredApplicationInfo.version, supportedVersions);
|
|
114
|
+
throw new errors_js_1.UnsupportedVersionError(baseAssetName, desiredApplicationInfo.name, desiredApplicationInfo.version, supportedVersions);
|
|
109
115
|
}
|
|
110
116
|
};
|
|
111
117
|
ensureApplicationIsOpened = async (baseAssetName) => {
|
|
@@ -115,7 +121,7 @@ export class LedgerDevice {
|
|
|
115
121
|
await this.#ensureApplicationIsOpened(baseAssetName);
|
|
116
122
|
};
|
|
117
123
|
listSupportedAssetNames = async () => {
|
|
118
|
-
return supportedBaseAssetNames;
|
|
124
|
+
return index_js_1.supportedBaseAssetNames;
|
|
119
125
|
};
|
|
120
126
|
listInstalledAssetNames = async () => {
|
|
121
127
|
const { name: applicationName } = await this.#getInformation();
|
|
@@ -124,7 +130,7 @@ export class LedgerDevice {
|
|
|
124
130
|
const installedApplications = await this.#listApplications();
|
|
125
131
|
const installedAssets = [];
|
|
126
132
|
installedApplications.forEach(({ name: applicationName }) => {
|
|
127
|
-
const assetNames = applicationNameToBaseAssetNames[applicationName];
|
|
133
|
+
const assetNames = index_js_1.applicationNameToBaseAssetNames[applicationName];
|
|
128
134
|
if (assetNames)
|
|
129
135
|
installedAssets.push(...assetNames);
|
|
130
136
|
});
|
|
@@ -132,7 +138,7 @@ export class LedgerDevice {
|
|
|
132
138
|
};
|
|
133
139
|
listUseableAssetNames = async () => {
|
|
134
140
|
const { name: applicationName } = await this.#getInformation();
|
|
135
|
-
const assetNames = applicationNameToBaseAssetNames[applicationName];
|
|
141
|
+
const assetNames = index_js_1.applicationNameToBaseAssetNames[applicationName];
|
|
136
142
|
return assetNames || [];
|
|
137
143
|
};
|
|
138
144
|
getAddress = async (params) => {
|
|
@@ -171,13 +177,14 @@ export class LedgerDevice {
|
|
|
171
177
|
});
|
|
172
178
|
};
|
|
173
179
|
}
|
|
180
|
+
exports.LedgerDevice = LedgerDevice;
|
|
174
181
|
function transformToCommonError(_err) {
|
|
175
182
|
const err = _err;
|
|
176
183
|
if (err.name === 'LockedDeviceError') {
|
|
177
|
-
return new DeviceLockedError();
|
|
184
|
+
return new hw_common_1.DeviceLockedError();
|
|
178
185
|
}
|
|
179
186
|
if (err.name === 'UserRefusedOnDevice' || err.statusCode === 0x69_85) {
|
|
180
|
-
return new UserRefusedError(true);
|
|
187
|
+
return new hw_common_1.UserRefusedError(true);
|
|
181
188
|
}
|
|
182
189
|
if ([
|
|
183
190
|
'HwTransportError',
|
|
@@ -187,7 +194,7 @@ function transformToCommonError(_err) {
|
|
|
187
194
|
'DisconnectedDevice',
|
|
188
195
|
'DisconnectedDeviceDuringOperation',
|
|
189
196
|
].includes(err.name)) {
|
|
190
|
-
return new DeviceConnectionError(err);
|
|
197
|
+
return new hw_common_1.DeviceConnectionError(err);
|
|
191
198
|
}
|
|
192
199
|
return err;
|
|
193
200
|
}
|
|
@@ -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;
|
package/lib/module/discovery.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LedgerDiscovery = void 0;
|
|
4
|
+
const ledgerhq_devices_1 = require("@exodus/ledgerhq-devices");
|
|
5
|
+
const constants_js_1 = require("./constants.js");
|
|
6
|
+
const device_js_1 = require("./device.js");
|
|
7
|
+
const errors_js_1 = require("./errors.js");
|
|
5
8
|
const MODULE_ID = 'ledgerDiscovery';
|
|
6
|
-
|
|
9
|
+
class LedgerDiscovery {
|
|
7
10
|
#logger;
|
|
8
11
|
#transportsFactories;
|
|
9
12
|
#scannerTimeout;
|
|
@@ -24,7 +27,7 @@ export class LedgerDiscovery {
|
|
|
24
27
|
transportFactory !== undefined &&
|
|
25
28
|
typeof transportFactory.list === 'function' &&
|
|
26
29
|
typeof transportFactory.open === 'function'))) {
|
|
27
|
-
throw new UnknownTransportError();
|
|
30
|
+
throw new errors_js_1.UnknownTransportError();
|
|
28
31
|
}
|
|
29
32
|
if (!Number.isInteger(config.bluetoothScannerTimeout)) {
|
|
30
33
|
throw new TypeError(`Invalid bluetoothScannerTimeout passed through config`);
|
|
@@ -98,14 +101,14 @@ export class LedgerDiscovery {
|
|
|
98
101
|
case 'usb':
|
|
99
102
|
const deviceList = (await transportFactory.list());
|
|
100
103
|
const usbDeviceList = deviceList.map((hidDevice) => {
|
|
101
|
-
const deviceModel = identifyUSBProductId(hidDevice.productId);
|
|
104
|
+
const deviceModel = (0, ledgerhq_devices_1.identifyUSBProductId)(hidDevice.productId);
|
|
102
105
|
const descriptor = {
|
|
103
106
|
name: deviceModel?.productName ?? 'Ledger USB',
|
|
104
107
|
manufacturer: 'ledger',
|
|
105
108
|
transport: 'usb',
|
|
106
109
|
model: deviceModel?.id ?? 'unknown',
|
|
107
110
|
internalDescriptor: hidDevice,
|
|
108
|
-
get: async () => new LedgerDevice({
|
|
111
|
+
get: async () => new device_js_1.LedgerDevice({
|
|
109
112
|
transportFactory,
|
|
110
113
|
descriptor,
|
|
111
114
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
@@ -117,14 +120,14 @@ export class LedgerDiscovery {
|
|
|
117
120
|
break;
|
|
118
121
|
case 'bluetooth':
|
|
119
122
|
const bluetoothDeviceList = Object.values(this.#discoveredBluetoothDevices).map((bluetoothDevice) => {
|
|
120
|
-
const deviceModel = getInfosForServiceUuid(bluetoothDevice.serviceUUIDs?.[0] ?? '')?.deviceModel;
|
|
123
|
+
const deviceModel = (0, ledgerhq_devices_1.getInfosForServiceUuid)(bluetoothDevice.serviceUUIDs?.[0] ?? '')?.deviceModel;
|
|
121
124
|
const descriptor = {
|
|
122
125
|
name: bluetoothDevice.localName ?? deviceModel?.productName,
|
|
123
126
|
manufacturer: 'ledger',
|
|
124
127
|
transport: 'bluetooth',
|
|
125
128
|
model: deviceModel?.id ?? 'unknown',
|
|
126
129
|
internalDescriptor: bluetoothDevice,
|
|
127
|
-
get: async () => new LedgerDevice({
|
|
130
|
+
get: async () => new device_js_1.LedgerDevice({
|
|
128
131
|
transportFactory,
|
|
129
132
|
descriptor,
|
|
130
133
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
@@ -140,8 +143,8 @@ export class LedgerDiscovery {
|
|
|
140
143
|
manufacturer: 'ledger',
|
|
141
144
|
transport: 'tcp',
|
|
142
145
|
model: 'unknown',
|
|
143
|
-
internalDescriptor: { apduPort: APDU_PORT },
|
|
144
|
-
get: async () => new LedgerDevice({
|
|
146
|
+
internalDescriptor: { apduPort: constants_js_1.APDU_PORT },
|
|
147
|
+
get: async () => new device_js_1.LedgerDevice({
|
|
145
148
|
transportFactory,
|
|
146
149
|
descriptor,
|
|
147
150
|
walletPolicyAtom: this.#walletPolicyAtom,
|
|
@@ -150,7 +153,7 @@ export class LedgerDiscovery {
|
|
|
150
153
|
descriptors.push(descriptor);
|
|
151
154
|
break;
|
|
152
155
|
default:
|
|
153
|
-
throw new UnknownTransportError(transportName);
|
|
156
|
+
throw new errors_js_1.UnknownTransportError(transportName);
|
|
154
157
|
}
|
|
155
158
|
}
|
|
156
159
|
return descriptors;
|
|
@@ -159,8 +162,9 @@ export class LedgerDiscovery {
|
|
|
159
162
|
this.#statusBluetooth?.unsubscribe();
|
|
160
163
|
};
|
|
161
164
|
}
|
|
165
|
+
exports.LedgerDiscovery = LedgerDiscovery;
|
|
162
166
|
const createLedgerDiscovery = (deps) => new LedgerDiscovery({ ...deps });
|
|
163
|
-
|
|
167
|
+
exports.default = {
|
|
164
168
|
id: MODULE_ID,
|
|
165
169
|
type: 'module',
|
|
166
170
|
factory: createLedgerDiscovery,
|
package/lib/module/errors.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.RequiresBlindSigningError = exports.UnsupportedVersionError = exports.ApplicationNotFoundError = exports.UnknownTransportError = void 0;
|
|
4
|
+
const hw_common_1 = require("@exodus/hw-common");
|
|
5
|
+
class UnknownTransportError extends hw_common_1.HardwareWalletError {
|
|
3
6
|
name = 'UnknownTransportError';
|
|
4
7
|
constructor(transportName) {
|
|
5
8
|
super(`unknown transport type ${transportName || ''}`);
|
|
6
9
|
}
|
|
7
10
|
}
|
|
8
|
-
|
|
11
|
+
exports.UnknownTransportError = UnknownTransportError;
|
|
12
|
+
class ApplicationNotFoundError extends hw_common_1.HardwareWalletError {
|
|
9
13
|
name = 'ApplicationNotFoundError';
|
|
10
14
|
supportedApplications;
|
|
11
15
|
constructor(supportedApplications) {
|
|
@@ -13,7 +17,8 @@ export class ApplicationNotFoundError extends HardwareWalletError {
|
|
|
13
17
|
this.supportedApplications = supportedApplications;
|
|
14
18
|
}
|
|
15
19
|
}
|
|
16
|
-
|
|
20
|
+
exports.ApplicationNotFoundError = ApplicationNotFoundError;
|
|
21
|
+
class UnsupportedVersionError extends hw_common_1.HardwareWalletError {
|
|
17
22
|
name = 'UnsupportedVersionError';
|
|
18
23
|
baseAssetName;
|
|
19
24
|
applicationName;
|
|
@@ -27,9 +32,11 @@ export class UnsupportedVersionError extends HardwareWalletError {
|
|
|
27
32
|
this.actualVersion = actualVersion;
|
|
28
33
|
}
|
|
29
34
|
}
|
|
30
|
-
|
|
35
|
+
exports.UnsupportedVersionError = UnsupportedVersionError;
|
|
36
|
+
class RequiresBlindSigningError extends hw_common_1.HardwareWalletError {
|
|
31
37
|
name = 'RequiresBlindSigningError';
|
|
32
38
|
constructor() {
|
|
33
39
|
super('signing operation requires that blind signing is enabled on the device');
|
|
34
40
|
}
|
|
35
41
|
}
|
|
42
|
+
exports.RequiresBlindSigningError = RequiresBlindSigningError;
|
package/lib/module/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './discovery';
|
|
2
|
-
export { default } from './discovery';
|
|
1
|
+
export * from './discovery.js';
|
|
2
|
+
export { default } from './discovery.js';
|
package/lib/module/index.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
+
};
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.default = void 0;
|
|
21
|
+
__exportStar(require("./discovery.js"), exports);
|
|
22
|
+
var discovery_js_1 = require("./discovery.js");
|
|
23
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(discovery_js_1).default; } });
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createApplicationManager = createApplicationManager;
|
|
4
|
+
async function createApplicationManager(transport) {
|
|
2
5
|
return {
|
|
3
6
|
getInformation: async () => {
|
|
4
7
|
const r = await transport.send(0xb0, 0x01, 0x00, 0x00);
|
|
@@ -24,7 +27,7 @@ export async function createApplicationManager(transport) {
|
|
|
24
27
|
const apps = [];
|
|
25
28
|
let data = payload;
|
|
26
29
|
while (data.length > 2) {
|
|
27
|
-
if (
|
|
30
|
+
if (data[0] !== 0x01) {
|
|
28
31
|
throw new Error('unknown listApps format');
|
|
29
32
|
}
|
|
30
33
|
let i = 1;
|
package/lib/module/types.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
package/lib/plugin/index.d.ts
CHANGED
|
@@ -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";
|
package/lib/plugin/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const atoms_1 = require("@exodus/atoms");
|
|
2
4
|
const createHardwareWalletLedgerPlugin = ({ bluetoothStatusAtom, bluetoothScanningAtom, ledgerDiscovery, port, }) => {
|
|
3
5
|
const observers = [
|
|
4
|
-
createAtomObserver({ atom: bluetoothStatusAtom, port, event: 'bluetoothStatus' }),
|
|
5
|
-
createAtomObserver({ atom: bluetoothScanningAtom, port, event: 'bluetoothScanning' }),
|
|
6
|
+
(0, atoms_1.createAtomObserver)({ atom: bluetoothStatusAtom, port, event: 'bluetoothStatus' }),
|
|
7
|
+
(0, atoms_1.createAtomObserver)({ atom: bluetoothScanningAtom, port, event: 'bluetoothScanning' }),
|
|
6
8
|
];
|
|
7
9
|
observers.forEach((observer) => observer.register());
|
|
8
10
|
const start = () => {
|
|
@@ -30,4 +32,4 @@ const hardwareWalletLedgerPluginDefinition = {
|
|
|
30
32
|
dependencies: ['bluetoothStatusAtom', 'bluetoothScanningAtom', 'ledgerDiscovery', 'port'],
|
|
31
33
|
public: true,
|
|
32
34
|
};
|
|
33
|
-
|
|
35
|
+
exports.default = hardwareWalletLedgerPluginDefinition;
|
package/lib/redux/id.js
CHANGED
package/lib/redux/index.d.ts
CHANGED
|
@@ -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,20 +10,20 @@ 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
|
-
readonly selector:
|
|
20
|
+
readonly selector: "$state";
|
|
21
21
|
}];
|
|
22
22
|
} | {
|
|
23
23
|
readonly id: "bluetoothScanning";
|
|
24
24
|
readonly resultFunction: (state: LedgerHardwareWalletState) => boolean;
|
|
25
25
|
readonly dependencies: readonly [{
|
|
26
|
-
readonly selector:
|
|
26
|
+
readonly selector: "$state";
|
|
27
27
|
}];
|
|
28
28
|
})[];
|
|
29
29
|
};
|
package/lib/redux/index.js
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const id_js_1 = __importDefault(require("./id.js"));
|
|
7
|
+
const initial_state_js_1 = __importDefault(require("./initial-state.js"));
|
|
8
|
+
const index_js_1 = __importDefault(require("./selectors/index.js"));
|
|
4
9
|
const exchangeReduxDefinition = {
|
|
5
|
-
id,
|
|
10
|
+
id: id_js_1.default,
|
|
6
11
|
type: 'redux-module',
|
|
7
|
-
initialState,
|
|
12
|
+
initialState: initial_state_js_1.default,
|
|
8
13
|
eventReducers: {
|
|
9
14
|
bluetoothStatus: (state, payload) => ({
|
|
10
15
|
...state,
|
|
@@ -15,6 +20,6 @@ const exchangeReduxDefinition = {
|
|
|
15
20
|
bluetoothScanning: payload,
|
|
16
21
|
}),
|
|
17
22
|
},
|
|
18
|
-
selectorDefinitions,
|
|
23
|
+
selectorDefinitions: index_js_1.default,
|
|
19
24
|
};
|
|
20
|
-
|
|
25
|
+
exports.default = exchangeReduxDefinition;
|
|
@@ -1,9 +1,9 @@
|
|
|
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;
|
|
5
5
|
readonly dependencies: readonly [{
|
|
6
|
-
readonly selector:
|
|
6
|
+
readonly selector: "$state";
|
|
7
7
|
}];
|
|
8
8
|
};
|
|
9
9
|
export default bluetoothScanningSelectorDefinition;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const redux_dependency_injection_1 = require("@exodus/redux-dependency-injection");
|
|
2
4
|
const resultFunction = (state) => state.bluetoothScanning;
|
|
3
5
|
const bluetoothScanningSelectorDefinition = {
|
|
4
6
|
id: 'bluetoothScanning',
|
|
5
7
|
resultFunction,
|
|
6
|
-
dependencies: [{ selector: MY_STATE }],
|
|
8
|
+
dependencies: [{ selector: redux_dependency_injection_1.MY_STATE }],
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
exports.default = bluetoothScanningSelectorDefinition;
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
-
readonly selector:
|
|
6
|
+
readonly selector: "$state";
|
|
7
7
|
}];
|
|
8
8
|
};
|
|
9
9
|
export default bluetoothStatusSelectorDefinition;
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const redux_dependency_injection_1 = require("@exodus/redux-dependency-injection");
|
|
2
4
|
const resultFunction = (state) => state.bluetoothStatus;
|
|
3
5
|
const bluetoothStatusSelectorDefinition = {
|
|
4
6
|
id: 'bluetoothStatus',
|
|
5
7
|
resultFunction,
|
|
6
|
-
dependencies: [{ selector: MY_STATE }],
|
|
8
|
+
dependencies: [{ selector: redux_dependency_injection_1.MY_STATE }],
|
|
7
9
|
};
|
|
8
|
-
|
|
10
|
+
exports.default = bluetoothStatusSelectorDefinition;
|
|
@@ -1,14 +1,14 @@
|
|
|
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
|
-
readonly selector:
|
|
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
|
-
readonly selector:
|
|
11
|
+
readonly selector: "$state";
|
|
12
12
|
}];
|
|
13
13
|
})[];
|
|
14
14
|
export default ledgerSelectors;
|
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const bluetoothStatus_js_1 = __importDefault(require("./bluetoothStatus.js"));
|
|
7
|
+
const bluetoothScanning_js_1 = __importDefault(require("./bluetoothScanning.js"));
|
|
8
|
+
const ledgerSelectors = [bluetoothStatus_js_1.default, bluetoothScanning_js_1.default];
|
|
9
|
+
exports.default = ledgerSelectors;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/hw-ledger",
|
|
3
|
-
"version": "3.9.
|
|
3
|
+
"version": "3.9.2",
|
|
4
4
|
"description": "The ledger module",
|
|
5
5
|
"author": "Exodus Movement, Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -13,8 +13,14 @@
|
|
|
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
|
+
"exports": {
|
|
17
|
+
".": "./lib/index.js",
|
|
18
|
+
"./redux": "./lib/redux/index.js",
|
|
19
|
+
"./lib/redux": "./lib/redux/index.js"
|
|
20
|
+
},
|
|
16
21
|
"files": [
|
|
17
22
|
"lib",
|
|
23
|
+
"redux.js",
|
|
18
24
|
"./README.md",
|
|
19
25
|
"./CHANGELOG.md"
|
|
20
26
|
],
|
|
@@ -30,7 +36,7 @@
|
|
|
30
36
|
"prepublishOnly": "yarn run -T build --scope @exodus/hw-ledger"
|
|
31
37
|
},
|
|
32
38
|
"dependencies": {
|
|
33
|
-
"@exodus/atoms": "^
|
|
39
|
+
"@exodus/atoms": "^10.3.3",
|
|
34
40
|
"@exodus/bip322-js": "^3.1.0",
|
|
35
41
|
"@exodus/bitcoinjs": "^2.0.0",
|
|
36
42
|
"@exodus/bytes": "^1.0.0-rc.6",
|
|
@@ -43,6 +49,7 @@
|
|
|
43
49
|
"@exodus/ledgerhq-hw-app-eth": "^6.33.7-exodus.8",
|
|
44
50
|
"@exodus/redux-dependency-injection": "^4.0.0",
|
|
45
51
|
"@exodus/ripple-binary-codec": "^0.2.6",
|
|
52
|
+
"@exodus/storage-interface": "^1.0.0",
|
|
46
53
|
"@ledgerhq/hw-app-solana": "^7.0.10",
|
|
47
54
|
"@ledgerhq/hw-app-trx": "^6.29.4",
|
|
48
55
|
"@ledgerhq/hw-app-xrp": "^6.32.7",
|
|
@@ -65,5 +72,5 @@
|
|
|
65
72
|
"access": "public",
|
|
66
73
|
"provenance": false
|
|
67
74
|
},
|
|
68
|
-
"gitHead": "
|
|
75
|
+
"gitHead": "fbb1b8f8bd720834f022e22af854ab606f9ecc6a"
|
|
69
76
|
}
|
package/redux.js
ADDED