utxo-lib 1.0.8 → 1.1.0
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/base_crypto.d.ts +14 -0
- package/dist/src/base_crypto.d.ts.map +1 -0
- package/dist/src/base_crypto.js +215 -0
- 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 -101
- 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 +91 -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 +657 -121
- 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 +285 -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 +172 -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 +7 -16
- package/dist/src/bitgo/zcash/ZcashTransaction.js +2 -2
- package/dist/src/musig.d.ts +390 -0
- package/dist/src/musig.d.ts.map +1 -0
- package/dist/src/musig.js +447 -0
- 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 +11 -7
- package/dist/src/payments/p2tr.d.ts.map +1 -1
- package/dist/src/payments/p2tr.js +21 -19
- package/dist/src/payments/p2tr_ns.js +2 -3
- package/dist/src/taproot.d.ts +16 -0
- package/dist/src/taproot.d.ts.map +1 -1
- package/dist/src/taproot.js +45 -4
- 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 +6 -7
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"file":"PsbtUtil.d.ts","sourceRoot":"","sources":["../../../src/bitgo/PsbtUtil.ts"],"names":[],"mappings":";AAAA,OAAO,EAAwB,cAAc,EAAE,MAAM,kCAAkC,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,wBAAwB,CAAC;AAE9C;;GAEG;AACH,eAAO,MAAM,2BAA2B,UAAU,CAAC;AAEnD;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,uBAAuB,IAAO;IAC9B,2BAA2B,IAAO;IAClC,gBAAgB,IAAO;IACvB,kBAAkB,IAAO;CAC1B;AAED;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC,GAAG,EAAE,cAAc,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,MAAM,WAAW,oBAAoB;IACnC,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kBAAkB,CAAC,EAAE,cAAc,CAAC;CACrC;AAED;;;GAGG;AACH,wBAAgB,8BAA8B,CAC5C,KAAK,EAAE,SAAS,EAChB,SAAS,CAAC,EAAE,oBAAoB,GAC/B,mBAAmB,EAAE,CAmBvB;AAED;;GAEG;AACH,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,SAAS,GAAG,MAAM,CAYnE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAE9D;AAED;;;KAGK;AACL,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAUrD;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,MAAM,CAAC,EAAE,MAAM,UAAO,GAAG,CAAC,CAOhF"}
|
@@ -0,0 +1,91 @@
|
|
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
|
+
if (!input.unknownKeyVals?.length) {
|
25
|
+
return [];
|
26
|
+
}
|
27
|
+
if (keySearch && keySearch.subtype === undefined && Buffer.isBuffer(keySearch.keydata)) {
|
28
|
+
throw new Error('invalid proprietary key search filter combination. subtype is required');
|
29
|
+
}
|
30
|
+
const keyVals = input.unknownKeyVals.map(({ key, value }, i) => {
|
31
|
+
return { key: proprietaryKeyVal_1.decodeProprietaryKey(key), value };
|
32
|
+
});
|
33
|
+
return keyVals.filter((keyVal) => {
|
34
|
+
return (keySearch === undefined ||
|
35
|
+
(keySearch.identifier === keyVal.key.identifier &&
|
36
|
+
(keySearch.subtype === undefined ||
|
37
|
+
(keySearch.subtype === keyVal.key.subtype &&
|
38
|
+
(!Buffer.isBuffer(keySearch.keydata) || keySearch.keydata.equals(keyVal.key.keydata))))));
|
39
|
+
});
|
40
|
+
}
|
41
|
+
exports.getPsbtInputProprietaryKeyVals = getPsbtInputProprietaryKeyVals;
|
42
|
+
/**
|
43
|
+
* @return partialSig/tapScriptSig/MUSIG2_PARTIAL_SIG count iff input is not finalized
|
44
|
+
*/
|
45
|
+
function getPsbtInputSignatureCount(input) {
|
46
|
+
if (isPsbtInputFinalized(input)) {
|
47
|
+
throw new Error('Input is already finalized');
|
48
|
+
}
|
49
|
+
return Math.max(Array.isArray(input.partialSig) ? input.partialSig.length : 0, Array.isArray(input.tapScriptSig) ? input.tapScriptSig.length : 0, getPsbtInputProprietaryKeyVals(input, {
|
50
|
+
identifier: exports.PSBT_PROPRIETARY_IDENTIFIER,
|
51
|
+
subtype: ProprietaryKeySubtype.MUSIG2_PARTIAL_SIG,
|
52
|
+
}).length);
|
53
|
+
}
|
54
|
+
exports.getPsbtInputSignatureCount = getPsbtInputSignatureCount;
|
55
|
+
/**
|
56
|
+
* @return true iff PSBT input is finalized
|
57
|
+
*/
|
58
|
+
function isPsbtInputFinalized(input) {
|
59
|
+
return Buffer.isBuffer(input.finalScriptSig) || Buffer.isBuffer(input.finalScriptWitness);
|
60
|
+
}
|
61
|
+
exports.isPsbtInputFinalized = isPsbtInputFinalized;
|
62
|
+
/**
|
63
|
+
* @return true iff data starts with magic PSBT byte sequence
|
64
|
+
* @param data byte array or hex string
|
65
|
+
* */
|
66
|
+
function isPsbt(data) {
|
67
|
+
// https://github.com/bitcoin/bips/blob/master/bip-0174.mediawiki#specification
|
68
|
+
// 0x70736274 - ASCII for 'psbt'. 0xff - separator
|
69
|
+
if (typeof data === 'string') {
|
70
|
+
if (data.length < 10) {
|
71
|
+
return false;
|
72
|
+
}
|
73
|
+
data = Buffer.from(data.slice(0, 10), 'hex');
|
74
|
+
}
|
75
|
+
return 5 <= data.length && data.readUInt32BE(0) === 0x70736274 && data.readUInt8(4) === 0xff;
|
76
|
+
}
|
77
|
+
exports.isPsbt = isPsbt;
|
78
|
+
/**
|
79
|
+
* This function allows signing or validating a psbt with non-segwit inputs those do not contain nonWitnessUtxo.
|
80
|
+
*/
|
81
|
+
function withUnsafeNonSegwit(psbt, fn, unsafe = true) {
|
82
|
+
psbt.__CACHE.__UNSAFE_SIGN_NONSEGWIT = unsafe;
|
83
|
+
try {
|
84
|
+
return fn();
|
85
|
+
}
|
86
|
+
finally {
|
87
|
+
psbt.__CACHE.__UNSAFE_SIGN_NONSEGWIT = false;
|
88
|
+
}
|
89
|
+
}
|
90
|
+
exports.withUnsafeNonSegwit = withUnsafeNonSegwit;
|
91
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiUHNidFV0aWwuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvYml0Z28vUHNidFV0aWwudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBQUEsd0VBQXdGO0FBSXhGOztHQUVHO0FBQ1UsUUFBQSwyQkFBMkIsR0FBRyxPQUFPLENBQUM7QUFFbkQ7O0dBRUc7QUFDSCxJQUFZLHFCQUtYO0FBTEQsV0FBWSxxQkFBcUI7SUFDL0IsdUdBQThCLENBQUE7SUFDOUIsK0dBQWtDLENBQUE7SUFDbEMseUZBQXVCLENBQUE7SUFDdkIsNkZBQXlCLENBQUE7QUFDM0IsQ0FBQyxFQUxXLHFCQUFxQixHQUFyQiw2QkFBcUIsS0FBckIsNkJBQXFCLFFBS2hDO0FBdUJEOzs7R0FHRztBQUNILFNBQWdCLDhCQUE4QixDQUM1QyxLQUFnQ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gwLCAxMCksICdoZXgnKTtcbiAgfVxuICByZXR1cm4gNSA8PSBkYXRhLmxlbmd0aCAmJiBkYXRhLnJlYWRVSW50MzJCRSgwKSA9PT0gMHg3MDczNjI3NCAmJiBkYXRhLnJlYWRVSW50OCg0KSA9PT0gMHhmZjtcbn1cblxuLyoqXG4gKiBUaGlzIGZ1bmN0aW9uIGFsbG93cyBzaWduaW5nIG9yIHZhbGlkYXRpbmcgYSBwc2J0IHdpdGggbm9uLXNlZ3dpdCBpbnB1dHMgdGhvc2UgZG8gbm90IGNvbnRhaW4gbm9uV2l0bmVzc1V0eG8uXG4gKi9cbmV4cG9ydCBmdW5jdGlvbiB3aXRoVW5zYWZlTm9uU2Vnd2l0PFQ+KHBzYnQ6IFBzYnQsIGZuOiAoKSA9PiBULCB1bnNhZmUgPSB0cnVlKTogVCB7XG4gIChwc2J0IGFzIGFueSkuX19DQUNIRS5fX1VOU0FGRV9TSUdOX05PTlNFR1dJVCA9IHVuc2FmZTtcbiAgdHJ5IHtcbiAgICByZXR1cm4gZm4oKTtcbiAgfSBmaW5hbGx5IHtcbiAgICAocHNidCBhcyBhbnkpLl9fQ0FDSEUuX19VTlNBRkVfU0lHTl9OT05TRUdXSVQgPSBmYWxzZTtcbiAgfVxufVxuIl19
|
@@ -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":["../../../src/bitgo/UtxoPsbt.ts"],"names":[],"mappings":";
|
1
|
+
{"version":3,"file":"UtxoPsbt.d.ts","sourceRoot":"","sources":["../../../src/bitgo/UtxoPsbt.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,IAAI,IAAI,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAC1C,OAAO,EACL,eAAe,EACf,SAAS,EAIV,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAgB,cAAc,EAAE,MAAM,OAAO,CAAC;AAIrD,OAAO,EAEL,QAAQ,EACR,IAAI,EAGJ,QAAQ,EACR,OAAO,EAIR,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAyBpD,OAAO,EAAqB,MAAM,EAAS,MAAM,SAAS,CAAC;AAE3D,OAAO,EAGL,oBAAoB,EAEpB,mBAAmB,EAEpB,MAAM,YAAY,CAAC;AAEpB,aAAK,eAAe,GAAG;IACrB;;;OAGG;IACH,aAAa,EAAE,OAAO,CAAC;IACvB,4BAA4B;IAC5B,YAAY,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AA6BF,MAAM,WAAW,eAAgB,SAAQ,QAAQ;IAC/C;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,eAAe,CAAC;IAC1C;;;OAGG;IACH,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,qBAAsB,SAAQ,QAAQ;IACrD;;OAEG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,qBAAqB,CAAC;CACjD;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACnC;AAED,MAA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