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,265 @@
|
|
|
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 BIP44 keys derivation.
|
|
23
|
+
Reference: https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
|
|
24
|
+
"""
|
|
25
|
+
|
|
26
|
+
# Imports
|
|
27
|
+
from typing import Union
|
|
28
|
+
|
|
29
|
+
from ..bip32 import Bip32KeyData, Bip32KeyIndex, Bip32KeyNetVersions, Bip32Const, Bip32Slip10Secp256k1
|
|
30
|
+
from ..bip44_base import Bip44Base, Bip44Changes, Bip44Levels
|
|
31
|
+
|
|
32
|
+
_BIP44_BTC_KEY_NET_VER_MAIN: Bip32KeyNetVersions = Bip32Const.MAIN_NET_KEY_NET_VERSIONS
|
|
33
|
+
|
|
34
|
+
# from ..conf.bip44 import Bip44ConfGetter
|
|
35
|
+
# from ..conf.bip44 import BipCoinConf
|
|
36
|
+
from ..conf.common import BipCoins, BipCoinConf
|
|
37
|
+
from ..coin_conf import CoinsConf
|
|
38
|
+
from ..slip.slip44 import Slip44
|
|
39
|
+
from ..conf.common import DER_PATH_NON_HARDENED_FULL
|
|
40
|
+
# from bip_utils.ecc import IPrivateKey, IPublicKey
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class Bip44Const:
|
|
44
|
+
"""Class container for BIP44 constants."""
|
|
45
|
+
|
|
46
|
+
# Specification name
|
|
47
|
+
SPEC_NAME: str = "BIP-0044"
|
|
48
|
+
# Purpose
|
|
49
|
+
PURPOSE: int = Bip32KeyIndex.HardenIndex(44)
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class Bip44(Bip44Base):
|
|
53
|
+
"""
|
|
54
|
+
BIP44 class.
|
|
55
|
+
It allows master key generation and children keys derivation in according to BIP-0044.
|
|
56
|
+
"""
|
|
57
|
+
|
|
58
|
+
#
|
|
59
|
+
# Class methods for construction
|
|
60
|
+
#
|
|
61
|
+
|
|
62
|
+
@classmethod
|
|
63
|
+
def FromSeed(cls,
|
|
64
|
+
seed_bytes: bytes) -> Bip44Base:
|
|
65
|
+
"""
|
|
66
|
+
Create a Bip44Base object from the specified seed (e.g. BIP39 seed).
|
|
67
|
+
|
|
68
|
+
Args:
|
|
69
|
+
seed_bytes (bytes) : Seed bytes
|
|
70
|
+
coin_type (BipCoins): Coin type, shall be a Bip44Coins enum
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Bip44Base object: Bip44Base object
|
|
74
|
+
|
|
75
|
+
Raises:
|
|
76
|
+
TypeError: If coin type is not a Bip44Coins enum
|
|
77
|
+
ValueError: If the seed is too short
|
|
78
|
+
Bip32KeyError: If the seed is not suitable for master key generation
|
|
79
|
+
"""
|
|
80
|
+
|
|
81
|
+
# Bip44ConfGetter already checks the enum type
|
|
82
|
+
conf = BipCoinConf(
|
|
83
|
+
coin_names=CoinsConf.Cosmos.CoinNames(),
|
|
84
|
+
coin_idx=Slip44.ATOM,
|
|
85
|
+
is_testnet=False,
|
|
86
|
+
def_path=DER_PATH_NON_HARDENED_FULL,
|
|
87
|
+
key_net_ver=_BIP44_BTC_KEY_NET_VER_MAIN,
|
|
88
|
+
wif_net_ver=None,
|
|
89
|
+
bip32_cls=Bip32Slip10Secp256k1,
|
|
90
|
+
# addr_cls=AtomAddrEncoder,
|
|
91
|
+
addr_params={
|
|
92
|
+
"hrp": CoinsConf.Cosmos.ParamByKey("addr_hrp"),
|
|
93
|
+
},
|
|
94
|
+
)
|
|
95
|
+
return cls._FromSeed(seed_bytes,
|
|
96
|
+
conf)
|
|
97
|
+
|
|
98
|
+
@classmethod
|
|
99
|
+
def FromExtendedKey(cls,
|
|
100
|
+
ex_key_str: str) -> Bip44Base:
|
|
101
|
+
"""
|
|
102
|
+
Create a Bip44Base object from the specified extended key.
|
|
103
|
+
|
|
104
|
+
Args:
|
|
105
|
+
ex_key_str (str) : Extended key string
|
|
106
|
+
coin_type (BipCoins): Coin type, shall be a Bip44Coins enum
|
|
107
|
+
|
|
108
|
+
Returns:
|
|
109
|
+
Bip44Base object: Bip44Base object
|
|
110
|
+
|
|
111
|
+
Raises:
|
|
112
|
+
TypeError: If coin type is not a Bip44Coins enum
|
|
113
|
+
Bip32KeyError: If the extended key is not valid
|
|
114
|
+
"""
|
|
115
|
+
|
|
116
|
+
# Bip44ConfGetter already checks the enum type
|
|
117
|
+
return cls._FromExtendedKey(ex_key_str, Bip44ConfGetter.GetConfig(coin_type))
|
|
118
|
+
|
|
119
|
+
# @classmethod
|
|
120
|
+
# def FromPrivateKey(cls,
|
|
121
|
+
# priv_key: Union[bytes, IPrivateKey],
|
|
122
|
+
# coin_type: BipCoins,
|
|
123
|
+
# key_data: Bip32KeyData = Bip32KeyData()) -> Bip44Base:
|
|
124
|
+
# """
|
|
125
|
+
# Create a Bip44Base object from the specified private key and derivation data.
|
|
126
|
+
# If only the private key bytes are specified, the key will be considered a master key with
|
|
127
|
+
# the chain code set to zero, since there is no way to recover the key derivation data.
|
|
128
|
+
|
|
129
|
+
# Args:
|
|
130
|
+
# priv_key (bytes or IPrivateKey) : Private key
|
|
131
|
+
# coin_type (BipCoins) : Coin type, shall be a Bip44Coins enum
|
|
132
|
+
# key_data (Bip32KeyData object, optional): Key data (default: all zeros)
|
|
133
|
+
|
|
134
|
+
# Returns:
|
|
135
|
+
# Bip44Base object: Bip44Base object
|
|
136
|
+
|
|
137
|
+
# Raises:
|
|
138
|
+
# TypeError: If coin type is not a Bip44Coins enum
|
|
139
|
+
# Bip32KeyError: If the key is not valid
|
|
140
|
+
# """
|
|
141
|
+
|
|
142
|
+
# # Bip44ConfGetter already checks the enum type
|
|
143
|
+
# return cls._FromPrivateKey(priv_key,
|
|
144
|
+
# Bip44ConfGetter.GetConfig(coin_type),
|
|
145
|
+
# key_data)
|
|
146
|
+
|
|
147
|
+
# @classmethod
|
|
148
|
+
# def FromPublicKey(cls,
|
|
149
|
+
# pub_key: Union[bytes, IPublicKey],
|
|
150
|
+
# coin_type: BipCoins,
|
|
151
|
+
# key_data: Bip32KeyData = Bip32KeyData(depth=Bip44Levels.ACCOUNT)) -> Bip44Base:
|
|
152
|
+
# """
|
|
153
|
+
# Create a Bip44Base object from the specified public key and derivation data.
|
|
154
|
+
# If only the public key bytes are specified, the key will be considered an account key with
|
|
155
|
+
# the chain code set to zero, since there is no way to recover the key derivation data.
|
|
156
|
+
|
|
157
|
+
# Args:
|
|
158
|
+
# pub_key (bytes or IPublicKey) : Public key
|
|
159
|
+
# coin_type (BipCoins) : Coin type, shall be a Bip44Coins enum
|
|
160
|
+
# key_data (Bip32KeyData object, optional): Key data (default: all zeros with account depth)
|
|
161
|
+
|
|
162
|
+
# Returns:
|
|
163
|
+
# Bip44Base object: Bip44Base object
|
|
164
|
+
|
|
165
|
+
# Raises:
|
|
166
|
+
# TypeError: If coin type is not a Bip44Coins enum
|
|
167
|
+
# Bip32KeyError: If the key is not valid
|
|
168
|
+
# """
|
|
169
|
+
|
|
170
|
+
# # Bip44ConfGetter already checks the enum type
|
|
171
|
+
# return cls._FromPublicKey(pub_key,
|
|
172
|
+
# Bip44ConfGetter.GetConfig(coin_type),
|
|
173
|
+
# key_data)
|
|
174
|
+
|
|
175
|
+
#
|
|
176
|
+
# Overridden abstract methods
|
|
177
|
+
#
|
|
178
|
+
|
|
179
|
+
def Purpose(self) -> Bip44Base:
|
|
180
|
+
"""
|
|
181
|
+
Derive a child key from the purpose and return a new Bip44Base object.
|
|
182
|
+
|
|
183
|
+
Returns:
|
|
184
|
+
Bip44Base object: Bip44Base object
|
|
185
|
+
|
|
186
|
+
Raises:
|
|
187
|
+
Bip44DepthError: If current depth is not suitable for deriving keys
|
|
188
|
+
Bip32KeyError: If the derivation results in an invalid key
|
|
189
|
+
"""
|
|
190
|
+
return self._PurposeGeneric(Bip44Const.PURPOSE)
|
|
191
|
+
|
|
192
|
+
def Coin(self) -> Bip44Base:
|
|
193
|
+
"""
|
|
194
|
+
Derive a child key from the coin type specified at construction and return a new Bip44Base object.
|
|
195
|
+
|
|
196
|
+
Returns:
|
|
197
|
+
Bip44Base object: Bip44Base object
|
|
198
|
+
|
|
199
|
+
Raises:
|
|
200
|
+
Bip44DepthError: If current depth is not suitable for deriving keys
|
|
201
|
+
Bip32KeyError: If the derivation results in an invalid key
|
|
202
|
+
"""
|
|
203
|
+
return self._CoinGeneric()
|
|
204
|
+
|
|
205
|
+
def Account(self,
|
|
206
|
+
acc_idx: int) -> Bip44Base:
|
|
207
|
+
"""
|
|
208
|
+
Derive a child key from the specified account index and return a new Bip44Base object.
|
|
209
|
+
|
|
210
|
+
Args:
|
|
211
|
+
acc_idx (int): Account index
|
|
212
|
+
|
|
213
|
+
Returns:
|
|
214
|
+
Bip44Base object: Bip44Base object
|
|
215
|
+
|
|
216
|
+
Raises:
|
|
217
|
+
Bip44DepthError: If current depth is not suitable for deriving keys
|
|
218
|
+
Bip32KeyError: If the derivation results in an invalid key
|
|
219
|
+
"""
|
|
220
|
+
return self._AccountGeneric(acc_idx)
|
|
221
|
+
|
|
222
|
+
def Change(self,
|
|
223
|
+
change_type: Bip44Changes) -> Bip44Base:
|
|
224
|
+
"""
|
|
225
|
+
Derive a child key from the specified change type and return a new Bip44Base object.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
change_type (Bip44Changes): Change type, must a Bip44Changes enum
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
Bip44Base object: Bip44Base object
|
|
232
|
+
|
|
233
|
+
Raises:
|
|
234
|
+
TypeError: If change type is not a Bip44Changes enum
|
|
235
|
+
Bip44DepthError: If current depth is not suitable for deriving keys
|
|
236
|
+
Bip32KeyError: If the derivation results in an invalid key
|
|
237
|
+
"""
|
|
238
|
+
return self._ChangeGeneric(change_type)
|
|
239
|
+
|
|
240
|
+
def AddressIndex(self,
|
|
241
|
+
addr_idx: int) -> Bip44Base:
|
|
242
|
+
"""
|
|
243
|
+
Derive a child key from the specified address index and return a new Bip44Base object.
|
|
244
|
+
|
|
245
|
+
Args:
|
|
246
|
+
addr_idx (int): Address index
|
|
247
|
+
|
|
248
|
+
Returns:
|
|
249
|
+
Bip44Base object: Bip44Base object
|
|
250
|
+
|
|
251
|
+
Raises:
|
|
252
|
+
Bip44DepthError: If current depth is not suitable for deriving keys
|
|
253
|
+
Bip32KeyError: If the derivation results in an invalid key
|
|
254
|
+
"""
|
|
255
|
+
return self._AddressIndexGeneric(addr_idx)
|
|
256
|
+
|
|
257
|
+
@staticmethod
|
|
258
|
+
def SpecName() -> str:
|
|
259
|
+
"""
|
|
260
|
+
Get specification name.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
str: Specification name
|
|
264
|
+
"""
|
|
265
|
+
return Bip44Const.SPEC_NAME
|