utxo-lib 1.1.3 → 1.1.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (92) hide show
  1. package/dist/src/address.d.ts.map +1 -1
  2. package/dist/src/address.js +1 -11
  3. package/dist/src/addressFormat.d.ts +1 -1
  4. package/dist/src/addressFormat.d.ts.map +1 -1
  5. package/dist/src/addressFormat.js +1 -1
  6. package/dist/src/bitgo/Musig2.d.ts +17 -115
  7. package/dist/src/bitgo/Musig2.d.ts.map +1 -1
  8. package/dist/src/bitgo/Musig2.js +101 -283
  9. package/dist/src/bitgo/UtxoPsbt.d.ts +49 -173
  10. package/dist/src/bitgo/UtxoPsbt.d.ts.map +1 -1
  11. package/dist/src/bitgo/UtxoPsbt.js +112 -634
  12. package/dist/src/bitgo/bbc/DashPsbt.d.ts +12 -0
  13. package/dist/src/bitgo/bbc/DashPsbt.d.ts.map +1 -0
  14. package/dist/src/bitgo/bbc/DashPsbt.js +27 -0
  15. package/dist/src/bitgo/bbc/DashTransaction.d.ts +39 -0
  16. package/dist/src/bitgo/bbc/DashTransaction.d.ts.map +1 -0
  17. package/dist/src/bitgo/bbc/DashTransaction.js +109 -0
  18. package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts +14 -0
  19. package/dist/src/bitgo/bbc/DashTransactionBuilder.d.ts.map +1 -0
  20. package/dist/src/bitgo/bbc/DashTransactionBuilder.js +28 -0
  21. package/dist/src/bitgo/bbc/index.d.ts +4 -0
  22. package/dist/src/bitgo/bbc/index.d.ts.map +1 -0
  23. package/dist/src/bitgo/{litecoin → bbc}/index.js +4 -4
  24. package/dist/src/bitgo/bitcoincash/address.js +2 -2
  25. package/dist/src/bitgo/index.d.ts +0 -10
  26. package/dist/src/bitgo/index.d.ts.map +1 -1
  27. package/dist/src/bitgo/index.js +2 -5
  28. package/dist/src/bitgo/outputScripts.d.ts +1 -3
  29. package/dist/src/bitgo/outputScripts.d.ts.map +1 -1
  30. package/dist/src/bitgo/outputScripts.js +10 -18
  31. package/dist/src/bitgo/parseInput.d.ts +20 -49
  32. package/dist/src/bitgo/parseInput.d.ts.map +1 -1
  33. package/dist/src/bitgo/parseInput.js +24 -108
  34. package/dist/src/bitgo/psbt/fromHalfSigned.d.ts.map +1 -1
  35. package/dist/src/bitgo/psbt/fromHalfSigned.js +6 -9
  36. package/dist/src/bitgo/signature.d.ts +3 -3
  37. package/dist/src/bitgo/signature.d.ts.map +1 -1
  38. package/dist/src/bitgo/signature.js +16 -48
  39. package/dist/src/bitgo/transaction.d.ts +3 -18
  40. package/dist/src/bitgo/transaction.d.ts.map +1 -1
  41. package/dist/src/bitgo/transaction.js +15 -28
  42. package/dist/src/bitgo/types.d.ts +0 -2
  43. package/dist/src/bitgo/types.d.ts.map +1 -1
  44. package/dist/src/bitgo/types.js +1 -1
  45. package/dist/src/bitgo/wallet/Psbt.d.ts +12 -90
  46. package/dist/src/bitgo/wallet/Psbt.d.ts.map +1 -1
  47. package/dist/src/bitgo/wallet/Psbt.js +71 -221
  48. package/dist/src/bitgo/wallet/Unspent.d.ts +0 -28
  49. package/dist/src/bitgo/wallet/Unspent.d.ts.map +1 -1
  50. package/dist/src/bitgo/wallet/Unspent.js +68 -173
  51. package/dist/src/bitgo/wallet/chains.d.ts +2 -2
  52. package/dist/src/bitgo/wallet/chains.d.ts.map +1 -1
  53. package/dist/src/bitgo/wallet/chains.js +1 -1
  54. package/dist/src/bitgo/zcash/ZcashPsbt.d.ts.map +1 -1
  55. package/dist/src/bitgo/zcash/ZcashPsbt.js +3 -4
  56. package/dist/src/networks.d.ts +2 -1
  57. package/dist/src/networks.d.ts.map +1 -1
  58. package/dist/src/networks.js +29 -22
  59. package/dist/src/noble_ecc.d.ts.map +1 -1
  60. package/dist/src/noble_ecc.js +2 -6
  61. package/dist/src/payments/p2tr.d.ts.map +1 -1
  62. package/dist/src/payments/p2tr.js +9 -15
  63. package/dist/src/taproot.d.ts +0 -16
  64. package/dist/src/taproot.d.ts.map +1 -1
  65. package/dist/src/taproot.js +2 -44
  66. package/dist/src/testutil/index.d.ts +0 -2
  67. package/dist/src/testutil/index.d.ts.map +1 -1
  68. package/dist/src/testutil/index.js +1 -3
  69. package/dist/src/testutil/mock.d.ts +1 -1
  70. package/dist/src/testutil/mock.d.ts.map +1 -1
  71. package/dist/src/testutil/mock.js +4 -12
  72. package/package.json +3 -5
  73. package/dist/src/bitgo/PsbtUtil.d.ts +0 -54
  74. package/dist/src/bitgo/PsbtUtil.d.ts.map +0 -1
  75. package/dist/src/bitgo/PsbtUtil.js +0 -79
  76. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts +0 -10
  77. package/dist/src/bitgo/litecoin/LitecoinPsbt.d.ts.map +0 -1
  78. package/dist/src/bitgo/litecoin/LitecoinPsbt.js +0 -17
  79. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts +0 -16
  80. package/dist/src/bitgo/litecoin/LitecoinTransaction.d.ts.map +0 -1
  81. package/dist/src/bitgo/litecoin/LitecoinTransaction.js +0 -46
  82. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts +0 -10
  83. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.d.ts.map +0 -1
  84. package/dist/src/bitgo/litecoin/LitecoinTransactionBuilder.js +0 -15
  85. package/dist/src/bitgo/litecoin/index.d.ts +0 -4
  86. package/dist/src/bitgo/litecoin/index.d.ts.map +0 -1
  87. package/dist/src/testutil/psbt.d.ts +0 -71
  88. package/dist/src/testutil/psbt.d.ts.map +0 -1
  89. package/dist/src/testutil/psbt.js +0 -147
  90. package/dist/src/testutil/transaction.d.ts +0 -61
  91. package/dist/src/testutil/transaction.d.ts.map +0 -1
  92. package/dist/src/testutil/transaction.js +0 -107
@@ -1,11 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.parsePubScript = exports.parsePubScript2Of3 = exports.parseSignatureScript2Of3 = exports.parseSignatureScript = exports.getLeafVersion = exports.calculateScriptPathLevel = exports.isValidControlBock = exports.isPlaceholderSignature = void 0;
4
- /* eslint no-redeclare: 0 */
3
+ exports.parsePubScript = exports.parseSignatureScript2Of3 = exports.parseSignatureScript = exports.getScriptPathLevel = exports.calculateScriptPathLevel = exports.isValidControlBock = exports.isPlaceholderSignature = void 0;
5
4
  const opcodes = require("bitcoin-ops");
6
5
  const bitcoinjs_lib_1 = require("bitcoinjs-lib");
7
- const types_1 = require("./types");
8
6
  const outputScripts_1 = require("./outputScripts");
7
+ const types_1 = require("./types");
9
8
  function isPlaceholderSignature(v) {
10
9
  if (Buffer.isBuffer(v)) {
11
10
  return v.length === 0;
@@ -40,13 +39,13 @@ exports.calculateScriptPathLevel = calculateScriptPathLevel;
40
39
  /**
41
40
  * @return leaf version for P2TR control block.
42
41
  */
43
- function getLeafVersion(controlBlock) {
42
+ function getScriptPathLevel(controlBlock) {
44
43
  if (Buffer.isBuffer(controlBlock) && controlBlock.length > 0) {
45
44
  return controlBlock[0] & 0xfe;
46
45
  }
47
46
  throw new Error('unexpected leafVersion.');
48
47
  }
49
- exports.getLeafVersion = getLeafVersion;
48
+ exports.getScriptPathLevel = getScriptPathLevel;
50
49
  function emptyMatchResult() {
51
50
  return {
52
51
  ':pubkey': [],
@@ -228,24 +227,7 @@ const parseP2wsh2Of3 = (p) => {
228
227
  }
229
228
  return parseP2ms(p.witness, 'p2wsh');
230
229
  };
231
- const parseTaprootKeyPath2Of3 = (p) => {
232
- if (!isNativeSegwit(p)) {
233
- return new MatchError(`expected native segwit`);
234
- }
235
- const match = matchScript(p.witness, [':signature']);
236
- if (match instanceof MatchError) {
237
- return match;
238
- }
239
- const signatures = match[':signature'];
240
- if (isPlaceholderSignature(signatures[0])) {
241
- throw new Error(`invalid taproot key path signature`);
242
- }
243
- return {
244
- scriptType: 'taprootKeyPathSpend',
245
- signatures,
246
- };
247
- };
248
- const parseTaprootScriptPath2Of3 = (p) => {
230
+ const parseP2tr2Of3 = (p) => {
249
231
  if (!isNativeSegwit(p)) {
250
232
  return new MatchError(`expected native segwit`);
251
233
  }
@@ -261,9 +243,9 @@ const parseTaprootScriptPath2Of3 = (p) => {
261
243
  }
262
244
  const [controlBlock] = match[':control-block'];
263
245
  const scriptPathLevel = calculateScriptPathLevel(controlBlock);
264
- const leafVersion = getLeafVersion(controlBlock);
246
+ const leafVersion = getScriptPathLevel(controlBlock);
265
247
  return {
266
- scriptType: 'taprootScriptPathSpend',
248
+ scriptType: 'p2tr',
267
249
  pubScript: match[':script'][0].buffer,
268
250
  publicKeys: match[':script'][0].match[':pubkey-xonly'],
269
251
  signatures: match[':signature'],
@@ -283,14 +265,7 @@ const parseTaprootScriptPath2Of3 = (p) => {
283
265
  */
284
266
  function parseSignatureScript(input) {
285
267
  const decScript = bitcoinjs_lib_1.script.decompile(input.script);
286
- const parsers = [
287
- parseP2sh2Of3,
288
- parseP2shP2wsh2Of3,
289
- parseP2wsh2Of3,
290
- parseTaprootKeyPath2Of3,
291
- parseTaprootScriptPath2Of3,
292
- parseP2shP2pk,
293
- ];
268
+ const parsers = [parseP2sh2Of3, parseP2shP2wsh2Of3, parseP2wsh2Of3, parseP2tr2Of3, parseP2shP2pk];
294
269
  for (const f of parsers) {
295
270
  const parsed = f({
296
271
  script: (decScript === null || decScript === void 0 ? void 0 : decScript.length) === 0 ? null : decScript,
@@ -306,42 +281,19 @@ function parseSignatureScript(input) {
306
281
  exports.parseSignatureScript = parseSignatureScript;
307
282
  function parseSignatureScript2Of3(input) {
308
283
  const result = parseSignatureScript(input);
309
- if (!outputScripts_1.isScriptType2Of3(result.scriptType) &&
310
- result.scriptType !== 'taprootKeyPathSpend' &&
311
- result.scriptType !== 'taprootScriptPathSpend') {
284
+ if (!outputScripts_1.isScriptType2Of3(result.scriptType)) {
312
285
  throw new Error(`invalid script type`);
313
286
  }
314
287
  if (!result.signatures) {
315
288
  throw new Error(`missing signatures`);
316
289
  }
317
- if (result.scriptType !== 'taprootKeyPathSpend' &&
318
- result.publicKeys.length !== 3 &&
319
- (result.publicKeys.length !== 2 || result.scriptType !== 'taprootScriptPathSpend')) {
290
+ if (result.publicKeys.length !== 3 && (result.publicKeys.length !== 2 || result.scriptType !== 'p2tr')) {
320
291
  throw new Error(`unexpected pubkey count`);
321
292
  }
322
293
  return result;
323
294
  }
324
295
  exports.parseSignatureScript2Of3 = parseSignatureScript2Of3;
325
- const parseP2shP2pkPubScript = (pubScript, scriptType) => {
326
- if (scriptType !== 'p2shP2pk') {
327
- throw new Error('invalid script type');
328
- }
329
- const match = matchScript([pubScript], [{ ':script': [':pubkey', 'OP_CHECKSIG'] }]);
330
- if (match instanceof MatchError) {
331
- return match;
332
- }
333
- const [script] = match[':script'];
334
- return {
335
- scriptType,
336
- publicKeys: script.match[':pubkey'],
337
- pubScript: pubScript,
338
- redeemScript: pubScript,
339
- };
340
- };
341
296
  const parseP2msPubScript = (pubScript, scriptType) => {
342
- if (scriptType === 'taprootScriptPathSpend' || scriptType === 'taprootKeyPathSpend' || scriptType === 'p2shP2pk') {
343
- throw new Error('invalid script type');
344
- }
345
297
  const match = matchScript([pubScript], [{ ':script': ['OP_2', ':pubkey', ':pubkey', ':pubkey', 'OP_3', 'OP_CHECKMULTISIG'] }]);
346
298
  if (match instanceof MatchError) {
347
299
  return match;
@@ -358,71 +310,35 @@ const parseP2msPubScript = (pubScript, scriptType) => {
358
310
  witnessScript: scriptType === 'p2shP2wsh' || scriptType === 'p2wsh' ? redeemScript.buffer : undefined,
359
311
  };
360
312
  };
361
- const parseTaprootKeyPathPubScript = (pubScript, scriptType) => {
362
- if (scriptType === 'p2sh' ||
363
- scriptType === 'p2wsh' ||
364
- scriptType === 'p2shP2wsh' ||
365
- scriptType === 'taprootScriptPathSpend' ||
366
- scriptType === 'p2shP2pk') {
367
- throw new Error('invalid script type');
368
- }
369
- const match = matchScript([pubScript], [{ ':script': ['OP_1', ':pubkey-xonly'] }]);
370
- if (match instanceof MatchError) {
371
- return match;
372
- }
373
- const [script] = match[':script'];
374
- return {
375
- scriptType: 'taprootKeyPathSpend',
376
- publicKeys: script.match[':pubkey-xonly'],
377
- pubScript: pubScript,
378
- };
379
- };
380
- const parseTaprootScriptPathPubScript = (pubScript, scriptType) => {
381
- if (scriptType === 'p2sh' ||
382
- scriptType === 'p2wsh' ||
383
- scriptType === 'p2shP2wsh' ||
384
- scriptType === 'taprootKeyPathSpend' ||
385
- scriptType === 'p2shP2pk') {
386
- throw new Error('invalid script type');
387
- }
313
+ const parseP2tr2Of3PubScript = (pubScript, scriptType) => {
388
314
  const match = matchScript([pubScript], [{ ':script': [':pubkey-xonly', 'OP_CHECKSIGVERIFY', ':pubkey-xonly', 'OP_CHECKSIG'] }]);
389
315
  if (match instanceof MatchError) {
390
316
  return match;
391
317
  }
392
318
  return {
393
- scriptType,
319
+ scriptType: 'p2tr',
394
320
  pubScript: match[':script'][0].buffer,
395
321
  publicKeys: match[':script'][0].match[':pubkey-xonly'],
396
322
  };
397
323
  };
398
- function parsePubScript2Of3(inputPubScript, scriptType) {
399
- const result = scriptType === 'taprootKeyPathSpend'
400
- ? parseTaprootKeyPathPubScript(inputPubScript, scriptType)
401
- : scriptType === 'taprootScriptPathSpend'
402
- ? parseTaprootScriptPathPubScript(inputPubScript, scriptType)
403
- : parseP2msPubScript(inputPubScript, scriptType);
404
- if (result instanceof MatchError) {
405
- throw new Error(result.message);
406
- }
407
- if ((result.scriptType === 'taprootKeyPathSpend' && result.publicKeys.length !== 1) ||
408
- (result.scriptType === 'taprootScriptPathSpend' && result.publicKeys.length !== 2) ||
409
- (outputScripts_1.isScriptType2Of3(result.scriptType) && result.publicKeys.length !== 3)) {
410
- throw new Error('unexpected pubkey count');
411
- }
412
- return result;
413
- }
414
- exports.parsePubScript2Of3 = parsePubScript2Of3;
324
+ /**
325
+ * @return pubScript (scriptPubKey/redeemScript/witnessScript) is parsed.
326
+ * P2SH => scriptType, pubScript (redeemScript), redeemScript, public keys
327
+ * PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
328
+ * P2SH-PW2SH => scriptType, pubScript (witnessScript), witnessScript, public keys.
329
+ * P2TR => scriptType, pubScript, controlBlock, scriptPathLevel, leafVersion, pub keys, signatures.
330
+ */
415
331
  function parsePubScript(inputPubScript, scriptType) {
416
- const result = scriptType === 'p2shP2pk'
417
- ? parseP2shP2pkPubScript(inputPubScript, scriptType)
418
- : parsePubScript2Of3(inputPubScript, scriptType);
332
+ const result = scriptType === 'p2tr'
333
+ ? parseP2tr2Of3PubScript(inputPubScript, scriptType)
334
+ : parseP2msPubScript(inputPubScript, scriptType);
419
335
  if (result instanceof MatchError) {
420
336
  throw new Error(result.message);
421
337
  }
422
- if (result.scriptType === 'p2shP2pk' && result.publicKeys.length !== 1) {
338
+ if (result.publicKeys.length !== 3 && (result.publicKeys.length !== 2 || result.scriptType !== 'p2tr')) {
423
339
  throw new Error('unexpected pubkey count');
424
340
  }
425
341
  return result;
426
342
  }
427
343
  exports.parsePubScript = parsePubScript;
428
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGFyc2VJbnB1dC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9iaXRnby9wYXJzZUlucHV0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7OztBQUFBLDRCQUE0QjtBQUM1Qix1Q0FBdUM7QUFDdkMsaURBQTJEO0FBRTNELG1DQUFtQztBQUNuQyxtREFBbUQ7QUFFbkQsU0FBZ0Isc0JBQXNCLENBQUMsQ0FBa0I7SUFDdkQsSUFBSSxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxFQUFFO1FBQ3RCLE9BQU8sQ0FBQyxDQUFDLE1BQU0sS0FBSyxDQUFDLENBQUM7S0FDdkI7SUFDRCxPQUFPLENBQUMsS0FBSyxDQUFDLENBQUM7QUFDakIsQ0FBQztBQUxELHdEQUtDO0FBRUQ7O0dBRUc7QUFDSCxTQUFnQixrQkFBa0IsQ0FBQyxZQUFvQjtJQUNyRCxzRkFBc0Y7SUFDdEYs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,CAAC,MAAM,CAAC,EAAE,GAAG,eAAe,EAAE,CAOnG"}
1
+ {"version":3,"file":"fromHalfSigned.d.ts","sourceRoot":"","sources":["../../../../src/bitgo/psbt/fromHalfSigned.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,eAAe,EAAc,MAAM,2BAA2B,CAAC;AACxE,OAAO,EAAiB,QAAQ,EAAiC,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AASrD,wBAAgB,cAAc,CAC5B,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,EAC3B,GAAG,EAAE,MAAM,EACX,QAAQ,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG;IAAE,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,EAAE,GACnD,eAAe,CA2DjB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,MAAM,CAAC,EAAE,EAAE,eAAe,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,EAAE,GAAG,eAAe,EAAE,CAOnG"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.unsign = exports.getInputUpdate = void 0;
4
- const assert = require("assert");
5
4
  const __1 = require("../..");
6
5
  const parseInput_1 = require("../parseInput");
7
6
  const signature_1 = require("../signature");
@@ -16,9 +15,7 @@ function getInputUpdate(tx, vin, prevOuts) {
16
15
  return nonWitnessUtxo ? { nonWitnessUtxo } : {};
17
16
  }
18
17
  const parsedInput = parseInput_1.parseSignatureScript(tx.ins[vin]);
19
- assert.ok(parsedInput.scriptType !== 'taprootKeyPathSpend');
20
18
  function getPartialSigs() {
21
- assert.ok(parsedInput.scriptType !== 'taprootKeyPathSpend');
22
19
  return signature_1.getSignaturesWithPublicKeys(tx, vin, prevOuts, parsedInput.publicKeys).flatMap((signature, i) => signature
23
20
  ? [
24
21
  {
@@ -31,10 +28,7 @@ function getInputUpdate(tx, vin, prevOuts) {
31
28
  // Because Zcash directly hashes the value for non-segwit transactions, we do not need to check indirectly
32
29
  // with the previous transaction. Therefore, we can treat Zcash non-segwit transactions as Bitcoin
33
30
  // segwit transactions
34
- if (parsedInput.scriptType !== 'taprootScriptPathSpend' &&
35
- !outputScripts_1.hasWitnessData(parsedInput.scriptType) &&
36
- !nonWitnessUtxo &&
37
- __1.getMainnet(tx.network) !== __1.networks.zcash) {
31
+ if (!outputScripts_1.hasWitnessData(parsedInput.scriptType) && !nonWitnessUtxo && __1.getMainnet(tx.network) !== __1.networks.zcash) {
38
32
  throw new Error(`scriptType ${parsedInput.scriptType} requires prevTx Buffer`);
39
33
  }
40
34
  switch (parsedInput.scriptType) {
@@ -52,7 +46,10 @@ function getInputUpdate(tx, vin, prevOuts) {
52
46
  redeemScript: parsedInput.redeemScript,
53
47
  witnessScript: parsedInput.witnessScript,
54
48
  });
55
- case 'taprootScriptPathSpend':
49
+ case 'p2tr':
50
+ if (!('controlBlock' in parsedInput)) {
51
+ throw new Error(`keypath not implemented`);
52
+ }
56
53
  const leafHash = __1.taproot.getTapleafHash(__1.ecc, parsedInput.controlBlock, parsedInput.pubScript);
57
54
  return {
58
55
  tapLeafScript: [
@@ -91,4 +88,4 @@ function unsign(tx, prevOuts) {
91
88
  });
92
89
  }
93
90
  exports.unsign = unsign;
94
- //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZnJvbUhhbGZTaWduZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi9zcmMvYml0Z28vcHNidC9mcm9tSGFsZlNpZ25lZC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBQSxpQ0FBaUM7QUFFakMsNkJBQStFO0FBRS9FLDhDQUFxRDtBQUNyRCw0Q0FBMkQ7QUFDM0Qsb0RBQWtEO0FBRWxELFNBQVMsYUFBYSxDQUFvQyx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GUodHgsIHZpbiwgcHJldk91dHMpO1xuICAgIGlucHV0LndpdG5lc3MgPSBbXTtcbiAgICBpbnB1dC5zY3JpcHQgPSBCdWZmZXIuYWxsb2MoMCk7XG4gICAgcmV0dXJuIHVwZGF0ZTtcbiAgfSk7XG59XG4iXX0=
@@ -3,7 +3,7 @@ import { BIP32Interface } from 'bip32';
3
3
  import { TxOutput } from 'bitcoinjs-lib';
4
4
  import { UtxoTransaction } from './UtxoTransaction';
5
5
  import { UtxoTransactionBuilder } from './UtxoTransactionBuilder';
6
- import { ScriptType, ScriptType2Of3 } from './outputScripts';
6
+ import { ScriptType2Of3 } from './outputScripts';
7
7
  import { Triple } from './types';
8
8
  import { Network } from '../networks';
9
9
  /**
@@ -40,7 +40,7 @@ export declare type SignatureVerification = {
40
40
  * @param inputIndex
41
41
  * @param amount - must be set for segwit transactions and BIP143 transactions
42
42
  * @param verificationSettings
43
- * @param prevOutputs - must be set for p2tr and p2trMusig2 transactions
43
+ * @param prevOutputs - must be set for p2tr transactions
44
44
  * @returns SignatureVerification[] - in order of parsed non-empty signatures
45
45
  */
46
46
  export declare function getSignatureVerifications<TNumber extends number | bigint>(transaction: UtxoTransaction<TNumber>, inputIndex: number, amount: TNumber, verificationSettings?: VerificationSettings, prevOutputs?: TxOutput<TNumber>[]): SignatureVerification[];
@@ -78,7 +78,7 @@ export declare function verifySignatureWithPublicKeys<TNumber extends number | b
78
78
  * @return true iff signature is valid
79
79
  */
80
80
  export declare function verifySignatureWithPublicKey<TNumber extends number | bigint>(transaction: UtxoTransaction<TNumber>, inputIndex: number, prevOutputs: TxOutput<TNumber>[], publicKey: Buffer): boolean;
81
- export declare function getDefaultSigHash(network: Network, scriptType?: ScriptType): number;
81
+ export declare function getDefaultSigHash(network: Network, scriptType?: ScriptType2Of3): number;
82
82
  export declare function signInputP2shP2pk<TNumber extends number | bigint>(txBuilder: UtxoTransactionBuilder<TNumber>, vin: number, keyPair: BIP32Interface): void;
83
83
  export declare function signInput2Of3<TNumber extends number | bigint>(txBuilder: UtxoTransactionBuilder<TNumber>, vin: number, scriptType: ScriptType2Of3, pubkeys: Triple<Buffer>, keyPair: BIP32Interface, cosigner: Buffer, amount: TNumber): void;
84
84
  //# sourceMappingURL=signature.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../src/bitgo/signature.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,EAAwB,QAAQ,EAAmB,MAAM,eAAe,CAAC;AAEhF,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAIL,UAAU,EACV,cAAc,EAEf,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAc,OAAO,EAAY,MAAM,aAAa,CAAC;AAK5D;;;;GAIG;AACH,oBAAY,oBAAoB,GAAG;IACjC;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,oBAAY,qBAAqB,GAC7B;IACE,0DAA0D;IAC1D,QAAQ,EAAE,MAAM,CAAC;IACjB,kCAAkC;IAClC,SAAS,EAAE,MAAM,CAAC;CACnB,GACD;IAAE,QAAQ,EAAE,SAAS,CAAC;IAAC,SAAS,EAAE,SAAS,CAAA;CAAE,CAAC;AAElD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,SAAS,MAAM,GAAG,MAAM,EACvE,WAAW,EAAE,eAAe,CAAC,OAAO,CAAC,EACrC,UAAU,EAAE,MAAM,EAClB,MAAM,EAAE,OAAO,EACf,oBAAoB,GAAE,oBAAyB,EAC/C,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,CAAC,EAAE,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