@kukks/bitcoin-descriptors 3.2.2 → 3.2.3
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/index.d.ts +1 -0
- package/dist/index.js +3 -0
- package/dist/miniscript.d.ts +5 -0
- package/dist/miniscript.js +13 -9
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export type { PsbtLike } from './psbt.js';
|
|
|
12
12
|
export { networks } from './networks.js';
|
|
13
13
|
export type { Network } from './networks.js';
|
|
14
14
|
export { nobleECPair, scureBIP32 } from './adapters.js';
|
|
15
|
+
export { ensureMiniscriptLoaded } from './miniscript.js';
|
|
15
16
|
export declare const defaultFactory: {
|
|
16
17
|
Output: {
|
|
17
18
|
new ({ descriptor, index, checksumRequired, allowMiniscriptInP2SH, network, preimages, signersPubKeys }: {
|
package/dist/index.js
CHANGED
|
@@ -10,6 +10,9 @@ export { scriptExpressions };
|
|
|
10
10
|
export { networks } from './networks.js';
|
|
11
11
|
// Built-in adapters using @noble/curves and @scure/bip32
|
|
12
12
|
export { nobleECPair, scureBIP32 } from './adapters.js';
|
|
13
|
+
// Optional miniscript support — call before using miniscript descriptors
|
|
14
|
+
// if you need to guarantee the library is loaded synchronously.
|
|
15
|
+
export { ensureMiniscriptLoaded } from './miniscript.js';
|
|
13
16
|
// Pre-built factory using built-in adapters (zero-config convenience)
|
|
14
17
|
import { DescriptorsFactory } from './descriptors.js';
|
|
15
18
|
export const defaultFactory = DescriptorsFactory();
|
package/dist/miniscript.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { Network } from './networks.js';
|
|
|
2
2
|
import type { ECPairAPI } from './types.js';
|
|
3
3
|
import type { BIP32API } from './types.js';
|
|
4
4
|
import type { PartialSig } from './types.js';
|
|
5
|
+
/**
|
|
6
|
+
* Ensure the optional miniscript library has finished loading.
|
|
7
|
+
* Call before using any miniscript code path.
|
|
8
|
+
*/
|
|
9
|
+
export declare function ensureMiniscriptLoaded(): Promise<void>;
|
|
5
10
|
import type { Preimage, TimeConstraints, ExpansionMap } from './types.js';
|
|
6
11
|
/**
|
|
7
12
|
* Expand a miniscript to a generalized form using variables instead of key
|
package/dist/miniscript.js
CHANGED
|
@@ -6,23 +6,27 @@ import { hash160 } from '@scure/btc-signer/utils.js';
|
|
|
6
6
|
import { hex } from '@scure/base';
|
|
7
7
|
import { parseKeyExpression } from './keyExpressions.js';
|
|
8
8
|
import * as RE from './re.js';
|
|
9
|
-
import { createRequire } from 'module';
|
|
10
9
|
// Lazy-load @bitcoinerlab/miniscript (optional peer dependency).
|
|
10
|
+
// Uses dynamic import() so it works in both Node and browser bundlers (Vite/Rollup).
|
|
11
11
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
12
12
|
let _miniscriptLib;
|
|
13
|
+
// Kick off loading immediately but don't block — the result is awaited on first use.
|
|
14
|
+
const _miniscriptPromise = import('@bitcoinerlab/miniscript').then(m => (_miniscriptLib = m), () => { } // not installed — will error at use time
|
|
15
|
+
);
|
|
13
16
|
function getMiniscriptLib() {
|
|
14
17
|
if (!_miniscriptLib) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
_miniscriptLib = require('@bitcoinerlab/miniscript');
|
|
18
|
-
}
|
|
19
|
-
catch {
|
|
20
|
-
throw new Error('@bitcoinerlab/miniscript is required for miniscript descriptors. ' +
|
|
21
|
-
'Install it: npm install @bitcoinerlab/miniscript');
|
|
22
|
-
}
|
|
18
|
+
throw new Error('@bitcoinerlab/miniscript is required for miniscript descriptors. ' +
|
|
19
|
+
'Install it: npm install @bitcoinerlab/miniscript');
|
|
23
20
|
}
|
|
24
21
|
return _miniscriptLib;
|
|
25
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Ensure the optional miniscript library has finished loading.
|
|
25
|
+
* Call before using any miniscript code path.
|
|
26
|
+
*/
|
|
27
|
+
export async function ensureMiniscriptLoaded() {
|
|
28
|
+
await _miniscriptPromise;
|
|
29
|
+
}
|
|
26
30
|
/**
|
|
27
31
|
* Expand a miniscript to a generalized form using variables instead of key
|
|
28
32
|
* expressions. Variables will be of this form: @0, @1, ...
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@kukks/bitcoin-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/Kukks/descriptors",
|
|
5
|
-
"version": "3.2.
|
|
5
|
+
"version": "3.2.3",
|
|
6
6
|
"author": "Jose-Luis Landabaso",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"repository": {
|