coinex-api 0.0.89__py3-none-any.whl → 0.0.110__py3-none-any.whl
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.
Potentially problematic release.
This version of coinex-api might be problematic. Click here for more details.
- coinex/ccxt/__init__.py +1 -1
- coinex/ccxt/async_support/__init__.py +1 -1
- coinex/ccxt/async_support/base/exchange.py +139 -10
- coinex/ccxt/async_support/base/throttler.py +1 -1
- coinex/ccxt/async_support/base/ws/cache.py +1 -0
- coinex/ccxt/async_support/base/ws/client.py +26 -4
- coinex/ccxt/async_support/coinex.py +2 -2
- coinex/ccxt/base/exchange.py +587 -91
- coinex/ccxt/base/types.py +11 -2
- coinex/ccxt/coinex.py +2 -2
- coinex/ccxt/pro/__init__.py +1 -1
- coinex/ccxt/pro/coinex.py +10 -7
- coinex/ccxt/static_dependencies/bip/__init__.py +6 -0
- coinex/ccxt/static_dependencies/bip/addr/P2PKH_addr.py +205 -0
- coinex/ccxt/static_dependencies/bip/addr/__init__.py +5 -0
- coinex/ccxt/static_dependencies/bip/addr/addr_dec_utils.py +125 -0
- coinex/ccxt/static_dependencies/bip/addr/addr_key_validator.py +162 -0
- coinex/ccxt/static_dependencies/bip/addr/iaddr_decoder.py +48 -0
- coinex/ccxt/static_dependencies/bip/addr/iaddr_encoder.py +50 -0
- coinex/ccxt/static_dependencies/bip/base58/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/base58/base58.py +207 -0
- coinex/ccxt/static_dependencies/bip/base58/base58_ex.py +25 -0
- coinex/ccxt/static_dependencies/bip/base58/base58_xmr.py +155 -0
- coinex/ccxt/static_dependencies/bip/bech32/__init__.py +4 -0
- coinex/ccxt/static_dependencies/bip/bech32/bch_bech32.py +220 -0
- coinex/ccxt/static_dependencies/bip/bech32/bech32.py +235 -0
- coinex/ccxt/static_dependencies/bip/bech32/bech32_base.py +246 -0
- coinex/ccxt/static_dependencies/bip/bech32/bech32_ex.py +25 -0
- coinex/ccxt/static_dependencies/bip/bech32/segwit_bech32.py +173 -0
- coinex/ccxt/static_dependencies/bip/bip32/__init__.py +14 -0
- coinex/ccxt/static_dependencies/bip/bip32/base/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/bip32/base/bip32_base.py +581 -0
- coinex/ccxt/static_dependencies/bip/bip32/base/ibip32_key_derivator.py +83 -0
- coinex/ccxt/static_dependencies/bip/bip32/base/ibip32_mst_key_generator.py +47 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_const.py +35 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_ex.py +29 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_key_data.py +500 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_key_net_ver.py +83 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_key_ser.py +294 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_keys.py +457 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_path.py +247 -0
- coinex/ccxt/static_dependencies/bip/bip32/bip32_utils.py +72 -0
- coinex/ccxt/static_dependencies/bip/bip32/kholaw/__init__.py +4 -0
- coinex/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519.py +82 -0
- coinex/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_ed25519_key_derivator.py +118 -0
- coinex/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_key_derivator_base.py +204 -0
- coinex/ccxt/static_dependencies/bip/bip32/kholaw/bip32_kholaw_mst_key_generator.py +119 -0
- coinex/ccxt/static_dependencies/bip/bip32/slip10/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_key_derivator.py +200 -0
- coinex/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_mst_key_generator.py +168 -0
- coinex/ccxt/static_dependencies/bip/bip32/slip10/bip32_slip10_secp256k1.py +82 -0
- coinex/ccxt/static_dependencies/bip/bip44/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/bip44/bip44.py +265 -0
- coinex/ccxt/static_dependencies/bip/bip44_base/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/bip44_base/bip44_base.py +624 -0
- coinex/ccxt/static_dependencies/bip/bip44_base/bip44_base_ex.py +25 -0
- coinex/ccxt/static_dependencies/bip/bip44_base/bip44_keys.py +225 -0
- coinex/ccxt/static_dependencies/bip/coin_conf/__init__.py +2 -0
- coinex/ccxt/static_dependencies/bip/coin_conf/coin_conf.py +68 -0
- coinex/ccxt/static_dependencies/bip/coin_conf/coins_conf.py +890 -0
- coinex/ccxt/static_dependencies/bip/conf/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/conf/bip44/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/conf/bip44/bip44_coins.py +126 -0
- coinex/ccxt/static_dependencies/bip/conf/bip44/bip44_conf.py +1360 -0
- coinex/ccxt/static_dependencies/bip/conf/bip44/bip44_conf_getter.py +153 -0
- coinex/ccxt/static_dependencies/bip/conf/bip49/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/conf/bip49/bip49_coins.py +53 -0
- coinex/ccxt/static_dependencies/bip/conf/bip49/bip49_conf.py +366 -0
- coinex/ccxt/static_dependencies/bip/conf/bip49/bip49_conf_getter.py +80 -0
- coinex/ccxt/static_dependencies/bip/conf/bip84/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/conf/bip84/bip84_coins.py +39 -0
- coinex/ccxt/static_dependencies/bip/conf/bip84/bip84_conf.py +113 -0
- coinex/ccxt/static_dependencies/bip/conf/bip84/bip84_conf_getter.py +66 -0
- coinex/ccxt/static_dependencies/bip/conf/bip86/__init__.py +3 -0
- coinex/ccxt/static_dependencies/bip/conf/bip86/bip86_coins.py +37 -0
- coinex/ccxt/static_dependencies/bip/conf/bip86/bip86_conf.py +83 -0
- coinex/ccxt/static_dependencies/bip/conf/bip86/bip86_conf_getter.py +64 -0
- coinex/ccxt/static_dependencies/bip/conf/common/__init__.py +8 -0
- coinex/ccxt/static_dependencies/bip/conf/common/atom_addr.py +104 -0
- coinex/ccxt/static_dependencies/bip/conf/common/bip_bitcoin_cash_conf.py +106 -0
- coinex/ccxt/static_dependencies/bip/conf/common/bip_coin_conf.py +217 -0
- coinex/ccxt/static_dependencies/bip/conf/common/bip_coins.py +28 -0
- coinex/ccxt/static_dependencies/bip/conf/common/bip_conf_const.py +30 -0
- coinex/ccxt/static_dependencies/bip/conf/common/bip_litecoin_conf.py +121 -0
- coinex/ccxt/static_dependencies/bip/ecc/__init__.py +42 -0
- coinex/ccxt/static_dependencies/bip/ecc/common/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/ecc/common/dummy_point.py +219 -0
- coinex/ccxt/static_dependencies/bip/ecc/common/ikeys.py +263 -0
- coinex/ccxt/static_dependencies/bip/ecc/common/ipoint.py +190 -0
- coinex/ccxt/static_dependencies/bip/ecc/conf.py +28 -0
- coinex/ccxt/static_dependencies/bip/ecc/curve/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve.py +121 -0
- coinex/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_getter.py +74 -0
- coinex/ccxt/static_dependencies/bip/ecc/curve/elliptic_curve_types.py +37 -0
- coinex/ccxt/static_dependencies/bip/ecc/ecdsa/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/ecc/ecdsa/ecdsa_keys.py +36 -0
- coinex/ccxt/static_dependencies/bip/ecc/secp256k1/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1.py +36 -0
- coinex/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_const.py +59 -0
- coinex/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_keys_ecdsa.py +248 -0
- coinex/ccxt/static_dependencies/bip/ecc/secp256k1/secp256k1_point_ecdsa.py +234 -0
- coinex/ccxt/static_dependencies/bip/slip/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/slip/slip173/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/slip/slip173/slip173.py +60 -0
- coinex/ccxt/static_dependencies/bip/slip/slip32/__init__.py +4 -0
- coinex/ccxt/static_dependencies/bip/slip/slip32/slip32.py +322 -0
- coinex/ccxt/static_dependencies/bip/slip/slip32/slip32_key_net_ver.py +62 -0
- coinex/ccxt/static_dependencies/bip/slip/slip44/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/slip/slip44/slip44.py +81 -0
- coinex/ccxt/static_dependencies/bip/utils/__init__.py +0 -0
- coinex/ccxt/static_dependencies/bip/utils/conf/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/utils/conf/coin_names.py +59 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/__init__.py +10 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/aes_ecb.py +152 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/blake2.py +191 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/chacha20_poly1305.py +101 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/hash160.py +57 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/hmac.py +118 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/pbkdf2.py +66 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/ripemd.py +58 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/scrypt.py +66 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/sha2.py +182 -0
- coinex/ccxt/static_dependencies/bip/utils/crypto/sha3.py +99 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/__init__.py +7 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/algo.py +108 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/base32.py +151 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/bit.py +115 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/bytes.py +200 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/data_bytes.py +181 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/integer.py +97 -0
- coinex/ccxt/static_dependencies/bip/utils/misc/string.py +54 -0
- coinex/ccxt/static_dependencies/bip/utils/typing/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/utils/typing/literal.py +27 -0
- coinex/ccxt/static_dependencies/bip/wif/__init__.py +1 -0
- coinex/ccxt/static_dependencies/bip/wif/wif.py +144 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/amino/amino_pb2.py +31 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/base/v1beta1/coin_pb2.py +47 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/keys_pb2.py +33 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/multisig/v1beta1/multisig_pb2.py +33 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/crypto/secp256k1/keys_pb2.py +34 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/msg/v1/msg_pb2.py +27 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/signing/v1beta1/signing_pb2.py +38 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos/tx/v1beta1/tx_pb2.py +75 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/cosmos_proto/cosmos_pb2.py +36 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/accountplus_pb2.py +31 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/genesis_pb2.py +40 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/models_pb2.py +26 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/params_pb2.py +29 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/query_pb2.py +57 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/accountplus/tx_pb2.py +51 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/block_rate_limit_config_pb2.py +37 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/clob_pair_pb2.py +41 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/equity_tier_limit_config_pb2.py +35 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/finalize_block_pb2.py +27 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_config_pb2.py +39 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/liquidations_pb2.py +38 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/matches_pb2.py +55 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/mev_pb2.py +49 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/operation_pb2.py +32 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_pb2.py +86 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/order_removals_pb2.py +32 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/process_proposer_matches_events_pb2.py +42 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/query_pb2.py +124 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/streaming_pb2.py +29 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/clob/tx_pb2.py +117 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/genesis_pb2.py +26 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/query_pb2.py +26 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/transfer_pb2.py +61 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/sending/tx_pb2.py +37 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/asset_position_pb2.py +29 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/genesis_pb2.py +30 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/perpetual_position_pb2.py +33 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/query_pb2.py +63 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/streaming_pb2.py +31 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/dydxprotocol/subaccounts/subaccount_pb2.py +33 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/gogoproto/gogo_pb2.py +102 -0
- coinex/ccxt/static_dependencies/dydx_v4_client/registry.py +38 -0
- coinex/ccxt/static_dependencies/ecdsa/ellipticcurve.py +842 -0
- coinex/ccxt/static_dependencies/ecdsa/keys.py +15 -4
- coinex/ccxt/static_dependencies/mnemonic/__init__.py +4 -0
- coinex/ccxt/static_dependencies/mnemonic/mnemonic.py +282 -0
- coinex/ccxt/static_dependencies/mnemonic/py.typed +1 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/chinese_simplified.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/chinese_traditional.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/czech.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/english.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/french.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/italian.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/japanese.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/korean.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/portuguese.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/russian.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/spanish.txt +2048 -0
- coinex/ccxt/static_dependencies/mnemonic/wordlist/turkish.txt +2048 -0
- {coinex_api-0.0.89.dist-info → coinex_api-0.0.110.dist-info}/METADATA +3 -3
- {coinex_api-0.0.89.dist-info → coinex_api-0.0.110.dist-info}/RECORD +197 -17
- {coinex_api-0.0.89.dist-info → coinex_api-0.0.110.dist-info}/WHEEL +1 -1
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Copyright (c) 2022 Emanuele Bellocchia
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
# THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
Module for SLIP-0173 human-readable parts.
|
|
23
|
+
Not all the human-readable parts are defined, but only the used ones.
|
|
24
|
+
Reference: https://github.com/satoshilabs/slips/blob/master/slip-0173.md
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Slip173:
|
|
29
|
+
"""
|
|
30
|
+
SLIP-0173 class.
|
|
31
|
+
It defines the human-readable parts in according to SLIP-0173.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
AKASH_NETWORK: str = "akash"
|
|
35
|
+
AXELAR: str = "axelar"
|
|
36
|
+
BAND_PROTOCOL: str = "band"
|
|
37
|
+
BINANCE_CHAIN: str = "bnb"
|
|
38
|
+
BITCOIN_MAINNET: str = "bc"
|
|
39
|
+
BITCOIN_REGTEST: str = "bcrt"
|
|
40
|
+
BITCOIN_TESTNET: str = "tb"
|
|
41
|
+
CERTIK: str = "certik"
|
|
42
|
+
CHIHUAHUA: str = "chihuahua"
|
|
43
|
+
CELESTIA: str = "celestia"
|
|
44
|
+
COSMOS: str = "cosmos"
|
|
45
|
+
DYDX: str = "dydx"
|
|
46
|
+
ELROND: str = "erd"
|
|
47
|
+
FETCH_AI: str = "fetch"
|
|
48
|
+
HARMONY_ONE: str = "one"
|
|
49
|
+
INJECTIVE: str = "inj"
|
|
50
|
+
IRIS_NETWORK: str = "iaa"
|
|
51
|
+
KAVA: str = "kava"
|
|
52
|
+
LITECOIN_MAINNET: str = "ltc"
|
|
53
|
+
LITECOIN_TESTNET: str = "tltc"
|
|
54
|
+
NEUTRON: str = "neutron"
|
|
55
|
+
OKEX_CHAIN: str = "ex"
|
|
56
|
+
OSMOSIS: str = "osmo"
|
|
57
|
+
SECRET_NETWORK: str = "secret"
|
|
58
|
+
STAFI: str = "stafi"
|
|
59
|
+
TERRA: str = "terra"
|
|
60
|
+
ZILLIQA: str = "zil"
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# Copyright (c) 2021 Emanuele Bellocchia
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
# THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
Module for SLIP32 extended key serialization/deserialization.
|
|
23
|
+
Reference: https://github.com/satoshilabs/slips/blob/master/slip-0032.md
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# Imports
|
|
27
|
+
from typing import Tuple, Union
|
|
28
|
+
|
|
29
|
+
from bip_utils.bech32 import Bech32Decoder, Bech32Encoder
|
|
30
|
+
from bip_utils.bip.bip32 import Bip32ChainCode, Bip32Depth, Bip32KeyIndex, Bip32Path, Bip32PathParser
|
|
31
|
+
from bip_utils.ecc import IPrivateKey, IPublicKey
|
|
32
|
+
from bip_utils.slip.slip32.slip32_key_net_ver import Slip32KeyNetVersions
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
class Slip32KeySerConst:
|
|
36
|
+
"""Class container for SLIP32 key serialize constants."""
|
|
37
|
+
|
|
38
|
+
# Standard key net versions
|
|
39
|
+
STD_KEY_NET_VERSIONS: Slip32KeyNetVersions = Slip32KeyNetVersions("xpub", "xprv")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
class _Slip32KeySerializer:
|
|
43
|
+
"""
|
|
44
|
+
SLIP32 key serializer class.
|
|
45
|
+
It serializes private/public keys.
|
|
46
|
+
"""
|
|
47
|
+
|
|
48
|
+
@classmethod
|
|
49
|
+
def Serialize(cls,
|
|
50
|
+
key_bytes: bytes,
|
|
51
|
+
path: Union[str, Bip32Path],
|
|
52
|
+
chain_code: Union[bytes, Bip32ChainCode],
|
|
53
|
+
key_net_ver_str: str) -> str:
|
|
54
|
+
"""
|
|
55
|
+
Serialize the specified key bytes.
|
|
56
|
+
|
|
57
|
+
Args:
|
|
58
|
+
key_bytes (bytes) : Key bytes
|
|
59
|
+
path (str or Bip32Path object) : BIP32 path
|
|
60
|
+
chain_code (bytes or Bip32ChainCode object): Chain code
|
|
61
|
+
key_net_ver_str (str) : Key net version string
|
|
62
|
+
|
|
63
|
+
Returns:
|
|
64
|
+
str: Serialized key
|
|
65
|
+
"""
|
|
66
|
+
if isinstance(path, str):
|
|
67
|
+
path = Bip32PathParser.Parse(path)
|
|
68
|
+
if isinstance(chain_code, bytes):
|
|
69
|
+
chain_code = Bip32ChainCode(chain_code)
|
|
70
|
+
|
|
71
|
+
# Serialize key
|
|
72
|
+
ser_key = (
|
|
73
|
+
bytes(Bip32Depth(path.Length())) + cls.__SerializePath(path) + bytes(chain_code) + key_bytes
|
|
74
|
+
)
|
|
75
|
+
# Encode it
|
|
76
|
+
return Bech32Encoder.Encode(key_net_ver_str, ser_key)
|
|
77
|
+
|
|
78
|
+
@staticmethod
|
|
79
|
+
def __SerializePath(path: Bip32Path) -> bytes:
|
|
80
|
+
"""
|
|
81
|
+
Serialize BIP32 path.
|
|
82
|
+
|
|
83
|
+
Args:
|
|
84
|
+
path (Bip32Path object): BIP32 path
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
bytes: Serialized path
|
|
88
|
+
"""
|
|
89
|
+
path_bytes = b""
|
|
90
|
+
for path_elem in path:
|
|
91
|
+
path_bytes += path_elem.ToBytes()
|
|
92
|
+
|
|
93
|
+
return path_bytes
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class Slip32PrivateKeySerializer:
|
|
97
|
+
"""
|
|
98
|
+
SLIP32 private key serializer class.
|
|
99
|
+
It serializes private keys.
|
|
100
|
+
"""
|
|
101
|
+
|
|
102
|
+
@staticmethod
|
|
103
|
+
def Serialize(priv_key: IPrivateKey,
|
|
104
|
+
path: Union[str, Bip32Path],
|
|
105
|
+
chain_code: Union[bytes, Bip32ChainCode],
|
|
106
|
+
key_net_ver: Slip32KeyNetVersions = Slip32KeySerConst.STD_KEY_NET_VERSIONS) -> str:
|
|
107
|
+
"""
|
|
108
|
+
Serialize a private key.
|
|
109
|
+
|
|
110
|
+
Args:
|
|
111
|
+
priv_key (IPrivateKey object) : IPrivateKey object
|
|
112
|
+
path (str or Bip32Path object) : BIP32 path
|
|
113
|
+
chain_code (bytes or Bip32ChainCode object) : Chain code
|
|
114
|
+
key_net_ver (Slip32KeyNetVersions object, optional): Key net versions (SLIP32 net version by default)
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
str: Serialized private key
|
|
118
|
+
"""
|
|
119
|
+
return _Slip32KeySerializer.Serialize(b"\x00" + priv_key.Raw().ToBytes(),
|
|
120
|
+
path,
|
|
121
|
+
chain_code,
|
|
122
|
+
key_net_ver.Private())
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
class Slip32PublicKeySerializer:
|
|
126
|
+
"""
|
|
127
|
+
SLIP32 public key serializer class.
|
|
128
|
+
It serializes public keys.
|
|
129
|
+
"""
|
|
130
|
+
|
|
131
|
+
@staticmethod
|
|
132
|
+
def Serialize(pub_key: IPublicKey,
|
|
133
|
+
path: Union[str, Bip32Path],
|
|
134
|
+
chain_code: Union[bytes, Bip32ChainCode],
|
|
135
|
+
key_net_ver: Slip32KeyNetVersions = Slip32KeySerConst.STD_KEY_NET_VERSIONS) -> str:
|
|
136
|
+
"""
|
|
137
|
+
Serialize a public key.
|
|
138
|
+
|
|
139
|
+
Args:
|
|
140
|
+
pub_key (IPublicKey object) : IPublicKey object
|
|
141
|
+
path (str or Bip32Path object) : BIP32 path
|
|
142
|
+
chain_code (bytes or Bip32ChainCode object) : Chain code
|
|
143
|
+
key_net_ver (Slip32KeyNetVersions object, optional): Key net versions (SLIP32 net version by default)
|
|
144
|
+
|
|
145
|
+
Returns:
|
|
146
|
+
str: Serialized public key
|
|
147
|
+
"""
|
|
148
|
+
return _Slip32KeySerializer.Serialize(pub_key.RawCompressed().ToBytes(),
|
|
149
|
+
path,
|
|
150
|
+
chain_code,
|
|
151
|
+
key_net_ver.Public())
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
class Slip32DeserializedKey:
|
|
155
|
+
"""
|
|
156
|
+
SLIP32 deserialized key class.
|
|
157
|
+
It represents a key deserialized with the Slip32KeyDeserializer.
|
|
158
|
+
"""
|
|
159
|
+
|
|
160
|
+
m_key_bytes: bytes
|
|
161
|
+
m_path: Bip32Path
|
|
162
|
+
m_chain_code: Bip32ChainCode
|
|
163
|
+
m_is_public: bool
|
|
164
|
+
|
|
165
|
+
def __init__(self,
|
|
166
|
+
key_bytes: bytes,
|
|
167
|
+
path: Bip32Path,
|
|
168
|
+
chain_code: Bip32ChainCode,
|
|
169
|
+
is_public: bool) -> None:
|
|
170
|
+
"""
|
|
171
|
+
Construct class.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
key_bytes (bytes) : Key bytes
|
|
175
|
+
path (Bip32Path object) : BIP32 path
|
|
176
|
+
chain_code (Bip32ChainCode object): Chain code
|
|
177
|
+
is_public (bool) : True if the key is public, false otherwise
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
str: Serialized public key
|
|
181
|
+
"""
|
|
182
|
+
self.m_key_bytes = key_bytes
|
|
183
|
+
self.m_path = path
|
|
184
|
+
self.m_chain_code = chain_code
|
|
185
|
+
self.m_is_public = is_public
|
|
186
|
+
|
|
187
|
+
def KeyBytes(self) -> bytes:
|
|
188
|
+
"""
|
|
189
|
+
Get key bytes.
|
|
190
|
+
|
|
191
|
+
Returns:
|
|
192
|
+
bytes: Key bytes
|
|
193
|
+
"""
|
|
194
|
+
return self.m_key_bytes
|
|
195
|
+
|
|
196
|
+
def Path(self) -> Bip32Path:
|
|
197
|
+
"""
|
|
198
|
+
Get path.
|
|
199
|
+
|
|
200
|
+
Returns:
|
|
201
|
+
Bip32Path object: Bip32Path object
|
|
202
|
+
"""
|
|
203
|
+
return self.m_path
|
|
204
|
+
|
|
205
|
+
def ChainCode(self) -> Bip32ChainCode:
|
|
206
|
+
"""
|
|
207
|
+
Get chain code.
|
|
208
|
+
|
|
209
|
+
Returns:
|
|
210
|
+
Bip32ChainCode object: Bip32ChainCode object
|
|
211
|
+
"""
|
|
212
|
+
return self.m_chain_code
|
|
213
|
+
|
|
214
|
+
def IsPublic(self) -> bool:
|
|
215
|
+
"""
|
|
216
|
+
Get if public.
|
|
217
|
+
|
|
218
|
+
Returns:
|
|
219
|
+
bool: True if the key is public, false otherwise
|
|
220
|
+
"""
|
|
221
|
+
return self.m_is_public
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
class Slip32KeyDeserializer:
|
|
225
|
+
"""
|
|
226
|
+
SLIP32 key deserializer class.
|
|
227
|
+
It deserializes an extended key.
|
|
228
|
+
"""
|
|
229
|
+
|
|
230
|
+
@classmethod
|
|
231
|
+
def DeserializeKey(
|
|
232
|
+
cls,
|
|
233
|
+
ser_key_str: str,
|
|
234
|
+
key_net_ver: Slip32KeyNetVersions = Slip32KeySerConst.STD_KEY_NET_VERSIONS
|
|
235
|
+
) -> Slip32DeserializedKey:
|
|
236
|
+
"""
|
|
237
|
+
Deserialize a key.
|
|
238
|
+
|
|
239
|
+
Args:
|
|
240
|
+
ser_key_str (str) : Serialized key string
|
|
241
|
+
key_net_ver (Slip32KeyNetVersions object, optional): Key net versions (SLIP32 net version by default)
|
|
242
|
+
|
|
243
|
+
Returns:
|
|
244
|
+
Slip32DeserializedKey object: Slip32DeserializedKey object
|
|
245
|
+
|
|
246
|
+
Raises:
|
|
247
|
+
ValueError: If the key net version is not valid
|
|
248
|
+
"""
|
|
249
|
+
|
|
250
|
+
# Get if key is public/private depending on the net version
|
|
251
|
+
is_public = cls.__GetIfPublic(ser_key_str, key_net_ver)
|
|
252
|
+
|
|
253
|
+
# Decode key
|
|
254
|
+
ser_key_bytes = Bech32Decoder.Decode(
|
|
255
|
+
key_net_ver.Public() if is_public else key_net_ver.Private(),
|
|
256
|
+
ser_key_str
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
# Get parts back
|
|
260
|
+
key_bytes, path, chain_code = cls.__GetPartsFromBytes(ser_key_bytes, is_public)
|
|
261
|
+
|
|
262
|
+
return Slip32DeserializedKey(key_bytes, path, chain_code, is_public)
|
|
263
|
+
|
|
264
|
+
@staticmethod
|
|
265
|
+
def __GetIfPublic(ser_key_str: str,
|
|
266
|
+
key_net_ver: Slip32KeyNetVersions) -> bool:
|
|
267
|
+
"""
|
|
268
|
+
Get if the key is public.
|
|
269
|
+
|
|
270
|
+
Args:
|
|
271
|
+
ser_key_str (str) : Serialized key string
|
|
272
|
+
key_net_ver (Slip32KeyNetVersions object): Key net versions
|
|
273
|
+
|
|
274
|
+
Returns:
|
|
275
|
+
bool: True if public, false otherwise
|
|
276
|
+
"""
|
|
277
|
+
if ser_key_str[:len(key_net_ver.Public())] == key_net_ver.Public():
|
|
278
|
+
is_public = True
|
|
279
|
+
elif ser_key_str[:len(key_net_ver.Private())] == key_net_ver.Private():
|
|
280
|
+
is_public = False
|
|
281
|
+
else:
|
|
282
|
+
raise ValueError("Invalid extended key (wrong net version)")
|
|
283
|
+
return is_public
|
|
284
|
+
|
|
285
|
+
@staticmethod
|
|
286
|
+
def __GetPartsFromBytes(ser_key_bytes: bytes,
|
|
287
|
+
is_public: bool) -> Tuple[bytes, Bip32Path, Bip32ChainCode]:
|
|
288
|
+
"""
|
|
289
|
+
Get back key parts from serialized key bytes.
|
|
290
|
+
|
|
291
|
+
Args:
|
|
292
|
+
ser_key_bytes (bytes): Serialized key bytes
|
|
293
|
+
is_public (bool) : True if the key is public, false otherwise
|
|
294
|
+
|
|
295
|
+
Returns:
|
|
296
|
+
Tuple[bytes, Bip32Path, Bip32ChainCode]: key bytes (index 0), BIP32 path (index 1) and chain code (index 2)
|
|
297
|
+
"""
|
|
298
|
+
depth_idx = 0
|
|
299
|
+
path_idx = depth_idx + Bip32Depth.FixedLength()
|
|
300
|
+
|
|
301
|
+
# Get back depth and path
|
|
302
|
+
depth = ser_key_bytes[depth_idx]
|
|
303
|
+
path = Bip32Path()
|
|
304
|
+
for i in range(depth):
|
|
305
|
+
key_index_bytes = ser_key_bytes[path_idx + (i * Bip32KeyIndex.FixedLength()):
|
|
306
|
+
path_idx + ((i + 1) * Bip32KeyIndex.FixedLength())]
|
|
307
|
+
path = path.AddElem(Bip32KeyIndex.FromBytes(key_index_bytes))
|
|
308
|
+
|
|
309
|
+
# Get back chain code and key
|
|
310
|
+
chain_code_idx = path_idx + (depth * Bip32KeyIndex.FixedLength())
|
|
311
|
+
key_idx = chain_code_idx + Bip32ChainCode.FixedLength()
|
|
312
|
+
|
|
313
|
+
chain_code_bytes = ser_key_bytes[chain_code_idx:key_idx]
|
|
314
|
+
key_bytes = ser_key_bytes[key_idx:]
|
|
315
|
+
|
|
316
|
+
# If private key, the first byte shall be zero and shall be removed
|
|
317
|
+
if not is_public:
|
|
318
|
+
if key_bytes[0] != 0:
|
|
319
|
+
raise ValueError(f"Invalid extended private key (wrong secret: {key_bytes[0]})")
|
|
320
|
+
key_bytes = key_bytes[1:]
|
|
321
|
+
|
|
322
|
+
return key_bytes, path, Bip32ChainCode(chain_code_bytes)
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
# Copyright (c) 2021 Emanuele Bellocchia
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
# THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
"""Module for SLIP32 net version class."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Slip32KeyNetVersions:
|
|
25
|
+
"""
|
|
26
|
+
SLIP32 key net versions class.
|
|
27
|
+
It represents a SLIP32 key net versions.
|
|
28
|
+
"""
|
|
29
|
+
|
|
30
|
+
m_pub_net_ver: str
|
|
31
|
+
m_priv_net_ver: str
|
|
32
|
+
|
|
33
|
+
def __init__(self,
|
|
34
|
+
pub_net_ver: str,
|
|
35
|
+
priv_net_ver: str) -> None:
|
|
36
|
+
"""
|
|
37
|
+
Construct class.
|
|
38
|
+
|
|
39
|
+
Args:
|
|
40
|
+
pub_net_ver (str) : Public net version
|
|
41
|
+
priv_net_ver (str): Private net version
|
|
42
|
+
"""
|
|
43
|
+
self.m_pub_net_ver = pub_net_ver
|
|
44
|
+
self.m_priv_net_ver = priv_net_ver
|
|
45
|
+
|
|
46
|
+
def Public(self) -> str:
|
|
47
|
+
"""
|
|
48
|
+
Get public net version.
|
|
49
|
+
|
|
50
|
+
Returns:
|
|
51
|
+
str: Public net version
|
|
52
|
+
"""
|
|
53
|
+
return self.m_pub_net_ver
|
|
54
|
+
|
|
55
|
+
def Private(self) -> str:
|
|
56
|
+
"""
|
|
57
|
+
Get private net version.
|
|
58
|
+
|
|
59
|
+
Returns:
|
|
60
|
+
str: Private net version
|
|
61
|
+
"""
|
|
62
|
+
return self.m_priv_net_ver
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .slip44 import Slip44
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# Copyright (c) 2022 Emanuele Bellocchia
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
# THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
"""
|
|
22
|
+
Module for SLIP-0044 coin types.
|
|
23
|
+
Not all the coin types are defined, but only the used ones.
|
|
24
|
+
Reference: https://github.com/satoshilabs/slips/blob/master/slip-0044.md
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
class Slip44:
|
|
29
|
+
"""
|
|
30
|
+
SLIP-0044 class.
|
|
31
|
+
It defines the coin types in according to SLIP-0044.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
BITCOIN: int = 0
|
|
35
|
+
TESTNET: int = 1
|
|
36
|
+
LITECOIN: int = 2
|
|
37
|
+
DOGECOIN: int = 3
|
|
38
|
+
DASH: int = 5
|
|
39
|
+
ETHEREUM: int = 60
|
|
40
|
+
ETHEREUM_CLASSIC: int = 61
|
|
41
|
+
ICON: int = 74
|
|
42
|
+
VERGE: int = 77
|
|
43
|
+
ATOM: int = 118
|
|
44
|
+
MONERO: int = 128
|
|
45
|
+
ZCASH: int = 133
|
|
46
|
+
RIPPLE: int = 144
|
|
47
|
+
BITCOIN_CASH: int = 145
|
|
48
|
+
STELLAR: int = 148
|
|
49
|
+
NANO: int = 165
|
|
50
|
+
EOS: int = 194
|
|
51
|
+
TRON: int = 195
|
|
52
|
+
BITCOIN_SV: int = 236
|
|
53
|
+
NIMIQ: int = 242
|
|
54
|
+
ALGORAND: int = 283
|
|
55
|
+
ZILLIQA: int = 313
|
|
56
|
+
TERRA: int = 330
|
|
57
|
+
POLKADOT: int = 354
|
|
58
|
+
NEAR_PROTOCOL: int = 397
|
|
59
|
+
ERGO: int = 429
|
|
60
|
+
KUSAMA: int = 434
|
|
61
|
+
KAVA: int = 459
|
|
62
|
+
FILECOIN: int = 461
|
|
63
|
+
BAND_PROTOCOL: int = 494
|
|
64
|
+
THETA: int = 500
|
|
65
|
+
SOLANA: int = 501
|
|
66
|
+
ELROND: int = 508
|
|
67
|
+
SECRET_NETWORK: int = 529
|
|
68
|
+
NINE_CHRONICLES: int = 567
|
|
69
|
+
APTOS: int = 637
|
|
70
|
+
BINANCE_CHAIN: int = 714
|
|
71
|
+
SUI: int = 784
|
|
72
|
+
VECHAIN: int = 818
|
|
73
|
+
NEO: int = 888
|
|
74
|
+
OKEX_CHAIN: int = 996
|
|
75
|
+
HARMONY_ONE: int = 1023
|
|
76
|
+
ONTOLOGY: int = 1024
|
|
77
|
+
TEZOS: int = 1729
|
|
78
|
+
CARDANO: int = 1815
|
|
79
|
+
AVALANCHE: int = 9000
|
|
80
|
+
CELO: int = 52752
|
|
81
|
+
PI_NETWORK: int = 314159
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .coin_names import CoinNames
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Copyright (c) 2021 Emanuele Bellocchia
|
|
2
|
+
#
|
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
# of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
# in the Software without restriction, including without limitation the rights
|
|
6
|
+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
# copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
# furnished to do so, subject to the following conditions:
|
|
9
|
+
#
|
|
10
|
+
# The above copyright notice and this permission notice shall be included in
|
|
11
|
+
# all copies or substantial portions of the Software.
|
|
12
|
+
#
|
|
13
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
# THE SOFTWARE.
|
|
20
|
+
|
|
21
|
+
"""Module with helper class for coin names."""
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class CoinNames:
|
|
25
|
+
"""Helper class for representing coin names."""
|
|
26
|
+
|
|
27
|
+
m_name: str
|
|
28
|
+
m_abbr: str
|
|
29
|
+
|
|
30
|
+
def __init__(self,
|
|
31
|
+
name: str,
|
|
32
|
+
abbr: str) -> None:
|
|
33
|
+
"""
|
|
34
|
+
Construct class.
|
|
35
|
+
|
|
36
|
+
Args:
|
|
37
|
+
name (str): Name
|
|
38
|
+
abbr (str): Abbreviation
|
|
39
|
+
"""
|
|
40
|
+
self.m_name = name
|
|
41
|
+
self.m_abbr = abbr
|
|
42
|
+
|
|
43
|
+
def Name(self) -> str:
|
|
44
|
+
"""
|
|
45
|
+
Get name.
|
|
46
|
+
|
|
47
|
+
Returns :
|
|
48
|
+
str: Name
|
|
49
|
+
"""
|
|
50
|
+
return self.m_name
|
|
51
|
+
|
|
52
|
+
def Abbreviation(self) -> str:
|
|
53
|
+
"""
|
|
54
|
+
Get abbreviation.
|
|
55
|
+
|
|
56
|
+
Returns:
|
|
57
|
+
str: Abbreviation
|
|
58
|
+
"""
|
|
59
|
+
return self.m_abbr
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
from .aes_ecb import AesEcbDecrypter, AesEcbEncrypter
|
|
2
|
+
from .blake2 import Blake2b, Blake2b32, Blake2b40, Blake2b160, Blake2b224, Blake2b256, Blake2b512
|
|
3
|
+
from .chacha20_poly1305 import ChaCha20Poly1305
|
|
4
|
+
from .hash160 import Hash160
|
|
5
|
+
from .hmac import HmacSha256, HmacSha512
|
|
6
|
+
from .pbkdf2 import Pbkdf2HmacSha512
|
|
7
|
+
from .ripemd import Ripemd160
|
|
8
|
+
from .scrypt import Scrypt
|
|
9
|
+
from .sha2 import DoubleSha256, Sha256, Sha512, Sha512_256
|
|
10
|
+
from .sha3 import Kekkak256, Sha3_256
|