@btc-vision/bitcoin 6.5.6 → 7.0.0-alpha.1
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 +57 -10
- 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 +12477 -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 +58 -11
- package/build/address.d.ts.map +1 -0
- package/build/address.js +82 -25
- 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 +202 -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 +35 -9
- package/build/payments/bip341.d.ts.map +1 -0
- package/build/payments/bip341.js +34 -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 -150
- 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 +428 -103
- 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 +465 -143
- 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 +117 -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 +406 -413
- 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 +101 -37
- 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 +169 -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 +68 -9
- package/scripts/bundle-ecc.ts +111 -0
- package/src/address.ts +91 -45
- package/src/bech32utils.ts +3 -3
- package/src/bip66.ts +34 -24
- package/src/block.ts +205 -86
- package/src/branded.ts +18 -0
- package/src/crypto.ts +64 -26
- package/src/ecc/context.ts +280 -0
- package/src/ecc/index.ts +14 -0
- package/src/ecc/types.ts +147 -0
- package/src/ecpair.d.ts +99 -0
- package/src/errors.ts +163 -0
- package/src/index.ts +112 -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 +32 -33
- package/src/payments/embed.ts +244 -41
- package/src/payments/index.ts +12 -10
- package/src/payments/p2ms.ts +497 -118
- package/src/payments/p2op.ts +432 -134
- package/src/payments/p2pk.ts +370 -72
- package/src/payments/p2pkh.ts +524 -130
- package/src/payments/p2sh.ts +572 -169
- package/src/payments/p2tr.ts +686 -194
- package/src/payments/p2wpkh.ts +482 -105
- package/src/payments/p2wsh.ts +524 -162
- package/src/payments/types.ts +80 -66
- package/src/psbt/bip371.ts +72 -51
- package/src/psbt/psbtutils.ts +39 -40
- package/src/psbt/types.ts +324 -0
- package/src/psbt/utils.ts +188 -0
- package/src/psbt/validation.ts +185 -0
- package/src/psbt.ts +608 -827
- package/src/pubkey.ts +22 -23
- package/src/push_data.ts +18 -16
- package/src/script.ts +81 -66
- package/src/script_number.ts +6 -6
- package/src/script_signature.ts +33 -36
- package/src/transaction.ts +462 -239
- package/src/types.ts +229 -100
- package/src/workers/WorkerSigningPool.node.ts +887 -0
- package/src/workers/WorkerSigningPool.ts +666 -0
- package/src/workers/ecc-bundle.ts +26 -0
- package/src/workers/index.ts +165 -0
- package/src/workers/psbt-parallel.ts +327 -0
- package/src/workers/signing-worker.ts +353 -0
- package/src/workers/types.ts +417 -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/typedoc.json +29 -0
- 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
|
@@ -1,761 +0,0 @@
|
|
|
1
|
-
import { B as A, g as on, a as R } from "./crypto-BhCpKpek.js";
|
|
2
|
-
import { o as _ } from "./script-DyPItFEl.js";
|
|
3
|
-
function Dn(n) {
|
|
4
|
-
if (n.length < 8 || n.length > 72 || n[0] !== 48 || n[1] !== n.length - 2 || n[2] !== 2) return !1;
|
|
5
|
-
const r = n[3];
|
|
6
|
-
if (r === 0 || 5 + r >= n.length || n[4 + r] !== 2) return !1;
|
|
7
|
-
const t = n[5 + r];
|
|
8
|
-
return !(t === 0 || 6 + r + t !== n.length || n[4] & 128 || r > 1 && n[4] === 0 && !(n[5] & 128) || n[r + 6] & 128 || t > 1 && n[r + 6] === 0 && !(n[r + 7] & 128));
|
|
9
|
-
}
|
|
10
|
-
function Cn(n) {
|
|
11
|
-
if (n.length < 8) throw new Error("DER sequence length is too short");
|
|
12
|
-
if (n.length > 72) throw new Error("DER sequence length is too long");
|
|
13
|
-
if (n[0] !== 48) throw new Error("Expected DER sequence");
|
|
14
|
-
if (n[1] !== n.length - 2) throw new Error("DER sequence length is invalid");
|
|
15
|
-
if (n[2] !== 2) throw new Error("Expected DER integer");
|
|
16
|
-
const r = n[3];
|
|
17
|
-
if (r === 0) throw new Error("R length is zero");
|
|
18
|
-
if (5 + r >= n.length) throw new Error("R length is too long");
|
|
19
|
-
if (n[4 + r] !== 2) throw new Error("Expected DER integer (2)");
|
|
20
|
-
const t = n[5 + r];
|
|
21
|
-
if (t === 0) throw new Error("S length is zero");
|
|
22
|
-
if (6 + r + t !== n.length) throw new Error("S length is invalid");
|
|
23
|
-
if (n[4] & 128) throw new Error("R value is negative");
|
|
24
|
-
if (r > 1 && n[4] === 0 && !(n[5] & 128))
|
|
25
|
-
throw new Error("R value excessively padded");
|
|
26
|
-
if (n[r + 6] & 128) throw new Error("S value is negative");
|
|
27
|
-
if (t > 1 && n[r + 6] === 0 && !(n[r + 7] & 128))
|
|
28
|
-
throw new Error("S value excessively padded");
|
|
29
|
-
return {
|
|
30
|
-
r: n.subarray(4, 4 + r),
|
|
31
|
-
s: n.subarray(6 + r)
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
function Fn(n, r) {
|
|
35
|
-
const t = n.length, e = r.length;
|
|
36
|
-
if (t === 0) throw new Error("R length is zero");
|
|
37
|
-
if (e === 0) throw new Error("S length is zero");
|
|
38
|
-
if (t > 33) throw new Error("R length is too long");
|
|
39
|
-
if (e > 33) throw new Error("S length is too long");
|
|
40
|
-
if (n[0] & 128) throw new Error("R value is negative");
|
|
41
|
-
if (r[0] & 128) throw new Error("S value is negative");
|
|
42
|
-
if (t > 1 && n[0] === 0 && !(n[1] & 128)) throw new Error("R value excessively padded");
|
|
43
|
-
if (e > 1 && r[0] === 0 && !(r[1] & 128)) throw new Error("S value excessively padded");
|
|
44
|
-
const a = A.allocUnsafe(6 + t + e);
|
|
45
|
-
return a[0] = 48, a[1] = a.length - 2, a[2] = 2, a[3] = n.length, n.copy(a, 4), a[4 + t] = 2, a[5 + t] = r.length, r.copy(a, 6 + t), a;
|
|
46
|
-
}
|
|
47
|
-
function fn(n) {
|
|
48
|
-
return n < _.OP_PUSHDATA1 ? 1 : n <= 255 ? 2 : n <= 65535 ? 3 : 5;
|
|
49
|
-
}
|
|
50
|
-
function Mn(n, r, t) {
|
|
51
|
-
const e = fn(r);
|
|
52
|
-
return e === 1 ? n.writeUInt8(r, t) : e === 2 ? (n.writeUInt8(_.OP_PUSHDATA1, t), n.writeUInt8(r, t + 1)) : e === 3 ? (n.writeUInt8(_.OP_PUSHDATA2, t), n.writeUInt16LE(r, t + 1)) : (n.writeUInt8(_.OP_PUSHDATA4, t), n.writeUInt32LE(r, t + 1)), e;
|
|
53
|
-
}
|
|
54
|
-
function zn(n, r) {
|
|
55
|
-
const t = n.readUInt8(r);
|
|
56
|
-
let e, a;
|
|
57
|
-
if (t < _.OP_PUSHDATA1)
|
|
58
|
-
e = t, a = 1;
|
|
59
|
-
else if (t === _.OP_PUSHDATA1) {
|
|
60
|
-
if (r + 2 > n.length) return null;
|
|
61
|
-
e = n.readUInt8(r + 1), a = 2;
|
|
62
|
-
} else if (t === _.OP_PUSHDATA2) {
|
|
63
|
-
if (r + 3 > n.length) return null;
|
|
64
|
-
e = n.readUInt16LE(r + 1), a = 3;
|
|
65
|
-
} else {
|
|
66
|
-
if (r + 5 > n.length) return null;
|
|
67
|
-
if (t !== _.OP_PUSHDATA4) throw new Error("Unexpected opcode");
|
|
68
|
-
e = n.readUInt32LE(r + 1), a = 5;
|
|
69
|
-
}
|
|
70
|
-
return {
|
|
71
|
-
opcode: t,
|
|
72
|
-
number: e,
|
|
73
|
-
size: a
|
|
74
|
-
};
|
|
75
|
-
}
|
|
76
|
-
var p, q;
|
|
77
|
-
function J() {
|
|
78
|
-
if (q) return p;
|
|
79
|
-
q = 1;
|
|
80
|
-
var n = {
|
|
81
|
-
Array: function(t) {
|
|
82
|
-
return t != null && t.constructor === Array;
|
|
83
|
-
},
|
|
84
|
-
Boolean: function(t) {
|
|
85
|
-
return typeof t == "boolean";
|
|
86
|
-
},
|
|
87
|
-
Function: function(t) {
|
|
88
|
-
return typeof t == "function";
|
|
89
|
-
},
|
|
90
|
-
Nil: function(t) {
|
|
91
|
-
return t == null;
|
|
92
|
-
},
|
|
93
|
-
Number: function(t) {
|
|
94
|
-
return typeof t == "number";
|
|
95
|
-
},
|
|
96
|
-
Object: function(t) {
|
|
97
|
-
return typeof t == "object";
|
|
98
|
-
},
|
|
99
|
-
String: function(t) {
|
|
100
|
-
return typeof t == "string";
|
|
101
|
-
},
|
|
102
|
-
"": function() {
|
|
103
|
-
return !0;
|
|
104
|
-
}
|
|
105
|
-
};
|
|
106
|
-
n.Null = n.Nil;
|
|
107
|
-
for (var r in n)
|
|
108
|
-
n[r].toJSON = function(t) {
|
|
109
|
-
return t;
|
|
110
|
-
}.bind(null, r);
|
|
111
|
-
return p = n, p;
|
|
112
|
-
}
|
|
113
|
-
var P, H;
|
|
114
|
-
function z() {
|
|
115
|
-
if (H) return P;
|
|
116
|
-
H = 1;
|
|
117
|
-
var n = J();
|
|
118
|
-
function r(i) {
|
|
119
|
-
return i.name || i.toString().match(/function (.*?)\s*\(/)[1];
|
|
120
|
-
}
|
|
121
|
-
function t(i) {
|
|
122
|
-
return n.Nil(i) ? "" : r(i.constructor);
|
|
123
|
-
}
|
|
124
|
-
function e(i) {
|
|
125
|
-
return n.Function(i) ? "" : n.String(i) ? JSON.stringify(i) : i && n.Object(i) ? "" : i;
|
|
126
|
-
}
|
|
127
|
-
function a(i, f) {
|
|
128
|
-
Error.captureStackTrace && Error.captureStackTrace(i, f);
|
|
129
|
-
}
|
|
130
|
-
function d(i) {
|
|
131
|
-
return n.Function(i) ? i.toJSON ? i.toJSON() : r(i) : n.Array(i) ? "Array" : i && n.Object(i) ? "Object" : i !== void 0 ? i : "";
|
|
132
|
-
}
|
|
133
|
-
function N(i, f, o) {
|
|
134
|
-
var s = e(f);
|
|
135
|
-
return "Expected " + d(i) + ", got" + (o !== "" ? " " + o : "") + (s !== "" ? " " + s : "");
|
|
136
|
-
}
|
|
137
|
-
function l(i, f, o) {
|
|
138
|
-
o = o || t(f), this.message = N(i, f, o), a(this, l), this.__type = i, this.__value = f, this.__valueTypeName = o;
|
|
139
|
-
}
|
|
140
|
-
l.prototype = Object.create(Error.prototype), l.prototype.constructor = l;
|
|
141
|
-
function E(i, f, o, s, c) {
|
|
142
|
-
var g = '" of type ';
|
|
143
|
-
return f === "key" && (g = '" with key type '), N('property "' + d(o) + g + d(i), s, c);
|
|
144
|
-
}
|
|
145
|
-
function h(i, f, o, s, c) {
|
|
146
|
-
i ? (c = c || t(s), this.message = E(i, o, f, s, c)) : this.message = 'Unexpected property "' + f + '"', a(this, l), this.__label = o, this.__property = f, this.__type = i, this.__value = s, this.__valueTypeName = c;
|
|
147
|
-
}
|
|
148
|
-
h.prototype = Object.create(Error.prototype), h.prototype.constructor = l;
|
|
149
|
-
function S(i, f) {
|
|
150
|
-
return new l(i, {}, f);
|
|
151
|
-
}
|
|
152
|
-
function y(i, f, o) {
|
|
153
|
-
return i instanceof h ? (f = f + "." + i.__property, i = new h(
|
|
154
|
-
i.__type,
|
|
155
|
-
f,
|
|
156
|
-
i.__label,
|
|
157
|
-
i.__value,
|
|
158
|
-
i.__valueTypeName
|
|
159
|
-
)) : i instanceof l && (i = new h(
|
|
160
|
-
i.__type,
|
|
161
|
-
f,
|
|
162
|
-
o,
|
|
163
|
-
i.__value,
|
|
164
|
-
i.__valueTypeName
|
|
165
|
-
)), a(i), i;
|
|
166
|
-
}
|
|
167
|
-
return P = {
|
|
168
|
-
TfTypeError: l,
|
|
169
|
-
TfPropertyTypeError: h,
|
|
170
|
-
tfCustomError: S,
|
|
171
|
-
tfSubError: y,
|
|
172
|
-
tfJSON: d,
|
|
173
|
-
getValueTypeName: t
|
|
174
|
-
}, P;
|
|
175
|
-
}
|
|
176
|
-
var V, D;
|
|
177
|
-
function un() {
|
|
178
|
-
if (D) return V;
|
|
179
|
-
D = 1;
|
|
180
|
-
var n = J(), r = z();
|
|
181
|
-
function t(u) {
|
|
182
|
-
return A.isBuffer(u);
|
|
183
|
-
}
|
|
184
|
-
function e(u) {
|
|
185
|
-
return typeof u == "string" && /^([0-9a-f]{2})+$/i.test(u);
|
|
186
|
-
}
|
|
187
|
-
function a(u, L) {
|
|
188
|
-
var U = u.toJSON();
|
|
189
|
-
function B(O) {
|
|
190
|
-
if (!u(O)) return !1;
|
|
191
|
-
if (O.length === L) return !0;
|
|
192
|
-
throw r.tfCustomError(U + "(Length: " + L + ")", U + "(Length: " + O.length + ")");
|
|
193
|
-
}
|
|
194
|
-
return B.toJSON = function() {
|
|
195
|
-
return U;
|
|
196
|
-
}, B;
|
|
197
|
-
}
|
|
198
|
-
var d = a.bind(null, n.Array), N = a.bind(null, t), l = a.bind(null, e), E = a.bind(null, n.String);
|
|
199
|
-
function h(u, L, U) {
|
|
200
|
-
U = U || n.Number;
|
|
201
|
-
function B(O, en) {
|
|
202
|
-
return U(O, en) && O > u && O < L;
|
|
203
|
-
}
|
|
204
|
-
return B.toJSON = function() {
|
|
205
|
-
return `${U.toJSON()} between [${u}, ${L}]`;
|
|
206
|
-
}, B;
|
|
207
|
-
}
|
|
208
|
-
var S = Math.pow(2, 53) - 1;
|
|
209
|
-
function y(u) {
|
|
210
|
-
return typeof u == "number" && isFinite(u);
|
|
211
|
-
}
|
|
212
|
-
function i(u) {
|
|
213
|
-
return u << 24 >> 24 === u;
|
|
214
|
-
}
|
|
215
|
-
function f(u) {
|
|
216
|
-
return u << 16 >> 16 === u;
|
|
217
|
-
}
|
|
218
|
-
function o(u) {
|
|
219
|
-
return (u | 0) === u;
|
|
220
|
-
}
|
|
221
|
-
function s(u) {
|
|
222
|
-
return typeof u == "number" && u >= -S && u <= S && Math.floor(u) === u;
|
|
223
|
-
}
|
|
224
|
-
function c(u) {
|
|
225
|
-
return (u & 255) === u;
|
|
226
|
-
}
|
|
227
|
-
function g(u) {
|
|
228
|
-
return (u & 65535) === u;
|
|
229
|
-
}
|
|
230
|
-
function m(u) {
|
|
231
|
-
return u >>> 0 === u;
|
|
232
|
-
}
|
|
233
|
-
function I(u) {
|
|
234
|
-
return typeof u == "number" && u >= 0 && u <= S && Math.floor(u) === u;
|
|
235
|
-
}
|
|
236
|
-
var x = {
|
|
237
|
-
ArrayN: d,
|
|
238
|
-
Buffer: t,
|
|
239
|
-
BufferN: N,
|
|
240
|
-
Finite: y,
|
|
241
|
-
Hex: e,
|
|
242
|
-
HexN: l,
|
|
243
|
-
Int8: i,
|
|
244
|
-
Int16: f,
|
|
245
|
-
Int32: o,
|
|
246
|
-
Int53: s,
|
|
247
|
-
Range: h,
|
|
248
|
-
StringN: E,
|
|
249
|
-
UInt8: c,
|
|
250
|
-
UInt16: g,
|
|
251
|
-
UInt32: m,
|
|
252
|
-
UInt53: I
|
|
253
|
-
};
|
|
254
|
-
for (var T in x)
|
|
255
|
-
x[T].toJSON = function(u) {
|
|
256
|
-
return u;
|
|
257
|
-
}.bind(null, T);
|
|
258
|
-
return V = x, V;
|
|
259
|
-
}
|
|
260
|
-
var j, C;
|
|
261
|
-
function sn() {
|
|
262
|
-
if (C) return j;
|
|
263
|
-
C = 1;
|
|
264
|
-
var n = z(), r = J(), t = n.tfJSON, e = n.TfTypeError, a = n.TfPropertyTypeError, d = n.tfSubError, N = n.getValueTypeName, l = {
|
|
265
|
-
arrayOf: function(f, o) {
|
|
266
|
-
f = E(f), o = o || {};
|
|
267
|
-
function s(c, g) {
|
|
268
|
-
return !r.Array(c) || r.Nil(c) || o.minLength !== void 0 && c.length < o.minLength || o.maxLength !== void 0 && c.length > o.maxLength || o.length !== void 0 && c.length !== o.length ? !1 : c.every(function(m, I) {
|
|
269
|
-
try {
|
|
270
|
-
return h(f, m, g);
|
|
271
|
-
} catch (x) {
|
|
272
|
-
throw d(x, I);
|
|
273
|
-
}
|
|
274
|
-
});
|
|
275
|
-
}
|
|
276
|
-
return s.toJSON = function() {
|
|
277
|
-
var c = "[" + t(f) + "]";
|
|
278
|
-
return o.length !== void 0 ? c += "{" + o.length + "}" : (o.minLength !== void 0 || o.maxLength !== void 0) && (c += "{" + (o.minLength === void 0 ? 0 : o.minLength) + "," + (o.maxLength === void 0 ? 1 / 0 : o.maxLength) + "}"), c;
|
|
279
|
-
}, s;
|
|
280
|
-
},
|
|
281
|
-
maybe: function i(f) {
|
|
282
|
-
f = E(f);
|
|
283
|
-
function o(s, c) {
|
|
284
|
-
return r.Nil(s) || f(s, c, i);
|
|
285
|
-
}
|
|
286
|
-
return o.toJSON = function() {
|
|
287
|
-
return "?" + t(f);
|
|
288
|
-
}, o;
|
|
289
|
-
},
|
|
290
|
-
map: function(f, o) {
|
|
291
|
-
f = E(f), o && (o = E(o));
|
|
292
|
-
function s(c, g) {
|
|
293
|
-
if (!r.Object(c) || r.Nil(c)) return !1;
|
|
294
|
-
for (var m in c) {
|
|
295
|
-
try {
|
|
296
|
-
o && h(o, m, g);
|
|
297
|
-
} catch (x) {
|
|
298
|
-
throw d(x, m, "key");
|
|
299
|
-
}
|
|
300
|
-
try {
|
|
301
|
-
var I = c[m];
|
|
302
|
-
h(f, I, g);
|
|
303
|
-
} catch (x) {
|
|
304
|
-
throw d(x, m);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
return !0;
|
|
308
|
-
}
|
|
309
|
-
return o ? s.toJSON = function() {
|
|
310
|
-
return "{" + t(o) + ": " + t(f) + "}";
|
|
311
|
-
} : s.toJSON = function() {
|
|
312
|
-
return "{" + t(f) + "}";
|
|
313
|
-
}, s;
|
|
314
|
-
},
|
|
315
|
-
object: function(f) {
|
|
316
|
-
var o = {};
|
|
317
|
-
for (var s in f)
|
|
318
|
-
o[s] = E(f[s]);
|
|
319
|
-
function c(g, m) {
|
|
320
|
-
if (!r.Object(g) || r.Nil(g)) return !1;
|
|
321
|
-
var I;
|
|
322
|
-
try {
|
|
323
|
-
for (I in o) {
|
|
324
|
-
var x = o[I], T = g[I];
|
|
325
|
-
h(x, T, m);
|
|
326
|
-
}
|
|
327
|
-
} catch (u) {
|
|
328
|
-
throw d(u, I);
|
|
329
|
-
}
|
|
330
|
-
if (m) {
|
|
331
|
-
for (I in g)
|
|
332
|
-
if (!o[I])
|
|
333
|
-
throw new a(void 0, I);
|
|
334
|
-
}
|
|
335
|
-
return !0;
|
|
336
|
-
}
|
|
337
|
-
return c.toJSON = function() {
|
|
338
|
-
return t(o);
|
|
339
|
-
}, c;
|
|
340
|
-
},
|
|
341
|
-
anyOf: function() {
|
|
342
|
-
var f = [].slice.call(arguments).map(E);
|
|
343
|
-
function o(s, c) {
|
|
344
|
-
return f.some(function(g) {
|
|
345
|
-
try {
|
|
346
|
-
return h(g, s, c);
|
|
347
|
-
} catch {
|
|
348
|
-
return !1;
|
|
349
|
-
}
|
|
350
|
-
});
|
|
351
|
-
}
|
|
352
|
-
return o.toJSON = function() {
|
|
353
|
-
return f.map(t).join("|");
|
|
354
|
-
}, o;
|
|
355
|
-
},
|
|
356
|
-
allOf: function() {
|
|
357
|
-
var f = [].slice.call(arguments).map(E);
|
|
358
|
-
function o(s, c) {
|
|
359
|
-
return f.every(function(g) {
|
|
360
|
-
try {
|
|
361
|
-
return h(g, s, c);
|
|
362
|
-
} catch {
|
|
363
|
-
return !1;
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
}
|
|
367
|
-
return o.toJSON = function() {
|
|
368
|
-
return f.map(t).join(" & ");
|
|
369
|
-
}, o;
|
|
370
|
-
},
|
|
371
|
-
quacksLike: function(f) {
|
|
372
|
-
function o(s) {
|
|
373
|
-
return f === N(s);
|
|
374
|
-
}
|
|
375
|
-
return o.toJSON = function() {
|
|
376
|
-
return f;
|
|
377
|
-
}, o;
|
|
378
|
-
},
|
|
379
|
-
tuple: function() {
|
|
380
|
-
var f = [].slice.call(arguments).map(E);
|
|
381
|
-
function o(s, c) {
|
|
382
|
-
return r.Nil(s) || r.Nil(s.length) || c && s.length !== f.length ? !1 : f.every(function(g, m) {
|
|
383
|
-
try {
|
|
384
|
-
return h(g, s[m], c);
|
|
385
|
-
} catch (I) {
|
|
386
|
-
throw d(I, m);
|
|
387
|
-
}
|
|
388
|
-
});
|
|
389
|
-
}
|
|
390
|
-
return o.toJSON = function() {
|
|
391
|
-
return "(" + f.map(t).join(", ") + ")";
|
|
392
|
-
}, o;
|
|
393
|
-
},
|
|
394
|
-
value: function(f) {
|
|
395
|
-
function o(s) {
|
|
396
|
-
return s === f;
|
|
397
|
-
}
|
|
398
|
-
return o.toJSON = function() {
|
|
399
|
-
return f;
|
|
400
|
-
}, o;
|
|
401
|
-
}
|
|
402
|
-
};
|
|
403
|
-
l.oneOf = l.anyOf;
|
|
404
|
-
function E(i) {
|
|
405
|
-
if (r.String(i))
|
|
406
|
-
return i[0] === "?" ? l.maybe(i.slice(1)) : r[i] || l.quacksLike(i);
|
|
407
|
-
if (i && r.Object(i)) {
|
|
408
|
-
if (r.Array(i)) {
|
|
409
|
-
if (i.length !== 1) throw new TypeError("Expected compile() parameter of type Array of length 1");
|
|
410
|
-
return l.arrayOf(i[0]);
|
|
411
|
-
}
|
|
412
|
-
return l.object(i);
|
|
413
|
-
} else if (r.Function(i))
|
|
414
|
-
return i;
|
|
415
|
-
return l.value(i);
|
|
416
|
-
}
|
|
417
|
-
function h(i, f, o, s) {
|
|
418
|
-
if (r.Function(i)) {
|
|
419
|
-
if (i(f, o)) return !0;
|
|
420
|
-
throw new e(s || i, f);
|
|
421
|
-
}
|
|
422
|
-
return h(E(i), f, o);
|
|
423
|
-
}
|
|
424
|
-
for (var S in r)
|
|
425
|
-
h[S] = r[S];
|
|
426
|
-
for (S in l)
|
|
427
|
-
h[S] = l[S];
|
|
428
|
-
var y = un();
|
|
429
|
-
for (S in y)
|
|
430
|
-
h[S] = y[S];
|
|
431
|
-
return h.compile = E, h.TfTypeError = e, h.TfPropertyTypeError = a, j = h, j;
|
|
432
|
-
}
|
|
433
|
-
var cn = sn();
|
|
434
|
-
const w = /* @__PURE__ */ on(cn), F = R.alloc(32, 0), M = R.from(
|
|
435
|
-
"fffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f",
|
|
436
|
-
"hex"
|
|
437
|
-
);
|
|
438
|
-
function an(n, r) {
|
|
439
|
-
return n.length !== r.length ? !1 : n.every((t, e) => t.equals(r[e]));
|
|
440
|
-
}
|
|
441
|
-
function hn(n) {
|
|
442
|
-
if (!R.isBuffer(n) || n.length < 33) return !1;
|
|
443
|
-
const r = n[0], t = n.subarray(1, 33);
|
|
444
|
-
if (t.compare(F) === 0 || t.compare(M) >= 0) return !1;
|
|
445
|
-
if ((r === 2 || r === 3) && n.length === 33)
|
|
446
|
-
return !0;
|
|
447
|
-
if (n.length !== 65) return !1;
|
|
448
|
-
const e = n.subarray(33);
|
|
449
|
-
return e.compare(F) === 0 || e.compare(M) >= 0 ? !1 : r === 4 || r === 6 || r === 7;
|
|
450
|
-
}
|
|
451
|
-
const ln = 21 * 1e14;
|
|
452
|
-
function gn(n) {
|
|
453
|
-
return w.UInt53(n) && n <= ln;
|
|
454
|
-
}
|
|
455
|
-
const b = 254;
|
|
456
|
-
function X(n) {
|
|
457
|
-
if (!n || typeof n != "object" || !("output" in n)) return !1;
|
|
458
|
-
const r = n;
|
|
459
|
-
return R.isBuffer(r.output) ? r.version !== void 0 ? (r.version & b) === r.version : !0 : !1;
|
|
460
|
-
}
|
|
461
|
-
function G(n) {
|
|
462
|
-
return globalThis.Array.isArray(n) ? n.length !== 2 ? !1 : n.every((r) => G(r)) : X(n);
|
|
463
|
-
}
|
|
464
|
-
const wn = w.BufferN(32), dn = w.BufferN(20), En = w.BufferN(32), mn = w.Number, In = w.Array, Sn = w.Boolean, xn = w.String, $ = w.Buffer, Nn = w.Hex, Un = w.maybe, v = w.tuple, _n = w.UInt8, k = w.UInt32, On = w.Function, yn = w.BufferN, An = w.Null, Ln = w.oneOf, Bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
465
|
-
__proto__: null,
|
|
466
|
-
Array: In,
|
|
467
|
-
Boolean: Sn,
|
|
468
|
-
Buffer: $,
|
|
469
|
-
Buffer256bit: wn,
|
|
470
|
-
BufferN: yn,
|
|
471
|
-
Function: On,
|
|
472
|
-
Hash160bit: dn,
|
|
473
|
-
Hash256bit: En,
|
|
474
|
-
Hex: Nn,
|
|
475
|
-
Null: An,
|
|
476
|
-
Number: mn,
|
|
477
|
-
Satoshi: gn,
|
|
478
|
-
String: xn,
|
|
479
|
-
TAPLEAF_VERSION_MASK: b,
|
|
480
|
-
UInt32: k,
|
|
481
|
-
UInt8: _n,
|
|
482
|
-
isPoint: hn,
|
|
483
|
-
isTapleaf: X,
|
|
484
|
-
isTaptree: G,
|
|
485
|
-
maybe: Un,
|
|
486
|
-
oneOf: Ln,
|
|
487
|
-
stacksEqual: an,
|
|
488
|
-
tuple: v,
|
|
489
|
-
typeforce: w
|
|
490
|
-
}, Symbol.toStringTag, { value: "Module" })), Y = "0123456789abcdefABCDEF";
|
|
491
|
-
Y.split("").map((n) => n.codePointAt(0));
|
|
492
|
-
Array(256).fill(!0).map((n, r) => {
|
|
493
|
-
const t = String.fromCodePoint(r), e = Y.indexOf(t);
|
|
494
|
-
return e < 0 ? void 0 : e < 16 ? e : e - 6;
|
|
495
|
-
});
|
|
496
|
-
new TextEncoder();
|
|
497
|
-
new TextDecoder();
|
|
498
|
-
function Tn(n, r, t, e) {
|
|
499
|
-
if (r + 2 > n.length)
|
|
500
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
501
|
-
if (e = e.toUpperCase(), t > 65535)
|
|
502
|
-
throw new Error(`The value of "value" is out of range. It must be >= 0 and <= 65535. Received ${t}`);
|
|
503
|
-
e === "LE" ? (n[r] = t & 255, n[r + 1] = t >> 8 & 255) : (n[r] = t >> 8 & 255, n[r + 1] = t & 255);
|
|
504
|
-
}
|
|
505
|
-
function Rn(n, r, t, e) {
|
|
506
|
-
if (r + 4 > n.length)
|
|
507
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
508
|
-
if (e = e.toUpperCase(), t > 4294967295)
|
|
509
|
-
throw new Error(`The value of "value" is out of range. It must be >= 0 and <= ${4294967295}. Received ${t}`);
|
|
510
|
-
e === "LE" ? (n[r] = t & 255, n[r + 1] = t >> 8 & 255, n[r + 2] = t >> 16 & 255, n[r + 3] = t >> 24 & 255) : (n[r] = t >> 24 & 255, n[r + 1] = t >> 16 & 255, n[r + 2] = t >> 8 & 255, n[r + 3] = t & 255);
|
|
511
|
-
}
|
|
512
|
-
function pn(n, r, t, e) {
|
|
513
|
-
if (r + 8 > n.length)
|
|
514
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
515
|
-
if (e = e.toUpperCase(), t > 0xffffffffffffffffn)
|
|
516
|
-
throw new Error(`The value of "value" is out of range. It must be >= 0 and <= ${0xffffffffffffffffn}. Received ${t}`);
|
|
517
|
-
e === "LE" ? (n[r] = Number(t & 0xffn), n[r + 1] = Number(t >> 8n & 0xffn), n[r + 2] = Number(t >> 16n & 0xffn), n[r + 3] = Number(t >> 24n & 0xffn), n[r + 4] = Number(t >> 32n & 0xffn), n[r + 5] = Number(t >> 40n & 0xffn), n[r + 6] = Number(t >> 48n & 0xffn), n[r + 7] = Number(t >> 56n & 0xffn)) : (n[r] = Number(t >> 56n & 0xffn), n[r + 1] = Number(t >> 48n & 0xffn), n[r + 2] = Number(t >> 40n & 0xffn), n[r + 3] = Number(t >> 32n & 0xffn), n[r + 4] = Number(t >> 24n & 0xffn), n[r + 5] = Number(t >> 16n & 0xffn), n[r + 6] = Number(t >> 8n & 0xffn), n[r + 7] = Number(t & 0xffn));
|
|
518
|
-
}
|
|
519
|
-
function Pn(n, r, t) {
|
|
520
|
-
if (r + 2 > n.length)
|
|
521
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
522
|
-
if (t = t.toUpperCase(), t === "LE") {
|
|
523
|
-
let e = 0;
|
|
524
|
-
return e = (e << 8) + n[r + 1], e = (e << 8) + n[r], e;
|
|
525
|
-
} else {
|
|
526
|
-
let e = 0;
|
|
527
|
-
return e = (e << 8) + n[r], e = (e << 8) + n[r + 1], e;
|
|
528
|
-
}
|
|
529
|
-
}
|
|
530
|
-
function Vn(n, r, t) {
|
|
531
|
-
if (r + 4 > n.length)
|
|
532
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
533
|
-
if (t = t.toUpperCase(), t === "LE") {
|
|
534
|
-
let e = 0;
|
|
535
|
-
return e = (e << 8) + n[r + 3] >>> 0, e = (e << 8) + n[r + 2] >>> 0, e = (e << 8) + n[r + 1] >>> 0, e = (e << 8) + n[r] >>> 0, e;
|
|
536
|
-
} else {
|
|
537
|
-
let e = 0;
|
|
538
|
-
return e = (e << 8) + n[r] >>> 0, e = (e << 8) + n[r + 1] >>> 0, e = (e << 8) + n[r + 2] >>> 0, e = (e << 8) + n[r + 3] >>> 0, e;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
function jn(n, r, t) {
|
|
542
|
-
if (r + 8 > n.length)
|
|
543
|
-
throw new Error("Offset is outside the bounds of Uint8Array");
|
|
544
|
-
if (t = t.toUpperCase(), t === "LE") {
|
|
545
|
-
let e = 0n;
|
|
546
|
-
return e = (e << 8n) + BigInt(n[r + 7]), e = (e << 8n) + BigInt(n[r + 6]), e = (e << 8n) + BigInt(n[r + 5]), e = (e << 8n) + BigInt(n[r + 4]), e = (e << 8n) + BigInt(n[r + 3]), e = (e << 8n) + BigInt(n[r + 2]), e = (e << 8n) + BigInt(n[r + 1]), e = (e << 8n) + BigInt(n[r]), e;
|
|
547
|
-
} else {
|
|
548
|
-
let e = 0n;
|
|
549
|
-
return e = (e << 8n) + BigInt(n[r]), e = (e << 8n) + BigInt(n[r + 1]), e = (e << 8n) + BigInt(n[r + 2]), e = (e << 8n) + BigInt(n[r + 3]), e = (e << 8n) + BigInt(n[r + 4]), e = (e << 8n) + BigInt(n[r + 5]), e = (e << 8n) + BigInt(n[r + 6]), e = (e << 8n) + BigInt(n[r + 7]), e;
|
|
550
|
-
}
|
|
551
|
-
}
|
|
552
|
-
const Jn = (n) => {
|
|
553
|
-
if (n < 0 || n > 0xffffffffffffffffn)
|
|
554
|
-
throw new RangeError("value out of range");
|
|
555
|
-
};
|
|
556
|
-
function $n(n) {
|
|
557
|
-
if (n < 0 || n > Number.MAX_SAFE_INTEGER || n % 1 !== 0)
|
|
558
|
-
throw new RangeError("value out of range");
|
|
559
|
-
}
|
|
560
|
-
function Z(n) {
|
|
561
|
-
typeof n == "number" ? $n(n) : Jn(n);
|
|
562
|
-
}
|
|
563
|
-
function Q(n, r, t) {
|
|
564
|
-
Z(n), t === void 0 && (t = 0), r === void 0 && (r = new Uint8Array(K(n)));
|
|
565
|
-
let e = 0;
|
|
566
|
-
return n < 253 ? (r.set([Number(n)], t), e = 1) : n <= 65535 ? (r.set([253], t), Tn(r, t + 1, Number(n), "LE"), e = 3) : n <= 4294967295 ? (r.set([254], t), Rn(r, t + 1, Number(n), "LE"), e = 5) : (r.set([255], t), pn(r, t + 1, BigInt(n), "LE"), e = 9), { buffer: r, bytes: e };
|
|
567
|
-
}
|
|
568
|
-
function W(n, r) {
|
|
569
|
-
r === void 0 && (r = 0);
|
|
570
|
-
const t = n.at(r);
|
|
571
|
-
if (t === void 0)
|
|
572
|
-
throw new Error("buffer too small");
|
|
573
|
-
if (t < 253)
|
|
574
|
-
return { numberValue: t, bigintValue: BigInt(t), bytes: 1 };
|
|
575
|
-
if (t === 253) {
|
|
576
|
-
const e = Pn(n, r + 1, "LE");
|
|
577
|
-
return {
|
|
578
|
-
numberValue: e,
|
|
579
|
-
bigintValue: BigInt(e),
|
|
580
|
-
bytes: 3
|
|
581
|
-
};
|
|
582
|
-
} else if (t === 254) {
|
|
583
|
-
const e = Vn(n, r + 1, "LE");
|
|
584
|
-
return {
|
|
585
|
-
numberValue: e,
|
|
586
|
-
bigintValue: BigInt(e),
|
|
587
|
-
bytes: 5
|
|
588
|
-
};
|
|
589
|
-
} else {
|
|
590
|
-
const e = jn(n, r + 1, "LE");
|
|
591
|
-
return { numberValue: e <= Number.MAX_SAFE_INTEGER ? Number(e) : null, bigintValue: e, bytes: 9 };
|
|
592
|
-
}
|
|
593
|
-
}
|
|
594
|
-
function K(n) {
|
|
595
|
-
return Z(n), n < 253 ? 1 : n <= 65535 ? 3 : n <= 4294967295 ? 5 : 9;
|
|
596
|
-
}
|
|
597
|
-
const bn = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
598
|
-
__proto__: null,
|
|
599
|
-
decode: W,
|
|
600
|
-
encode: Q,
|
|
601
|
-
encodingLength: K
|
|
602
|
-
}, Symbol.toStringTag, { value: "Module" })), { typeforce: nn } = Bn;
|
|
603
|
-
function rn(n, r) {
|
|
604
|
-
if (typeof n != "number") throw new Error("cannot write a non-number as a number");
|
|
605
|
-
if (n < 0) throw new Error("specified a negative value for writing an unsigned value");
|
|
606
|
-
if (n > r) throw new Error("RangeError: value out of range");
|
|
607
|
-
if (Math.floor(n) !== n) throw new Error("value has a fractional component");
|
|
608
|
-
}
|
|
609
|
-
function vn(n, r) {
|
|
610
|
-
const t = n.readUInt32LE(r);
|
|
611
|
-
let e = n.readUInt32LE(r + 4);
|
|
612
|
-
return e *= 4294967296, rn(e + t, 9007199254740991), e + t;
|
|
613
|
-
}
|
|
614
|
-
function kn(n, r, t) {
|
|
615
|
-
return rn(r, 9007199254740991), n.writeInt32LE(r & -1, t), n.writeUInt32LE(Math.floor(r / 4294967296), t + 4), t + 8;
|
|
616
|
-
}
|
|
617
|
-
function Xn(n) {
|
|
618
|
-
if (n.length < 1) return n;
|
|
619
|
-
let r = n.length - 1, t = 0;
|
|
620
|
-
for (let e = 0; e < n.length / 2; e++)
|
|
621
|
-
t = n[e], n[e] = n[r], n[r] = t, r--;
|
|
622
|
-
return n;
|
|
623
|
-
}
|
|
624
|
-
function Gn(n) {
|
|
625
|
-
const r = A.allocUnsafe(n.length);
|
|
626
|
-
return n.copy(r), r;
|
|
627
|
-
}
|
|
628
|
-
class tn {
|
|
629
|
-
constructor(r, t = 0) {
|
|
630
|
-
this.buffer = r, this.offset = t, nn(v($, k), [r, t]);
|
|
631
|
-
}
|
|
632
|
-
static withCapacity(r) {
|
|
633
|
-
return new tn(A.alloc(r));
|
|
634
|
-
}
|
|
635
|
-
writeUInt8(r) {
|
|
636
|
-
this.offset = this.buffer.writeUInt8(r, this.offset);
|
|
637
|
-
}
|
|
638
|
-
writeInt32(r) {
|
|
639
|
-
this.offset = this.buffer.writeInt32LE(r, this.offset);
|
|
640
|
-
}
|
|
641
|
-
writeUInt32(r) {
|
|
642
|
-
this.offset = this.buffer.writeUInt32LE(r, this.offset);
|
|
643
|
-
}
|
|
644
|
-
writeUInt64(r) {
|
|
645
|
-
this.offset = kn(this.buffer, r, this.offset);
|
|
646
|
-
}
|
|
647
|
-
writeVarInt(r) {
|
|
648
|
-
const t = Q(r, this.buffer, this.offset);
|
|
649
|
-
this.offset += t.bytes;
|
|
650
|
-
}
|
|
651
|
-
writeSlice(r) {
|
|
652
|
-
if (this.buffer.length < this.offset + r.length)
|
|
653
|
-
throw new Error("Cannot write slice out of bounds");
|
|
654
|
-
this.offset += r.copy(this.buffer, this.offset);
|
|
655
|
-
}
|
|
656
|
-
writeVarSlice(r) {
|
|
657
|
-
this.writeVarInt(r.length), this.writeSlice(r);
|
|
658
|
-
}
|
|
659
|
-
writeVector(r) {
|
|
660
|
-
this.writeVarInt(r.length), r.forEach((t) => this.writeVarSlice(t));
|
|
661
|
-
}
|
|
662
|
-
end() {
|
|
663
|
-
if (this.buffer.length === this.offset)
|
|
664
|
-
return this.buffer;
|
|
665
|
-
throw new Error(`buffer size ${this.buffer.length}, offset ${this.offset}`);
|
|
666
|
-
}
|
|
667
|
-
}
|
|
668
|
-
class Yn {
|
|
669
|
-
constructor(r, t = 0) {
|
|
670
|
-
this.buffer = r, this.offset = t, nn(v($, k), [r, t]);
|
|
671
|
-
}
|
|
672
|
-
readUInt8() {
|
|
673
|
-
const r = this.buffer.readUInt8(this.offset);
|
|
674
|
-
return this.offset++, r;
|
|
675
|
-
}
|
|
676
|
-
readInt32() {
|
|
677
|
-
const r = this.buffer.readInt32LE(this.offset);
|
|
678
|
-
return this.offset += 4, r;
|
|
679
|
-
}
|
|
680
|
-
readUInt32() {
|
|
681
|
-
const r = this.buffer.readUInt32LE(this.offset);
|
|
682
|
-
return this.offset += 4, r;
|
|
683
|
-
}
|
|
684
|
-
readUInt64() {
|
|
685
|
-
const r = vn(this.buffer, this.offset);
|
|
686
|
-
return this.offset += 8, r;
|
|
687
|
-
}
|
|
688
|
-
readVarInt() {
|
|
689
|
-
const r = W(this.buffer, this.offset);
|
|
690
|
-
return this.offset += r.bytes, r.numberValue || 0;
|
|
691
|
-
}
|
|
692
|
-
readSlice(r) {
|
|
693
|
-
if (this.buffer.length < this.offset + r)
|
|
694
|
-
throw new Error("Cannot read slice out of bounds");
|
|
695
|
-
const t = A.from(this.buffer.subarray(this.offset, this.offset + r));
|
|
696
|
-
return this.offset += r, t;
|
|
697
|
-
}
|
|
698
|
-
readVarSlice() {
|
|
699
|
-
return this.readSlice(this.readVarInt());
|
|
700
|
-
}
|
|
701
|
-
readVector() {
|
|
702
|
-
const r = this.readVarInt(), t = [];
|
|
703
|
-
for (let e = 0; e < r; e++) t.push(this.readVarSlice());
|
|
704
|
-
return t;
|
|
705
|
-
}
|
|
706
|
-
}
|
|
707
|
-
function Zn(n, r) {
|
|
708
|
-
if (!Array.isArray(n)) throw TypeError("Expected values Array");
|
|
709
|
-
if (typeof r != "function") throw TypeError("Expected digest Function");
|
|
710
|
-
let t = n.length;
|
|
711
|
-
const e = n.concat();
|
|
712
|
-
for (; t > 1; ) {
|
|
713
|
-
let a = 0;
|
|
714
|
-
for (let d = 0; d < t; d += 2, ++a) {
|
|
715
|
-
const N = e[d], l = d + 1 === t ? N : e[d + 1], E = A.concat([N, l]);
|
|
716
|
-
e[a] = r(E);
|
|
717
|
-
}
|
|
718
|
-
t = a;
|
|
719
|
-
}
|
|
720
|
-
return e[0];
|
|
721
|
-
}
|
|
722
|
-
export {
|
|
723
|
-
In as A,
|
|
724
|
-
Yn as B,
|
|
725
|
-
Dn as C,
|
|
726
|
-
bn as D,
|
|
727
|
-
vn as E,
|
|
728
|
-
On as F,
|
|
729
|
-
kn as G,
|
|
730
|
-
dn as H,
|
|
731
|
-
An as N,
|
|
732
|
-
gn as S,
|
|
733
|
-
b as T,
|
|
734
|
-
_n as U,
|
|
735
|
-
v as a,
|
|
736
|
-
X as b,
|
|
737
|
-
Gn as c,
|
|
738
|
-
hn as d,
|
|
739
|
-
K as e,
|
|
740
|
-
Q as f,
|
|
741
|
-
Bn as g,
|
|
742
|
-
En as h,
|
|
743
|
-
G as i,
|
|
744
|
-
k as j,
|
|
745
|
-
$ as k,
|
|
746
|
-
mn as l,
|
|
747
|
-
Un as m,
|
|
748
|
-
tn as n,
|
|
749
|
-
Zn as o,
|
|
750
|
-
Cn as p,
|
|
751
|
-
yn as q,
|
|
752
|
-
Xn as r,
|
|
753
|
-
an as s,
|
|
754
|
-
w as t,
|
|
755
|
-
Fn as u,
|
|
756
|
-
fn as v,
|
|
757
|
-
Mn as w,
|
|
758
|
-
zn as x,
|
|
759
|
-
xn as y,
|
|
760
|
-
Nn as z
|
|
761
|
-
};
|