@exodus/hw-ledger 3.9.2 → 4.0.1

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 (48) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +1 -1
  3. package/lib/atoms/index.d.ts +3 -3
  4. package/lib/atoms/index.js +7 -10
  5. package/lib/index.d.ts +5 -5
  6. package/lib/index.js +9 -14
  7. package/lib/module/assets/applications.js +1 -3
  8. package/lib/module/assets/basemainnet.d.ts +1 -1
  9. package/lib/module/assets/basemainnet.js +5 -10
  10. package/lib/module/assets/bitcoin.d.ts +1 -1
  11. package/lib/module/assets/bitcoin.js +31 -36
  12. package/lib/module/assets/ethereum.d.ts +1 -1
  13. package/lib/module/assets/ethereum.js +31 -64
  14. package/lib/module/assets/index.d.ts +1 -1
  15. package/lib/module/assets/index.js +22 -28
  16. package/lib/module/assets/matic.d.ts +1 -1
  17. package/lib/module/assets/matic.js +5 -10
  18. package/lib/module/assets/ripple.d.ts +1 -1
  19. package/lib/module/assets/ripple.js +13 -17
  20. package/lib/module/assets/solana.d.ts +1 -1
  21. package/lib/module/assets/solana.js +16 -19
  22. package/lib/module/assets/tronmainnet.d.ts +1 -1
  23. package/lib/module/assets/tronmainnet.js +14 -50
  24. package/lib/module/assets/utils/bip322.js +7 -43
  25. package/lib/module/assets/utils/derivation-paths.js +17 -28
  26. package/lib/module/assets/utils/index.js +3 -19
  27. package/lib/module/assets/utils/psbt.d.ts +3 -3
  28. package/lib/module/assets/utils/psbt.js +34 -46
  29. package/lib/module/assets/utils/xpub.js +3 -6
  30. package/lib/module/constants.js +1 -4
  31. package/lib/module/device.d.ts +1 -1
  32. package/lib/module/device.js +21 -28
  33. package/lib/module/discovery.js +14 -18
  34. package/lib/module/errors.js +5 -12
  35. package/lib/module/index.js +2 -23
  36. package/lib/module/management/application.d.ts +2 -2
  37. package/lib/module/management/application.js +1 -4
  38. package/lib/module/types.d.ts +3 -2
  39. package/lib/module/types.js +1 -2
  40. package/lib/plugin/index.js +4 -6
  41. package/lib/redux/id.js +1 -3
  42. package/lib/redux/index.js +7 -12
  43. package/lib/redux/initial-state.js +1 -3
  44. package/lib/redux/selectors/bluetoothScanning.js +3 -5
  45. package/lib/redux/selectors/bluetoothStatus.js +3 -5
  46. package/lib/redux/selectors/index.js +4 -9
  47. package/package.json +23 -15
  48. package/redux.js +0 -1
@@ -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", { with: { "resolution-mode": "import" } }).HardwareWalletAssetHandler>;
7
+ handler: (transport: import("../types.js").Transport) => Promise<import("@exodus/hw-common").HardwareWalletAssetHandler>;
8
8
  };
9
9
  export default metadata;
@@ -1,12 +1,7 @@
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 applications_js_1 = __importDefault(require("./applications.js"));
7
- const ethereum_js_1 = __importDefault(require("./ethereum.js"));
1
+ import applications from './applications.js';
2
+ import ethereum from './ethereum.js';
8
3
  const metadata = {
9
- applications: [applications_js_1.default.Polygon, applications_js_1.default.Ethereum],
10
- handler: ethereum_js_1.default.handler,
4
+ applications: [applications.Polygon, applications.Ethereum],
5
+ handler: ethereum.handler,
11
6
  };
12
- exports.default = metadata;
7
+ export default metadata;
@@ -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,28 +1,24 @@
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 hw_app_xrp_1 = __importDefault(require("@ledgerhq/hw-app-xrp"));
7
- const minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
8
- const hw_common_1 = require("@exodus/hw-common");
9
- const ripple_binary_codec_1 = __importDefault(require("@exodus/ripple-binary-codec"));
10
- const applications_js_1 = __importDefault(require("./applications.js"));
1
+ import AppXrpImport from '@ledgerhq/hw-app-xrp';
2
+ import assert from 'minimalistic-assert';
3
+ import { XPubUnsupportedError, SignMessageUnsupportedError } from '@exodus/hw-common';
4
+ import binaryCodec from '@exodus/ripple-binary-codec';
5
+ import applications from './applications.js';
6
+ const AppXrp = (AppXrpImport.default ?? AppXrpImport);
11
7
  async function createHandler(transport) {
12
- const app = new hw_app_xrp_1.default(transport);
8
+ const app = new AppXrp(transport);
13
9
  const getAddress = async (params) => {
14
10
  const { address } = await app.getAddress(params.derivationPath.replace('m/', ''));
15
11
  return address;
16
12
  };
17
13
  const getXPub = async () => {
18
- throw new hw_common_1.XPubUnsupportedError();
14
+ throw new XPubUnsupportedError();
19
15
  };
20
16
  const getPublicKey = async (params) => {
21
17
  const { publicKey } = await app.getAddress(params.derivationPath.replace('m/', ''));
22
18
  return Buffer.from(publicKey, 'hex');
23
19
  };
24
20
  const signTransaction = async (params) => {
25
- (0, minimalistic_assert_1.default)(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
21
+ assert(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
26
22
  const { txData } = params.signableTransaction;
27
23
  const derivationPath = params.derivationPaths[0].replace('m/', '');
28
24
  const { address, publicKey } = await app.getAddress(derivationPath);
@@ -31,7 +27,7 @@ async function createHandler(transport) {
31
27
  Account: address,
32
28
  SigningPubKey: publicKey.toUpperCase(),
33
29
  };
34
- const encoded = ripple_binary_codec_1.default.encode(txForSigning);
30
+ const encoded = binaryCodec.encode(txForSigning);
35
31
  const signature = await app.signTransaction(derivationPath, encoded);
36
32
  return [
37
33
  {
@@ -41,7 +37,7 @@ async function createHandler(transport) {
41
37
  ];
42
38
  };
43
39
  const signMessage = async () => {
44
- throw new hw_common_1.SignMessageUnsupportedError();
40
+ throw new SignMessageUnsupportedError();
45
41
  };
46
42
  return {
47
43
  getAddress,
@@ -52,7 +48,7 @@ async function createHandler(transport) {
52
48
  };
53
49
  }
54
50
  const metadata = {
55
- applications: [applications_js_1.default.XRP],
51
+ applications: [applications.XRP],
56
52
  handler: createHandler,
57
53
  };
58
- exports.default = metadata;
54
+ export default metadata;
@@ -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,29 +1,26 @@
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 hw_app_solana_1 = __importDefault(require("@ledgerhq/hw-app-solana"));
7
- const minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
8
- const base58_js_1 = require("@exodus/bytes/base58.js");
9
- const hw_common_1 = require("@exodus/hw-common");
10
- const errors_js_1 = require("../errors.js");
11
- const applications_js_1 = __importDefault(require("./applications.js"));
1
+ import AppSolanaImport from '@ledgerhq/hw-app-solana';
2
+ import assert from 'minimalistic-assert';
3
+ import { toBase58 } from '@exodus/bytes/base58.js';
4
+ import { XPubUnsupportedError } from '@exodus/hw-common';
5
+ import { RequiresBlindSigningError } from '../errors.js';
6
+ import applications from './applications.js';
7
+ const AppSolana = (AppSolanaImport.default ??
8
+ AppSolanaImport);
12
9
  async function createHandler(transport) {
13
- const app = new hw_app_solana_1.default(transport);
10
+ const app = new AppSolana(transport);
14
11
  const getAddress = async (params) => {
15
12
  const { address } = await app.getAddress(params.derivationPath.replace('m/', ''));
16
- return (0, base58_js_1.toBase58)(address);
13
+ return toBase58(address);
17
14
  };
18
15
  const getXPub = async (params) => {
19
- throw new hw_common_1.XPubUnsupportedError();
16
+ throw new XPubUnsupportedError();
20
17
  };
21
18
  const getPublicKey = async (params) => {
22
19
  const { address } = await app.getAddress(params.derivationPath.replace('m/', ''));
23
20
  return address;
24
21
  };
25
22
  const signTransaction = async (params) => {
26
- (0, minimalistic_assert_1.default)(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
23
+ assert(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
27
24
  let serializedTransaction;
28
25
  if (Buffer.isBuffer(params.signableTransaction)) {
29
26
  serializedTransaction = params.signableTransaction;
@@ -41,7 +38,7 @@ async function createHandler(transport) {
41
38
  .signTransaction(params.derivationPaths[0].replace('m/', ''), serializedTransaction)
42
39
  .catch((err) => {
43
40
  if (err.message.includes('Try enabling blind signature in the app')) {
44
- throw new errors_js_1.RequiresBlindSigningError();
41
+ throw new RequiresBlindSigningError();
45
42
  }
46
43
  else {
47
44
  throw err;
@@ -56,7 +53,7 @@ async function createHandler(transport) {
56
53
  ];
57
54
  };
58
55
  const signMessage = async (params) => {
59
- (0, minimalistic_assert_1.default)(Buffer.isBuffer(params.message.rawMessage), 'rawMessage must be a buffer');
56
+ assert(Buffer.isBuffer(params.message.rawMessage), 'rawMessage must be a buffer');
60
57
  const { signature } = await app.signOffchainMessage(params.derivationPath.replace('m/', ''), params.message.rawMessage);
61
58
  return signature;
62
59
  };
@@ -69,7 +66,7 @@ async function createHandler(transport) {
69
66
  };
70
67
  }
71
68
  const metadata = {
72
- applications: [applications_js_1.default.Solana],
69
+ applications: [applications.Solana],
73
70
  handler: createHandler,
74
71
  };
75
- exports.default = metadata;
72
+ export default metadata;
@@ -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,54 +1,18 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __importDefault = (this && this.__importDefault) || function (mod) {
36
- return (mod && mod.__esModule) ? mod : { "default": mod };
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- const hw_app_trx_1 = __importDefault(require("@ledgerhq/hw-app-trx"));
40
- const minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
41
- const hw_common_1 = require("@exodus/hw-common");
42
- const secp256k1 = __importStar(require("@exodus/crypto/secp256k1"));
43
- const applications_js_1 = __importDefault(require("./applications.js"));
1
+ import AppTronImport from '@ledgerhq/hw-app-trx';
2
+ import assert from 'minimalistic-assert';
3
+ import { XPubUnsupportedError } from '@exodus/hw-common';
4
+ import * as secp256k1 from '@exodus/crypto/secp256k1';
5
+ import applications from './applications.js';
6
+ const AppTron = (AppTronImport.default ??
7
+ AppTronImport);
44
8
  async function createHandler(transport) {
45
- const app = new hw_app_trx_1.default(transport);
9
+ const app = new AppTron(transport);
46
10
  const getAddress = async (params) => {
47
11
  const { address } = await app.getAddress(params.derivationPath.replace('m/', ''));
48
12
  return address;
49
13
  };
50
14
  const getXPub = async (params) => {
51
- throw new hw_common_1.XPubUnsupportedError();
15
+ throw new XPubUnsupportedError();
52
16
  };
53
17
  const getPublicKey = async (params) => {
54
18
  const { publicKey } = await app.getAddress(params.derivationPath.replace('m/', ''));
@@ -59,7 +23,7 @@ async function createHandler(transport) {
59
23
  });
60
24
  };
61
25
  const signTransaction = async (params) => {
62
- (0, minimalistic_assert_1.default)(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
26
+ assert(Array.isArray(params.derivationPaths) && params.derivationPaths.length === 1, 'derivationsPath array must be one element long');
63
27
  if (!Buffer.isBuffer(params.signableTransaction)) {
64
28
  throw new TypeError(`signableTransaction must be Buffer or serializable to a Buffer.`);
65
29
  }
@@ -72,7 +36,7 @@ async function createHandler(transport) {
72
36
  };
73
37
  const signMessage = async (params) => {
74
38
  if (params.message.rawMessage) {
75
- (0, minimalistic_assert_1.default)(Buffer.isBuffer(params.message.rawMessage), 'rawMessage must be a buffer');
39
+ assert(Buffer.isBuffer(params.message.rawMessage), 'rawMessage must be a buffer');
76
40
  const signature = await app.signPersonalMessage(params.derivationPath.replace('m/', ''), params.message.rawMessage.toString('hex'));
77
41
  return Buffer.from(signature, 'hex');
78
42
  }
@@ -80,7 +44,7 @@ async function createHandler(transport) {
80
44
  throw new Error('TIP712 messages are not yet supported');
81
45
  }
82
46
  else {
83
- (0, minimalistic_assert_1.default)(false, 'rawMessage or TIP712Message must be specified');
47
+ assert(false, 'rawMessage or TIP712Message must be specified');
84
48
  }
85
49
  };
86
50
  return {
@@ -92,7 +56,7 @@ async function createHandler(transport) {
92
56
  };
93
57
  }
94
58
  const metadata = {
95
- applications: [applications_js_1.default.Tron],
59
+ applications: [applications.Tron],
96
60
  handler: createHandler,
97
61
  };
98
- exports.default = metadata;
62
+ export default metadata;
@@ -1,49 +1,13 @@
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.buildBip322PSBT = buildBip322PSBT;
37
- const bitcoin = __importStar(require("@exodus/bitcoinjs"));
38
- const bip322_js_1 = require("@exodus/bip322-js");
39
- function buildBip322PSBT(message, address) {
40
- const scriptPubKey = bip322_js_1.Address.convertAdressToScriptPubkey(address);
41
- const toSpendTx = bip322_js_1.BIP322.buildToSpendTx(message, scriptPubKey);
1
+ import * as bitcoin from '@exodus/bitcoinjs';
2
+ import { BIP322, Address } from '@exodus/bip322-js';
3
+ export function buildBip322PSBT(message, address) {
4
+ const scriptPubKey = Address.convertAdressToScriptPubkey(address);
5
+ const toSpendTx = BIP322.buildToSpendTx(message, scriptPubKey);
42
6
  const toSpendTxId = toSpendTx.getId();
43
- if (bip322_js_1.Address.isP2SH(address)) {
7
+ if (Address.isP2SH(address)) {
44
8
  throw new Error('Unable to sign BIP-322 message for unimplemented address type.');
45
9
  }
46
- else if (bip322_js_1.Address.isP2WPKH(address) || bip322_js_1.Address.isP2TR(address)) {
10
+ else if (Address.isP2WPKH(address) || Address.isP2TR(address)) {
47
11
  return buildToSignNativeSegwitOrTaproot(toSpendTxId, scriptPubKey);
48
12
  }
49
13
  throw new Error('Unable to sign BIP-322 message for unsupported address type.');
@@ -1,45 +1,34 @@
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.splitDerivationPath = splitDerivationPath;
7
- exports.assertBip44Path = assertBip44Path;
8
- exports.splitBip44DerivationPath = splitBip44DerivationPath;
9
- exports.assertBip44PathNumber = assertBip44PathNumber;
10
- exports.buildBip44PathFromNumber = buildBip44PathFromNumber;
11
- exports.splitBip44PathToNumber = splitBip44PathToNumber;
12
- const minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
13
- function splitDerivationPath(derivationPath) {
14
- (0, minimalistic_assert_1.default)(typeof derivationPath === 'string', 'derivationPath must be string');
1
+ import assert from 'minimalistic-assert';
2
+ export function splitDerivationPath(derivationPath) {
3
+ assert(typeof derivationPath === 'string', 'derivationPath must be string');
15
4
  const parts = derivationPath.split('/');
16
- (0, minimalistic_assert_1.default)(parts.length > 1, 'invalid derivationPath: must have length > 1');
17
- (0, minimalistic_assert_1.default)(parts[0] === 'm', 'invalid derivationPath: must start with m');
5
+ assert(parts.length > 1, 'invalid derivationPath: must have length > 1');
6
+ assert(parts[0] === 'm', 'invalid derivationPath: must start with m');
18
7
  return parts.slice(1);
19
8
  }
20
- function assertBip44Path(parts) {
21
- (0, minimalistic_assert_1.default)(parts.length === 5, 'invalid bip44 derivation path: length must be 5');
22
- (0, minimalistic_assert_1.default)(parts.every((part) => typeof part === 'string'), 'Invalid parts');
9
+ export function assertBip44Path(parts) {
10
+ assert(parts.length === 5, 'invalid bip44 derivation path: length must be 5');
11
+ assert(parts.every((part) => typeof part === 'string'), 'Invalid parts');
23
12
  }
24
- function splitBip44DerivationPath(derivationPath) {
13
+ export function splitBip44DerivationPath(derivationPath) {
25
14
  const parts = splitDerivationPath(derivationPath);
26
15
  assertBip44Path(parts);
27
16
  const [purpose, coin, account, change, address] = parts;
28
- (0, minimalistic_assert_1.default)(purpose.endsWith("'"), 'invalid derivationPath: purpose must be hardened');
29
- (0, minimalistic_assert_1.default)(coin.endsWith("'"), 'invalid derivationPath: coin must be hardened');
30
- (0, minimalistic_assert_1.default)(account.endsWith("'"), 'invalid derivationPath: account must be hardened');
17
+ assert(purpose.endsWith("'"), 'invalid derivationPath: purpose must be hardened');
18
+ assert(coin.endsWith("'"), 'invalid derivationPath: coin must be hardened');
19
+ assert(account.endsWith("'"), 'invalid derivationPath: account must be hardened');
31
20
  return [purpose, coin, account, change, address];
32
21
  }
33
- function assertBip44PathNumber(parts) {
34
- (0, minimalistic_assert_1.default)(parts.length === 5, 'invalid bip44 derivation path: length must be 5');
35
- (0, minimalistic_assert_1.default)(parts.every((part) => typeof part === 'number'), 'Invalid parts');
22
+ export function assertBip44PathNumber(parts) {
23
+ assert(parts.length === 5, 'invalid bip44 derivation path: length must be 5');
24
+ assert(parts.every((part) => typeof part === 'number'), 'Invalid parts');
36
25
  }
37
- function buildBip44PathFromNumber(parts) {
26
+ export function buildBip44PathFromNumber(parts) {
38
27
  const [purpose, coin, account, chainIndex, addressIndex] = parts;
39
28
  const HARDENED_OFFSET = 0x80_00_00_00;
40
29
  return `m/${purpose - HARDENED_OFFSET}'/${coin - HARDENED_OFFSET}'/${account - HARDENED_OFFSET}'/${chainIndex}/${addressIndex}`;
41
30
  }
42
- function splitBip44PathToNumber(derivationPath) {
31
+ export function splitBip44PathToNumber(derivationPath) {
43
32
  const [purpose, coin, account, change, address] = splitBip44DerivationPath(derivationPath);
44
33
  const HARDENED_OFFSET = 0x80_00_00_00;
45
34
  return [
@@ -1,19 +1,3 @@
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
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./derivation-paths.js"), exports);
18
- __exportStar(require("./xpub.js"), exports);
19
- __exportStar(require("./psbt.js"), exports);
1
+ export * from './derivation-paths.js';
2
+ export * from './xpub.js';
3
+ export * from './psbt.js';
@@ -1,9 +1,9 @@
1
- import type { PsbtV2 } from '@exodus/ledger-bitcoin';
1
+ import type { AppClient, PsbtV2 } from '@exodus/ledger-bitcoin';
2
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) => any;
6
+ export declare const getWalletPolicy: (fpr: string, xpub: string, purpose: string, coin: string, account: string) => WalletPolicy;
7
7
  export declare const getMultisigWalletPolicy: (fpr: string, xpub: string, purpose: string, coin: string, account: string, multisigData: MultisigData) => WalletPolicy;
8
- export declare function derivationPathsToWalletPolicy(fpr: string, app: any, derivationPaths: string[], multisigData?: MultisigData): Promise<WalletPolicy[]>;
8
+ export declare function derivationPathsToWalletPolicy(fpr: string, app: AppClient, derivationPaths: string[], multisigData?: MultisigData): Promise<WalletPolicy[]>;
9
9
  export declare function addDummyInputs(psbt: PsbtV2): void;