utxo-lib 1.0.9 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- package/README.md +19 -16
- package/dist/src/address.d.ts.map +1 -1
- package/dist/src/address.js +11 -1
- package/dist/src/addressFormat.d.ts +1 -1
- package/dist/src/addressFormat.d.ts.map +1 -1
- package/dist/src/addressFormat.js +1 -1
- package/dist/src/bitgo/Musig2.d.ts +115 -17
- package/dist/src/bitgo/Musig2.d.ts.map +1 -1
- package/dist/src/bitgo/Musig2.js +283 -100
- package/dist/src/bitgo/PsbtUtil.d.ts +59 -0
- package/dist/src/bitgo/PsbtUtil.d.ts.map +1 -0
- package/dist/src/bitgo/PsbtUtil.js +92 -0
- package/dist/src/bitgo/UtxoPsbt.d.ts +180 -47
- package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/UtxoPsbt.js +673 -113
- package/dist/src/bitgo/UtxoTransaction.js +2 -2
- package/dist/src/bitgo/bitcoincash/address.js +2 -2
- package/dist/src/bitgo/index.d.ts +11 -0
- package/dist/src/bitgo/index.d.ts.map +1 -1
- package/dist/src/bitgo/index.js +6 -2
- package/dist/src/bitgo/legacysafe/index.d.ts +15 -0
- package/dist/src/bitgo/legacysafe/index.d.ts.map +1 -0
- package/dist/src/bitgo/legacysafe/index.js +61 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinPsbt.js +17 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +16 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransaction.js +46 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +10 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +15 -0
- package/dist/src/bitgo/litecoin/index.d.ts +4 -0
- package/dist/src/bitgo/litecoin/index.d.ts.map +1 -0
- package/dist/src/bitgo/litecoin/index.js +16 -0
- package/dist/src/bitgo/outputScripts.d.ts +3 -1
- package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
- package/dist/src/bitgo/outputScripts.js +20 -12
- package/dist/src/bitgo/parseInput.d.ts +49 -20
- package/dist/src/bitgo/parseInput.d.ts.map +1 -1
- package/dist/src/bitgo/parseInput.js +110 -26
- package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
- package/dist/src/bitgo/psbt/fromHalfSigned.js +9 -6
- package/dist/src/bitgo/psbt/scriptTypes.js +3 -3
- package/dist/src/bitgo/signature.d.ts +3 -3
- package/dist/src/bitgo/signature.d.ts.map +1 -1
- package/dist/src/bitgo/signature.js +48 -16
- package/dist/src/bitgo/transaction.d.ts +18 -3
- package/dist/src/bitgo/transaction.d.ts.map +1 -1
- package/dist/src/bitgo/transaction.js +28 -15
- package/dist/src/bitgo/types.d.ts +2 -0
- package/dist/src/bitgo/types.d.ts.map +1 -1
- package/dist/src/bitgo/types.js +1 -1
- package/dist/src/bitgo/wallet/Psbt.d.ts +104 -12
- package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Psbt.js +288 -70
- package/dist/src/bitgo/wallet/Unspent.d.ts +28 -0
- package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/Unspent.js +173 -68
- package/dist/src/bitgo/wallet/WalletOutput.d.ts +17 -1
- package/dist/src/bitgo/wallet/WalletOutput.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/WalletOutput.js +64 -23
- package/dist/src/bitgo/wallet/chains.d.ts +2 -2
- package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
- package/dist/src/bitgo/wallet/chains.js +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts +0 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
- package/dist/src/bitgo/zcash/ZcashPsbt.js +8 -15
- package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
- package/dist/src/musig.d.ts +0 -1
- package/dist/src/musig.d.ts.map +1 -1
- package/dist/src/musig.js +15 -29
- package/dist/src/networks.d.ts +1 -2
- package/dist/src/networks.d.ts.map +1 -1
- package/dist/src/networks.js +22 -29
- package/dist/src/noble_ecc.d.ts +1 -1
- package/dist/src/noble_ecc.d.ts.map +1 -1
- package/dist/src/noble_ecc.js +9 -5
- package/dist/src/payments/p2tr.d.ts.map +1 -1
- package/dist/src/payments/p2tr.js +25 -15
- package/dist/src/payments/p2tr_ns.js +3 -2
- package/dist/src/taproot.d.ts +16 -0
- package/dist/src/taproot.d.ts.map +1 -1
- package/dist/src/taproot.js +46 -3
- package/dist/src/testutil/index.d.ts +2 -0
- package/dist/src/testutil/index.d.ts.map +1 -1
- package/dist/src/testutil/index.js +3 -1
- package/dist/src/testutil/keys.d.ts +3 -0
- package/dist/src/testutil/keys.d.ts.map +1 -1
- package/dist/src/testutil/keys.js +17 -2
- package/dist/src/testutil/mock.d.ts +1 -1
- package/dist/src/testutil/mock.d.ts.map +1 -1
- package/dist/src/testutil/mock.js +12 -4
- package/dist/src/testutil/psbt.d.ts +89 -0
- package/dist/src/testutil/psbt.d.ts.map +1 -0
- package/dist/src/testutil/psbt.js +150 -0
- package/dist/src/testutil/transaction.d.ts +70 -0
- package/dist/src/testutil/transaction.d.ts.map +1 -0
- package/dist/src/testutil/transaction.js +107 -0
- package/dist/src/transaction_builder.js +2 -2
- package/package.json +7 -6
@@ -0,0 +1,92 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.withUnsafeNonSegwit = exports.isPsbt = exports.isPsbtInputFinalized = exports.getPsbtInputSignatureCount = exports.getPsbtInputProprietaryKeyVals = exports.ProprietaryKeySubtype = exports.PSBT_PROPRIETARY_IDENTIFIER = void 0;
|
4
|
+
const proprietaryKeyVal_1 = require("bip174/src/lib/proprietaryKeyVal");
|
5
|
+
/**
|
6
|
+
* bitgo proprietary key identifier
|
7
|
+
*/
|
8
|
+
exports.PSBT_PROPRIETARY_IDENTIFIER = 'BITGO';
|
9
|
+
/**
|
10
|
+
* subtype for proprietary keys that bitgo uses
|
11
|
+
*/
|
12
|
+
var ProprietaryKeySubtype;
|
13
|
+
(function (ProprietaryKeySubtype) {
|
14
|
+
ProprietaryKeySubtype[ProprietaryKeySubtype["ZEC_CONSENSUS_BRANCH_ID"] = 0] = "ZEC_CONSENSUS_BRANCH_ID";
|
15
|
+
ProprietaryKeySubtype[ProprietaryKeySubtype["MUSIG2_PARTICIPANT_PUB_KEYS"] = 1] = "MUSIG2_PARTICIPANT_PUB_KEYS";
|
16
|
+
ProprietaryKeySubtype[ProprietaryKeySubtype["MUSIG2_PUB_NONCE"] = 2] = "MUSIG2_PUB_NONCE";
|
17
|
+
ProprietaryKeySubtype[ProprietaryKeySubtype["MUSIG2_PARTIAL_SIG"] = 3] = "MUSIG2_PARTIAL_SIG";
|
18
|
+
})(ProprietaryKeySubtype = exports.ProprietaryKeySubtype || (exports.ProprietaryKeySubtype = {}));
|
19
|
+
/**
|
20
|
+
* Search any data from psbt proprietary key value against keydata.
|
21
|
+
* Default identifierEncoding is utf-8 for identifier.
|
22
|
+
*/
|
23
|
+
function getPsbtInputProprietaryKeyVals(input, keySearch) {
|
24
|
+
var _a;
|
25
|
+
if (!((_a = input.unknownKeyVals) === null || _a === void 0 ? void 0 : _a.length)) {
|
26
|
+
return [];
|
27
|
+
}
|
28
|
+
if (keySearch && keySearch.subtype === undefined && Buffer.isBuffer(keySearch.keydata)) {
|
29
|
+
throw new Error('invalid proprietary key search filter combination. subtype is required');
|
30
|
+
}
|
31
|
+
const keyVals = input.unknownKeyVals.map(({ key, value }, i) => {
|
32
|
+
return { key: proprietaryKeyVal_1.decodeProprietaryKey(key), value };
|
33
|
+
});
|
34
|
+
return keyVals.filter((keyVal) => {
|
35
|
+
return (keySearch === undefined ||
|
36
|
+
(keySearch.identifier === keyVal.key.identifier &&
|
37
|
+
(keySearch.subtype === undefined ||
|
38
|
+
(keySearch.subtype === keyVal.key.subtype &&
|
39
|
+
(!Buffer.isBuffer(keySearch.keydata) || keySearch.keydata.equals(keyVal.key.keydata))))));
|
40
|
+
});
|
41
|
+
}
|
42
|
+
exports.getPsbtInputProprietaryKeyVals = getPsbtInputProprietaryKeyVals;
|
43
|
+
/**
|
44
|
+
* @return partialSig/tapScriptSig/MUSIG2_PARTIAL_SIG count iff input is not finalized
|
45
|
+
*/
|
46
|
+
function getPsbtInputSignatureCount(input) {
|
47
|
+
if (isPsbtInputFinalized(input)) {
|
48
|
+
throw new Error('Input is already finalized');
|
49
|
+
}
|
50
|
+
return Math.max(Array.isArray(input.partialSig) ? input.partialSig.length : 0, Array.isArray(input.tapScriptSig) ? input.tapScriptSig.length : 0, getPsbtInputProprietaryKeyVals(input, {
|
51
|
+
identifier: exports.PSBT_PROPRIETARY_IDENTIFIER,
|
52
|
+
subtype: ProprietaryKeySubtype.MUSIG2_PARTIAL_SIG,
|
53
|
+
}).length);
|
54
|
+
}
|
55
|
+
exports.getPsbtInputSignatureCount = getPsbtInputSignatureCount;
|
56
|
+
/**
|
57
|
+
* @return true iff PSBT input is finalized
|
58
|
+
*/
|
59
|
+
function isPsbtInputFinalized(input) {
|
60
|
+
return Buffer.isBuffer(input.finalScriptSig) || Buffer.isBuffer(input.finalScriptWitness);
|
61
|
+
}
|
62
|
+
exports.isPsbtInputFinalized = isPsbtInputFinalized;
|
63
|
+
/**
|
64
|
+
* @return true iff data starts with magic PSBT byte sequence
|
65
|
+
* @param data byte array or hex string
|
66
|
+
* */
|
67
|
+
function isPsbt(data) {
|
68
|
+
// https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#specification
|
69
|
+
// 0x70736274 - ASCII for 'psbt'. 0xff - separator
|
70
|
+
if (typeof data === 'string') {
|
71
|
+
if (data.length < 10) {
|
72
|
+
return false;
|
73
|
+
}
|
74
|
+
data = Buffer.from(data.slice(0, 10), 'hex');
|
75
|
+
}
|
76
|
+
return 5 <= data.length && data.readUInt32BE(0) === 0x70736274 && data.readUInt8(4) === 0xff;
|
77
|
+
}
|
78
|
+
exports.isPsbt = isPsbt;
|
79
|
+
/**
|
80
|
+
* This function allows signing or validating a psbt with non-segwit inputs those do not contain nonWitnessUtxo.
|
81
|
+
*/
|
82
|
+
function withUnsafeNonSegwit(psbt, fn, unsafe = true) {
|
83
|
+
psbt.__CACHE.__UNSAFE_SIGN_NONSEGWIT = unsafe;
|
84
|
+
try {
|
85
|
+
return fn();
|
86
|
+
}
|
87
|
+
finally {
|
88
|
+
psbt.__CACHE.__UNSAFE_SIGN_NONSEGWIT = false;
|
89
|
+
}
|
90
|
+
}
|
91
|
+
exports.withUnsafeNonSegwit = withUnsafeNonSegwit;
|
92
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUHNidFV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYml0Z28vUHNidFV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsd0VBQXdGO0FBSXhGOztHQUVHO0FBQ1UsUUFBQSwyQkFBMkIsR0FBRyxPQUFPLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxJQUFZLHFCQUtYO0FBTEQsV0FBWSxxQkFBcUI7SUFDL0IsdUdBQThCLENBQUE7SUFDOUIsK0dBQWtDLENBQUE7SUFDbEMseUZBQXVCLENBQUE7SUFDdkIsNkZBQXlCLENBQUE7QUFDM0IsQ0FBQyxFQUxXLHFCQUFxQixHQUFyQiw2QkFBcUIsS0FBckIsNkJBQXFCLFFBS2hDO0FBdUJEOzs7R0FHRztBQUNILFNBQWdCLDhCQUE4QixDQUM1QyxLQUFnQixFQUNoQixTQUFnQzs7SUFFaEMsSUFBSSxDQUFDLENB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xuICB9XG4gIHJldHVybiA1IDw9IGRhdGEubGVuZ3RoICYmIGRhdGEucmVhZFVJbnQzMkJFKDApID09PSAweDcwNzM2Mjc0ICYmIGRhdGEucmVhZFVJbnQ4KDQpID09PSAweGZmO1xufVxuXG4vKipcbiAqIFRoaXMgZnVuY3Rpb24gYWxsb3dzIHNpZ25pbmcgb3IgdmFsaWRhdGluZyBhIHBzYnQgd2l0aCBub24tc2Vnd2l0IGlucHV0cyB0aG9zZSBkbyBub3QgY29udGFpbiBub25XaXRuZXNzVXR4by5cbiAqL1xuZXhwb3J0IGZ1bmN0aW9uIHdpdGhVbnNhZmVOb25TZWd3aXQ8VD4ocHNidDogUHNidCwgZm46ICgpID0+IFQsIHVuc2FmZSA9IHRydWUpOiBUIHtcbiAgKHBzYnQgYXMgYW55KS5fX0NBQ0hFLl9fVU5TQUZFX1NJR05fTk9OU0VHV0lUID0gdW5zYWZlO1xuICB0cnkge1xuICAgIHJldHVybiBmbigpO1xuICB9IGZpbmFsbHkge1xuICAgIChwc2J0IGFzIGFueSkuX19DQUNIRS5fX1VOU0FGRV9TSUdOX05PTlNFR1dJVCA9IGZhbHNlO1xuICB9XG59XG4iXX0=
|
@@ -1,14 +1,20 @@
|
|
1
1
|
/// <reference types="node" />
|
2
2
|
import { Psbt as PsbtBase } from 'bip174';
|
3
|
+
import { Bip32Derivation, PsbtInput } from 'bip174/src/lib/interfaces';
|
4
|
+
import { BIP32Interface } from 'bip32';
|
3
5
|
import { HDSigner, Psbt, TxOutput, Network } from '..';
|
4
6
|
import { UtxoTransaction } from './UtxoTransaction';
|
5
|
-
import {
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
import { Triple } from './types';
|
8
|
+
import { ProprietaryKeySearch, ProprietaryKeyValue } from './PsbtUtil';
|
9
|
+
declare type SignatureParams = {
|
10
|
+
/** When true, and add the second (last) nonce and signature for a taproot key
|
11
|
+
* path spend deterministically. Throws an error if done for the first nonce/signature
|
12
|
+
* of a taproot keypath spend. Ignore for all other input types.
|
13
|
+
*/
|
14
|
+
deterministic: boolean;
|
15
|
+
/** Allowed sighash types */
|
16
|
+
sighashTypes: number[];
|
17
|
+
};
|
12
18
|
export interface HDTaprootSigner extends HDSigner {
|
13
19
|
/**
|
14
20
|
* The path string must match /^m(\/\d+'?)+$/
|
@@ -21,10 +27,28 @@ export interface HDTaprootSigner extends HDSigner {
|
|
21
27
|
*/
|
22
28
|
signSchnorr(hash: Buffer): Buffer;
|
23
29
|
}
|
30
|
+
/**
|
31
|
+
* HD signer object for taproot p2tr musig2 key path sign
|
32
|
+
*/
|
33
|
+
export interface HDTaprootMusig2Signer extends HDSigner {
|
34
|
+
/**
|
35
|
+
* Musig2 requires signer's 32-bytes private key to be passed to it.
|
36
|
+
*/
|
37
|
+
privateKey: Buffer;
|
38
|
+
/**
|
39
|
+
* The path string must match /^m(\/\d+'?)+$/
|
40
|
+
* ex. m/44'/0'/0'/1/23 levels with ' must be hard derivations
|
41
|
+
*/
|
42
|
+
derivePath(path: string): HDTaprootMusig2Signer;
|
43
|
+
}
|
24
44
|
export interface SchnorrSigner {
|
25
45
|
publicKey: Buffer;
|
26
46
|
signSchnorr(hash: Buffer): Buffer;
|
27
47
|
}
|
48
|
+
export interface Musig2Signer {
|
49
|
+
publicKey: Buffer;
|
50
|
+
privateKey: Buffer;
|
51
|
+
}
|
28
52
|
export interface TaprootSigner {
|
29
53
|
leafHashes: Buffer[];
|
30
54
|
signer: SchnorrSigner;
|
@@ -34,40 +58,33 @@ export interface PsbtOpts {
|
|
34
58
|
maximumFeeRate?: number;
|
35
59
|
bip32PathsAbsolute?: boolean;
|
36
60
|
}
|
37
|
-
/**
|
38
|
-
* Psbt proprietary keydata object.
|
39
|
-
* <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata>
|
40
|
-
* => <bytes valuedata>
|
41
|
-
*/
|
42
|
-
export interface ProprietaryKeyValueData {
|
43
|
-
key: ProprietaryKey;
|
44
|
-
value: Buffer;
|
45
|
-
}
|
46
|
-
/**
|
47
|
-
* Psbt proprietary keydata object search fields.
|
48
|
-
* <compact size uint identifier length> <bytes identifier> <compact size uint subtype> <bytes subkeydata>
|
49
|
-
*/
|
50
|
-
export interface ProprietaryKeySearch {
|
51
|
-
identifier: string;
|
52
|
-
subtype: number;
|
53
|
-
keydata?: Buffer;
|
54
|
-
identifierEncoding?: BufferEncoding;
|
55
|
-
}
|
56
61
|
export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint> = UtxoTransaction<bigint>> extends Psbt {
|
62
|
+
private nonceStore;
|
57
63
|
protected static transactionFromBuffer(buffer: Buffer, network: Network): UtxoTransaction<bigint>;
|
58
64
|
static createPsbt(opts: PsbtOpts, data?: PsbtBase): UtxoPsbt;
|
59
65
|
static fromBuffer(buffer: Buffer, opts: PsbtOpts): UtxoPsbt;
|
60
66
|
static fromHex(data: string, opts: PsbtOpts): UtxoPsbt;
|
61
|
-
get network(): Network;
|
62
|
-
toHex(): string;
|
63
67
|
/**
|
64
|
-
* @
|
68
|
+
* @param parent - Parent key. Matched with `bip32Derivations` using `fingerprint` property.
|
69
|
+
* @param bip32Derivations - possible derivations for input or output
|
70
|
+
* @param ignoreY - when true, ignore the y coordinate when matching public keys
|
71
|
+
* @return derived bip32 node if matching derivation is found, undefined if none is found
|
72
|
+
* @throws Error if more than one match is found
|
65
73
|
*/
|
66
|
-
|
74
|
+
static deriveKeyPair(parent: BIP32Interface, bip32Derivations: Bip32Derivation[], { ignoreY }: {
|
75
|
+
ignoreY: boolean;
|
76
|
+
}): BIP32Interface | undefined;
|
77
|
+
static deriveKeyPairForInput(bip32: BIP32Interface, input: PsbtInput): Buffer | undefined;
|
78
|
+
get network(): Network;
|
79
|
+
toHex(): string;
|
67
80
|
/**
|
68
|
-
*
|
81
|
+
* It is expensive to attempt to compute every output address using psbt.txOutputs[outputIndex]
|
82
|
+
* to then just get the script. Here, we are doing the same thing as what txOutputs() does in
|
83
|
+
* bitcoinjs-lib, but without iterating over each output.
|
84
|
+
* @param outputIndex
|
85
|
+
* @returns output script at the given index
|
69
86
|
*/
|
70
|
-
|
87
|
+
getOutputScript(outputIndex: number): Buffer;
|
71
88
|
getNonWitnessPreviousTxids(): string[];
|
72
89
|
addNonWitnessUtxos(txBufs: Record<string, Buffer>): this;
|
73
90
|
static fromTransaction(transaction: UtxoTransaction<bigint>, prevOutputs: TxOutput<bigint>[]): UtxoPsbt;
|
@@ -75,11 +92,31 @@ export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint> = UtxoTransacti
|
|
75
92
|
protected static newTransaction(network: Network): UtxoTransaction<bigint>;
|
76
93
|
protected get tx(): Tx;
|
77
94
|
protected checkForSignatures(propName?: string): void;
|
95
|
+
/**
|
96
|
+
* @returns true if the input at inputIndex is a taproot key path.
|
97
|
+
* Checks for presence of minimum required key path input fields and absence of any script path only input fields.
|
98
|
+
*/
|
99
|
+
isTaprootKeyPathInput(inputIndex: number): boolean;
|
100
|
+
/**
|
101
|
+
* @returns true if the input at inputIndex is a taproot script path.
|
102
|
+
* Checks for presence of minimum required script path input fields and absence of any key path only input fields.
|
103
|
+
*/
|
104
|
+
isTaprootScriptPathInput(inputIndex: number): boolean;
|
105
|
+
/**
|
106
|
+
* @returns true if the input at inputIndex is a taproot
|
107
|
+
*/
|
108
|
+
isTaprootInput(inputIndex: number): boolean;
|
109
|
+
private isMultisigTaprootScript;
|
78
110
|
/**
|
79
111
|
* Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
|
80
112
|
*/
|
81
113
|
finalizeAllInputs(): this;
|
82
114
|
finalizeTaprootInput(inputIndex: number): this;
|
115
|
+
/**
|
116
|
+
* Finalizes a taproot musig2 input by aggregating all partial sigs.
|
117
|
+
* IMPORTANT: Always call validate* function before finalizing.
|
118
|
+
*/
|
119
|
+
finalizeTaprootMusig2Input(inputIndex: number): this;
|
83
120
|
finalizeTapInputWithSingleLeafScriptAndSignature(inputIndex: number): this;
|
84
121
|
/**
|
85
122
|
* Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
|
@@ -89,44 +126,140 @@ export declare class UtxoPsbt<Tx extends UtxoTransaction<bigint> = UtxoTransacti
|
|
89
126
|
* validator.
|
90
127
|
*/
|
91
128
|
validateSignaturesOfAllInputs(): boolean;
|
129
|
+
/**
|
130
|
+
* @returns true iff any matching valid signature is found for a derived pub key from given HD key pair.
|
131
|
+
*/
|
132
|
+
validateSignaturesOfInputHD(inputIndex: number, hdKeyPair: BIP32Interface): boolean;
|
133
|
+
/**
|
134
|
+
* @returns true iff any valid signature(s) are found from bip32 data of PSBT or for given pub key.
|
135
|
+
*/
|
136
|
+
validateSignaturesOfInputCommon(inputIndex: number, pubkey?: Buffer): boolean;
|
137
|
+
private getMusig2SessionKey;
|
138
|
+
/**
|
139
|
+
* @returns true for following cases.
|
140
|
+
* If valid musig2 partial signatures exists for both 2 keys, it will also verify aggregated sig
|
141
|
+
* for aggregated tweaked key (output key), otherwise only verifies partial sig.
|
142
|
+
* If pubkey is passed in input, it will check sig only for that pubkey,
|
143
|
+
* if no sig exits for such key, throws error.
|
144
|
+
* For invalid state of input data, it will throw errors.
|
145
|
+
*/
|
146
|
+
validateTaprootMusig2SignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
|
92
147
|
validateTaprootSignaturesOfInput(inputIndex: number, pubkey?: Buffer): boolean;
|
93
148
|
/**
|
149
|
+
* @param inputIndex
|
150
|
+
* @param rootNodes optional input root bip32 nodes to verify with. If it is not provided, globalXpub will be used.
|
94
151
|
* @return array of boolean values. True when corresponding index in `publicKeys` has signed the transaction.
|
95
152
|
* If no signature in the tx or no public key matching signature, the validation is considered as false.
|
96
153
|
*/
|
97
|
-
getSignatureValidationArray(inputIndex: number
|
154
|
+
getSignatureValidationArray(inputIndex: number, { rootNodes }?: {
|
155
|
+
rootNodes?: Triple<BIP32Interface>;
|
156
|
+
}): Triple<boolean>;
|
98
157
|
/**
|
99
158
|
* Mostly copied from bitcoinjs-lib/ts_src/psbt.ts
|
100
159
|
*/
|
101
|
-
signAllInputsHD(hdKeyPair: HDTaprootSigner,
|
160
|
+
signAllInputsHD(hdKeyPair: HDTaprootSigner | HDTaprootMusig2Signer, params?: number[] | Partial<SignatureParams>): this;
|
102
161
|
/**
|
103
162
|
* Mostly copied from bitcoinjs-lib/ts_src/psbt.ts:signInputHD
|
104
163
|
*/
|
105
|
-
signTaprootInputHD(inputIndex: number, hdKeyPair: HDTaprootSigner, sighashTypes?:
|
164
|
+
signTaprootInputHD(inputIndex: number, hdKeyPair: HDTaprootSigner | HDTaprootMusig2Signer, { sighashTypes, deterministic }?: {
|
165
|
+
sighashTypes?: number[] | undefined;
|
166
|
+
deterministic?: boolean | undefined;
|
167
|
+
}): this;
|
168
|
+
signInputHD(inputIndex: number, hdKeyPair: HDTaprootSigner | HDTaprootMusig2Signer, params?: number[] | Partial<SignatureParams>): this;
|
169
|
+
private getMusig2Participants;
|
170
|
+
private getMusig2Nonces;
|
171
|
+
/**
|
172
|
+
* Signs p2tr musig2 key path input with 2 aggregated keys.
|
173
|
+
*
|
174
|
+
* Note: Only can sign deterministically as the cosigner
|
175
|
+
* @param inputIndex
|
176
|
+
* @param signer - XY public key and private key are required
|
177
|
+
* @param sighashTypes
|
178
|
+
* @param deterministic If true, sign the musig input deterministically
|
179
|
+
*/
|
180
|
+
signTaprootMusig2Input(inputIndex: number, signer: Musig2Signer, { sighashTypes, deterministic }?: {
|
181
|
+
sighashTypes?: number[] | undefined;
|
182
|
+
deterministic?: boolean | undefined;
|
183
|
+
}): this;
|
106
184
|
signTaprootInput(inputIndex: number, signer: SchnorrSigner, leafHashes: Buffer[], sighashTypes?: number[]): this;
|
185
|
+
private getTaprootOutputScript;
|
107
186
|
private getTaprootHashForSig;
|
108
187
|
/**
|
109
|
-
*
|
188
|
+
* Adds proprietary key value pair to PSBT input.
|
189
|
+
* Default identifierEncoding is utf-8 for identifier.
|
110
190
|
*/
|
111
|
-
|
191
|
+
addProprietaryKeyValToInput(inputIndex: number, keyValueData: ProprietaryKeyValue): this;
|
112
192
|
/**
|
113
|
-
*
|
114
|
-
*
|
193
|
+
* Adds or updates (if exists) proprietary key value pair to PSBT input.
|
194
|
+
* Default identifierEncoding is utf-8 for identifier.
|
115
195
|
*/
|
116
|
-
|
117
|
-
hash: Buffer;
|
118
|
-
sighashType: number;
|
119
|
-
};
|
196
|
+
addOrUpdateProprietaryKeyValToInput(inputIndex: number, keyValueData: ProprietaryKeyValue): this;
|
120
197
|
/**
|
121
|
-
*
|
198
|
+
* To search any data from proprietary key value against keydata.
|
122
199
|
* Default identifierEncoding is utf-8 for identifier.
|
123
200
|
*/
|
124
|
-
|
201
|
+
getProprietaryKeyVals(inputIndex: number, keySearch?: ProprietaryKeySearch): ProprietaryKeyValue[];
|
125
202
|
/**
|
126
|
-
* To
|
203
|
+
* To delete any data from proprietary key value.
|
127
204
|
* Default identifierEncoding is utf-8 for identifier.
|
128
205
|
*/
|
129
|
-
|
206
|
+
deleteProprietaryKeyVals(inputIndex: number, keysToDelete?: ProprietaryKeySearch): this;
|
207
|
+
private createMusig2NonceForInput;
|
208
|
+
private setMusig2NoncesInner;
|
209
|
+
/**
|
210
|
+
* Generates and sets MuSig2 nonce to taproot key path input at inputIndex.
|
211
|
+
* If input is not a taproot key path, no action.
|
212
|
+
*
|
213
|
+
* @param inputIndex input index
|
214
|
+
* @param keyPair derived key pair
|
215
|
+
* @param sessionId Optional extra entropy. If provided it must either be a counter unique to this secret key,
|
216
|
+
* (converted to an array of 32 bytes), or 32 uniformly random bytes.
|
217
|
+
* @param deterministic If true, set the cosigner nonce deterministically
|
218
|
+
*/
|
219
|
+
setInputMusig2Nonce(inputIndex: number, derivedKeyPair: BIP32Interface, params?: {
|
220
|
+
sessionId?: Buffer;
|
221
|
+
deterministic?: boolean;
|
222
|
+
}): this;
|
223
|
+
/**
|
224
|
+
* Generates and sets MuSig2 nonce to taproot key path input at inputIndex.
|
225
|
+
* If input is not a taproot key path, no action.
|
226
|
+
*
|
227
|
+
* @param inputIndex input index
|
228
|
+
* @param keyPair HD root key pair
|
229
|
+
* @param sessionId Optional extra entropy. If provided it must either be a counter unique to this secret key,
|
230
|
+
* (converted to an array of 32 bytes), or 32 uniformly random bytes.
|
231
|
+
* @param deterministic If true, set the cosigner nonce deterministically
|
232
|
+
*/
|
233
|
+
setInputMusig2NonceHD(inputIndex: number, keyPair: BIP32Interface, params?: {
|
234
|
+
sessionId?: Buffer;
|
235
|
+
deterministic?: boolean;
|
236
|
+
}): this;
|
237
|
+
/**
|
238
|
+
* Generates and sets MuSig2 nonce to all taproot key path inputs. Other inputs will be skipped.
|
239
|
+
*
|
240
|
+
* @param inputIndex input index
|
241
|
+
* @param keyPair derived key pair
|
242
|
+
* @param sessionId Optional extra entropy. If provided it must either be a counter unique to this secret key,
|
243
|
+
* (converted to an array of 32 bytes), or 32 uniformly random bytes.
|
244
|
+
*/
|
245
|
+
setAllInputsMusig2Nonce(keyPair: BIP32Interface, params?: {
|
246
|
+
sessionId?: Buffer;
|
247
|
+
deterministic?: boolean;
|
248
|
+
}): this;
|
249
|
+
/**
|
250
|
+
* Generates and sets MuSig2 nonce to all taproot key path inputs. Other inputs will be skipped.
|
251
|
+
*
|
252
|
+
* @param inputIndex input index
|
253
|
+
* @param keyPair HD root key pair
|
254
|
+
* @param sessionId Optional extra entropy. If provided it must either be a counter unique to this secret key,
|
255
|
+
* (converted to an array of 32 bytes), or 32 uniformly random bytes.
|
256
|
+
*/
|
257
|
+
setAllInputsMusig2NonceHD(keyPair: BIP32Interface, params?: {
|
258
|
+
sessionId?: Buffer;
|
259
|
+
deterministic?: boolean;
|
260
|
+
}): this;
|
130
261
|
clone(): this;
|
262
|
+
extractTransaction(disableFeeCheck?: boolean): UtxoTransaction<bigint>;
|
131
263
|
}
|
264
|
+
export {};
|
132
265
|
//# sourceMappingURL=UtxoPsbt.d.ts.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"UtxoPsbt.d.ts","sourceRoot":"","sources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