libnexapy-test 0.1.0__tar.gz → 0.2.0__tar.gz
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.
- {libnexapy_test-0.1.0/libnexapy_test.egg-info → libnexapy_test-0.2.0}/PKG-INFO +1 -1
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0/libnexapy_test.egg-info}/PKG-INFO +1 -1
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/libnexapy_test.egg-info/SOURCES.txt +1 -51
- libnexapy_test-0.2.0/libnexapy_test.egg-info/top_level.txt +1 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/pyproject.toml +1 -1
- libnexapy_test-0.1.0/libnexapy_test.egg-info/top_level.txt +0 -1
- libnexapy_test-0.1.0/src/__init__.py +0 -0
- libnexapy_test-0.1.0/src/common/__init__.py +0 -2
- libnexapy_test-0.1.0/src/common/class_types.py +0 -60
- libnexapy_test-0.1.0/src/common/types.py +0 -351
- libnexapy_test-0.1.0/src/core/address/address.py +0 -380
- libnexapy_test-0.1.0/src/core/address/address_formatter.py +0 -293
- libnexapy_test-0.1.0/src/core/block/block.py +0 -158
- libnexapy_test-0.1.0/src/core/block/block_header.py +0 -257
- libnexapy_test-0.1.0/src/core/grouptoken.py +0 -363
- libnexapy_test-0.1.0/src/core/message.py +0 -131
- libnexapy_test-0.1.0/src/core/network/network.py +0 -118
- libnexapy_test-0.1.0/src/core/network/network_manager.py +0 -131
- libnexapy_test-0.1.0/src/core/script/opcode.py +0 -312
- libnexapy_test-0.1.0/src/core/script/script.py +0 -841
- libnexapy_test-0.1.0/src/core/script/script_factory.py +0 -385
- libnexapy_test-0.1.0/src/core/transaction/input/input.py +0 -134
- libnexapy_test-0.1.0/src/core/transaction/input/public_key_hash.py +0 -47
- libnexapy_test-0.1.0/src/core/transaction/input/public_key_template.py +0 -47
- libnexapy_test-0.1.0/src/core/transaction/input/script_template.py +0 -154
- libnexapy_test-0.1.0/src/core/transaction/output.py +0 -161
- libnexapy_test-0.1.0/src/core/transaction/sighash_type.py +0 -246
- libnexapy_test-0.1.0/src/core/transaction/transaction.py +0 -506
- libnexapy_test-0.1.0/src/core/transaction/tx_builder.py +0 -228
- libnexapy_test-0.1.0/src/core/transaction/tx_signature.py +0 -85
- libnexapy_test-0.1.0/src/core/transaction/tx_signer.py +0 -164
- libnexapy_test-0.1.0/src/core/transaction/unspent_output.py +0 -79
- libnexapy_test-0.1.0/src/crypto/__init__.py +0 -3
- libnexapy_test-0.1.0/src/crypto/curve_utils.py +0 -43
- libnexapy_test-0.1.0/src/crypto/digital_signature.py +0 -73
- libnexapy_test-0.1.0/src/crypto/ecc_fast.py +0 -175
- libnexapy_test-0.1.0/src/crypto/ecdsa.py +0 -310
- libnexapy_test-0.1.0/src/crypto/hash.py +0 -64
- libnexapy_test-0.1.0/src/crypto/ripemd160.py +0 -408
- libnexapy_test-0.1.0/src/crypto/schnorr.py +0 -509
- libnexapy_test-0.1.0/src/crypto/secp256k1.py +0 -223
- libnexapy_test-0.1.0/src/crypto/signature.py +0 -244
- libnexapy_test-0.1.0/src/encoding/base32.py +0 -51
- libnexapy_test-0.1.0/src/encoding/base58.py +0 -165
- libnexapy_test-0.1.0/src/encoding/base58_check.py +0 -92
- libnexapy_test-0.1.0/src/encoding/buffer_reader.py +0 -159
- libnexapy_test-0.1.0/src/encoding/buffer_writer.py +0 -138
- libnexapy_test-0.1.0/src/keys/hd_private_key.py +0 -473
- libnexapy_test-0.1.0/src/keys/hd_public_key.py +0 -417
- libnexapy_test-0.1.0/src/keys/hdkey_utils.py +0 -139
- libnexapy_test-0.1.0/src/keys/private_key.py +0 -340
- libnexapy_test-0.1.0/src/keys/public_key.py +0 -394
- libnexapy_test-0.1.0/src/utils/buffer_utils.py +0 -47
- libnexapy_test-0.1.0/src/utils/common_utils.py +0 -4
- libnexapy_test-0.1.0/src/utils/num_utils.py +0 -81
- libnexapy_test-0.1.0/src/utils/unit_utils.py +0 -78
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/LICENCE +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/MANIFEST.in +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/README.md +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/libnexapy_test.egg-info/dependency_links.txt +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/libnexapy_test.egg-info/requires.txt +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/COPYING +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/Makefile.am +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/README.md +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/autogen.sh +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/build-aux/m4/ax_jni_include_dir.m4 +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/build-aux/m4/ax_prog_cc_for_build.m4 +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/build-aux/m4/bitcoin_secp.m4 +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/configure.ac +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/contrib/lax_der_parsing.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/contrib/lax_der_parsing.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/contrib/lax_der_privatekey_parsing.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/contrib/lax_der_privatekey_parsing.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1_ecdh.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1_multiset.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1_preallocated.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1_recovery.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/include/secp256k1_schnorr.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/libsecp256k1.pc.in +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/asm/field_10x26_arm.s +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/basic-config.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_ecdh.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_ecmult.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_internal.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_multiset.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_recover.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_sign.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/bench_verify.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecdsa.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecdsa_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/eckey.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/eckey_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult_const.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult_const_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult_gen.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult_gen_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/ecmult_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_10x26.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_10x26_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_5x52.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_5x52_asm_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_5x52_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_5x52_int128_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/field_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/gen_context.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/group.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/group_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/hash.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/hash_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/java/org_bitcoin_NativeSecp256k1.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/java/org_bitcoin_NativeSecp256k1.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/java/org_bitcoin_Secp256k1Context.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/java/org_bitcoin_Secp256k1Context.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/ecdh/Makefile.am.include +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/ecdh/main_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/ecdh/tests_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/multiset/Makefile.am.include +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/multiset/main_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/multiset/tests_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/recovery/Makefile.am.include +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/recovery/main_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/recovery/tests_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/schnorr/Makefile.am.include +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/schnorr/main_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/schnorr/schnorr.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/schnorr/schnorr_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/modules/schnorr/tests_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/num.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/num_gmp.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/num_gmp_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/num_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_4x64.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_4x64_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_8x32.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_8x32_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_low.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scalar_low_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scratch.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/scratch_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/secp256k1.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/testrand.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/testrand_impl.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/tests.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/tests_exhaustive.c +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/secp256k1/src/util.h +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/setup.cfg +0 -0
- {libnexapy_test-0.1.0 → libnexapy_test-0.2.0}/setup.py +0 -0
|
@@ -97,54 +97,4 @@ secp256k1/src/modules/schnorr/Makefile.am.include
|
|
|
97
97
|
secp256k1/src/modules/schnorr/main_impl.h
|
|
98
98
|
secp256k1/src/modules/schnorr/schnorr.h
|
|
99
99
|
secp256k1/src/modules/schnorr/schnorr_impl.h
|
|
100
|
-
secp256k1/src/modules/schnorr/tests_impl.h
|
|
101
|
-
src/__init__.py
|
|
102
|
-
src/common/__init__.py
|
|
103
|
-
src/common/class_types.py
|
|
104
|
-
src/common/types.py
|
|
105
|
-
src/core/grouptoken.py
|
|
106
|
-
src/core/message.py
|
|
107
|
-
src/core/address/address.py
|
|
108
|
-
src/core/address/address_formatter.py
|
|
109
|
-
src/core/block/block.py
|
|
110
|
-
src/core/block/block_header.py
|
|
111
|
-
src/core/network/network.py
|
|
112
|
-
src/core/network/network_manager.py
|
|
113
|
-
src/core/script/opcode.py
|
|
114
|
-
src/core/script/script.py
|
|
115
|
-
src/core/script/script_factory.py
|
|
116
|
-
src/core/transaction/output.py
|
|
117
|
-
src/core/transaction/sighash_type.py
|
|
118
|
-
src/core/transaction/transaction.py
|
|
119
|
-
src/core/transaction/tx_builder.py
|
|
120
|
-
src/core/transaction/tx_signature.py
|
|
121
|
-
src/core/transaction/tx_signer.py
|
|
122
|
-
src/core/transaction/unspent_output.py
|
|
123
|
-
src/core/transaction/input/input.py
|
|
124
|
-
src/core/transaction/input/public_key_hash.py
|
|
125
|
-
src/core/transaction/input/public_key_template.py
|
|
126
|
-
src/core/transaction/input/script_template.py
|
|
127
|
-
src/crypto/__init__.py
|
|
128
|
-
src/crypto/curve_utils.py
|
|
129
|
-
src/crypto/digital_signature.py
|
|
130
|
-
src/crypto/ecc_fast.py
|
|
131
|
-
src/crypto/ecdsa.py
|
|
132
|
-
src/crypto/hash.py
|
|
133
|
-
src/crypto/ripemd160.py
|
|
134
|
-
src/crypto/schnorr.py
|
|
135
|
-
src/crypto/secp256k1.py
|
|
136
|
-
src/crypto/signature.py
|
|
137
|
-
src/encoding/base32.py
|
|
138
|
-
src/encoding/base58.py
|
|
139
|
-
src/encoding/base58_check.py
|
|
140
|
-
src/encoding/buffer_reader.py
|
|
141
|
-
src/encoding/buffer_writer.py
|
|
142
|
-
src/keys/hd_private_key.py
|
|
143
|
-
src/keys/hd_public_key.py
|
|
144
|
-
src/keys/hdkey_utils.py
|
|
145
|
-
src/keys/private_key.py
|
|
146
|
-
src/keys/public_key.py
|
|
147
|
-
src/utils/buffer_utils.py
|
|
148
|
-
src/utils/common_utils.py
|
|
149
|
-
src/utils/num_utils.py
|
|
150
|
-
src/utils/unit_utils.py
|
|
100
|
+
secp256k1/src/modules/schnorr/tests_impl.h
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
src
|
|
File without changes
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
from collections import defaultdict
|
|
2
|
-
from types import UnionType
|
|
3
|
-
from typing import get_type_hints, get_args
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
# readonly class. attributes can not be added, deleted, or updated.
|
|
7
|
-
class FrozenClass:
|
|
8
|
-
def __init__(self):
|
|
9
|
-
self._is_frozen = False
|
|
10
|
-
|
|
11
|
-
def __setattr__(self, key, value):
|
|
12
|
-
if key != "_is_frozen":
|
|
13
|
-
if self.__dict__["_is_frozen"]:
|
|
14
|
-
raise TypeError(f"{key} can not be updated. {self} is a frozen class.")
|
|
15
|
-
object.__setattr__(self, key, value)
|
|
16
|
-
|
|
17
|
-
def __delattr__(self, key):
|
|
18
|
-
if self._is_frozen:
|
|
19
|
-
raise TypeError(f"{key} can not be deleted. {self} is a frozen class.")
|
|
20
|
-
object.__delattr__(self, key)
|
|
21
|
-
|
|
22
|
-
def _freeze_attributes(self):
|
|
23
|
-
self._is_frozen = True
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
# A typed class can not add more attributes, delete existing ones, or assign values that are not the same type
|
|
27
|
-
# as the existing value
|
|
28
|
-
class TypedClass:
|
|
29
|
-
def __init__(self):
|
|
30
|
-
self._acceptable_types = defaultdict(lambda: set([type(None)]))
|
|
31
|
-
self._enforced_types = False
|
|
32
|
-
self._added_annotations = False
|
|
33
|
-
|
|
34
|
-
def __setattr__(self, key, value):
|
|
35
|
-
if "_acceptable_types" in self.__dict__ and "_enforced_types" in self.__dict__:
|
|
36
|
-
if "_added_annotations" in self.__dict__ and self._added_annotations == False:
|
|
37
|
-
hints = get_type_hints(type(self))
|
|
38
|
-
if hints != {}:
|
|
39
|
-
for k, v in hints.items():
|
|
40
|
-
if isinstance(v, UnionType):
|
|
41
|
-
self._acceptable_types[k].update(get_args(v))
|
|
42
|
-
else:
|
|
43
|
-
self._acceptable_types[k].add(v)
|
|
44
|
-
object.__setattr__(self, "_added_annotations", True)
|
|
45
|
-
if self.__dict__["_enforced_types"]:
|
|
46
|
-
if self._enforced_types and type(value) not in self._acceptable_types[key]:
|
|
47
|
-
raise TypeError(
|
|
48
|
-
f"{self} is a typed class. {key} with acceptable types {self._acceptable_types[key]} can not updated with {value} of type {type(value)}"
|
|
49
|
-
)
|
|
50
|
-
else:
|
|
51
|
-
self._acceptable_types[key].add(type(value))
|
|
52
|
-
object.__setattr__(self, key, value)
|
|
53
|
-
|
|
54
|
-
def __delattr__(self, key):
|
|
55
|
-
if self._enforced_types:
|
|
56
|
-
raise TypeError(f"{key} can not be deleted. {self} is a typed class.")
|
|
57
|
-
object.__delattr__(self, key)
|
|
58
|
-
|
|
59
|
-
def _enforce_attribute_types(self):
|
|
60
|
-
self._enforced_types = True
|
|
@@ -1,351 +0,0 @@
|
|
|
1
|
-
from enum import Enum, IntEnum, unique
|
|
2
|
-
from typing import TypeVar
|
|
3
|
-
|
|
4
|
-
from .class_types import TypedClass
|
|
5
|
-
from src.core.network.network import Network
|
|
6
|
-
|
|
7
|
-
COIN = 100
|
|
8
|
-
MAX_MONEY = 21000000000000 * COIN
|
|
9
|
-
|
|
10
|
-
"""
|
|
11
|
-
Any type that can be used where a big number is needed.
|
|
12
|
-
"""
|
|
13
|
-
BigNumberish = TypeVar("BigNumberish", str, int)
|
|
14
|
-
|
|
15
|
-
"""
|
|
16
|
-
Any type that can be used where a network is needed.
|
|
17
|
-
"""
|
|
18
|
-
Networkish = TypeVar("Networkish", str, Network)
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
@unique
|
|
22
|
-
class EndianType(Enum):
|
|
23
|
-
LITTLE = "little"
|
|
24
|
-
BIG = "big"
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@unique
|
|
28
|
-
class InputType(IntEnum):
|
|
29
|
-
UTXO = 0
|
|
30
|
-
READ_ONLY = 1
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
@unique
|
|
34
|
-
class OutputType(IntEnum):
|
|
35
|
-
SATOSCRIPT = 0
|
|
36
|
-
TEMPLATE = (1,)
|
|
37
|
-
INFER = 0x8000 # Not a real type: implies the type should be infered from the script at construction time
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
class InputSighashType(IntEnum):
|
|
41
|
-
ALL = 0
|
|
42
|
-
FIRSTN = 1
|
|
43
|
-
THISIN = 2
|
|
44
|
-
LAST_VALID = THISIN # end indicator
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
class OutputSighashType(IntEnum):
|
|
48
|
-
ALL = 0
|
|
49
|
-
FIRSTN = 1
|
|
50
|
-
TWO = 2
|
|
51
|
-
LAST_VALID = TWO # end indicator
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
# TODO - Doing abstract bases or interfaces was a mistake and all they did was cause a lot of problems.
|
|
55
|
-
# remove them all at some point. Just use the classes instead and for serialisation use dicts where
|
|
56
|
-
# bytes and bytearrays are stored as hex values
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
class BufferParams(TypedClass):
|
|
60
|
-
def __init__(self):
|
|
61
|
-
super().__init__()
|
|
62
|
-
self.buf = bytearray() # bytes
|
|
63
|
-
self.pos = int() # int
|
|
64
|
-
self._enforce_attribute_types() # no new attributes after this point.
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
class BufferWriterOptions(TypedClass):
|
|
68
|
-
def __init__(self):
|
|
69
|
-
super().__init__()
|
|
70
|
-
self.bufs: list[bytearray] = []
|
|
71
|
-
self._enforce_attribute_types()
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
class GroupIdData(TypedClass):
|
|
75
|
-
def __init__(self):
|
|
76
|
-
super().__init__()
|
|
77
|
-
self.hash_buffer = bytearray()
|
|
78
|
-
self.nonce = int()
|
|
79
|
-
self._enforce_attribute_types()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
class ITxSignature(TypedClass):
|
|
83
|
-
def __init__(self):
|
|
84
|
-
self.input_index = int()
|
|
85
|
-
self.public_key = PublicKey()
|
|
86
|
-
self.subscript = Script()
|
|
87
|
-
self.signature = Signature()
|
|
88
|
-
self.sig_type = SighashType()
|
|
89
|
-
self._enforce_attribute_types()
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
class ISignature(TypedClass):
|
|
93
|
-
def __init__(self):
|
|
94
|
-
super().__init__()
|
|
95
|
-
self.r = int()
|
|
96
|
-
self.s = int()
|
|
97
|
-
self.i = int()
|
|
98
|
-
self.compressed = bool()
|
|
99
|
-
self._enforce_attribute_types()
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
class IDigitalSignature(TypedClass):
|
|
103
|
-
def __init__(self):
|
|
104
|
-
super().__init__()
|
|
105
|
-
self.hashbuf = bytearray()
|
|
106
|
-
self.endian = EndianType()
|
|
107
|
-
self.privkey = IPrivateKey()
|
|
108
|
-
self.pubkey = IPublicKey()
|
|
109
|
-
self.sig = ISignature()
|
|
110
|
-
self.verified = bool()
|
|
111
|
-
self._enforce_attribute_types()
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
class IPrivateKey(TypedClass):
|
|
115
|
-
compressed: bool
|
|
116
|
-
network: Network
|
|
117
|
-
bn: int
|
|
118
|
-
|
|
119
|
-
def __init__(self):
|
|
120
|
-
self.compressed = None
|
|
121
|
-
self.network = None
|
|
122
|
-
self.bn = None
|
|
123
|
-
self._enforce_attribute_types()
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
class IPublicKey(TypedClass):
|
|
127
|
-
x: int
|
|
128
|
-
y: int
|
|
129
|
-
compressed: bool
|
|
130
|
-
network: Network
|
|
131
|
-
|
|
132
|
-
def __init__(self):
|
|
133
|
-
super().__init__()
|
|
134
|
-
self.x = None
|
|
135
|
-
self.y = None
|
|
136
|
-
self.compressed = None
|
|
137
|
-
self.network = None
|
|
138
|
-
self._enforce_attribute_types()
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
class PrivateKeyDto(TypedClass):
|
|
142
|
-
def __init__(self):
|
|
143
|
-
super().__init__()
|
|
144
|
-
self.compressed = bool()
|
|
145
|
-
self.network = str()
|
|
146
|
-
self.bn = str()
|
|
147
|
-
self._enforce_attribute_types()
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
class PublicKeyDto(TypedClass):
|
|
151
|
-
def __init__(self):
|
|
152
|
-
super().__init__()
|
|
153
|
-
self.x = str()
|
|
154
|
-
self.y = str()
|
|
155
|
-
self.compressed = bool()
|
|
156
|
-
self.network = str()
|
|
157
|
-
self._enforce_attribute_types()
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
class AddressDto(TypedClass):
|
|
161
|
-
data: bytearray
|
|
162
|
-
network: str
|
|
163
|
-
type: str
|
|
164
|
-
|
|
165
|
-
def __init__(self, data: str = None, network: str = None, type: str = None):
|
|
166
|
-
super().__init__()
|
|
167
|
-
self.data = None
|
|
168
|
-
self.network = None
|
|
169
|
-
self.type = None
|
|
170
|
-
self._enforce_attribute_types()
|
|
171
|
-
if data:
|
|
172
|
-
self.data = data
|
|
173
|
-
if network:
|
|
174
|
-
self.network = network
|
|
175
|
-
if type:
|
|
176
|
-
self.type = type
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
class HDKeyDto(TypedClass):
|
|
180
|
-
def __init__(self):
|
|
181
|
-
super().__init__()
|
|
182
|
-
self.network = str()
|
|
183
|
-
self.depth = int()
|
|
184
|
-
self.fingerprint = int()
|
|
185
|
-
self.parent_fingerprint = int()
|
|
186
|
-
self.child_index = int()
|
|
187
|
-
self.chain_code = str()
|
|
188
|
-
self.checksum = int()
|
|
189
|
-
self._enforce_attribute_types()
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
class HDPrivateKeyDto(HDKeyDto):
|
|
193
|
-
def __init__(self):
|
|
194
|
-
super().__init__()
|
|
195
|
-
self.private_key = str()
|
|
196
|
-
self.xprivkey = str()
|
|
197
|
-
self._enforce_attribute_types()
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
class HDPublicKeyDto(HDKeyDto):
|
|
201
|
-
def __init__(self):
|
|
202
|
-
super().__init__()
|
|
203
|
-
self.public_key = str()
|
|
204
|
-
self.xpubkey = str()
|
|
205
|
-
self._enforce_attribute_types()
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
class IHDKey(TypedClass):
|
|
209
|
-
def __init__(self):
|
|
210
|
-
super().__init__()
|
|
211
|
-
self.network = Network()
|
|
212
|
-
self.depth = int()
|
|
213
|
-
self.parent_fingerprint = bytearray()
|
|
214
|
-
self.fingerprint = bytearray()
|
|
215
|
-
self.chain_code = bytearray()
|
|
216
|
-
self.chain_index = int()
|
|
217
|
-
self.checksum = bytearray()
|
|
218
|
-
self._enforce_attribute_types()
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
class IHDPrivateKey(IHDKey):
|
|
222
|
-
def __init__(self):
|
|
223
|
-
super().__init__()
|
|
224
|
-
self.private_key = IPrivateKey()
|
|
225
|
-
self.public_key = IPublicKey()
|
|
226
|
-
self.xprivkey = str()
|
|
227
|
-
self._enforce_attribute_types()
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
class IHDPublicKey(IHDKey):
|
|
231
|
-
def __init__(self):
|
|
232
|
-
super().__init__()
|
|
233
|
-
self.public_key = IPublicKey()
|
|
234
|
-
self.xpubkey = str()
|
|
235
|
-
self._enforce_attribute_types()
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
class HDKeyBuffers(TypedClass):
|
|
239
|
-
def __init__(self):
|
|
240
|
-
super().__init__()
|
|
241
|
-
self.version = bytes()
|
|
242
|
-
self.depth = bytes()
|
|
243
|
-
self.parent_fingerprint = bytearray()
|
|
244
|
-
self.child_index = bytearray()
|
|
245
|
-
self.chain_code = bytearray()
|
|
246
|
-
self.checksum = bytearray()
|
|
247
|
-
self._enforce_attribute_types()
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
class HDPublicKeyBuffers(HDKeyBuffers):
|
|
251
|
-
def __init__(self):
|
|
252
|
-
super().__init__()
|
|
253
|
-
self.public_key = bytearray()
|
|
254
|
-
self._enforce_attribute_types()
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
class HDPrivateKeyBuffers(HDKeyBuffers):
|
|
258
|
-
def __init__(self):
|
|
259
|
-
super().__init__()
|
|
260
|
-
self.private_key = bytearray()
|
|
261
|
-
self._enforce_attribute_types()
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
class IBlockHeader(TypedClass):
|
|
265
|
-
def __init__(self):
|
|
266
|
-
super().__init__()
|
|
267
|
-
self.hash = str()
|
|
268
|
-
self.prev_hash = bytearray()
|
|
269
|
-
self.bits = int()
|
|
270
|
-
self.ancestor_hash = bytearray()
|
|
271
|
-
self.merkle_root = bytearray()
|
|
272
|
-
self.tx_filter = bytearray()
|
|
273
|
-
self.time = int()
|
|
274
|
-
self.height = int()
|
|
275
|
-
self.chain_work = bytearray()
|
|
276
|
-
self.size = int()
|
|
277
|
-
self.tx_count = int()
|
|
278
|
-
self.pool_fee = int()
|
|
279
|
-
self.utxo_commitment = bytearray()
|
|
280
|
-
self.miner_data = bytearray()
|
|
281
|
-
self.nonce = bytearray()
|
|
282
|
-
self._enforce_attribute_types()
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
class IBlock(TypedClass):
|
|
286
|
-
def __init__(self):
|
|
287
|
-
super().__init__()
|
|
288
|
-
self.header = IBlockHeader()
|
|
289
|
-
self.transactions = []
|
|
290
|
-
self._enforce_attribute_types()
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
class UTXO(TypedClass):
|
|
294
|
-
def __init__(self):
|
|
295
|
-
super().__init__()
|
|
296
|
-
self.outpoint = str()
|
|
297
|
-
self.satoshis = int()
|
|
298
|
-
self.amount = int()
|
|
299
|
-
self.script_pubkey = Script()
|
|
300
|
-
self.address = Address()
|
|
301
|
-
self.group_id = Address()
|
|
302
|
-
self.group_amount = int()
|
|
303
|
-
self.template_data = ScriptTemplateObject()
|
|
304
|
-
self._enforce_attribute_types()
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
class SighashComponents(TypedClass):
|
|
308
|
-
def __init__(self):
|
|
309
|
-
super().__init__()
|
|
310
|
-
self.hashPrevouts = bytearray()
|
|
311
|
-
self.hashSequence = bytearray()
|
|
312
|
-
self.hashInputAmounts = bytearray()
|
|
313
|
-
self.hashOutputs = bytearray()
|
|
314
|
-
self._enforce_attribute_types()
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
class ScriptTemplateObject(TypedClass):
|
|
318
|
-
def __init__(self):
|
|
319
|
-
super().__init__()
|
|
320
|
-
self.template_script = Script()
|
|
321
|
-
self.constraint_script = Script()
|
|
322
|
-
self.public_key = PublicKey()
|
|
323
|
-
self._enforce_attribute_types()
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
class TxVerifyOptions(TypedClass):
|
|
327
|
-
"""
|
|
328
|
-
Contain a set of flags to skip certain tests:
|
|
329
|
-
|
|
330
|
-
* `disableAll`: disable all checks
|
|
331
|
-
* `disableIsFullySigned`: disable checking if all inputs are fully signed
|
|
332
|
-
* `disableDustOutputs`: disable checking if there are no outputs that are dust amounts
|
|
333
|
-
* `disableMoreOutputThanInput`: disable checking if the transaction spends more nexas than the sum of the input amounts
|
|
334
|
-
"""
|
|
335
|
-
|
|
336
|
-
def __init__(self):
|
|
337
|
-
super().__init__()
|
|
338
|
-
self.disable_all = bool()
|
|
339
|
-
self.disable_dust_outputs = bool()
|
|
340
|
-
self.disable_is_fully_signed = bool()
|
|
341
|
-
self.disable_more_output_than_input = bool()
|
|
342
|
-
self._enforce_attribute_types()
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
PrivateKeyVariants = TypeVar(
|
|
346
|
-
"PrivateKeyVariants", int, str, bytearray, IPrivateKey, PrivateKeyDto, None
|
|
347
|
-
)
|
|
348
|
-
|
|
349
|
-
PublicKeyVariants = TypeVar(
|
|
350
|
-
"PublicKeyVariants", IPrivateKey, IPublicKey, PublicKeyDto, bytearray, str
|
|
351
|
-
)
|