@btc-vision/bitcoin 7.0.0-alpha.0 → 7.0.0-alpha.10
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/README.md +455 -155
- package/browser/address.d.ts +6 -2
- package/browser/address.d.ts.map +1 -1
- package/browser/block.d.ts.map +1 -1
- package/browser/branded.d.ts +3 -14
- package/browser/branded.d.ts.map +1 -1
- package/browser/chunks/psbt-parallel-BBFlkmiv.js +10717 -0
- package/browser/crypto.d.ts +1 -1
- package/browser/ecc/context.d.ts +25 -24
- package/browser/ecc/context.d.ts.map +1 -1
- package/browser/ecc/index.d.ts +1 -1
- package/browser/ecc/index.d.ts.map +1 -1
- package/browser/ecc/types.d.ts +10 -123
- package/browser/ecc/types.d.ts.map +1 -1
- package/browser/env.d.ts +13 -0
- package/browser/env.d.ts.map +1 -0
- package/browser/index.d.ts +7 -7
- package/browser/index.d.ts.map +1 -1
- package/browser/index.js +2497 -11686
- package/browser/io/BinaryReader.d.ts +15 -15
- package/browser/io/BinaryReader.d.ts.map +1 -1
- package/browser/io/BinaryWriter.d.ts +17 -17
- package/browser/io/BinaryWriter.d.ts.map +1 -1
- package/browser/io/hex.d.ts.map +1 -1
- package/browser/io/index.d.ts +0 -1
- package/browser/io/index.d.ts.map +1 -1
- package/browser/opcodes.d.ts +11 -0
- package/browser/opcodes.d.ts.map +1 -1
- package/browser/payments/bip341.d.ts +1 -1
- package/browser/payments/bip341.d.ts.map +1 -1
- package/browser/payments/embed.d.ts +1 -1
- package/browser/payments/embed.d.ts.map +1 -1
- package/browser/payments/p2ms.d.ts.map +1 -1
- package/browser/payments/p2op.d.ts +1 -1
- package/browser/payments/p2op.d.ts.map +1 -1
- package/browser/payments/p2pk.d.ts +1 -1
- package/browser/payments/p2pk.d.ts.map +1 -1
- package/browser/payments/p2pkh.d.ts +1 -1
- package/browser/payments/p2pkh.d.ts.map +1 -1
- package/browser/payments/p2sh.d.ts.map +1 -1
- package/browser/payments/p2tr.d.ts +2 -2
- package/browser/payments/p2tr.d.ts.map +1 -1
- package/browser/payments/p2wpkh.d.ts +1 -1
- package/browser/payments/p2wpkh.d.ts.map +1 -1
- package/browser/payments/p2wsh.d.ts.map +1 -1
- package/browser/payments/types.d.ts +1 -1
- package/browser/payments/types.d.ts.map +1 -1
- package/browser/psbt/PsbtCache.d.ts +54 -0
- package/browser/psbt/PsbtCache.d.ts.map +1 -0
- package/browser/psbt/PsbtFinalizer.d.ts +21 -0
- package/browser/psbt/PsbtFinalizer.d.ts.map +1 -0
- package/browser/psbt/PsbtSigner.d.ts +32 -0
- package/browser/psbt/PsbtSigner.d.ts.map +1 -0
- package/browser/psbt/PsbtTransaction.d.ts +25 -0
- package/browser/psbt/PsbtTransaction.d.ts.map +1 -0
- package/browser/psbt/bip371.d.ts.map +1 -1
- package/browser/psbt/types.d.ts +5 -71
- package/browser/psbt/types.d.ts.map +1 -1
- package/browser/psbt/validation.d.ts +1 -1
- package/browser/psbt/validation.d.ts.map +1 -1
- package/browser/psbt.d.ts +26 -40
- package/browser/psbt.d.ts.map +1 -1
- package/browser/script.d.ts.map +1 -1
- package/browser/transaction.d.ts +4 -4
- package/browser/transaction.d.ts.map +1 -1
- package/browser/types.d.ts +5 -3
- package/browser/types.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.d.ts +24 -17
- package/browser/workers/WorkerSigningPool.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.node.d.ts +19 -12
- package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -1
- package/browser/workers/WorkerSigningPool.sequential.d.ts +67 -0
- package/browser/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.worklet.d.ts +64 -0
- package/browser/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
- package/browser/workers/index.browser.d.ts +16 -0
- package/browser/workers/index.browser.d.ts.map +1 -0
- package/browser/workers/index.d.ts +4 -64
- package/browser/workers/index.d.ts.map +1 -1
- package/browser/workers/index.js +28 -0
- package/browser/workers/index.node.d.ts +17 -0
- package/browser/workers/index.node.d.ts.map +1 -0
- package/browser/workers/index.react-native.d.ts +28 -0
- package/browser/workers/index.react-native.d.ts.map +1 -0
- package/browser/workers/index.shared.d.ts +15 -0
- package/browser/workers/index.shared.d.ts.map +1 -0
- package/browser/workers/psbt-parallel.d.ts +2 -3
- package/browser/workers/psbt-parallel.d.ts.map +1 -1
- package/browser/workers/types.d.ts +17 -0
- package/browser/workers/types.d.ts.map +1 -1
- package/build/address.d.ts +6 -2
- package/build/address.d.ts.map +1 -1
- package/build/address.js +32 -19
- package/build/address.js.map +1 -1
- package/build/bech32utils.js.map +1 -1
- package/build/block.d.ts.map +1 -1
- package/build/block.js +2 -4
- package/build/block.js.map +1 -1
- package/build/branded.d.ts +3 -14
- package/build/branded.d.ts.map +1 -1
- package/build/branded.js +0 -5
- package/build/branded.js.map +1 -1
- package/build/crypto.d.ts +1 -1
- package/build/ecc/context.d.ts +25 -24
- package/build/ecc/context.d.ts.map +1 -1
- package/build/ecc/context.js +29 -101
- package/build/ecc/context.js.map +1 -1
- package/build/ecc/index.d.ts +1 -1
- package/build/ecc/index.d.ts.map +1 -1
- package/build/ecc/types.d.ts +7 -126
- package/build/ecc/types.d.ts.map +1 -1
- package/build/ecc/types.js +4 -1
- package/build/ecc/types.js.map +1 -1
- package/build/env.d.ts +13 -0
- package/build/env.d.ts.map +1 -0
- package/build/env.js +198 -0
- package/build/env.js.map +1 -0
- package/build/index.d.ts +8 -7
- package/build/index.d.ts.map +1 -1
- package/build/index.js +9 -7
- package/build/index.js.map +1 -1
- package/build/io/BinaryReader.d.ts +15 -15
- package/build/io/BinaryReader.d.ts.map +1 -1
- package/build/io/BinaryReader.js +17 -17
- package/build/io/BinaryReader.js.map +1 -1
- package/build/io/BinaryWriter.d.ts +17 -17
- package/build/io/BinaryWriter.d.ts.map +1 -1
- package/build/io/BinaryWriter.js +39 -39
- package/build/io/BinaryWriter.js.map +1 -1
- package/build/io/hex.d.ts.map +1 -1
- package/build/io/hex.js +2 -1
- package/build/io/hex.js.map +1 -1
- package/build/io/index.d.ts +0 -1
- package/build/io/index.d.ts.map +1 -1
- package/build/io/index.js +0 -2
- package/build/io/index.js.map +1 -1
- package/build/opcodes.d.ts +11 -0
- package/build/opcodes.d.ts.map +1 -1
- package/build/opcodes.js +19 -4
- package/build/opcodes.js.map +1 -1
- package/build/payments/bip341.d.ts +1 -2
- package/build/payments/bip341.d.ts.map +1 -1
- package/build/payments/bip341.js +1 -2
- package/build/payments/bip341.js.map +1 -1
- package/build/payments/embed.d.ts +1 -1
- package/build/payments/embed.d.ts.map +1 -1
- package/build/payments/embed.js +14 -14
- package/build/payments/embed.js.map +1 -1
- package/build/payments/p2ms.d.ts.map +1 -1
- package/build/payments/p2ms.js +21 -21
- package/build/payments/p2ms.js.map +1 -1
- package/build/payments/p2op.d.ts +1 -1
- package/build/payments/p2op.d.ts.map +1 -1
- package/build/payments/p2op.js +18 -18
- package/build/payments/p2op.js.map +1 -1
- package/build/payments/p2pk.d.ts +1 -1
- package/build/payments/p2pk.d.ts.map +1 -1
- package/build/payments/p2pk.js +17 -17
- package/build/payments/p2pk.js.map +1 -1
- package/build/payments/p2pkh.d.ts +1 -1
- package/build/payments/p2pkh.d.ts.map +1 -1
- package/build/payments/p2pkh.js +20 -20
- package/build/payments/p2pkh.js.map +1 -1
- package/build/payments/p2sh.d.ts.map +1 -1
- package/build/payments/p2sh.js +22 -20
- package/build/payments/p2sh.js.map +1 -1
- package/build/payments/p2tr.d.ts +2 -2
- package/build/payments/p2tr.d.ts.map +1 -1
- package/build/payments/p2tr.js +25 -26
- package/build/payments/p2tr.js.map +1 -1
- package/build/payments/p2wpkh.d.ts +1 -1
- package/build/payments/p2wpkh.d.ts.map +1 -1
- package/build/payments/p2wpkh.js +20 -20
- package/build/payments/p2wpkh.js.map +1 -1
- package/build/payments/p2wsh.d.ts.map +1 -1
- package/build/payments/p2wsh.js +22 -22
- package/build/payments/p2wsh.js.map +1 -1
- package/build/payments/types.d.ts +1 -1
- package/build/payments/types.d.ts.map +1 -1
- package/build/psbt/PsbtCache.d.ts +54 -0
- package/build/psbt/PsbtCache.d.ts.map +1 -0
- package/build/psbt/PsbtCache.js +249 -0
- package/build/psbt/PsbtCache.js.map +1 -0
- package/build/psbt/PsbtFinalizer.d.ts +21 -0
- package/build/psbt/PsbtFinalizer.d.ts.map +1 -0
- package/build/psbt/PsbtFinalizer.js +157 -0
- package/build/psbt/PsbtFinalizer.js.map +1 -0
- package/build/psbt/PsbtSigner.d.ts +32 -0
- package/build/psbt/PsbtSigner.d.ts.map +1 -0
- package/build/psbt/PsbtSigner.js +192 -0
- package/build/psbt/PsbtSigner.js.map +1 -0
- package/build/psbt/PsbtTransaction.d.ts +25 -0
- package/build/psbt/PsbtTransaction.d.ts.map +1 -0
- package/build/psbt/PsbtTransaction.js +61 -0
- package/build/psbt/PsbtTransaction.js.map +1 -0
- package/build/psbt/bip371.d.ts.map +1 -1
- package/build/psbt/bip371.js +6 -2
- package/build/psbt/bip371.js.map +1 -1
- package/build/psbt/psbtutils.js +1 -1
- package/build/psbt/psbtutils.js.map +1 -1
- package/build/psbt/types.d.ts +5 -71
- package/build/psbt/types.d.ts.map +1 -1
- package/build/psbt/validation.d.ts +1 -1
- package/build/psbt/validation.d.ts.map +1 -1
- package/build/psbt/validation.js +1 -1
- package/build/psbt/validation.js.map +1 -1
- package/build/psbt.d.ts +26 -40
- package/build/psbt.d.ts.map +1 -1
- package/build/psbt.js +180 -808
- package/build/psbt.js.map +1 -1
- package/build/script.d.ts.map +1 -1
- package/build/script.js +4 -4
- package/build/script.js.map +1 -1
- package/build/transaction.d.ts +4 -4
- package/build/transaction.d.ts.map +1 -1
- package/build/transaction.js +6 -5
- package/build/transaction.js.map +1 -1
- package/build/tsconfig.build.tsbuildinfo +1 -1
- package/build/types.d.ts +5 -3
- package/build/types.d.ts.map +1 -1
- package/build/types.js +14 -25
- package/build/types.js.map +1 -1
- package/build/workers/WorkerSigningPool.d.ts +24 -17
- package/build/workers/WorkerSigningPool.d.ts.map +1 -1
- package/build/workers/WorkerSigningPool.js +36 -25
- package/build/workers/WorkerSigningPool.js.map +1 -1
- package/build/workers/WorkerSigningPool.node.d.ts +19 -12
- package/build/workers/WorkerSigningPool.node.d.ts.map +1 -1
- package/build/workers/WorkerSigningPool.node.js +60 -28
- package/build/workers/WorkerSigningPool.node.js.map +1 -1
- package/build/workers/WorkerSigningPool.sequential.d.ts +76 -0
- package/build/workers/WorkerSigningPool.sequential.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.sequential.js +160 -0
- package/build/workers/WorkerSigningPool.sequential.js.map +1 -0
- package/build/workers/WorkerSigningPool.worklet.d.ts +79 -0
- package/build/workers/WorkerSigningPool.worklet.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.worklet.js +390 -0
- package/build/workers/WorkerSigningPool.worklet.js.map +1 -0
- package/build/workers/index.browser.d.ts +24 -0
- package/build/workers/index.browser.d.ts.map +1 -0
- package/build/workers/index.browser.js +30 -0
- package/build/workers/index.browser.js.map +1 -0
- package/build/workers/index.d.ts +6 -18
- package/build/workers/index.d.ts.map +1 -1
- package/build/workers/index.js +12 -14
- package/build/workers/index.js.map +1 -1
- package/build/workers/index.node.d.ts +38 -0
- package/build/workers/index.node.d.ts.map +1 -0
- package/build/workers/index.node.js +45 -0
- package/build/workers/index.node.js.map +1 -0
- package/build/workers/index.react-native.d.ts +28 -0
- package/build/workers/index.react-native.d.ts.map +1 -0
- package/build/workers/index.react-native.js +67 -0
- package/build/workers/index.react-native.js.map +1 -0
- package/build/workers/index.shared.d.ts +15 -0
- package/build/workers/index.shared.d.ts.map +1 -0
- package/build/workers/index.shared.js +20 -0
- package/build/workers/index.shared.js.map +1 -0
- package/build/workers/psbt-parallel.d.ts +2 -3
- package/build/workers/psbt-parallel.d.ts.map +1 -1
- package/build/workers/psbt-parallel.js +4 -4
- package/build/workers/psbt-parallel.js.map +1 -1
- package/build/workers/types.d.ts +17 -0
- package/build/workers/types.d.ts.map +1 -1
- package/build/workers/types.js.map +1 -1
- package/package.json +48 -9
- package/src/address.ts +53 -21
- package/src/bech32utils.ts +3 -3
- package/src/block.ts +17 -10
- package/src/branded.ts +15 -13
- package/src/crypto.ts +1 -1
- package/src/ecc/context.ts +36 -136
- package/src/ecc/index.ts +2 -2
- package/src/ecc/types.ts +7 -145
- package/src/env.ts +239 -0
- package/src/index.ts +57 -22
- package/src/io/BinaryReader.ts +18 -18
- package/src/io/BinaryWriter.ts +43 -43
- package/src/io/hex.ts +2 -1
- package/src/io/index.ts +0 -3
- package/src/opcodes.ts +21 -4
- package/src/payments/bip341.ts +5 -7
- package/src/payments/embed.ts +19 -19
- package/src/payments/p2ms.ts +34 -27
- package/src/payments/p2op.ts +22 -22
- package/src/payments/p2pk.ts +22 -22
- package/src/payments/p2pkh.ts +28 -28
- package/src/payments/p2sh.ts +33 -30
- package/src/payments/p2tr.ts +40 -40
- package/src/payments/p2wpkh.ts +30 -30
- package/src/payments/p2wsh.ts +29 -29
- package/src/payments/types.ts +1 -1
- package/src/psbt/PsbtCache.ts +325 -0
- package/src/psbt/PsbtFinalizer.ts +213 -0
- package/src/psbt/PsbtSigner.ts +302 -0
- package/src/psbt/PsbtTransaction.ts +82 -0
- package/src/psbt/bip371.ts +7 -3
- package/src/psbt/psbtutils.ts +1 -1
- package/src/psbt/types.ts +5 -94
- package/src/psbt/validation.ts +5 -12
- package/src/psbt.ts +376 -1201
- package/src/script.ts +6 -9
- package/src/transaction.ts +19 -15
- package/src/types.ts +33 -45
- package/src/workers/WorkerSigningPool.node.ts +72 -36
- package/src/workers/WorkerSigningPool.sequential.ts +191 -0
- package/src/workers/WorkerSigningPool.ts +48 -39
- package/src/workers/WorkerSigningPool.worklet.ts +522 -0
- package/src/workers/index.browser.ts +34 -0
- package/src/workers/index.node.ts +50 -0
- package/src/workers/index.react-native.ts +110 -0
- package/src/workers/index.shared.ts +58 -0
- package/src/workers/index.ts +14 -65
- package/src/workers/psbt-parallel.ts +8 -13
- package/src/workers/types.ts +26 -1
- package/test/address.spec.ts +2 -2
- package/test/bitcoin.core.spec.ts +5 -2
- package/test/browser/payments.spec.ts +151 -0
- package/test/browser/psbt.spec.ts +1510 -0
- package/test/browser/script.spec.ts +223 -0
- package/test/browser/setup.ts +13 -0
- package/test/browser/workers-signing.spec.ts +537 -0
- package/test/crypto.spec.ts +2 -2
- package/test/env.spec.ts +418 -0
- package/test/fixtures/core/base58_encode_decode.json +12 -48
- package/test/fixtures/core/base58_keys_invalid.json +50 -150
- package/test/fixtures/core/sighash.json +1 -3
- package/test/fixtures/core/tx_valid.json +133 -501
- package/test/fixtures/embed.json +3 -11
- package/test/fixtures/p2ms.json +21 -91
- package/test/fixtures/p2pk.json +5 -24
- package/test/fixtures/p2pkh.json +7 -36
- package/test/fixtures/p2sh.json +8 -54
- package/test/fixtures/p2tr.json +2 -6
- package/test/fixtures/p2wpkh.json +7 -36
- package/test/fixtures/p2wsh.json +14 -59
- package/test/fixtures/psbt.json +2 -6
- package/test/fixtures/script.json +12 -48
- package/test/integration/addresses.spec.ts +11 -5
- package/test/integration/bip32.spec.ts +1 -1
- package/test/integration/cltv.spec.ts +10 -6
- package/test/integration/csv.spec.ts +10 -9
- package/test/integration/payments.spec.ts +8 -4
- package/test/integration/taproot.spec.ts +26 -6
- package/test/integration/transactions.spec.ts +22 -8
- package/test/payments.spec.ts +1 -1
- package/test/payments.utils.ts +1 -1
- package/test/psbt.spec.ts +250 -64
- package/test/script_signature.spec.ts +1 -1
- package/test/transaction.spec.ts +18 -5
- package/test/tsconfig.json +6 -20
- package/test/workers-pool.spec.ts +65 -23
- package/test/workers-sequential.spec.ts +669 -0
- package/test/workers-signing.spec.ts +7 -3
- package/test/workers-worklet.spec.ts +500 -0
- package/test/workers.spec.ts +6 -7
- package/typedoc.json +39 -0
- package/vite.config.browser.ts +31 -6
- package/vitest.config.browser.ts +68 -0
- package/browser/ecpair.d.ts +0 -99
- package/browser/io/MemoryPool.d.ts +0 -220
- package/browser/io/MemoryPool.d.ts.map +0 -1
- package/build/io/MemoryPool.d.ts +0 -220
- package/build/io/MemoryPool.d.ts.map +0 -1
- package/build/io/MemoryPool.js +0 -309
- package/build/io/MemoryPool.js.map +0 -1
- package/src/ecpair.d.ts +0 -99
- package/src/io/MemoryPool.ts +0 -343
- package/test/taproot-cache.spec.ts +0 -694
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
{
|
|
4
4
|
"asm": "OP_1NEGATE",
|
|
5
5
|
"script": "4f",
|
|
6
|
-
"stack": [
|
|
7
|
-
"81"
|
|
8
|
-
]
|
|
6
|
+
"stack": ["81"]
|
|
9
7
|
},
|
|
10
8
|
{
|
|
11
9
|
"asm": "304402207515cf147d201f411092e6be5a64a6006f9308fad7b2a8fdaab22cd86ce764c202200974b8aca7bf51dbf54150d3884e1ae04f675637b926ec33bf75939446f6ca2801",
|
|
@@ -74,18 +72,12 @@
|
|
|
74
72
|
{
|
|
75
73
|
"asm": "OP_0 aa4d7985c57e011a8b3dd8e0e5a73aaef41629c5",
|
|
76
74
|
"script": "0014aa4d7985c57e011a8b3dd8e0e5a73aaef41629c5",
|
|
77
|
-
"stack": [
|
|
78
|
-
"",
|
|
79
|
-
"aa4d7985c57e011a8b3dd8e0e5a73aaef41629c5"
|
|
80
|
-
]
|
|
75
|
+
"stack": ["", "aa4d7985c57e011a8b3dd8e0e5a73aaef41629c5"]
|
|
81
76
|
},
|
|
82
77
|
{
|
|
83
78
|
"asm": "OP_0 32447752937d355ca2defddcd1f6b4fc53d182f8901cebbcff42f5e381bf0b80",
|
|
84
79
|
"script": "002032447752937d355ca2defddcd1f6b4fc53d182f8901cebbcff42f5e381bf0b80",
|
|
85
|
-
"stack": [
|
|
86
|
-
"",
|
|
87
|
-
"32447752937d355ca2defddcd1f6b4fc53d182f8901cebbcff42f5e381bf0b80"
|
|
88
|
-
]
|
|
80
|
+
"stack": ["", "32447752937d355ca2defddcd1f6b4fc53d182f8901cebbcff42f5e381bf0b80"]
|
|
89
81
|
},
|
|
90
82
|
{
|
|
91
83
|
"asm": "OP_RETURN 06deadbeef03f895a2ad89fb6d696497af486cb7c644a27aa568c7a18dd06113401115185474",
|
|
@@ -112,12 +104,7 @@
|
|
|
112
104
|
{
|
|
113
105
|
"asm": "OP_0 OP_0 OP_0 OP_0",
|
|
114
106
|
"script": "00000000",
|
|
115
|
-
"stack": [
|
|
116
|
-
"",
|
|
117
|
-
"",
|
|
118
|
-
"",
|
|
119
|
-
""
|
|
120
|
-
]
|
|
107
|
+
"stack": ["", "", "", ""]
|
|
121
108
|
},
|
|
122
109
|
{
|
|
123
110
|
"asm": "OP_0 OP_0 30450221009c92c1ae1767ac04e424da7f6db045d979b08cde86b1ddba48621d59a109d818022004f5bb21ad72255177270abaeb2d7940ac18f1e5ca1f53db4f3fd1045647a8a801 52410479be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b84104c6047f9441ed7d6d3045406e95c07cd85c778e4b8cef3ca7abac09b95c709ee51ae168fea63dc339a3c58419466ceaeef7f632653266d0e1236431a950cfe52a52ae",
|
|
@@ -140,24 +127,17 @@
|
|
|
140
127
|
{
|
|
141
128
|
"asm": "OP_0",
|
|
142
129
|
"script": "00",
|
|
143
|
-
"stack": [
|
|
144
|
-
""
|
|
145
|
-
]
|
|
130
|
+
"stack": [""]
|
|
146
131
|
},
|
|
147
132
|
{
|
|
148
133
|
"asm": "OP_0 00",
|
|
149
134
|
"script": "000100",
|
|
150
|
-
"stack": [
|
|
151
|
-
"",
|
|
152
|
-
"00"
|
|
153
|
-
]
|
|
135
|
+
"stack": ["", "00"]
|
|
154
136
|
},
|
|
155
137
|
{
|
|
156
138
|
"asm": "OP_6",
|
|
157
139
|
"script": "56",
|
|
158
|
-
"stack": [
|
|
159
|
-
"06"
|
|
160
|
-
],
|
|
140
|
+
"stack": ["06"],
|
|
161
141
|
"nonstandard": {
|
|
162
142
|
"scriptSig": "OP_6",
|
|
163
143
|
"scriptSigHex": "0106"
|
|
@@ -306,9 +286,7 @@
|
|
|
306
286
|
},
|
|
307
287
|
{
|
|
308
288
|
"type": "nulldata",
|
|
309
|
-
"data": [
|
|
310
|
-
"deadffffffffffffffffffffffffffffffffbeef"
|
|
311
|
-
],
|
|
289
|
+
"data": ["deadffffffffffffffffffffffffffffffffbeef"],
|
|
312
290
|
"output": "OP_RETURN deadffffffffffffffffffffffffffffffffbeef",
|
|
313
291
|
"outputHex": "6a14deadffffffffffffffffffffffffffffffffbeef"
|
|
314
292
|
},
|
|
@@ -342,19 +320,10 @@
|
|
|
342
320
|
"02b80011a883a0fd621ad46dfc405df1e74bf075cbaf700fd4aebef6e96f848340",
|
|
343
321
|
"024289801366bcee6172b771cf5a7f13aaecd237a0b9a1ff9d769cabc2e6b70a34"
|
|
344
322
|
],
|
|
345
|
-
"signatures": [
|
|
346
|
-
null,
|
|
347
|
-
null,
|
|
348
|
-
null
|
|
349
|
-
],
|
|
323
|
+
"signatures": [null, null, null],
|
|
350
324
|
"input": "OP_0 OP_0 OP_0 OP_0",
|
|
351
325
|
"inputHex": "00000000",
|
|
352
|
-
"inputStack": [
|
|
353
|
-
"",
|
|
354
|
-
"",
|
|
355
|
-
"",
|
|
356
|
-
""
|
|
357
|
-
]
|
|
326
|
+
"inputStack": ["", "", "", ""]
|
|
358
327
|
},
|
|
359
328
|
{
|
|
360
329
|
"type": "scripthash",
|
|
@@ -406,10 +375,7 @@
|
|
|
406
375
|
"type": "nonstandard",
|
|
407
376
|
"input": "OP_0 00",
|
|
408
377
|
"inputHex": "000100",
|
|
409
|
-
"inputStack": [
|
|
410
|
-
"",
|
|
411
|
-
"00"
|
|
412
|
-
]
|
|
378
|
+
"inputStack": ["", "00"]
|
|
413
379
|
},
|
|
414
380
|
{
|
|
415
381
|
"type": "nonstandard",
|
|
@@ -419,9 +385,7 @@
|
|
|
419
385
|
"input": "06",
|
|
420
386
|
"inputHex": "0106"
|
|
421
387
|
},
|
|
422
|
-
"inputStack": [
|
|
423
|
-
"06"
|
|
424
|
-
]
|
|
388
|
+
"inputStack": ["06"]
|
|
425
389
|
},
|
|
426
390
|
{
|
|
427
391
|
"type": "nonstandard",
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
|
-
import { ECPairFactory } from 'ecpair';
|
|
3
|
-
import * as ecc from 'tiny-secp256k1';
|
|
4
2
|
import { describe, it } from 'vitest';
|
|
5
|
-
import * as bitcoin from '../../src/index.js';
|
|
6
3
|
import type { PublicKey } from '../../src/index.js';
|
|
4
|
+
import * as bitcoin from '../../src/index.js';
|
|
7
5
|
import { regtestUtils } from './_regtest.js';
|
|
8
|
-
|
|
9
|
-
|
|
6
|
+
import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
|
|
7
|
+
import type { Network } from '../../src/networks.js';
|
|
8
|
+
|
|
9
|
+
const backend = createNobleBackend();
|
|
10
|
+
const ECPair = {
|
|
11
|
+
makeRandom: (opts?: { network?: Network }) =>
|
|
12
|
+
ECPairSigner.makeRandom(backend, opts?.network ?? bitcoin.networks.bitcoin),
|
|
13
|
+
fromWIF: (wif: string, network?: Network | Network[]) =>
|
|
14
|
+
ECPairSigner.fromWIF(backend, wif, network ?? bitcoin.networks.bitcoin),
|
|
15
|
+
};
|
|
10
16
|
const dhttp = regtestUtils.dhttp;
|
|
11
17
|
const TESTNET = bitcoin.networks.testnet;
|
|
12
18
|
|
|
@@ -3,8 +3,8 @@ import { BIP32Factory } from '@btc-vision/bip32';
|
|
|
3
3
|
import * as ecc from 'tiny-secp256k1';
|
|
4
4
|
import * as bip39 from 'bip39';
|
|
5
5
|
import { describe, it } from 'vitest';
|
|
6
|
-
import * as bitcoin from '../../src/index.js';
|
|
7
6
|
import type { PublicKey } from '../../src/index.js';
|
|
7
|
+
import * as bitcoin from '../../src/index.js';
|
|
8
8
|
|
|
9
9
|
const bip32 = BIP32Factory(ecc);
|
|
10
10
|
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
|
-
import { ECPairFactory } from 'ecpair';
|
|
3
|
-
import * as ecc from 'tiny-secp256k1';
|
|
4
2
|
import { beforeAll, describe, it } from 'vitest';
|
|
3
|
+
import type { Bytes32, Satoshi, Script } from '../../src/index.js';
|
|
5
4
|
import * as bitcoin from '../../src/index.js';
|
|
6
|
-
import {
|
|
7
|
-
import type { Script, Bytes32, Satoshi } from '../../src/index.js';
|
|
5
|
+
import { fromHex, reverseCopy, toHex } from '../../src/index.js';
|
|
8
6
|
import { regtestUtils } from './_regtest.js';
|
|
9
7
|
|
|
10
8
|
// @ts-ignore
|
|
11
9
|
import bip65 from 'bip65';
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
|
|
11
|
+
import type { Network } from '../../src/networks.js';
|
|
12
|
+
|
|
13
|
+
const backend = createNobleBackend();
|
|
14
|
+
const ECPair = {
|
|
15
|
+
fromWIF: (wif: string, network?: Network | Network[]) =>
|
|
16
|
+
ECPairSigner.fromWIF(backend, wif, network ?? bitcoin.networks.bitcoin),
|
|
17
|
+
};
|
|
14
18
|
const regtest = regtestUtils.network;
|
|
15
19
|
|
|
16
20
|
function toOutputScript(address: string): Script {
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
|
-
import { ECPairFactory } from 'ecpair';
|
|
3
|
-
import * as ecc from 'tiny-secp256k1';
|
|
4
2
|
import { beforeAll, describe, it } from 'vitest';
|
|
3
|
+
import type { Bytes32, PsbtInput, Satoshi, Script } from '../../src/index.js';
|
|
5
4
|
import * as bitcoin from '../../src/index.js';
|
|
6
|
-
import
|
|
7
|
-
import { toHex, fromHex, reverseCopy } from '../../src/index.js';
|
|
8
|
-
import type { Script, Bytes32, Satoshi } from '../../src/index.js';
|
|
5
|
+
import { fromHex, reverseCopy, toHex } from '../../src/index.js';
|
|
9
6
|
import { regtestUtils } from './_regtest.js';
|
|
10
7
|
|
|
11
8
|
// @ts-ignore
|
|
12
9
|
import bip68 from 'bip68';
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
const
|
|
10
|
+
import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
|
|
11
|
+
import type { Network } from '../../src/networks.js';
|
|
12
|
+
|
|
13
|
+
const backend = createNobleBackend();
|
|
14
|
+
const ECPair = {
|
|
15
|
+
fromWIF: (wif: string, network?: Network | Network[]) =>
|
|
16
|
+
ECPairSigner.fromWIF(backend, wif, network ?? bitcoin.networks.bitcoin),
|
|
17
|
+
};
|
|
17
18
|
const regtest = regtestUtils.network;
|
|
18
19
|
|
|
19
20
|
function toOutputScript(address: string): Script {
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import * as ecc from 'tiny-secp256k1';
|
|
1
|
+
import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
|
|
3
2
|
import { describe, it } from 'vitest';
|
|
3
|
+
import type { Satoshi } from '../../src/index.js';
|
|
4
4
|
import * as bitcoin from '../../src/index.js';
|
|
5
5
|
import { fromHex } from '../../src/index.js';
|
|
6
|
-
import type { Satoshi } from '../../src/index.js';
|
|
7
6
|
import { regtestUtils } from './_regtest.js';
|
|
8
7
|
import * as fs from 'node:fs';
|
|
8
|
+
import type { Network } from '../../src/networks.js';
|
|
9
9
|
|
|
10
|
-
const
|
|
10
|
+
const backend = createNobleBackend();
|
|
11
|
+
const ECPair = {
|
|
12
|
+
makeRandom: (opts?: { network?: Network }) =>
|
|
13
|
+
ECPairSigner.makeRandom(backend, opts?.network ?? bitcoin.networks.bitcoin),
|
|
14
|
+
};
|
|
11
15
|
const NETWORK = regtestUtils.network;
|
|
12
16
|
const keyPairs = [ECPair.makeRandom({ network: NETWORK }), ECPair.makeRandom({ network: NETWORK })];
|
|
13
17
|
|
|
@@ -3,10 +3,19 @@ import { BIP32Factory } from '@btc-vision/bip32';
|
|
|
3
3
|
import * as bip39 from 'bip39';
|
|
4
4
|
import * as ecc from 'tiny-secp256k1';
|
|
5
5
|
import { describe, it } from 'vitest';
|
|
6
|
-
import {
|
|
6
|
+
import { broadcastAndVerify, regtestUtils } from './_regtest.js';
|
|
7
|
+
import type {
|
|
8
|
+
EccLib,
|
|
9
|
+
PsbtInput,
|
|
10
|
+
PublicKey,
|
|
11
|
+
Satoshi,
|
|
12
|
+
TapLeaf,
|
|
13
|
+
TapLeafScript,
|
|
14
|
+
Taptree,
|
|
15
|
+
XOnlyPublicKey,
|
|
16
|
+
} from '../../src/index.js';
|
|
7
17
|
import * as bitcoin from '../../src/index.js';
|
|
8
|
-
import {
|
|
9
|
-
import type { PsbtInput, TapLeaf, TapLeafScript, Taptree, XOnlyPublicKey, PublicKey, Satoshi, Bytes32, EccLib } from '../../src/index.js';
|
|
18
|
+
import { concat, fromHex, toHex } from '../../src/index.js';
|
|
10
19
|
import { LEAF_VERSION_TAPSCRIPT } from '../../src/payments/bip341.js';
|
|
11
20
|
import { tapTreeFromList, tapTreeToList } from '../../src/psbt/bip371.js';
|
|
12
21
|
import { witnessStackToScriptWitness } from '../../src/psbt/psbtutils.js';
|
|
@@ -59,7 +68,10 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
|
|
|
59
68
|
// amount to send
|
|
60
69
|
const sendAmount = amount - 1e4;
|
|
61
70
|
// Send some sats to the address via faucet. Get the hash and index. (txid/vout)
|
|
62
|
-
const { txId: hash, vout: index } = await regtestUtils.faucetComplex(
|
|
71
|
+
const { txId: hash, vout: index } = await regtestUtils.faucetComplex(
|
|
72
|
+
Buffer.from(output),
|
|
73
|
+
amount,
|
|
74
|
+
);
|
|
63
75
|
// Sent 420000 sats to taproot address
|
|
64
76
|
|
|
65
77
|
const psbt = new bitcoin.Psbt({ network: regtest })
|
|
@@ -583,7 +595,11 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
|
|
|
583
595
|
});
|
|
584
596
|
|
|
585
597
|
it('should fail validating invalid signatures for taproot (See issue #1931)', () => {
|
|
586
|
-
const schnorrValidator = (
|
|
598
|
+
const schnorrValidator = (
|
|
599
|
+
pubkey: Uint8Array,
|
|
600
|
+
msghash: Uint8Array,
|
|
601
|
+
signature: Uint8Array,
|
|
602
|
+
) => {
|
|
587
603
|
return ecc.verifySchnorr(msghash, pubkey, signature);
|
|
588
604
|
};
|
|
589
605
|
|
|
@@ -607,7 +623,11 @@ describe('bitcoinjs-lib (transaction with taproot)', () => {
|
|
|
607
623
|
});
|
|
608
624
|
|
|
609
625
|
it('should succeed validating valid signatures for taproot (See issue #1934)', () => {
|
|
610
|
-
const schnorrValidator = (
|
|
626
|
+
const schnorrValidator = (
|
|
627
|
+
pubkey: Uint8Array,
|
|
628
|
+
msghash: Uint8Array,
|
|
629
|
+
signature: Uint8Array,
|
|
630
|
+
) => {
|
|
611
631
|
return ecc.verifySchnorr(msghash, pubkey, signature);
|
|
612
632
|
};
|
|
613
633
|
|
|
@@ -1,22 +1,33 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
2
|
import { BIP32Factory } from '@btc-vision/bip32';
|
|
3
3
|
import * as ecc from 'tiny-secp256k1';
|
|
4
|
-
import { ECPairFactory } from 'ecpair';
|
|
5
4
|
import { describe, it } from 'vitest';
|
|
5
|
+
import type { MessageHash, PrivateKey, PublicKey, Satoshi, Signature } from '../../src/index.js';
|
|
6
6
|
import * as bitcoin from '../../src/index.js';
|
|
7
|
-
import {
|
|
8
|
-
import type { Satoshi, PublicKey } from '../../src/index.js';
|
|
7
|
+
import { compare, fromHex } from '../../src/index.js';
|
|
9
8
|
import type { HDSigner } from '../../src/psbt/types.js';
|
|
10
|
-
import {
|
|
9
|
+
import { broadcastAndVerify, regtestUtils } from './_regtest.js';
|
|
11
10
|
|
|
12
11
|
import rng from 'randombytes';
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
import { ECPairSigner, createNobleBackend } from '@btc-vision/ecpair';
|
|
13
|
+
import type { Network } from '../../src/networks.js';
|
|
14
|
+
|
|
15
|
+
const backend = createNobleBackend();
|
|
16
|
+
const ECPair = {
|
|
17
|
+
makeRandom: (opts?: { network?: Network }) =>
|
|
18
|
+
ECPairSigner.makeRandom(backend, opts?.network ?? bitcoin.networks.bitcoin),
|
|
19
|
+
fromWIF: (wif: string, network?: Network | Network[]) =>
|
|
20
|
+
ECPairSigner.fromWIF(backend, wif, network ?? bitcoin.networks.bitcoin),
|
|
21
|
+
fromPublicKey: (pubkey: Uint8Array, opts?: { network?: Network }) =>
|
|
22
|
+
ECPairSigner.fromPublicKey(backend, pubkey as PublicKey, opts?.network ?? bitcoin.networks.bitcoin),
|
|
23
|
+
fromPrivateKey: (key: Uint8Array, opts?: { network?: Network }) =>
|
|
24
|
+
ECPairSigner.fromPrivateKey(backend, key as PrivateKey, opts?.network ?? bitcoin.networks.bitcoin),
|
|
25
|
+
};
|
|
15
26
|
const regtest = { ...regtestUtils.network, bech32Opnet: 'opreg' };
|
|
16
27
|
const bip32 = BIP32Factory(ecc);
|
|
17
28
|
|
|
18
29
|
const validator = (pubkey: Uint8Array, msghash: Uint8Array, signature: Uint8Array): boolean =>
|
|
19
|
-
ECPair.fromPublicKey(pubkey).verify(msghash, signature);
|
|
30
|
+
ECPair.fromPublicKey(pubkey).verify(msghash as MessageHash, signature as Signature);
|
|
20
31
|
|
|
21
32
|
// See bottom of file for some helper functions used to make the payment objects needed.
|
|
22
33
|
|
|
@@ -566,7 +577,10 @@ describe('bitcoinjs-lib (transactions with psbt)', () => {
|
|
|
566
577
|
.signInputHD(0, hdRoot as unknown as HDSigner); // must sign with root!!!
|
|
567
578
|
|
|
568
579
|
assert.strictEqual(psbt.validateSignaturesOfInput(0, validator), true);
|
|
569
|
-
assert.strictEqual(
|
|
580
|
+
assert.strictEqual(
|
|
581
|
+
psbt.validateSignaturesOfInput(0, validator, childNode.publicKey as PublicKey),
|
|
582
|
+
true,
|
|
583
|
+
);
|
|
570
584
|
psbt.finalizeAllInputs();
|
|
571
585
|
|
|
572
586
|
const tx = psbt.extractTransaction();
|
package/test/payments.spec.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import assert from 'assert';
|
|
2
2
|
import * as ecc from 'tiny-secp256k1';
|
|
3
3
|
import { beforeEach, describe, it } from 'vitest';
|
|
4
|
-
import { initEccLib } from '../src/index.js';
|
|
5
4
|
import type { EccLib } from '../src/index.js';
|
|
5
|
+
import { initEccLib } from '../src/index.js';
|
|
6
6
|
import type { P2SHPayment, PaymentCreator } from '../src/payments/index.js';
|
|
7
7
|
import { p2pk, p2wsh } from '../src/payments/index.js';
|
|
8
8
|
import * as u from './payments.utils.js';
|
package/test/payments.utils.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as t from 'assert';
|
|
2
2
|
import * as BNETWORKS from '../src/networks.js';
|
|
3
3
|
import * as bscript from '../src/script.js';
|
|
4
|
-
import {
|
|
4
|
+
import { fromHex as ioFromHex, toHex } from '../src/io/index.js';
|
|
5
5
|
|
|
6
6
|
function tryHex(x: Uint8Array | Uint8Array[]): string | string[] {
|
|
7
7
|
if (x instanceof Uint8Array) return toHex(x);
|