@bitcoinerlab/descriptors 2.3.6 → 3.0.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/dist/types.d.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  import type { ECPairInterface } from 'ecpair';
2
2
  import type { BIP32Interface } from 'bip32';
3
3
  import type { Payment, Network } from 'bitcoinjs-lib';
4
+ import type { TapTreeNode, TapTreeInfoNode } from './tapTree';
4
5
  /**
5
6
  * Preimage
6
7
  * See {@link Output}
@@ -24,14 +25,14 @@ export type TimeConstraints = {
24
25
  nSequence: number | undefined;
25
26
  };
26
27
  /**
27
- * See {@link _Internal_.ParseKeyExpression | ParseKeyExpression}.
28
+ * See {@link _Internal_.KeyExpressionParser | KeyExpressionParser}.
28
29
  */
29
30
  export type KeyInfo = {
30
31
  keyExpression: string;
31
- pubkey?: Buffer;
32
+ pubkey?: Uint8Array;
32
33
  ecpair?: ECPairInterface;
33
34
  bip32?: BIP32Interface;
34
- masterFingerprint?: Buffer;
35
+ masterFingerprint?: Uint8Array;
35
36
  originPath?: string;
36
37
  keyPath?: string;
37
38
  path?: string;
@@ -127,14 +128,53 @@ export type Expansion = {
127
128
  * expression.
128
129
  */
129
130
  expandedMiniscript?: string;
131
+ /**
132
+ * The taproot tree expression, if any. Only defined for `tr(KEY, TREE)`.
133
+ * Example: `{pk(02aa...),{pk(03bb...),pk(02cc...)}}`.
134
+ */
135
+ tapTreeExpression?: string;
136
+ /**
137
+ * The parsed taproot tree, if any. Only defined for `tr(KEY, TREE)`.
138
+ * Example:
139
+ * ```
140
+ * {
141
+ * left: { miniscript: 'pk(02aa...)' },
142
+ * right: {
143
+ * left: { miniscript: 'pk(03bb...)' },
144
+ * right: { miniscript: 'pk(02cc...)' }
145
+ * }
146
+ * }
147
+ * ```
148
+ */
149
+ tapTree?: TapTreeNode;
150
+ /**
151
+ * The compiled taproot tree metadata, if any. Only defined for `tr(KEY, TREE)`.
152
+ * Same as tapTree, but each leaf includes the expanded miniscript, key
153
+ * expansion map, compiled tapscript (`tapScript`), and leaf version.
154
+ * Note: `@i` placeholders in `expandedMiniscript` are scoped per leaf, since
155
+ * each leaf is expanded and satisfied independently.
156
+ *
157
+ * Example:
158
+ * ```
159
+ * {
160
+ * left: {
161
+ * miniscript: 'pk(02aa...)',
162
+ * expandedMiniscript: 'pk(@0)',
163
+ * expansionMap: ExpansionMap;
164
+ * tapScript: Uint8Array;
165
+ * version: number;
166
+ * },
167
+ * right: ....
168
+ */
169
+ tapTreeInfo?: TapTreeInfoNode;
130
170
  /**
131
171
  * The redeem script for the descriptor, if applicable.
132
172
  */
133
- redeemScript?: Buffer;
173
+ redeemScript?: Uint8Array;
134
174
  /**
135
175
  * The witness script for the descriptor, if applicable.
136
176
  */
137
- witnessScript?: Buffer;
177
+ witnessScript?: Uint8Array;
138
178
  /**
139
179
  * Whether the descriptor is a ranged-descriptor.
140
180
  */
@@ -170,7 +210,7 @@ export type Expansion = {
170
210
  *
171
211
  * See {@link KeyInfo} for the complete list of elements retrieved by this function.
172
212
  */
173
- export interface ParseKeyExpression {
213
+ export interface KeyExpressionParser {
174
214
  (params: {
175
215
  keyExpression: string;
176
216
  /**
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@bitcoinerlab/descriptors",
3
3
  "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.",
4
4
  "homepage": "https://github.com/bitcoinerlab/descriptors",
5
- "version": "2.3.6",
5
+ "version": "3.0.0",
6
6
  "author": "Jose-Luis Landabaso",
7
7
  "license": "MIT",
8
8
  "repository": {
@@ -36,43 +36,43 @@
36
36
  "build": "npm run build:src && npm run build:test",
37
37
  "lint": "./node_modules/@bitcoinerlab/configs/scripts/lint.sh",
38
38
  "ensureTester": "./node_modules/@bitcoinerlab/configs/scripts/ensureTester.sh",
39
- "test:integration:soft": "npm run ensureTester && node test/integration/standardOutputs.js && echo \"\n\n\" && node test/integration/miniscript.js && echo \"\n\n\" && node test/integration/sortedmulti.js",
40
- "test:integration:ledger": "npm run ensureTester && node test/integration/ledger.js",
41
- "test:integration:deprecated": "npm run ensureTester && node test/integration/standardOutputs-deprecated.js && echo \"\n\n\" && node test/integration/miniscript-deprecated.js && echo \"\n\n\" && node test/integration/ledger-deprecated.js",
39
+ "test:integration:soft": "npm run ensureTester && node test/integration/standardOutputs.js && echo \"\n\n\" && node test/integration/miniscript.js && echo \"\n\n\" && node test/integration/sortedmulti.js && echo \"\n\n\" && node test/integration/taproot.js",
40
+ "test:integration:ledger": "npm run ensureTester && node test/integration/ledgerTaproot.js && echo \"\n\n\" && node test/integration/ledger.js",
42
41
  "test:unit": "jest",
43
42
  "test": "npm run lint && npm run build && npm run test:unit && npm run test:integration:soft",
44
43
  "testledger": "npm run lint && npm run build && npm run test:integration:ledger",
45
- "prepublishOnly": "npm run test && echo \"\n\n\" && npm run test:integration:deprecated && npm run test:integration:ledger"
44
+ "prepublishOnly": "npm run test && echo \"\n\n\" && npm run test:integration:ledger"
46
45
  },
47
46
  "files": [
48
47
  "dist"
49
48
  ],
50
49
  "peerDependencies": {
51
- "ledger-bitcoin": "^0.2.2"
50
+ "@ledgerhq/ledger-bitcoin": "^0.3.0"
52
51
  },
53
52
  "peerDependenciesMeta": {
54
- "ledger-bitcoin": {
53
+ "@ledgerhq/ledger-bitcoin": {
55
54
  "optional": true
56
55
  }
57
56
  },
58
57
  "devDependencies": {
59
58
  "@bitcoinerlab/configs": "^2.0.0",
60
- "@ledgerhq/hw-transport-node-hid": "^6.27.12",
59
+ "@bitcoinerlab/miniscript-policies": "^1.0.0",
60
+ "@ledgerhq/hw-transport-node-hid": "^6.30.0",
61
+ "@ledgerhq/ledger-bitcoin": "^0.3.0",
61
62
  "@types/lodash.memoize": "^4.1.9",
62
63
  "bip39": "^3.0.4",
63
64
  "bip65": "^1.0.3",
64
65
  "bip68": "^1.0.4",
65
- "ledger-bitcoin": "^0.2.2",
66
66
  "regtest-client": "^0.2.1",
67
67
  "yargs": "^17.7.2"
68
68
  },
69
69
  "dependencies": {
70
- "@bitcoinerlab/miniscript": "^1.4.3",
70
+ "@bitcoinerlab/miniscript": "^2.0.0",
71
71
  "@bitcoinerlab/secp256k1": "^1.2.0",
72
72
  "bip32": "^4.0.0",
73
- "bitcoinjs-lib": "^6.1.7",
74
- "ecpair": "^2.1.0",
73
+ "bitcoinjs-lib": "^7.0.1",
74
+ "ecpair": "^3.0.1",
75
75
  "lodash.memoize": "^4.1.2",
76
- "varuint-bitcoin": "^1.1.2"
76
+ "varuint-bitcoin": "^2.0.0"
77
77
  }
78
78
  }