@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.
- package/browser/address.d.ts +1 -0
- package/browser/index.js +1 -1
- package/browser/payments/embed.d.ts +2 -2
- package/browser/payments/index.d.ts +61 -12
- package/browser/payments/lazy.d.ts +1 -1
- package/browser/payments/p2ms.d.ts +2 -2
- package/browser/payments/p2op.d.ts +25 -0
- package/browser/payments/p2pk.d.ts +2 -2
- package/browser/payments/p2pkh.d.ts +2 -2
- package/browser/payments/p2sh.d.ts +2 -2
- package/browser/payments/p2tr.d.ts +2 -2
- package/browser/payments/p2wpkh.d.ts +2 -2
- package/browser/payments/p2wsh.d.ts +2 -2
- package/browser/psbt/psbtutils.d.ts +1 -0
- package/build/address.js +4 -5
- package/build/payments/embed.d.ts +2 -2
- package/build/payments/embed.js +6 -2
- package/build/payments/index.d.ts +61 -12
- package/build/payments/index.js +1 -0
- package/build/payments/lazy.d.ts +1 -1
- package/build/payments/p2ms.d.ts +2 -2
- package/build/payments/p2ms.js +8 -2
- package/build/payments/p2op.d.ts +25 -0
- package/build/payments/p2op.js +112 -0
- package/build/payments/p2pk.d.ts +2 -2
- package/build/payments/p2pk.js +5 -1
- package/build/payments/p2pkh.d.ts +2 -2
- package/build/payments/p2pkh.js +5 -1
- package/build/payments/p2sh.d.ts +2 -2
- package/build/payments/p2sh.js +5 -1
- package/build/payments/p2tr.d.ts +2 -2
- package/build/payments/p2tr.js +5 -2
- package/build/payments/p2wpkh.d.ts +2 -2
- package/build/payments/p2wpkh.js +5 -1
- package/build/payments/p2wsh.d.ts +2 -2
- package/build/payments/p2wsh.js +5 -1
- package/build/psbt/psbtutils.d.ts +1 -0
- package/build/psbt/psbtutils.js +2 -0
- package/build/psbt.js +3 -1
- package/package.json +1 -1
- package/src/address.ts +283 -287
- package/src/payments/embed.ts +61 -55
- package/src/payments/index.ts +110 -13
- package/src/payments/lazy.ts +28 -28
- package/src/payments/p2ms.ts +11 -5
- package/src/payments/p2op.ts +170 -0
- package/src/payments/p2pk.ts +93 -85
- package/src/payments/p2pkh.ts +214 -210
- package/src/payments/p2sh.ts +211 -206
- package/src/payments/p2tr.ts +9 -4
- package/src/payments/p2wpkh.ts +7 -3
- package/src/payments/p2wsh.ts +7 -3
- package/src/psbt/psbtutils.ts +322 -320
- package/src/psbt.ts +5 -3
- 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({
|
|
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(
|
package/test/payments.spec.ts
CHANGED
|
@@ -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');
|