@btc-vision/bitcoin 6.4.9 → 6.4.11
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/.babelrc +4 -4
- package/.mocharc.json +13 -13
- package/.prettierrc.json +12 -12
- package/CHANGELOG.md +403 -403
- package/CONTRIBUTING.md +83 -83
- package/LICENSE +21 -21
- package/README.md +201 -201
- package/browser/index.d.ts +1 -1
- package/browser/index.js +1 -1
- package/browser/{ops.d.ts → opcodes.d.ts} +2 -3
- package/browser/script.d.ts +2 -2
- package/build/address.js +2 -1
- package/build/index.d.ts +1 -1
- package/build/index.js +1 -1
- package/build/{ops.d.ts → opcodes.d.ts} +2 -3
- package/build/{ops.js → opcodes.js} +4 -5
- package/build/payments/embed.js +1 -1
- package/build/payments/p2ms.js +1 -1
- package/build/payments/p2op.js +1 -1
- package/build/payments/p2pk.js +1 -1
- package/build/payments/p2pkh.js +1 -1
- package/build/payments/p2sh.js +3 -3
- package/build/payments/p2tr.js +1 -1
- package/build/payments/p2wpkh.js +2 -2
- package/build/payments/p2wsh.js +2 -2
- package/build/push_data.js +9 -9
- package/build/script.d.ts +2 -2
- package/build/script.js +12 -12
- package/build/transaction.js +1 -1
- package/cjs/package.json +3 -3
- package/gulpfile.js +42 -42
- package/package.json +150 -150
- package/src/address.ts +304 -303
- package/src/bip66.ts +107 -107
- package/src/block.ts +233 -233
- package/src/bufferutils.ts +188 -188
- package/src/crypto.ts +108 -108
- package/src/ecc_lib.ts +94 -94
- package/src/hooks/AdvancedSignatureManager.ts +104 -104
- package/src/hooks/SignatureManager.ts +84 -84
- package/src/index.ts +105 -105
- package/src/merkle.ts +31 -31
- package/src/{ops.ts → opcodes.ts} +280 -282
- package/src/payments/bip341.ts +140 -140
- package/src/payments/embed.ts +61 -61
- package/src/payments/index.ts +172 -172
- package/src/payments/lazy.ts +28 -28
- package/src/payments/p2ms.ts +156 -156
- package/src/payments/p2op.ts +195 -195
- package/src/payments/p2pk.ts +93 -93
- package/src/payments/p2pkh.ts +214 -214
- package/src/payments/p2sh.ts +210 -210
- package/src/payments/p2tr.ts +309 -309
- package/src/payments/p2wpkh.ts +144 -144
- package/src/payments/p2wsh.ts +217 -217
- package/src/psbt/bip371.ts +441 -441
- package/src/push_data.ts +97 -97
- package/src/script.ts +247 -247
- package/src/script_number.ts +72 -72
- package/src/script_signature.ts +91 -91
- package/src/transaction.ts +656 -656
- package/test/address.spec.ts +155 -155
- package/test/bitcoin.core.spec.ts +212 -212
- package/test/block.spec.ts +171 -171
- package/test/bufferutils.spec.ts +450 -450
- package/test/crypto.spec.ts +49 -49
- package/test/fixtures/address.json +329 -329
- package/test/fixtures/block.json +148 -148
- package/test/fixtures/bufferutils.json +102 -102
- package/test/fixtures/core/README.md +26 -26
- package/test/fixtures/core/base58_encode_decode.json +50 -50
- package/test/fixtures/core/base58_keys_invalid.json +152 -152
- package/test/fixtures/core/base58_keys_valid.json +452 -452
- package/test/fixtures/core/blocks.json +27 -27
- package/test/fixtures/core/sig_canonical.json +7 -7
- package/test/fixtures/core/sig_noncanonical.json +33 -33
- package/test/fixtures/core/sighash.json +3505 -3505
- package/test/fixtures/core/tx_valid.json +2023 -2023
- package/test/fixtures/crypto.json +43 -43
- package/test/fixtures/ecdsa.json +217 -217
- package/test/fixtures/ecpair.json +141 -141
- package/test/fixtures/embed.json +108 -108
- package/test/fixtures/p2ms.json +434 -434
- package/test/fixtures/p2pk.json +179 -179
- package/test/fixtures/p2pkh.json +276 -276
- package/test/fixtures/p2sh.json +508 -508
- package/test/fixtures/p2tr.json +1198 -1198
- package/test/fixtures/p2wpkh.json +290 -290
- package/test/fixtures/p2wsh.json +489 -489
- package/test/fixtures/psbt.json +924 -924
- package/test/fixtures/script.json +465 -465
- package/test/fixtures/script_number.json +225 -225
- package/test/fixtures/signature.json +140 -140
- package/test/fixtures/transaction.json +916 -916
- package/test/integration/_regtest.ts +6 -6
- package/test/integration/addresses.spec.ts +142 -142
- package/test/integration/bip32.spec.ts +130 -130
- package/test/integration/blocks.spec.ts +28 -28
- package/test/integration/cltv.spec.ts +241 -241
- package/test/integration/csv.spec.ts +452 -452
- package/test/integration/payments.spec.ts +110 -110
- package/test/integration/taproot.spec.ts +663 -663
- package/test/integration/transactions.spec.ts +668 -668
- package/test/payments.spec.ts +114 -114
- package/test/payments.utils.ts +165 -165
- package/test/psbt.spec.ts +1285 -1285
- package/test/script.spec.ts +186 -186
- package/test/script_number.spec.ts +26 -26
- package/test/script_signature.spec.ts +66 -66
- package/test/transaction.spec.ts +337 -337
- package/test/ts-node-register.js +7 -7
- package/test/tsconfig.json +48 -48
- package/test/types.spec.ts +53 -53
- package/tsconfig.base.json +27 -27
- package/tsconfig.json +19 -19
- package/tsconfig.webpack.json +18 -18
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.ready +0 -0
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/.release-please-manifest.json +0 -3
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CHANGELOG.md +0 -962
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/CONTRIBUTING.md +0 -34
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/LICENSE +0 -24
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/README.md +0 -273
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/SECURITY.md +0 -2
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/addon.gypi +0 -204
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/bin/node-gyp.js +0 -138
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/.release-please-manifest.json +0 -3
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/LICENSE +0 -28
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/ninja/build.ninja +0 -4
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/data/win/large-pdb-shim.cc +0 -12
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/GypVsCMake.md +0 -116
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Hacking.md +0 -46
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/InputFormatReference.md +0 -1080
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/LanguageSpecification.md +0 -430
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/README.md +0 -27
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/Testing.md +0 -450
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/docs/UserDocumentation.md +0 -965
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp +0 -8
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp.bat +0 -5
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/gyp_main.py +0 -45
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSNew.py +0 -365
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSProject.py +0 -206
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings.py +0 -1272
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSSettings_test.py +0 -1547
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py +0 -59
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py +0 -153
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py +0 -271
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py +0 -574
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/__init__.py +0 -692
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common.py +0 -711
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/common_test.py +0 -171
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml.py +0 -169
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py +0 -113
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/flock_tool.py +0 -55
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/__init__.py +0 -0
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/analyzer.py +0 -804
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/android.py +0 -1173
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/cmake.py +0 -1318
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/compile_commands_json.py +0 -127
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/dump_dependency_json.py +0 -103
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/eclipse.py +0 -461
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypd.py +0 -89
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/gypsh.py +0 -57
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py +0 -2745
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs.py +0 -3976
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/msvs_test.py +0 -44
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja.py +0 -2964
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/ninja_test.py +0 -67
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode.py +0 -1391
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/generator/xcode_test.py +0 -25
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input.py +0 -3115
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/input_test.py +0 -98
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/mac_tool.py +0 -771
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/msvs_emulation.py +0 -1260
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py +0 -174
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/simple_copy.py +0 -61
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/win_tool.py +0 -373
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py +0 -1938
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation_test.py +0 -53
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py +0 -302
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xcodeproj_file.py +0 -3198
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py +0 -65
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE +0 -3
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.APACHE +0 -177
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/LICENSE.BSD +0 -23
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/__init__.py +0 -15
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_elffile.py +0 -108
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_manylinux.py +0 -252
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_musllinux.py +0 -83
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_parser.py +0 -359
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_structures.py +0 -61
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/_tokenizer.py +0 -192
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/markers.py +0 -252
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/metadata.py +0 -825
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/py.typed +0 -0
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/requirements.py +0 -90
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/specifiers.py +0 -1030
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/tags.py +0 -553
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/utils.py +0 -172
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pylib/packaging/version.py +0 -563
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/pyproject.toml +0 -120
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/release-please-config.json +0 -11
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/gyp/test_gyp.py +0 -261
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/Find-VisualStudio.cs +0 -250
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/build.js +0 -227
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/clean.js +0 -15
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/configure.js +0 -328
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/create-config-gypi.js +0 -150
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/download.js +0 -39
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-node-directory.js +0 -63
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-python.js +0 -310
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/find-visualstudio.js +0 -590
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/install.js +0 -415
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/list.js +0 -26
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/log.js +0 -168
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/node-gyp.js +0 -188
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/process-release.js +0 -146
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/rebuild.js +0 -12
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/remove.js +0 -43
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/lib/util.js +0 -81
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/macOS_Catalina_acid_test.sh +0 -21
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/package.json +0 -51
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/release-please-config.json +0 -40
- package/.yarn/unplugged/node-gyp-npm-10.2.0-cad1109948/node_modules/node-gyp/src/win_delay_load_hook.cc +0 -39
- package/coverage/tmp/coverage-31752-1735543485354-0.json +0 -1
- package/coverage/tmp/coverage-59920-1735543484555-0.json +0 -1
- package/coverage/tmp/coverage-66252-1735543483919-0.json +0 -1
- package/coverage/tmp/coverage-68440-1735543485236-0.json +0 -1
- package/coverage/tmp/coverage-70588-1735543484426-0.json +0 -1
- package/coverage/tmp/coverage-79292-1735543485296-0.json +0 -1
- package/coverage/tmp/coverage-80212-1735543483980-0.json +0 -1
|
@@ -119,8 +119,7 @@ export interface Opcodes {
|
|
|
119
119
|
OP_PUBKEY: number;
|
|
120
120
|
OP_INVALIDOPCODE: number;
|
|
121
121
|
}
|
|
122
|
-
declare const
|
|
123
|
-
declare const REVERSE_OPS: {
|
|
122
|
+
export declare const opcodes: Opcodes;
|
|
123
|
+
export declare const REVERSE_OPS: {
|
|
124
124
|
[key: number]: string;
|
|
125
125
|
};
|
|
126
|
-
export { OPS, REVERSE_OPS };
|
package/browser/script.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { opcodes } from './opcodes.js';
|
|
2
2
|
import { Stack } from './payments/index.js';
|
|
3
3
|
import * as scriptNumber from './script_number.js';
|
|
4
4
|
import * as scriptSignature from './script_signature.js';
|
|
5
|
-
export {
|
|
5
|
+
export { opcodes };
|
|
6
6
|
export declare function isPushOnly(value: Stack): boolean;
|
|
7
7
|
export declare function countNonPushOnlyOPs(value: Stack): number;
|
|
8
8
|
export declare function compile(chunks: Buffer | Stack): Buffer;
|
package/build/address.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { bech32, bech32m } from 'bech32';
|
|
2
2
|
import * as bs58check from 'bs58check';
|
|
3
|
-
import { opcodes, payments } from './index.js';
|
|
4
3
|
import * as networks from './networks.js';
|
|
5
4
|
import * as bscript from './script.js';
|
|
5
|
+
import { opcodes } from './script.js';
|
|
6
6
|
import { Hash160bit, tuple, typeforce, UInt8 } from './types.js';
|
|
7
|
+
import { payments } from './index.js';
|
|
7
8
|
export const FUTURE_SEGWIT_MAX_SIZE = 40;
|
|
8
9
|
export const FUTURE_SEGWIT_MIN_SIZE = 2;
|
|
9
10
|
export const FUTURE_SEGWIT_MAX_VERSION = 15;
|
package/build/index.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export * as script from './script.js';
|
|
|
13
13
|
export { Block } from './block.js';
|
|
14
14
|
export * from './crypto.js';
|
|
15
15
|
export * from './psbt.js';
|
|
16
|
-
export {
|
|
16
|
+
export { opcodes } from './opcodes.js';
|
|
17
17
|
export { Transaction } from './transaction.js';
|
|
18
18
|
export { Network } from './networks.js';
|
|
19
19
|
export { initEccLib } from './ecc_lib.js';
|
package/build/index.js
CHANGED
|
@@ -12,7 +12,7 @@ export * as script from './script.js';
|
|
|
12
12
|
export { Block } from './block.js';
|
|
13
13
|
export * from './crypto.js';
|
|
14
14
|
export * from './psbt.js';
|
|
15
|
-
export {
|
|
15
|
+
export { opcodes } from './opcodes.js';
|
|
16
16
|
export { Transaction } from './transaction.js';
|
|
17
17
|
export { initEccLib } from './ecc_lib.js';
|
|
18
18
|
export { PaymentType, } from './payments/index.js';
|
|
@@ -119,8 +119,7 @@ export interface Opcodes {
|
|
|
119
119
|
OP_PUBKEY: number;
|
|
120
120
|
OP_INVALIDOPCODE: number;
|
|
121
121
|
}
|
|
122
|
-
declare const
|
|
123
|
-
declare const REVERSE_OPS: {
|
|
122
|
+
export declare const opcodes: Opcodes;
|
|
123
|
+
export declare const REVERSE_OPS: {
|
|
124
124
|
[key: number]: string;
|
|
125
125
|
};
|
|
126
|
-
export { OPS, REVERSE_OPS };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
export const opcodes = {
|
|
2
2
|
OP_FALSE: 0,
|
|
3
3
|
OP_0: 0,
|
|
4
4
|
OP_PUSHDATA1: 76,
|
|
@@ -119,9 +119,8 @@ const OPS = {
|
|
|
119
119
|
OP_PUBKEY: 254,
|
|
120
120
|
OP_INVALIDOPCODE: 255,
|
|
121
121
|
};
|
|
122
|
-
const REVERSE_OPS = {};
|
|
123
|
-
for (const op of Object.keys(
|
|
124
|
-
const code =
|
|
122
|
+
export const REVERSE_OPS = {};
|
|
123
|
+
for (const op of Object.keys(opcodes)) {
|
|
124
|
+
const code = opcodes[op];
|
|
125
125
|
REVERSE_OPS[code] = op;
|
|
126
126
|
}
|
|
127
|
-
export { OPS, REVERSE_OPS };
|
package/build/payments/embed.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as bscript from '../script.js';
|
|
|
3
3
|
import { stacksEqual, typeforce as typef } from '../types.js';
|
|
4
4
|
import { PaymentType } from './index.js';
|
|
5
5
|
import * as lazy from './lazy.js';
|
|
6
|
-
const OPS = bscript.
|
|
6
|
+
const OPS = bscript.opcodes;
|
|
7
7
|
export function p2data(a, opts) {
|
|
8
8
|
if (!a.data && !a.output)
|
|
9
9
|
throw new TypeError('Not enough data');
|
package/build/payments/p2ms.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as bscript from '../script.js';
|
|
|
3
3
|
import { isPoint, stacksEqual, typeforce as typef } from '../types.js';
|
|
4
4
|
import { PaymentType } from './index.js';
|
|
5
5
|
import * as lazy from './lazy.js';
|
|
6
|
-
const OPS = bscript.
|
|
6
|
+
const OPS = bscript.opcodes;
|
|
7
7
|
const OP_INT_BASE = OPS.OP_RESERVED;
|
|
8
8
|
export function p2ms(a, opts) {
|
|
9
9
|
if (!a.input && !a.output && !(a.pubkeys && a.m !== undefined) && !a.signatures)
|
package/build/payments/p2op.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as bscript from '../script.js';
|
|
|
6
6
|
import { typeforce as typef } from '../types.js';
|
|
7
7
|
import * as lazy from './lazy.js';
|
|
8
8
|
import { PaymentType } from './index.js';
|
|
9
|
-
const OPS = bscript.
|
|
9
|
+
const OPS = bscript.opcodes;
|
|
10
10
|
const P2OP_WITNESS_VERSION = 0x10;
|
|
11
11
|
const MIN_SIZE = 2;
|
|
12
12
|
const MAX_SIZE = 40;
|
package/build/payments/p2pk.js
CHANGED
|
@@ -3,7 +3,7 @@ import * as bscript from '../script.js';
|
|
|
3
3
|
import { isPoint, typeforce as typef } from '../types.js';
|
|
4
4
|
import { PaymentType } from './index.js';
|
|
5
5
|
import * as lazy from './lazy.js';
|
|
6
|
-
const OPS = bscript.
|
|
6
|
+
const OPS = bscript.opcodes;
|
|
7
7
|
export function p2pk(a, opts) {
|
|
8
8
|
if (!a.input && !a.output && !a.pubkey && !a.input && !a.signature)
|
|
9
9
|
throw new TypeError('Not enough data');
|
package/build/payments/p2pkh.js
CHANGED
|
@@ -6,7 +6,7 @@ import { isPoint, typeforce as typef } from '../types.js';
|
|
|
6
6
|
import { PaymentType } from './index.js';
|
|
7
7
|
import * as lazy from './lazy.js';
|
|
8
8
|
import { decompressPublicKey } from '../psbt/psbtutils.js';
|
|
9
|
-
const OPS = bscript.
|
|
9
|
+
const OPS = bscript.opcodes;
|
|
10
10
|
export function p2pkh(a, opts) {
|
|
11
11
|
if (!a.address && !a.hash && !a.output && !a.pubkey && !a.input) {
|
|
12
12
|
throw new TypeError('Not enough data');
|
package/build/payments/p2sh.js
CHANGED
|
@@ -3,9 +3,9 @@ import * as bcrypto from '../crypto.js';
|
|
|
3
3
|
import { bitcoin as BITCOIN_NETWORK } from '../networks.js';
|
|
4
4
|
import * as bscript from '../script.js';
|
|
5
5
|
import { stacksEqual, typeforce as typef } from '../types.js';
|
|
6
|
-
import { PaymentType } from './index.js';
|
|
6
|
+
import { PaymentType, } from './index.js';
|
|
7
7
|
import * as lazy from './lazy.js';
|
|
8
|
-
const OPS = bscript.
|
|
8
|
+
const OPS = bscript.opcodes;
|
|
9
9
|
export function p2sh(a, opts) {
|
|
10
10
|
if (!a.address && !a.hash && !a.output && !a.redeem && !a.input) {
|
|
11
11
|
throw new TypeError('Not enough data');
|
|
@@ -31,7 +31,7 @@ export function p2sh(a, opts) {
|
|
|
31
31
|
}
|
|
32
32
|
const o = {
|
|
33
33
|
network,
|
|
34
|
-
name: PaymentType.P2SH
|
|
34
|
+
name: PaymentType.P2SH,
|
|
35
35
|
};
|
|
36
36
|
const _address = lazy.value(() => {
|
|
37
37
|
const payload = Buffer.from(bs58check.default.decode(a.address));
|
package/build/payments/p2tr.js
CHANGED
|
@@ -8,7 +8,7 @@ import { isTaptree, stacksEqual, TAPLEAF_VERSION_MASK, typeforce as typef } from
|
|
|
8
8
|
import { findScriptPath, LEAF_VERSION_TAPSCRIPT, rootHashFromPath, tapleafHash, toHashTree, tweakKey, } from './bip341.js';
|
|
9
9
|
import { PaymentType } from './index.js';
|
|
10
10
|
import * as lazy from './lazy.js';
|
|
11
|
-
const OPS = bscript.
|
|
11
|
+
const OPS = bscript.opcodes;
|
|
12
12
|
const TAPROOT_WITNESS_VERSION = 0x01;
|
|
13
13
|
const ANNEX_PREFIX = 0x50;
|
|
14
14
|
export function p2tr(a, opts) {
|
package/build/payments/p2wpkh.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as bscript from '../script.js';
|
|
|
5
5
|
import { isPoint, typeforce as typef } from '../types.js';
|
|
6
6
|
import { PaymentType } from './index.js';
|
|
7
7
|
import * as lazy from './lazy.js';
|
|
8
|
-
const OPS = bscript.
|
|
8
|
+
const OPS = bscript.opcodes;
|
|
9
9
|
const EMPTY_BUFFER = Buffer.alloc(0);
|
|
10
10
|
export function p2wpkh(a, opts) {
|
|
11
11
|
if (!a.address && !a.hash && !a.output && !a.pubkey && !a.witness)
|
|
@@ -34,7 +34,7 @@ export function p2wpkh(a, opts) {
|
|
|
34
34
|
const network = a.network || BITCOIN_NETWORK;
|
|
35
35
|
const o = {
|
|
36
36
|
name: PaymentType.P2WPKH,
|
|
37
|
-
network
|
|
37
|
+
network,
|
|
38
38
|
};
|
|
39
39
|
lazy.prop(o, 'address', () => {
|
|
40
40
|
if (!o.hash)
|
package/build/payments/p2wsh.js
CHANGED
|
@@ -5,7 +5,7 @@ import * as bscript from '../script.js';
|
|
|
5
5
|
import { isPoint, stacksEqual, typeforce as typef } from '../types.js';
|
|
6
6
|
import { PaymentType } from './index.js';
|
|
7
7
|
import * as lazy from './lazy.js';
|
|
8
|
-
const OPS = bscript.
|
|
8
|
+
const OPS = bscript.opcodes;
|
|
9
9
|
const EMPTY_BUFFER = Buffer.alloc(0);
|
|
10
10
|
function chunkHasUncompressedPubkey(chunk) {
|
|
11
11
|
if (Buffer.isBuffer(chunk) && chunk.length === 65 && chunk[0] === 0x04 && isPoint(chunk)) {
|
|
@@ -52,7 +52,7 @@ export function p2wsh(a, opts) {
|
|
|
52
52
|
}
|
|
53
53
|
const o = {
|
|
54
54
|
network,
|
|
55
|
-
name: PaymentType.P2WSH
|
|
55
|
+
name: PaymentType.P2WSH,
|
|
56
56
|
};
|
|
57
57
|
lazy.prop(o, 'address', () => {
|
|
58
58
|
if (!o.hash)
|
package/build/push_data.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { opcodes } from './opcodes.js';
|
|
2
2
|
export function encodingLength(i) {
|
|
3
|
-
return i <
|
|
3
|
+
return i < opcodes.OP_PUSHDATA1 ? 1 : i <= 0xff ? 2 : i <= 0xffff ? 3 : 5;
|
|
4
4
|
}
|
|
5
5
|
export function encode(buffer, num, offset) {
|
|
6
6
|
const size = encodingLength(num);
|
|
@@ -8,15 +8,15 @@ export function encode(buffer, num, offset) {
|
|
|
8
8
|
buffer.writeUInt8(num, offset);
|
|
9
9
|
}
|
|
10
10
|
else if (size === 2) {
|
|
11
|
-
buffer.writeUInt8(
|
|
11
|
+
buffer.writeUInt8(opcodes.OP_PUSHDATA1, offset);
|
|
12
12
|
buffer.writeUInt8(num, offset + 1);
|
|
13
13
|
}
|
|
14
14
|
else if (size === 3) {
|
|
15
|
-
buffer.writeUInt8(
|
|
15
|
+
buffer.writeUInt8(opcodes.OP_PUSHDATA2, offset);
|
|
16
16
|
buffer.writeUInt16LE(num, offset + 1);
|
|
17
17
|
}
|
|
18
18
|
else {
|
|
19
|
-
buffer.writeUInt8(
|
|
19
|
+
buffer.writeUInt8(opcodes.OP_PUSHDATA4, offset);
|
|
20
20
|
buffer.writeUInt32LE(num, offset + 1);
|
|
21
21
|
}
|
|
22
22
|
return size;
|
|
@@ -25,17 +25,17 @@ export function decode(buffer, offset) {
|
|
|
25
25
|
const opcode = buffer.readUInt8(offset);
|
|
26
26
|
let num;
|
|
27
27
|
let size;
|
|
28
|
-
if (opcode <
|
|
28
|
+
if (opcode < opcodes.OP_PUSHDATA1) {
|
|
29
29
|
num = opcode;
|
|
30
30
|
size = 1;
|
|
31
31
|
}
|
|
32
|
-
else if (opcode ===
|
|
32
|
+
else if (opcode === opcodes.OP_PUSHDATA1) {
|
|
33
33
|
if (offset + 2 > buffer.length)
|
|
34
34
|
return null;
|
|
35
35
|
num = buffer.readUInt8(offset + 1);
|
|
36
36
|
size = 2;
|
|
37
37
|
}
|
|
38
|
-
else if (opcode ===
|
|
38
|
+
else if (opcode === opcodes.OP_PUSHDATA2) {
|
|
39
39
|
if (offset + 3 > buffer.length)
|
|
40
40
|
return null;
|
|
41
41
|
num = buffer.readUInt16LE(offset + 1);
|
|
@@ -44,7 +44,7 @@ export function decode(buffer, offset) {
|
|
|
44
44
|
else {
|
|
45
45
|
if (offset + 5 > buffer.length)
|
|
46
46
|
return null;
|
|
47
|
-
if (opcode !==
|
|
47
|
+
if (opcode !== opcodes.OP_PUSHDATA4)
|
|
48
48
|
throw new Error('Unexpected opcode');
|
|
49
49
|
num = buffer.readUInt32LE(offset + 1);
|
|
50
50
|
size = 5;
|
package/build/script.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { opcodes } from './opcodes.js';
|
|
2
2
|
import { Stack } from './payments/index.js';
|
|
3
3
|
import * as scriptNumber from './script_number.js';
|
|
4
4
|
import * as scriptSignature from './script_signature.js';
|
|
5
|
-
export {
|
|
5
|
+
export { opcodes };
|
|
6
6
|
export declare function isPushOnly(value: Stack): boolean;
|
|
7
7
|
export declare function countNonPushOnlyOPs(value: Stack): number;
|
|
8
8
|
export declare function compile(chunks: Buffer | Stack): Buffer;
|
package/build/script.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import * as bip66 from './bip66.js';
|
|
2
|
-
import {
|
|
2
|
+
import { opcodes, REVERSE_OPS } from './opcodes.js';
|
|
3
3
|
import * as pushdata from './push_data.js';
|
|
4
4
|
import * as scriptNumber from './script_number.js';
|
|
5
5
|
import * as scriptSignature from './script_signature.js';
|
|
6
6
|
import * as types from './types.js';
|
|
7
7
|
const { typeforce } = types;
|
|
8
|
-
const OP_INT_BASE =
|
|
9
|
-
export {
|
|
8
|
+
const OP_INT_BASE = opcodes.OP_RESERVED;
|
|
9
|
+
export { opcodes };
|
|
10
10
|
function isOPInt(value) {
|
|
11
11
|
return (types.Number(value) &&
|
|
12
|
-
(value ===
|
|
13
|
-
(value >=
|
|
14
|
-
value ===
|
|
12
|
+
(value === opcodes.OP_0 ||
|
|
13
|
+
(value >= opcodes.OP_1 && value <= opcodes.OP_16) ||
|
|
14
|
+
value === opcodes.OP_1NEGATE));
|
|
15
15
|
}
|
|
16
16
|
function isPushOnlyChunk(value) {
|
|
17
17
|
return types.Buffer(value) || isOPInt(value);
|
|
@@ -24,13 +24,13 @@ export function countNonPushOnlyOPs(value) {
|
|
|
24
24
|
}
|
|
25
25
|
function asMinimalOP(buffer) {
|
|
26
26
|
if (buffer.length === 0)
|
|
27
|
-
return
|
|
27
|
+
return opcodes.OP_0;
|
|
28
28
|
if (buffer.length !== 1)
|
|
29
29
|
return;
|
|
30
30
|
if (buffer[0] >= 1 && buffer[0] <= 16)
|
|
31
31
|
return OP_INT_BASE + buffer[0];
|
|
32
32
|
if (buffer[0] === 0x81)
|
|
33
|
-
return
|
|
33
|
+
return opcodes.OP_1NEGATE;
|
|
34
34
|
}
|
|
35
35
|
function chunksIsBuffer(buf) {
|
|
36
36
|
return Buffer.isBuffer(buf);
|
|
@@ -85,7 +85,7 @@ export function decompile(buffer) {
|
|
|
85
85
|
let i = 0;
|
|
86
86
|
while (i < buffer.length) {
|
|
87
87
|
const opcode = buffer[i];
|
|
88
|
-
if (opcode >
|
|
88
|
+
if (opcode > opcodes.OP_0 && opcode <= opcodes.OP_PUSHDATA4) {
|
|
89
89
|
const d = pushdata.decode(buffer, i);
|
|
90
90
|
if (d === null)
|
|
91
91
|
return null;
|
|
@@ -131,8 +131,8 @@ export function toASM(chunks) {
|
|
|
131
131
|
export function fromASM(asm) {
|
|
132
132
|
typeforce(types.String, asm);
|
|
133
133
|
return compile(asm.split(' ').map((chunkStr) => {
|
|
134
|
-
if (
|
|
135
|
-
return
|
|
134
|
+
if (opcodes[chunkStr] !== undefined) {
|
|
135
|
+
return opcodes[chunkStr];
|
|
136
136
|
}
|
|
137
137
|
typeforce(types.Hex, chunkStr);
|
|
138
138
|
return Buffer.from(chunkStr, 'hex');
|
|
@@ -144,7 +144,7 @@ export function toStack(chunks) {
|
|
|
144
144
|
return chunks.map((op) => {
|
|
145
145
|
if (singleChunkIsBuffer(op))
|
|
146
146
|
return op;
|
|
147
|
-
if (op ===
|
|
147
|
+
if (op === opcodes.OP_0)
|
|
148
148
|
return Buffer.allocUnsafe(0);
|
|
149
149
|
return scriptNumber.encode(op - OP_INT_BASE);
|
|
150
150
|
});
|
package/build/transaction.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BufferReader, BufferWriter, reverseBuffer, varuint } from './bufferutils.js';
|
|
2
2
|
import * as bcrypto from './crypto.js';
|
|
3
3
|
import * as bscript from './script.js';
|
|
4
|
-
import {
|
|
4
|
+
import { opcodes } from './script.js';
|
|
5
5
|
import * as types from './types.js';
|
|
6
6
|
const { typeforce } = types;
|
|
7
7
|
function varSliceSize(someScript) {
|
package/cjs/package.json
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
{
|
|
2
|
-
"type": "commonjs"
|
|
3
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"type": "commonjs"
|
|
3
|
+
}
|
package/gulpfile.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
import gulp from 'gulp';
|
|
2
|
-
import gulpcache from 'gulp-cached';
|
|
3
|
-
import gulpESLintNew from 'gulp-eslint-new';
|
|
4
|
-
|
|
5
|
-
import gulpClean from 'gulp-clean';
|
|
6
|
-
import logger from 'gulp-logger-new';
|
|
7
|
-
import ts from 'gulp-typescript';
|
|
8
|
-
|
|
9
|
-
process.on('uncaughtException', function (err) {
|
|
10
|
-
console.log('Caught exception: ', err);
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
const tsProject = ts.createProject('tsconfig.json');
|
|
14
|
-
|
|
15
|
-
function buildESM() {
|
|
16
|
-
return tsProject
|
|
17
|
-
.src()
|
|
18
|
-
.pipe(gulpcache('ts-esm'))
|
|
19
|
-
.pipe(
|
|
20
|
-
logger({
|
|
21
|
-
before: 'Starting...',
|
|
22
|
-
after: 'Project compiled!',
|
|
23
|
-
extname: '.js',
|
|
24
|
-
showChange: true,
|
|
25
|
-
}),
|
|
26
|
-
)
|
|
27
|
-
.pipe(gulpESLintNew())
|
|
28
|
-
.pipe(gulpESLintNew.format())
|
|
29
|
-
.pipe(tsProject())
|
|
30
|
-
.pipe(gulp.dest('build'));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export async function clean() {
|
|
34
|
-
return gulp.src('./build/src', { read: false }).pipe(gulpClean());
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const build = buildESM;
|
|
38
|
-
export default build;
|
|
39
|
-
|
|
40
|
-
export function watch() {
|
|
41
|
-
gulp.watch(['src/**/*.ts', 'src/**/*.js'], gulp.series(buildESM));
|
|
42
|
-
}
|
|
1
|
+
import gulp from 'gulp';
|
|
2
|
+
import gulpcache from 'gulp-cached';
|
|
3
|
+
import gulpESLintNew from 'gulp-eslint-new';
|
|
4
|
+
|
|
5
|
+
import gulpClean from 'gulp-clean';
|
|
6
|
+
import logger from 'gulp-logger-new';
|
|
7
|
+
import ts from 'gulp-typescript';
|
|
8
|
+
|
|
9
|
+
process.on('uncaughtException', function (err) {
|
|
10
|
+
console.log('Caught exception: ', err);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
const tsProject = ts.createProject('tsconfig.json');
|
|
14
|
+
|
|
15
|
+
function buildESM() {
|
|
16
|
+
return tsProject
|
|
17
|
+
.src()
|
|
18
|
+
.pipe(gulpcache('ts-esm'))
|
|
19
|
+
.pipe(
|
|
20
|
+
logger({
|
|
21
|
+
before: 'Starting...',
|
|
22
|
+
after: 'Project compiled!',
|
|
23
|
+
extname: '.js',
|
|
24
|
+
showChange: true,
|
|
25
|
+
}),
|
|
26
|
+
)
|
|
27
|
+
.pipe(gulpESLintNew())
|
|
28
|
+
.pipe(gulpESLintNew.format())
|
|
29
|
+
.pipe(tsProject())
|
|
30
|
+
.pipe(gulp.dest('build'));
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export async function clean() {
|
|
34
|
+
return gulp.src('./build/src', { read: false }).pipe(gulpClean());
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export const build = buildESM;
|
|
38
|
+
export default build;
|
|
39
|
+
|
|
40
|
+
export function watch() {
|
|
41
|
+
gulp.watch(['src/**/*.ts', 'src/**/*.js'], gulp.series(buildESM));
|
|
42
|
+
}
|