@btc-vision/bitcoin 6.4.1 → 6.4.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.
Files changed (55) hide show
  1. package/browser/address.d.ts +1 -0
  2. package/browser/index.js +1 -1
  3. package/browser/payments/embed.d.ts +2 -2
  4. package/browser/payments/index.d.ts +61 -12
  5. package/browser/payments/lazy.d.ts +1 -1
  6. package/browser/payments/p2ms.d.ts +2 -2
  7. package/browser/payments/p2op.d.ts +25 -0
  8. package/browser/payments/p2pk.d.ts +2 -2
  9. package/browser/payments/p2pkh.d.ts +2 -2
  10. package/browser/payments/p2sh.d.ts +2 -2
  11. package/browser/payments/p2tr.d.ts +2 -2
  12. package/browser/payments/p2wpkh.d.ts +2 -2
  13. package/browser/payments/p2wsh.d.ts +2 -2
  14. package/browser/psbt/psbtutils.d.ts +1 -0
  15. package/build/address.js +4 -5
  16. package/build/payments/embed.d.ts +2 -2
  17. package/build/payments/embed.js +6 -2
  18. package/build/payments/index.d.ts +61 -12
  19. package/build/payments/index.js +1 -0
  20. package/build/payments/lazy.d.ts +1 -1
  21. package/build/payments/p2ms.d.ts +2 -2
  22. package/build/payments/p2ms.js +8 -2
  23. package/build/payments/p2op.d.ts +25 -0
  24. package/build/payments/p2op.js +112 -0
  25. package/build/payments/p2pk.d.ts +2 -2
  26. package/build/payments/p2pk.js +5 -1
  27. package/build/payments/p2pkh.d.ts +2 -2
  28. package/build/payments/p2pkh.js +5 -1
  29. package/build/payments/p2sh.d.ts +2 -2
  30. package/build/payments/p2sh.js +5 -1
  31. package/build/payments/p2tr.d.ts +2 -2
  32. package/build/payments/p2tr.js +5 -2
  33. package/build/payments/p2wpkh.d.ts +2 -2
  34. package/build/payments/p2wpkh.js +5 -1
  35. package/build/payments/p2wsh.d.ts +2 -2
  36. package/build/payments/p2wsh.js +5 -1
  37. package/build/psbt/psbtutils.d.ts +1 -0
  38. package/build/psbt/psbtutils.js +2 -0
  39. package/build/psbt.js +3 -1
  40. package/package.json +1 -1
  41. package/src/address.ts +283 -287
  42. package/src/payments/embed.ts +61 -55
  43. package/src/payments/index.ts +110 -13
  44. package/src/payments/lazy.ts +28 -28
  45. package/src/payments/p2ms.ts +11 -5
  46. package/src/payments/p2op.ts +170 -0
  47. package/src/payments/p2pk.ts +93 -85
  48. package/src/payments/p2pkh.ts +214 -210
  49. package/src/payments/p2sh.ts +211 -206
  50. package/src/payments/p2tr.ts +9 -4
  51. package/src/payments/p2wpkh.ts +7 -3
  52. package/src/payments/p2wsh.ts +7 -3
  53. package/src/psbt/psbtutils.ts +322 -320
  54. package/src/psbt.ts +5 -3
  55. package/test/payments.spec.ts +2 -2
package/src/psbt.ts CHANGED
@@ -23,7 +23,7 @@ import { cloneBuffer, reverseBuffer } from './bufferutils.js';
23
23
  import { payments } from './index.js';
24
24
  import { bitcoin as btcNetwork, Network } from './networks.js';
25
25
  import { tapleafHash } from './payments/bip341.js';
26
- import { Payment, PaymentOpts } from './payments/index.js';
26
+ import { P2SHPayment, Payment, PaymentOpts } from './payments/index.js';
27
27
  import {
28
28
  checkTaprootInputFields,
29
29
  checkTaprootInputForSigs,
@@ -1284,7 +1284,9 @@ function canFinalize(input: PsbtInput, script: Buffer, scriptType: string): bool
1284
1284
  case 'witnesspubkeyhash':
1285
1285
  return hasSigs(1, input.partialSig);
1286
1286
  case 'multisig':
1287
- const p2ms = payments.p2ms({ output: script });
1287
+ const p2ms = payments.p2ms({
1288
+ output: script,
1289
+ });
1288
1290
  return hasSigs(p2ms.m!, input.partialSig, p2ms.pubkeys);
1289
1291
  case 'nonstandard':
1290
1292
  return true;
@@ -1412,7 +1414,7 @@ function scriptCheckerFactory(
1412
1414
  ): void => {
1413
1415
  const redeemScriptOutput = payment({
1414
1416
  redeem: { output: redeemScript },
1415
- }).output as Buffer;
1417
+ } as P2SHPayment).output as Buffer;
1416
1418
 
1417
1419
  if (!scriptPubKey.equals(redeemScriptOutput)) {
1418
1420
  throw new Error(
@@ -4,7 +4,7 @@ import { describe, it } from 'mocha';
4
4
  import { initEccLib, PaymentCreator } from '../src/index.js';
5
5
  import * as u from './payments.utils.js';
6
6
  import fs from 'node:fs';
7
- import { p2pk, p2wsh } from '../src/payments/index.js';
7
+ import { p2pk, P2SHPayment, p2wsh } from '../src/payments/index.js';
8
8
 
9
9
  const require = async (name: string) => {
10
10
  const mod = await import(name);
@@ -68,7 +68,7 @@ const require = async (name: string) => {
68
68
  ),
69
69
  }),
70
70
  }),
71
- });
71
+ } as P2SHPayment);
72
72
  assert.strictEqual(actual.address, '3MGbrbye4ttNUXM8WAvBFRKry4fkS9fjuw');
73
73
  assert.strictEqual(actual.name, 'p2sh-p2wsh-p2pk');
74
74
  assert.strictEqual(actual.redeem!.name, 'p2wsh-p2pk');