@bitcoinerlab/descriptors 1.0.0 → 1.0.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/dist/ledger.d.ts CHANGED
@@ -7,7 +7,7 @@ import type { DescriptorInterface } from './types';
7
7
  * @param {unknown} ledgerClient - An optional parameter that, if provided, is checked to see if it's an instance of `AppClient`.
8
8
  * @throws {Error} Throws an error if `ledgerClient` is provided but is not an instance of `AppClient`.
9
9
  * @throws {Error} Throws an error if the 'ledger-bitcoin' module cannot be imported. This typically indicates that the 'ledger-bitcoin' peer dependency is not installed.
10
- * @returns {Promise<any>} Returns a promise that resolves with the entire 'ledger-bitcoin' module if it can be successfully imported.
10
+ * @returns {Promise<unknown>} Returns a promise that resolves with the entire 'ledger-bitcoin' module if it can be successfully imported. We force it to return an unknown type so that the declaration of this function won't break projects that don't use ledger-bitcoin as dependency
11
11
  *
12
12
  * @example
13
13
  *
@@ -18,7 +18,7 @@ import type { DescriptorInterface } from './types';
18
18
  * })
19
19
  * .catch((error) => console.error(error));
20
20
  */
21
- export declare function importAndValidateLedgerBitcoin(ledgerClient?: unknown): Promise<typeof import("ledger-bitcoin")>;
21
+ export declare function importAndValidateLedgerBitcoin(ledgerClient?: unknown): Promise<unknown>;
22
22
  export declare function assertLedgerApp({ transport, name, minVersion }: {
23
23
  transport: any;
24
24
  name: string;
package/dist/ledger.js CHANGED
@@ -35,7 +35,7 @@ const re_1 = require("./re");
35
35
  * @param {unknown} ledgerClient - An optional parameter that, if provided, is checked to see if it's an instance of `AppClient`.
36
36
  * @throws {Error} Throws an error if `ledgerClient` is provided but is not an instance of `AppClient`.
37
37
  * @throws {Error} Throws an error if the 'ledger-bitcoin' module cannot be imported. This typically indicates that the 'ledger-bitcoin' peer dependency is not installed.
38
- * @returns {Promise<any>} Returns a promise that resolves with the entire 'ledger-bitcoin' module if it can be successfully imported.
38
+ * @returns {Promise<unknown>} Returns a promise that resolves with the entire 'ledger-bitcoin' module if it can be successfully imported. We force it to return an unknown type so that the declaration of this function won't break projects that don't use ledger-bitcoin as dependency
39
39
  *
40
40
  * @example
41
41
  *
@@ -115,7 +115,7 @@ function isLedgerStandard({ ledgerTemplate, keyRoots, network = bitcoinjs_lib_1.
115
115
  return false;
116
116
  }
117
117
  async function getLedgerMasterFingerPrint({ ledgerClient, ledgerState }) {
118
- const { AppClient } = await importAndValidateLedgerBitcoin(ledgerClient);
118
+ const { AppClient } = (await importAndValidateLedgerBitcoin(ledgerClient));
119
119
  if (!(ledgerClient instanceof AppClient))
120
120
  throw new Error(`Error: pass a valid ledgerClient`);
121
121
  let masterFingerprint = ledgerState.masterFingerprint;
@@ -127,7 +127,7 @@ async function getLedgerMasterFingerPrint({ ledgerClient, ledgerState }) {
127
127
  }
128
128
  exports.getLedgerMasterFingerPrint = getLedgerMasterFingerPrint;
129
129
  async function getLedgerXpub({ originPath, ledgerClient, ledgerState }) {
130
- const { AppClient } = await importAndValidateLedgerBitcoin(ledgerClient);
130
+ const { AppClient } = (await importAndValidateLedgerBitcoin(ledgerClient));
131
131
  if (!(ledgerClient instanceof AppClient))
132
132
  throw new Error(`Error: pass a valid ledgerClient`);
133
133
  if (!ledgerState.xpubs)
@@ -242,7 +242,7 @@ exports.descriptorToLedgerFormat = descriptorToLedgerFormat;
242
242
  *
243
243
  **/
244
244
  async function registerLedgerWallet({ descriptor, ledgerClient, ledgerState, policyName }) {
245
- const { WalletPolicy, AppClient } = await importAndValidateLedgerBitcoin(ledgerClient);
245
+ const { WalletPolicy, AppClient } = (await importAndValidateLedgerBitcoin(ledgerClient));
246
246
  if (!(ledgerClient instanceof AppClient))
247
247
  throw new Error(`Error: pass a valid ledgerClient`);
248
248
  const result = await descriptorToLedgerFormat({
package/dist/signers.js CHANGED
@@ -27,7 +27,7 @@ const ledgerSignaturesForInputIndex = (index, ledgerSignatures) => ledgerSignatu
27
27
  signature: partialSignature.signature
28
28
  }));
29
29
  async function signInputLedger({ psbt, index, descriptor, ledgerClient, ledgerState }) {
30
- const { PsbtV2, DefaultWalletPolicy, WalletPolicy, AppClient } = await (0, ledger_1.importAndValidateLedgerBitcoin)(ledgerClient);
30
+ const { PsbtV2, DefaultWalletPolicy, WalletPolicy, AppClient } = (await (0, ledger_1.importAndValidateLedgerBitcoin)(ledgerClient));
31
31
  if (!(ledgerClient instanceof AppClient))
32
32
  throw new Error(`Error: pass a valid ledgerClient`);
33
33
  const result = await (0, ledger_1.descriptorToLedgerFormat)({
@@ -68,7 +68,7 @@ exports.signInputLedger = signInputLedger;
68
68
  //it clusters together wallet policy types before signing
69
69
  //it throws if it cannot sign any input.
70
70
  async function signLedger({ psbt, descriptors, ledgerClient, ledgerState }) {
71
- const { PsbtV2, DefaultWalletPolicy, WalletPolicy, AppClient } = await (0, ledger_1.importAndValidateLedgerBitcoin)(ledgerClient);
71
+ const { PsbtV2, DefaultWalletPolicy, WalletPolicy, AppClient } = (await (0, ledger_1.importAndValidateLedgerBitcoin)(ledgerClient));
72
72
  if (!(ledgerClient instanceof AppClient))
73
73
  throw new Error(`Error: pass a valid ledgerClient`);
74
74
  const ledgerPolicies = [];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitcoinerlab/descriptors",
3
3
  "homepage": "https://github.com/bitcoinerlab/descriptors",
4
- "version": "1.0.0",
4
+ "version": "1.0.2",
5
5
  "description": "This library parses and creates Bitcoin Miniscript Descriptors and generates Partially Signed Bitcoin Transactions (PSBTs). It provides PSBT finalizers and signers for single-signature, BIP32 and Hardware Wallets.",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -52,13 +52,6 @@
52
52
  "files": [
53
53
  "dist"
54
54
  ],
55
- "dependencies": {
56
- "@bitcoinerlab/miniscript": "^1.2.1",
57
- "@bitcoinerlab/secp256k1": "^1.0.2",
58
- "bip32": "^3.1.0",
59
- "bitcoinjs-lib": "^6.1.0",
60
- "ecpair": "^2.1.0"
61
- },
62
55
  "peerDependencies": {
63
56
  "ledger-bitcoin": "^0.2.2"
64
57
  },
@@ -89,5 +82,12 @@
89
82
  "regtest-client": "^0.2.0",
90
83
  "ts-node-dev": "^2.0.0",
91
84
  "typescript": "5.0"
85
+ },
86
+ "dependencies": {
87
+ "@bitcoinerlab/miniscript": "^1.2.1",
88
+ "@bitcoinerlab/secp256k1": "^1.0.5",
89
+ "bip32": "^4.0.0",
90
+ "bitcoinjs-lib": "^6.1.3",
91
+ "ecpair": "^2.1.0"
92
92
  }
93
93
  }