@btc-vision/bitcoin 6.5.6 → 7.0.0-alpha.0
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/HOW_TO_WRITE_GOOD_CODE.md +2436 -0
- package/benchmark/psbt-2000-inputs.bench.ts +178 -0
- package/benchmark/signing.bench.ts +147 -0
- package/browser/address.d.ts +56 -9
- package/browser/address.d.ts.map +1 -0
- package/browser/bech32utils.d.ts +9 -1
- package/browser/bech32utils.d.ts.map +1 -0
- package/browser/bip66.d.ts +11 -6
- package/browser/bip66.d.ts.map +1 -0
- package/browser/block.d.ts +117 -11
- package/browser/block.d.ts.map +1 -0
- package/browser/branded.d.ts +20 -0
- package/browser/branded.d.ts.map +1 -0
- package/browser/crypto/crypto.d.ts +1 -0
- package/browser/crypto/crypto.d.ts.map +1 -0
- package/browser/crypto.d.ts +46 -7
- package/browser/crypto.d.ts.map +1 -0
- package/browser/ecc/context.d.ts +129 -0
- package/browser/ecc/context.d.ts.map +1 -0
- package/browser/ecc/index.d.ts +11 -0
- package/browser/ecc/index.d.ts.map +1 -0
- package/browser/ecc/types.d.ts +128 -0
- package/browser/ecc/types.d.ts.map +1 -0
- package/browser/ecpair.d.ts +99 -0
- package/browser/errors.d.ts +124 -0
- package/browser/errors.d.ts.map +1 -0
- package/browser/index.d.ts +32 -5
- package/browser/index.d.ts.map +1 -0
- package/browser/index.js +12482 -101
- package/browser/io/BinaryReader.d.ts +276 -0
- package/browser/io/BinaryReader.d.ts.map +1 -0
- package/browser/io/BinaryWriter.d.ts +391 -0
- package/browser/io/BinaryWriter.d.ts.map +1 -0
- package/browser/io/MemoryPool.d.ts +220 -0
- package/browser/io/MemoryPool.d.ts.map +1 -0
- package/browser/io/base64.d.ts +13 -0
- package/browser/io/base64.d.ts.map +1 -0
- package/browser/io/hex.d.ts +67 -0
- package/browser/io/hex.d.ts.map +1 -0
- package/browser/io/index.d.ts +17 -0
- package/browser/io/index.d.ts.map +1 -0
- package/browser/io/utils.d.ts +199 -0
- package/browser/io/utils.d.ts.map +1 -0
- package/browser/merkle.d.ts +10 -1
- package/browser/merkle.d.ts.map +1 -0
- package/browser/networks.d.ts +70 -9
- package/browser/networks.d.ts.map +1 -0
- package/browser/opcodes.d.ts +1 -0
- package/browser/opcodes.d.ts.map +1 -0
- package/browser/payments/bip341.d.ts +35 -9
- package/browser/payments/bip341.d.ts.map +1 -0
- package/browser/payments/embed.d.ts +112 -1
- package/browser/payments/embed.d.ts.map +1 -0
- package/browser/payments/index.d.ts +17 -10
- package/browser/payments/index.d.ts.map +1 -0
- package/browser/payments/p2ms.d.ts +150 -0
- package/browser/payments/p2ms.d.ts.map +1 -0
- package/browser/payments/p2op.d.ts +150 -24
- package/browser/payments/p2op.d.ts.map +1 -0
- package/browser/payments/p2pk.d.ts +154 -1
- package/browser/payments/p2pk.d.ts.map +1 -0
- package/browser/payments/p2pkh.d.ts +176 -1
- package/browser/payments/p2pkh.d.ts.map +1 -0
- package/browser/payments/p2sh.d.ts +150 -1
- package/browser/payments/p2sh.d.ts.map +1 -0
- package/browser/payments/p2tr.d.ts +185 -1
- package/browser/payments/p2tr.d.ts.map +1 -0
- package/browser/payments/p2wpkh.d.ts +161 -1
- package/browser/payments/p2wpkh.d.ts.map +1 -0
- package/browser/payments/p2wsh.d.ts +146 -1
- package/browser/payments/p2wsh.d.ts.map +1 -0
- package/browser/payments/types.d.ts +94 -64
- package/browser/payments/types.d.ts.map +1 -0
- package/browser/psbt/bip371.d.ts +34 -8
- package/browser/psbt/bip371.d.ts.map +1 -0
- package/browser/psbt/psbtutils.d.ts +56 -16
- package/browser/psbt/psbtutils.d.ts.map +1 -0
- package/browser/psbt/types.d.ts +245 -0
- package/browser/psbt/types.d.ts.map +1 -0
- package/browser/psbt/utils.d.ts +64 -0
- package/browser/psbt/utils.d.ts.map +1 -0
- package/browser/psbt/validation.d.ts +84 -0
- package/browser/psbt/validation.d.ts.map +1 -0
- package/browser/psbt.d.ts +82 -118
- package/browser/psbt.d.ts.map +1 -0
- package/browser/pubkey.d.ts +27 -6
- package/browser/pubkey.d.ts.map +1 -0
- package/browser/push_data.d.ts +24 -2
- package/browser/push_data.d.ts.map +1 -0
- package/browser/script.d.ts +33 -8
- package/browser/script.d.ts.map +1 -0
- package/browser/script_number.d.ts +17 -0
- package/browser/script_number.d.ts.map +1 -0
- package/browser/script_signature.d.ts +23 -5
- package/browser/script_signature.d.ts.map +1 -0
- package/browser/transaction.d.ts +160 -18
- package/browser/transaction.d.ts.map +1 -0
- package/browser/types.d.ts +36 -38
- package/browser/types.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.d.ts +143 -0
- package/browser/workers/WorkerSigningPool.d.ts.map +1 -0
- package/browser/workers/WorkerSigningPool.node.d.ts +116 -0
- package/browser/workers/WorkerSigningPool.node.d.ts.map +1 -0
- package/browser/workers/ecc-bundle.d.ts +25 -0
- package/browser/workers/ecc-bundle.d.ts.map +1 -0
- package/browser/workers/index.d.ts +91 -0
- package/browser/workers/index.d.ts.map +1 -0
- package/browser/workers/psbt-parallel.d.ts +88 -0
- package/browser/workers/psbt-parallel.d.ts.map +1 -0
- package/browser/workers/signing-worker.d.ts +37 -0
- package/browser/workers/signing-worker.d.ts.map +1 -0
- package/browser/workers/types.d.ts +365 -0
- package/browser/workers/types.d.ts.map +1 -0
- package/build/address.d.ts +57 -10
- package/build/address.d.ts.map +1 -0
- package/build/address.js +80 -24
- package/build/address.js.map +1 -0
- package/build/bech32utils.d.ts +9 -1
- package/build/bech32utils.d.ts.map +1 -0
- package/build/bech32utils.js +10 -2
- package/build/bech32utils.js.map +1 -0
- package/build/bip66.d.ts +11 -6
- package/build/bip66.d.ts.map +1 -0
- package/build/bip66.js +32 -3
- package/build/bip66.js.map +1 -0
- package/build/block.d.ts +117 -11
- package/build/block.d.ts.map +1 -0
- package/build/block.js +204 -72
- package/build/block.js.map +1 -0
- package/build/branded.d.ts +20 -0
- package/build/branded.d.ts.map +1 -0
- package/build/branded.js +7 -0
- package/build/branded.js.map +1 -0
- package/build/crypto/crypto.d.ts +1 -0
- package/build/crypto/crypto.d.ts.map +1 -0
- package/build/crypto/crypto.js +1 -0
- package/build/crypto/crypto.js.map +1 -0
- package/build/crypto.d.ts +46 -7
- package/build/crypto.d.ts.map +1 -0
- package/build/crypto.js +65 -20
- package/build/crypto.js.map +1 -0
- package/build/ecc/context.d.ts +135 -0
- package/build/ecc/context.d.ts.map +1 -0
- package/build/ecc/context.js +232 -0
- package/build/ecc/context.js.map +1 -0
- package/build/ecc/index.d.ts +11 -0
- package/build/ecc/index.d.ts.map +1 -0
- package/build/ecc/index.js +11 -0
- package/build/ecc/index.js.map +1 -0
- package/build/ecc/types.d.ts +134 -0
- package/build/ecc/types.d.ts.map +1 -0
- package/build/ecc/types.js +8 -0
- package/build/ecc/types.js.map +1 -0
- package/build/errors.d.ts +124 -0
- package/build/errors.d.ts.map +1 -0
- package/build/errors.js +155 -0
- package/build/errors.js.map +1 -0
- package/build/index.d.ts +32 -5
- package/build/index.d.ts.map +1 -0
- package/build/index.js +26 -3
- package/build/index.js.map +1 -0
- package/build/io/BinaryReader.d.ts +276 -0
- package/build/io/BinaryReader.d.ts.map +1 -0
- package/build/io/BinaryReader.js +425 -0
- package/build/io/BinaryReader.js.map +1 -0
- package/build/io/BinaryWriter.d.ts +391 -0
- package/build/io/BinaryWriter.d.ts.map +1 -0
- package/build/io/BinaryWriter.js +611 -0
- package/build/io/BinaryWriter.js.map +1 -0
- package/build/io/MemoryPool.d.ts +220 -0
- package/build/io/MemoryPool.d.ts.map +1 -0
- package/build/io/MemoryPool.js +309 -0
- package/build/io/MemoryPool.js.map +1 -0
- package/build/io/base64.d.ts +13 -0
- package/build/io/base64.d.ts.map +1 -0
- package/build/io/base64.js +20 -0
- package/build/io/base64.js.map +1 -0
- package/build/io/hex.d.ts +67 -0
- package/build/io/hex.d.ts.map +1 -0
- package/build/io/hex.js +138 -0
- package/build/io/hex.js.map +1 -0
- package/build/io/index.d.ts +17 -0
- package/build/io/index.d.ts.map +1 -0
- package/build/io/index.js +23 -0
- package/build/io/index.js.map +1 -0
- package/build/io/utils.d.ts +199 -0
- package/build/io/utils.d.ts.map +1 -0
- package/build/io/utils.js +271 -0
- package/build/io/utils.js.map +1 -0
- package/build/merkle.d.ts +10 -1
- package/build/merkle.d.ts.map +1 -0
- package/build/merkle.js +12 -1
- package/build/merkle.js.map +1 -0
- package/build/networks.d.ts +70 -9
- package/build/networks.d.ts.map +1 -0
- package/build/networks.js +90 -4
- package/build/networks.js.map +1 -0
- package/build/opcodes.d.ts +1 -0
- package/build/opcodes.d.ts.map +1 -0
- package/build/opcodes.js +1 -0
- package/build/opcodes.js.map +1 -0
- package/build/payments/bip341.d.ts +36 -9
- package/build/payments/bip341.d.ts.map +1 -0
- package/build/payments/bip341.js +35 -15
- package/build/payments/bip341.js.map +1 -0
- package/build/payments/embed.d.ts +120 -1
- package/build/payments/embed.d.ts.map +1 -0
- package/build/payments/embed.js +215 -34
- package/build/payments/embed.js.map +1 -0
- package/build/payments/index.d.ts +17 -10
- package/build/payments/index.d.ts.map +1 -0
- package/build/payments/index.js +20 -10
- package/build/payments/index.js.map +1 -0
- package/build/payments/p2ms.d.ts +159 -1
- package/build/payments/p2ms.d.ts.map +1 -0
- package/build/payments/p2ms.js +427 -108
- package/build/payments/p2ms.js.map +1 -0
- package/build/payments/p2op.d.ts +158 -24
- package/build/payments/p2op.d.ts.map +1 -0
- package/build/payments/p2op.js +379 -93
- package/build/payments/p2op.js.map +1 -0
- package/build/payments/p2pk.d.ts +162 -1
- package/build/payments/p2pk.d.ts.map +1 -0
- package/build/payments/p2pk.js +327 -58
- package/build/payments/p2pk.js.map +1 -0
- package/build/payments/p2pkh.d.ts +185 -1
- package/build/payments/p2pkh.d.ts.map +1 -0
- package/build/payments/p2pkh.js +467 -114
- package/build/payments/p2pkh.js.map +1 -0
- package/build/payments/p2sh.d.ts +159 -1
- package/build/payments/p2sh.d.ts.map +1 -0
- package/build/payments/p2sh.js +500 -152
- package/build/payments/p2sh.js.map +1 -0
- package/build/payments/p2tr.d.ts +193 -1
- package/build/payments/p2tr.d.ts.map +1 -0
- package/build/payments/p2tr.js +592 -174
- package/build/payments/p2tr.js.map +1 -0
- package/build/payments/p2wpkh.d.ts +170 -1
- package/build/payments/p2wpkh.d.ts.map +1 -0
- package/build/payments/p2wpkh.js +429 -104
- package/build/payments/p2wpkh.js.map +1 -0
- package/build/payments/p2wsh.d.ts +155 -1
- package/build/payments/p2wsh.d.ts.map +1 -0
- package/build/payments/p2wsh.js +466 -144
- package/build/payments/p2wsh.js.map +1 -0
- package/build/payments/types.d.ts +98 -64
- package/build/payments/types.d.ts.map +1 -0
- package/build/payments/types.js +17 -13
- package/build/payments/types.js.map +1 -0
- package/build/psbt/bip371.d.ts +35 -9
- package/build/psbt/bip371.d.ts.map +1 -0
- package/build/psbt/bip371.js +113 -28
- package/build/psbt/bip371.js.map +1 -0
- package/build/psbt/psbtutils.d.ts +56 -16
- package/build/psbt/psbtutils.d.ts.map +1 -0
- package/build/psbt/psbtutils.js +71 -16
- package/build/psbt/psbtutils.js.map +1 -0
- package/build/psbt/types.d.ts +249 -0
- package/build/psbt/types.d.ts.map +1 -0
- package/build/psbt/types.js +6 -0
- package/build/psbt/types.js.map +1 -0
- package/build/psbt/utils.d.ts +68 -0
- package/build/psbt/utils.d.ts.map +1 -0
- package/build/psbt/utils.js +171 -0
- package/build/psbt/utils.js.map +1 -0
- package/build/psbt/validation.d.ts +88 -0
- package/build/psbt/validation.d.ts.map +1 -0
- package/build/psbt/validation.js +149 -0
- package/build/psbt/validation.js.map +1 -0
- package/build/psbt.d.ts +84 -120
- package/build/psbt.d.ts.map +1 -0
- package/build/psbt.js +411 -412
- package/build/psbt.js.map +1 -0
- package/build/pubkey.d.ts +27 -6
- package/build/pubkey.d.ts.map +1 -0
- package/build/pubkey.js +36 -12
- package/build/pubkey.js.map +1 -0
- package/build/push_data.d.ts +24 -2
- package/build/push_data.d.ts.map +1 -0
- package/build/push_data.js +44 -12
- package/build/push_data.js.map +1 -0
- package/build/script.d.ts +33 -8
- package/build/script.d.ts.map +1 -0
- package/build/script.js +100 -36
- package/build/script.js.map +1 -0
- package/build/script_number.d.ts +17 -0
- package/build/script_number.d.ts.map +1 -0
- package/build/script_number.js +19 -0
- package/build/script_number.js.map +1 -0
- package/build/script_signature.d.ts +23 -5
- package/build/script_signature.d.ts.map +1 -0
- package/build/script_signature.js +48 -15
- package/build/script_signature.js.map +1 -0
- package/build/transaction.d.ts +160 -18
- package/build/transaction.d.ts.map +1 -0
- package/build/transaction.js +443 -176
- package/build/transaction.js.map +1 -0
- package/build/tsconfig.build.tsbuildinfo +1 -0
- package/build/types.d.ts +36 -38
- package/build/types.d.ts.map +1 -0
- package/build/types.js +175 -57
- package/build/types.js.map +1 -0
- package/build/workers/WorkerSigningPool.d.ts +174 -0
- package/build/workers/WorkerSigningPool.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.js +553 -0
- package/build/workers/WorkerSigningPool.js.map +1 -0
- package/build/workers/WorkerSigningPool.node.d.ts +124 -0
- package/build/workers/WorkerSigningPool.node.d.ts.map +1 -0
- package/build/workers/WorkerSigningPool.node.js +753 -0
- package/build/workers/WorkerSigningPool.node.js.map +1 -0
- package/build/workers/ecc-bundle.d.ts +25 -0
- package/build/workers/ecc-bundle.d.ts.map +1 -0
- package/build/workers/ecc-bundle.js +25 -0
- package/build/workers/ecc-bundle.js.map +1 -0
- package/build/workers/index.d.ts +91 -0
- package/build/workers/index.d.ts.map +1 -0
- package/build/workers/index.js +114 -0
- package/build/workers/index.js.map +1 -0
- package/build/workers/psbt-parallel.d.ts +117 -0
- package/build/workers/psbt-parallel.d.ts.map +1 -0
- package/build/workers/psbt-parallel.js +233 -0
- package/build/workers/psbt-parallel.js.map +1 -0
- package/build/workers/signing-worker.d.ts +37 -0
- package/build/workers/signing-worker.d.ts.map +1 -0
- package/build/workers/signing-worker.js +350 -0
- package/build/workers/signing-worker.js.map +1 -0
- package/build/workers/types.d.ts +365 -0
- package/build/workers/types.d.ts.map +1 -0
- package/build/workers/types.js +60 -0
- package/build/workers/types.js.map +1 -0
- package/package.json +66 -8
- package/scripts/bundle-ecc.ts +111 -0
- package/src/address.ts +81 -44
- package/src/bech32utils.ts +3 -3
- package/src/bip66.ts +34 -24
- package/src/block.ts +196 -84
- package/src/branded.ts +18 -0
- package/src/crypto.ts +64 -26
- package/src/ecc/context.ts +277 -0
- package/src/ecc/index.ts +14 -0
- package/src/ecc/types.ts +154 -0
- package/src/ecpair.d.ts +99 -0
- package/src/errors.ts +163 -0
- package/src/index.ts +113 -9
- package/src/io/BinaryReader.ts +461 -0
- package/src/io/BinaryWriter.ts +696 -0
- package/src/io/MemoryPool.ts +343 -0
- package/src/io/base64.ts +20 -0
- package/src/io/hex.ts +155 -0
- package/src/io/index.ts +41 -0
- package/src/io/utils.ts +283 -0
- package/src/merkle.ts +14 -9
- package/src/networks.ts +9 -9
- package/src/payments/bip341.ts +34 -33
- package/src/payments/embed.ts +244 -41
- package/src/payments/index.ts +12 -10
- package/src/payments/p2ms.ts +490 -118
- package/src/payments/p2op.ts +431 -133
- package/src/payments/p2pk.ts +370 -72
- package/src/payments/p2pkh.ts +524 -130
- package/src/payments/p2sh.ts +572 -172
- package/src/payments/p2tr.ts +686 -194
- package/src/payments/p2wpkh.ts +484 -107
- package/src/payments/p2wsh.ts +526 -164
- package/src/payments/types.ts +80 -66
- package/src/psbt/bip371.ts +68 -51
- package/src/psbt/psbtutils.ts +39 -40
- package/src/psbt/types.ts +331 -0
- package/src/psbt/utils.ts +188 -0
- package/src/psbt/validation.ts +192 -0
- package/src/psbt.ts +566 -809
- package/src/pubkey.ts +22 -23
- package/src/push_data.ts +18 -16
- package/src/script.ts +82 -64
- package/src/script_number.ts +6 -6
- package/src/script_signature.ts +33 -36
- package/src/transaction.ts +458 -238
- package/src/types.ts +231 -100
- package/src/workers/WorkerSigningPool.node.ts +887 -0
- package/src/workers/WorkerSigningPool.ts +670 -0
- package/src/workers/ecc-bundle.ts +26 -0
- package/src/workers/index.ts +165 -0
- package/src/workers/psbt-parallel.ts +332 -0
- package/src/workers/signing-worker.ts +353 -0
- package/src/workers/types.ts +413 -0
- package/test/address.spec.ts +9 -6
- package/test/bitcoin.core.spec.ts +16 -17
- package/test/block.spec.ts +8 -7
- package/test/bufferutils.spec.ts +228 -214
- package/test/crypto.spec.ts +19 -11
- package/test/fixtures/p2pk.json +0 -8
- package/test/fixtures/p2pkh.json +1 -1
- package/test/fixtures/p2sh.json +1 -1
- package/test/fixtures/script.json +1 -1
- package/test/fixtures/transaction.json +2 -2
- package/test/integration/_regtest.ts +25 -0
- package/test/integration/addresses.spec.ts +4 -3
- package/test/integration/bip32.spec.ts +2 -1
- package/test/integration/blocks.spec.ts +1 -1
- package/test/integration/cltv.spec.ts +18 -16
- package/test/integration/csv.spec.ts +37 -64
- package/test/integration/payments.spec.ts +5 -3
- package/test/integration/taproot.spec.ts +76 -83
- package/test/integration/transactions.spec.ts +38 -35
- package/test/payments.spec.ts +35 -13
- package/test/payments.utils.ts +17 -16
- package/test/psbt.spec.ts +111 -100
- package/test/script.spec.ts +11 -10
- package/test/script_signature.spec.ts +9 -11
- package/test/taproot-cache.spec.ts +694 -0
- package/test/transaction.spec.ts +32 -40
- package/test/types.spec.ts +74 -29
- package/test/workers-pool.spec.ts +963 -0
- package/test/workers-signing.spec.ts +635 -0
- package/test/workers.spec.ts +1390 -0
- package/tsconfig.base.json +34 -18
- package/tsconfig.browser.json +15 -0
- package/tsconfig.build.json +5 -0
- package/tsconfig.json +5 -14
- package/vite.config.browser.ts +3 -42
- package/vitest.config.integration.ts +2 -0
- package/browser/bufferutils.d.ts +0 -34
- package/browser/chunks/crypto-BhCpKpek.js +0 -2033
- package/browser/chunks/payments-B1wlSccx.js +0 -1089
- package/browser/chunks/psbt-BCNk7JUx.js +0 -4055
- package/browser/chunks/script-DyPItFEl.js +0 -318
- package/browser/chunks/transaction-C_UbhMGn.js +0 -432
- package/browser/chunks/utils-DNZi-T5W.js +0 -761
- package/browser/ecc_lib.d.ts +0 -3
- package/browser/hooks/AdvancedSignatureManager.d.ts +0 -16
- package/browser/hooks/HookedSigner.d.ts +0 -4
- package/browser/hooks/SignatureManager.d.ts +0 -13
- package/browser/payments/lazy.d.ts +0 -2
- package/browser/typeforce.d.ts +0 -38
- package/build/bufferutils.d.ts +0 -34
- package/build/bufferutils.js +0 -141
- package/build/ecc_lib.d.ts +0 -3
- package/build/ecc_lib.js +0 -61
- package/build/hooks/AdvancedSignatureManager.d.ts +0 -16
- package/build/hooks/AdvancedSignatureManager.js +0 -52
- package/build/hooks/HookedSigner.d.ts +0 -4
- package/build/hooks/HookedSigner.js +0 -64
- package/build/hooks/SignatureManager.d.ts +0 -13
- package/build/hooks/SignatureManager.js +0 -45
- package/build/payments/lazy.d.ts +0 -2
- package/build/payments/lazy.js +0 -28
- package/build/tsconfig.tsbuildinfo +0 -1
- package/src/bufferutils.ts +0 -188
- package/src/ecc_lib.ts +0 -94
- package/src/hooks/AdvancedSignatureManager.ts +0 -104
- package/src/hooks/HookedSigner.ts +0 -108
- package/src/hooks/SignatureManager.ts +0 -84
- package/src/payments/lazy.ts +0 -28
- package/src/typeforce.d.ts +0 -38
- package/tsconfig.webpack.json +0 -18
package/build/script.js
CHANGED
|
@@ -1,23 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script tools, including decompile, compile, toASM, fromASM, toStack, isCanonicalPubKey, isCanonicalScriptSignature
|
|
3
|
+
* @packageDocumentation
|
|
4
|
+
*/
|
|
1
5
|
import * as bip66 from './bip66.js';
|
|
6
|
+
import { toHex, fromHex, alloc } from './io/index.js';
|
|
2
7
|
import { opcodes, REVERSE_OPS } from './opcodes.js';
|
|
3
8
|
import * as pushdata from './push_data.js';
|
|
4
9
|
import * as scriptNumber from './script_number.js';
|
|
5
10
|
import * as scriptSignature from './script_signature.js';
|
|
6
11
|
import * as types from './types.js';
|
|
7
|
-
const
|
|
8
|
-
const OP_INT_BASE = opcodes.OP_RESERVED;
|
|
12
|
+
const OP_INT_BASE = opcodes.OP_RESERVED; // OP_1 - 1
|
|
9
13
|
export { opcodes };
|
|
10
14
|
function isOPInt(value) {
|
|
11
|
-
return (types.
|
|
15
|
+
return (types.isNumber(value) &&
|
|
12
16
|
(value === opcodes.OP_0 ||
|
|
13
17
|
(value >= opcodes.OP_1 && value <= opcodes.OP_16) ||
|
|
14
18
|
value === opcodes.OP_1NEGATE));
|
|
15
19
|
}
|
|
16
20
|
function isPushOnlyChunk(value) {
|
|
17
|
-
|
|
21
|
+
if (value instanceof Uint8Array)
|
|
22
|
+
return true;
|
|
23
|
+
return isOPInt(value);
|
|
18
24
|
}
|
|
19
25
|
export function isPushOnly(value) {
|
|
20
|
-
return types.
|
|
26
|
+
return types.isArray(value) && value.every(isPushOnlyChunk);
|
|
21
27
|
}
|
|
22
28
|
export function countNonPushOnlyOPs(value) {
|
|
23
29
|
return value.length - value.filter(isPushOnlyChunk).length;
|
|
@@ -26,50 +32,67 @@ function asMinimalOP(buffer) {
|
|
|
26
32
|
if (buffer.length === 0)
|
|
27
33
|
return opcodes.OP_0;
|
|
28
34
|
if (buffer.length !== 1)
|
|
29
|
-
return;
|
|
35
|
+
return undefined;
|
|
30
36
|
if (buffer[0] >= 1 && buffer[0] <= 16)
|
|
31
37
|
return OP_INT_BASE + buffer[0];
|
|
32
38
|
if (buffer[0] === 0x81)
|
|
33
39
|
return opcodes.OP_1NEGATE;
|
|
40
|
+
return undefined;
|
|
34
41
|
}
|
|
35
|
-
function
|
|
36
|
-
return
|
|
42
|
+
function chunksIsUint8Array(buf) {
|
|
43
|
+
return buf instanceof Uint8Array;
|
|
37
44
|
}
|
|
38
45
|
function chunksIsArray(buf) {
|
|
39
|
-
return types.
|
|
46
|
+
return types.isArray(buf);
|
|
40
47
|
}
|
|
41
|
-
function
|
|
42
|
-
return
|
|
48
|
+
function singleChunkIsUint8Array(buf) {
|
|
49
|
+
return buf instanceof Uint8Array;
|
|
43
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* Compiles an array of chunks into a Uint8Array.
|
|
53
|
+
*
|
|
54
|
+
* @param chunks - The array of chunks to compile.
|
|
55
|
+
* @returns The compiled Uint8Array.
|
|
56
|
+
* @throws Error if the compilation fails.
|
|
57
|
+
*/
|
|
44
58
|
export function compile(chunks) {
|
|
45
|
-
|
|
59
|
+
// Already compiled - return as-is
|
|
60
|
+
if (chunksIsUint8Array(chunks))
|
|
46
61
|
return chunks;
|
|
47
|
-
|
|
62
|
+
if (!types.isArray(chunks)) {
|
|
63
|
+
throw new TypeError('Expected an array');
|
|
64
|
+
}
|
|
48
65
|
const bufferSize = chunks.reduce((accum, chunk) => {
|
|
49
|
-
|
|
66
|
+
// data chunk
|
|
67
|
+
if (singleChunkIsUint8Array(chunk)) {
|
|
68
|
+
// adhere to BIP62.3, minimal push policy
|
|
50
69
|
if (chunk.length === 1 && asMinimalOP(chunk) !== undefined) {
|
|
51
70
|
return accum + 1;
|
|
52
71
|
}
|
|
53
72
|
return accum + pushdata.encodingLength(chunk.length) + chunk.length;
|
|
54
73
|
}
|
|
74
|
+
// opcode
|
|
55
75
|
return accum + 1;
|
|
56
76
|
}, 0.0);
|
|
57
|
-
const buffer =
|
|
77
|
+
const buffer = new Uint8Array(bufferSize);
|
|
58
78
|
let offset = 0;
|
|
59
79
|
chunks.forEach((chunk) => {
|
|
60
|
-
|
|
80
|
+
// data chunk
|
|
81
|
+
if (singleChunkIsUint8Array(chunk)) {
|
|
82
|
+
// adhere to BIP62.3, minimal push policy
|
|
61
83
|
const opcode = asMinimalOP(chunk);
|
|
62
84
|
if (opcode !== undefined) {
|
|
63
|
-
buffer
|
|
85
|
+
buffer[offset] = opcode;
|
|
64
86
|
offset += 1;
|
|
65
87
|
return;
|
|
66
88
|
}
|
|
67
89
|
offset += pushdata.encode(buffer, chunk.length, offset);
|
|
68
|
-
|
|
90
|
+
buffer.set(chunk, offset);
|
|
69
91
|
offset += chunk.length;
|
|
92
|
+
// opcode
|
|
70
93
|
}
|
|
71
94
|
else {
|
|
72
|
-
buffer
|
|
95
|
+
buffer[offset] = chunk;
|
|
73
96
|
offset += 1;
|
|
74
97
|
}
|
|
75
98
|
});
|
|
@@ -78,22 +101,29 @@ export function compile(chunks) {
|
|
|
78
101
|
return buffer;
|
|
79
102
|
}
|
|
80
103
|
export function decompile(buffer) {
|
|
104
|
+
// Already decompiled - return as-is
|
|
81
105
|
if (chunksIsArray(buffer))
|
|
82
106
|
return buffer;
|
|
83
|
-
|
|
107
|
+
if (!(buffer instanceof Uint8Array)) {
|
|
108
|
+
throw new TypeError('Expected a Uint8Array');
|
|
109
|
+
}
|
|
84
110
|
const chunks = [];
|
|
85
111
|
let i = 0;
|
|
86
112
|
while (i < buffer.length) {
|
|
87
113
|
const opcode = buffer[i];
|
|
114
|
+
// data chunk
|
|
88
115
|
if (opcode > opcodes.OP_0 && opcode <= opcodes.OP_PUSHDATA4) {
|
|
89
116
|
const d = pushdata.decode(buffer, i);
|
|
117
|
+
// did reading a pushDataInt fail?
|
|
90
118
|
if (d === null)
|
|
91
119
|
return null;
|
|
92
120
|
i += d.size;
|
|
121
|
+
// attempt to read too much data?
|
|
93
122
|
if (i + d.number > buffer.length)
|
|
94
123
|
return null;
|
|
95
124
|
const data = buffer.subarray(i, i + d.number);
|
|
96
125
|
i += d.number;
|
|
126
|
+
// decompile minimally
|
|
97
127
|
const op = asMinimalOP(data);
|
|
98
128
|
if (op !== undefined) {
|
|
99
129
|
chunks.push(op);
|
|
@@ -101,6 +131,7 @@ export function decompile(buffer) {
|
|
|
101
131
|
else {
|
|
102
132
|
chunks.push(data);
|
|
103
133
|
}
|
|
134
|
+
// opcode
|
|
104
135
|
}
|
|
105
136
|
else {
|
|
106
137
|
chunks.push(opcode);
|
|
@@ -109,43 +140,75 @@ export function decompile(buffer) {
|
|
|
109
140
|
}
|
|
110
141
|
return chunks;
|
|
111
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* Converts the given chunks into an ASM (Assembly) string representation.
|
|
145
|
+
* If the chunks parameter is a Uint8Array, it will be decompiled into a Stack before conversion.
|
|
146
|
+
* @param chunks - The chunks to convert into ASM.
|
|
147
|
+
* @returns The ASM string representation of the chunks.
|
|
148
|
+
*/
|
|
112
149
|
export function toASM(chunks) {
|
|
113
|
-
|
|
114
|
-
|
|
150
|
+
let resolved;
|
|
151
|
+
if (chunksIsUint8Array(chunks)) {
|
|
152
|
+
const decompiled = decompile(chunks);
|
|
153
|
+
if (!decompiled) {
|
|
154
|
+
throw new Error('Could not convert invalid chunks to ASM');
|
|
155
|
+
}
|
|
156
|
+
resolved = decompiled;
|
|
115
157
|
}
|
|
116
|
-
|
|
117
|
-
|
|
158
|
+
else {
|
|
159
|
+
resolved = chunks;
|
|
118
160
|
}
|
|
119
|
-
return
|
|
161
|
+
return resolved
|
|
120
162
|
.map((chunk) => {
|
|
121
|
-
|
|
163
|
+
// data?
|
|
164
|
+
if (singleChunkIsUint8Array(chunk)) {
|
|
122
165
|
const op = asMinimalOP(chunk);
|
|
123
166
|
if (op === undefined)
|
|
124
|
-
return chunk
|
|
167
|
+
return toHex(chunk);
|
|
125
168
|
chunk = op;
|
|
126
169
|
}
|
|
170
|
+
// opcode!
|
|
127
171
|
return REVERSE_OPS[chunk];
|
|
128
172
|
})
|
|
129
173
|
.join(' ');
|
|
130
174
|
}
|
|
175
|
+
/**
|
|
176
|
+
* Converts an ASM string to a Uint8Array.
|
|
177
|
+
* @param asm The ASM string to convert.
|
|
178
|
+
* @returns The converted Uint8Array.
|
|
179
|
+
*/
|
|
131
180
|
export function fromASM(asm) {
|
|
132
|
-
|
|
181
|
+
if (typeof asm !== 'string') {
|
|
182
|
+
throw new TypeError('Expected a string');
|
|
183
|
+
}
|
|
133
184
|
return compile(asm.split(' ').map((chunkStr) => {
|
|
185
|
+
// opcode?
|
|
134
186
|
if (opcodes[chunkStr] !== undefined) {
|
|
135
187
|
return opcodes[chunkStr];
|
|
136
188
|
}
|
|
137
|
-
|
|
138
|
-
|
|
189
|
+
if (!types.isHex(chunkStr)) {
|
|
190
|
+
throw new TypeError('Expected hex string');
|
|
191
|
+
}
|
|
192
|
+
// data!
|
|
193
|
+
return fromHex(chunkStr);
|
|
139
194
|
}));
|
|
140
195
|
}
|
|
196
|
+
/**
|
|
197
|
+
* Converts the given chunks into a stack of Uint8Arrays.
|
|
198
|
+
*
|
|
199
|
+
* @param chunks - The chunks to convert.
|
|
200
|
+
* @returns The stack of Uint8Arrays.
|
|
201
|
+
*/
|
|
141
202
|
export function toStack(chunks) {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
203
|
+
const resolved = chunksIsUint8Array(chunks) ? decompile(chunks) : chunks;
|
|
204
|
+
if (!resolved || !isPushOnly(resolved)) {
|
|
205
|
+
throw new TypeError('Expected push-only script');
|
|
206
|
+
}
|
|
207
|
+
return resolved.map((op) => {
|
|
208
|
+
if (singleChunkIsUint8Array(op))
|
|
146
209
|
return op;
|
|
147
210
|
if (op === opcodes.OP_0)
|
|
148
|
-
return
|
|
211
|
+
return alloc(0);
|
|
149
212
|
return scriptNumber.encode(op - OP_INT_BASE);
|
|
150
213
|
});
|
|
151
214
|
}
|
|
@@ -154,7 +217,7 @@ export function isCanonicalPubKey(buffer) {
|
|
|
154
217
|
}
|
|
155
218
|
import { isDefinedHashType } from './script_signature.js';
|
|
156
219
|
export function isCanonicalScriptSignature(buffer) {
|
|
157
|
-
if (!
|
|
220
|
+
if (!(buffer instanceof Uint8Array))
|
|
158
221
|
return false;
|
|
159
222
|
if (!isDefinedHashType(buffer[buffer.length - 1]))
|
|
160
223
|
return false;
|
|
@@ -162,3 +225,4 @@ export function isCanonicalScriptSignature(buffer) {
|
|
|
162
225
|
}
|
|
163
226
|
export const number = scriptNumber;
|
|
164
227
|
export const signature = scriptSignature;
|
|
228
|
+
//# sourceMappingURL=script.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script.js","sourceRo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AAK,CAAC,KAAK,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,CAAC,MAAM,MAAM,GAAG,YAAY,CAAC;AACnC,MAAM,CAAC,MAAM,SAAS,GAAG,eAAe,CAAC"}
|
package/build/script_number.d.ts
CHANGED
|
@@ -1,2 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a script number from a buffer.
|
|
3
|
+
*
|
|
4
|
+
* @param buffer - The buffer containing the script number.
|
|
5
|
+
* @param maxLength - The maximum length of the script number. Defaults to 4.
|
|
6
|
+
* @param minimal - Whether the script number should be minimal. Defaults to true.
|
|
7
|
+
* @returns The decoded script number.
|
|
8
|
+
* @throws {TypeError} If the script number overflows the maximum length.
|
|
9
|
+
* @throws {Error} If the script number is not minimally encoded when minimal is true.
|
|
10
|
+
*/
|
|
1
11
|
export declare function decode(buffer: Buffer, maxLength?: number, minimal?: boolean): number;
|
|
12
|
+
/**
|
|
13
|
+
* Encodes a number into a Buffer using a specific format.
|
|
14
|
+
*
|
|
15
|
+
* @param _number - The number to encode.
|
|
16
|
+
* @returns The encoded number as a Buffer.
|
|
17
|
+
*/
|
|
2
18
|
export declare function encode(_number: number): Buffer;
|
|
19
|
+
//# sourceMappingURL=script_number.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script_number.d.ts","sourceRoot":"","sources":["../src/script_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,GAAG,MAAM,CA+BpF;AAMD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAkB9C"}
|
package/build/script_number.js
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Decodes a script number from a buffer.
|
|
3
|
+
*
|
|
4
|
+
* @param buffer - The buffer containing the script number.
|
|
5
|
+
* @param maxLength - The maximum length of the script number. Defaults to 4.
|
|
6
|
+
* @param minimal - Whether the script number should be minimal. Defaults to true.
|
|
7
|
+
* @returns The decoded script number.
|
|
8
|
+
* @throws {TypeError} If the script number overflows the maximum length.
|
|
9
|
+
* @throws {Error} If the script number is not minimally encoded when minimal is true.
|
|
10
|
+
*/
|
|
1
11
|
export function decode(buffer, maxLength, minimal) {
|
|
2
12
|
maxLength = maxLength || 4;
|
|
3
13
|
minimal = minimal === undefined ? true : minimal;
|
|
@@ -12,6 +22,7 @@ export function decode(buffer, maxLength, minimal) {
|
|
|
12
22
|
throw new Error('Non-minimally encoded script number');
|
|
13
23
|
}
|
|
14
24
|
}
|
|
25
|
+
// 40-bit
|
|
15
26
|
if (length === 5) {
|
|
16
27
|
const a = buffer.readUInt32LE(0);
|
|
17
28
|
const b = buffer.readUInt8(4);
|
|
@@ -19,6 +30,7 @@ export function decode(buffer, maxLength, minimal) {
|
|
|
19
30
|
return -((b & ~0x80) * 0x100000000 + a);
|
|
20
31
|
return b * 0x100000000 + a;
|
|
21
32
|
}
|
|
33
|
+
// 32-bit / 24-bit / 16-bit / 8-bit
|
|
22
34
|
let result = 0;
|
|
23
35
|
for (let i = 0; i < length; ++i) {
|
|
24
36
|
result |= buffer[i] << (8 * i);
|
|
@@ -30,6 +42,12 @@ export function decode(buffer, maxLength, minimal) {
|
|
|
30
42
|
function scriptNumSize(i) {
|
|
31
43
|
return i > 0x7fffffff ? 5 : i > 0x7fffff ? 4 : i > 0x7fff ? 3 : i > 0x7f ? 2 : i > 0x00 ? 1 : 0;
|
|
32
44
|
}
|
|
45
|
+
/**
|
|
46
|
+
* Encodes a number into a Buffer using a specific format.
|
|
47
|
+
*
|
|
48
|
+
* @param _number - The number to encode.
|
|
49
|
+
* @returns The encoded number as a Buffer.
|
|
50
|
+
*/
|
|
33
51
|
export function encode(_number) {
|
|
34
52
|
let value = Math.abs(_number);
|
|
35
53
|
const size = scriptNumSize(value);
|
|
@@ -47,3 +65,4 @@ export function encode(_number) {
|
|
|
47
65
|
}
|
|
48
66
|
return buffer;
|
|
49
67
|
}
|
|
68
|
+
//# sourceMappingURL=script_number.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script_number.js","sourceRoot":"","sources":["../src/script_number.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,UAAU,MAAM,CAAC,MAAc,EAAE,SAAkB,EAAE,OAAiB;IACxE,SAAS,GAAG,SAAS,IAAI,CAAC,CAAC;IAC3B,OAAO,GAAG,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;IAEjD,MAAM,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;IAC7B,IAAI,MAAM,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC3B,IAAI,MAAM,GAAG,SAAS;QAAE,MAAM,IAAI,SAAS,CAAC,wBAAwB,CAAC,CAAC;IACtE,IAAI,OAAO,EAAE,CAAC;QACV,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACrC,IAAI,MAAM,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAE,GAAG,IAAI,CAAC,KAAK,CAAC;gBACjD,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;QAC/D,CAAC;IACL,CAAC;IAED,SAAS;IACT,IAAI,MAAM,KAAK,CAAC,EAAE,CAAC;QACf,MAAM,CAAC,GAAG,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC;QACjC,MAAM,CAAC,GAAG,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QAE9B,IAAI,CAAC,GAAG,IAAI;YAAE,OAAO,CAAC,CAAC,CAAC,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G,CAAC,CAAC;IAE7B,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,EAAE,CAAC;QAC5B,MAAM,CAAC,UAAU,CAAC,KAAK,GAAG,IAAI,EAAE,CAAC,CAAC,CAAC;QACnC,KAAK,KAAK,CAAC,CAAC;IAChB,CAAC;IAED,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,CAAE,GAAG,IAAI,EAAE,CAAC;QAC3B,MAAM,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC;IACxD,CAAC;SAAM,IAAI,QAAQ,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,GAAG,CAAC,CAAE,IAAI,IAAI,CAAC;IAC9B,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC"}
|
|
@@ -1,8 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checks if a hash type is defined (valid for Bitcoin signatures).
|
|
3
|
+
* @param hashType - The hash type to check.
|
|
4
|
+
* @returns True if the hash type is valid, false otherwise.
|
|
5
|
+
*/
|
|
1
6
|
export declare function isDefinedHashType(hashType: number): boolean;
|
|
2
|
-
interface ScriptSignature {
|
|
3
|
-
signature:
|
|
7
|
+
export interface ScriptSignature {
|
|
8
|
+
signature: Uint8Array;
|
|
4
9
|
hashType: number;
|
|
5
10
|
}
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
11
|
+
/**
|
|
12
|
+
* Decodes a Uint8Array into a ScriptSignature object.
|
|
13
|
+
* @param buffer - The Uint8Array to decode.
|
|
14
|
+
* @returns The decoded ScriptSignature object.
|
|
15
|
+
* @throws Error if the hashType is invalid.
|
|
16
|
+
*/
|
|
17
|
+
export declare function decode(buffer: Uint8Array): ScriptSignature;
|
|
18
|
+
/**
|
|
19
|
+
* Encodes a signature and hash type into a Uint8Array.
|
|
20
|
+
* @param signature - The signature to encode.
|
|
21
|
+
* @param hashType - The hash type to encode.
|
|
22
|
+
* @returns The encoded Uint8Array.
|
|
23
|
+
* @throws Error if the hashType is invalid.
|
|
24
|
+
*/
|
|
25
|
+
export declare function encode(signature: Uint8Array, hashType: number): Uint8Array;
|
|
26
|
+
//# sourceMappingURL=script_signature.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script_signature.d.ts","sourceRoot":"","sources":["../src/script_signature.ts"],"names":[],"mappings":"AAMA;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG3D;AA+BD,MAAM,WAAW,eAAe;IAC5B,SAAS,EAAE,UAAU,CAAC;IACtB,QAAQ,EAAE,MAAM,CAAC;CACpB;AAGD;;;;;GAKG;AACH,wBAAgB,MAAM,CAAC,MAAM,EAAE,UAAU,GAAG,eAAe,CAY1D;AAED;;;;;;GAMG;AACH,wBAAgB,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,GAAG,UAAU,CAkB1E"}
|
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import * as bip66 from './bip66.js';
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const ZERO =
|
|
2
|
+
import { alloc, concat } from './io/index.js';
|
|
3
|
+
import { isUInt8, isUint8ArrayN } from './types.js';
|
|
4
|
+
const ZERO = new Uint8Array([0]);
|
|
5
|
+
/**
|
|
6
|
+
* Checks if a hash type is defined (valid for Bitcoin signatures).
|
|
7
|
+
* @param hashType - The hash type to check.
|
|
8
|
+
* @returns True if the hash type is valid, false otherwise.
|
|
9
|
+
*/
|
|
5
10
|
export function isDefinedHashType(hashType) {
|
|
6
11
|
const hashTypeMod = hashType & ~0x80;
|
|
7
12
|
return hashTypeMod > 0x00 && hashTypeMod < 0x04;
|
|
8
13
|
}
|
|
14
|
+
/**
|
|
15
|
+
* Converts a Uint8Array to a DER-encoded Uint8Array.
|
|
16
|
+
* @param x - The Uint8Array to be converted.
|
|
17
|
+
* @returns The DER-encoded Uint8Array.
|
|
18
|
+
*/
|
|
9
19
|
function toDER(x) {
|
|
10
20
|
let i = 0;
|
|
11
21
|
while (x[i] === 0)
|
|
@@ -14,39 +24,62 @@ function toDER(x) {
|
|
|
14
24
|
return ZERO;
|
|
15
25
|
x = x.subarray(i);
|
|
16
26
|
if (x[0] & 0x80)
|
|
17
|
-
return
|
|
27
|
+
return concat([ZERO, x]);
|
|
18
28
|
return x;
|
|
19
29
|
}
|
|
30
|
+
/**
|
|
31
|
+
* Converts a DER-encoded signature to a Uint8Array.
|
|
32
|
+
* If the first byte of the input is 0x00, it is skipped.
|
|
33
|
+
* The resulting Uint8Array is 32 bytes long, filled with zeros if necessary.
|
|
34
|
+
* @param x - The DER-encoded signature.
|
|
35
|
+
* @returns The converted Uint8Array.
|
|
36
|
+
*/
|
|
20
37
|
function fromDER(x) {
|
|
21
38
|
if (x[0] === 0x00)
|
|
22
39
|
x = x.subarray(1);
|
|
23
|
-
const buffer =
|
|
40
|
+
const buffer = alloc(32);
|
|
24
41
|
const bstart = Math.max(0, 32 - x.length);
|
|
25
|
-
|
|
42
|
+
buffer.set(x, bstart);
|
|
26
43
|
return buffer;
|
|
27
44
|
}
|
|
45
|
+
// BIP62: 1 byte hashType flag (only 0x01, 0x02, 0x03, 0x81, 0x82 and 0x83 are allowed)
|
|
46
|
+
/**
|
|
47
|
+
* Decodes a Uint8Array into a ScriptSignature object.
|
|
48
|
+
* @param buffer - The Uint8Array to decode.
|
|
49
|
+
* @returns The decoded ScriptSignature object.
|
|
50
|
+
* @throws Error if the hashType is invalid.
|
|
51
|
+
*/
|
|
28
52
|
export function decode(buffer) {
|
|
29
|
-
const hashType = buffer
|
|
53
|
+
const hashType = buffer[buffer.length - 1];
|
|
30
54
|
if (!isDefinedHashType(hashType)) {
|
|
31
55
|
throw new Error(`Invalid hashType ${hashType}`);
|
|
32
56
|
}
|
|
33
57
|
const decoded = bip66.decode(buffer.subarray(0, -1));
|
|
34
58
|
const r = fromDER(decoded.r);
|
|
35
59
|
const s = fromDER(decoded.s);
|
|
36
|
-
const signature =
|
|
60
|
+
const signature = concat([r, s]);
|
|
37
61
|
return { signature, hashType };
|
|
38
62
|
}
|
|
63
|
+
/**
|
|
64
|
+
* Encodes a signature and hash type into a Uint8Array.
|
|
65
|
+
* @param signature - The signature to encode.
|
|
66
|
+
* @param hashType - The hash type to encode.
|
|
67
|
+
* @returns The encoded Uint8Array.
|
|
68
|
+
* @throws Error if the hashType is invalid.
|
|
69
|
+
*/
|
|
39
70
|
export function encode(signature, hashType) {
|
|
40
|
-
|
|
41
|
-
signature
|
|
42
|
-
|
|
43
|
-
|
|
71
|
+
if (!isUint8ArrayN(signature, 64)) {
|
|
72
|
+
throw new TypeError('Expected signature to be a 64-byte Uint8Array');
|
|
73
|
+
}
|
|
74
|
+
if (!isUInt8(hashType)) {
|
|
75
|
+
throw new TypeError('Expected hashType to be a UInt8');
|
|
76
|
+
}
|
|
44
77
|
if (!isDefinedHashType(hashType)) {
|
|
45
78
|
throw new Error(`Invalid hashType ${hashType}`);
|
|
46
79
|
}
|
|
47
|
-
const hashTypeBuffer =
|
|
48
|
-
hashTypeBuffer.writeUInt8(hashType, 0);
|
|
80
|
+
const hashTypeBuffer = new Uint8Array([hashType]);
|
|
49
81
|
const r = toDER(signature.subarray(0, 32));
|
|
50
82
|
const s = toDER(signature.subarray(32, 64));
|
|
51
|
-
return
|
|
83
|
+
return concat([bip66.encode(r, s), hashTypeBuffer]);
|
|
52
84
|
}
|
|
85
|
+
//# sourceMappingURL=script_signature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"script_signature.js","sourceRoot":"","sources":["../src/script_signature.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,OAA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