diff --git a/mmgen/addrfile.py b/mmgen/addrfile.py index ff3eb854..e038b3ad 100755 --- a/mmgen/addrfile.py +++ b/mmgen/addrfile.py @@ -209,7 +209,7 @@ class AddrFile(MMGenObject): else: network = 'mainnet' - from .proto.btc import mainnet + from .proto.btc.params import mainnet if lbl in [MMGenAddrType(mainnet,key).name for key in mainnet.mmtypes]: coin,mmtype_key = ( 'BTC', lbl ) elif ':' in lbl: # first component is coin, second is mmtype_key diff --git a/mmgen/altcoin.py b/mmgen/altcoin.py index 7d4a75e9..a8aea77c 100755 --- a/mmgen/altcoin.py +++ b/mmgen/altcoin.py @@ -736,7 +736,7 @@ def init_genonly_altcoins(usr_coin=None,testnet=False): def create_altcoin_protos(data): from .protocol import CoinProtocol - from .proto.btc import mainnet + from .proto.btc.params import mainnet def make_proto(e,testnet=False): diff --git a/mmgen/help.py b/mmgen/help.py index 7df0d348..5cc0985f 100755 --- a/mmgen/help.py +++ b/mmgen/help.py @@ -162,7 +162,7 @@ one address with no amount on the command line. """ def txsign(): - from .proto.btc import mainnet + from .proto.btc.params import mainnet return """ Transactions may contain both {pnm} or non-{pnm} input addresses. diff --git a/mmgen/keygen.py b/mmgen/keygen.py index 0275e2f8..33a16d92 100755 --- a/mmgen/keygen.py +++ b/mmgen/keygen.py @@ -107,7 +107,7 @@ class keygen_backend: def __init__(self): - from .proto.xmr import mainnet + from .proto.xmr.params import mainnet self.proto_cls = mainnet from .util import get_keccak diff --git a/mmgen/proto/__init__.py b/mmgen/proto/__init__.py deleted file mode 100755 index e69de29b..00000000 diff --git a/mmgen/proto/bch/params.py b/mmgen/proto/bch/params.py index 5eff8bfa..1ae23195 100755 --- a/mmgen/proto/bch/params.py +++ b/mmgen/proto/bch/params.py @@ -12,7 +12,7 @@ Bitcoin Cash protocol """ -from .btc import mainnet,_finfo +from ..btc.params import mainnet,_finfo class mainnet(mainnet): is_fork_of = 'Bitcoin' diff --git a/mmgen/proto/btc/params.py b/mmgen/proto/btc/params.py index 6f8b7d4e..70b5630d 100755 --- a/mmgen/proto/btc/params.py +++ b/mmgen/proto/btc/params.py @@ -12,8 +12,8 @@ Bitcoin protocol """ -from ..protocol import CoinProtocol,decoded_wif,decoded_addr,_finfo,_nw -from .common import * +from ...protocol import CoinProtocol,decoded_wif,decoded_addr,_finfo,_nw +from ..common import * class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp """ @@ -80,7 +80,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp ret = bech32.decode(self.bech32_hrp,addr) if ret[0] != self.witness_vernum: - from ..util import msg + from ...util import msg msg(f'{ret[0]}: Invalid witness version number') return False diff --git a/mmgen/proto/etc/params.py b/mmgen/proto/etc/params.py index e7892232..0c61f04a 100755 --- a/mmgen/proto/etc/params.py +++ b/mmgen/proto/etc/params.py @@ -12,7 +12,7 @@ Ethereum Classic protocol """ -from .eth import mainnet +from ..eth.params import mainnet class mainnet(mainnet): chain_names = ['classic','ethereum_classic'] diff --git a/mmgen/proto/eth/params.py b/mmgen/proto/eth/params.py index 49e0a0ab..b08f30a5 100755 --- a/mmgen/proto/eth/params.py +++ b/mmgen/proto/eth/params.py @@ -12,9 +12,9 @@ Ethereum protocol """ -from ..globalvars import g -from ..protocol import CoinProtocol,_nw,decoded_addr -from ..util import is_hex_str_lc,Msg +from ...globalvars import g +from ...protocol import CoinProtocol,_nw,decoded_addr +from ...util import is_hex_str_lc,Msg class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Secp256k1): diff --git a/mmgen/proto/ltc/params.py b/mmgen/proto/ltc/params.py index 90f28a59..92b8a8cd 100755 --- a/mmgen/proto/ltc/params.py +++ b/mmgen/proto/ltc/params.py @@ -12,7 +12,7 @@ Litecoin protocol """ -from .btc import mainnet +from ..btc.params import mainnet class mainnet(mainnet): block0 = '12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2' diff --git a/mmgen/proto/xmr/params.py b/mmgen/proto/xmr/params.py index cb54cb12..61bb9b74 100755 --- a/mmgen/proto/xmr/params.py +++ b/mmgen/proto/xmr/params.py @@ -14,7 +14,7 @@ Monero protocol from collections import namedtuple -from ..protocol import CoinProtocol,_nw +from ...protocol import CoinProtocol,_nw parsed_addr = namedtuple('parsed_addr',['ver_bytes','data','payment_id']) @@ -39,7 +39,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Base): return (64,72)[addr_fmt == 'monero_integrated'] def preprocess_key(self,sec,pubkey_type): # reduce key - from ..contrib.ed25519 import l + from ...contrib.ed25519 import l return int.to_bytes( int.from_bytes( sec[::-1], 'big' ) % l, self.privkey_len, @@ -47,7 +47,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Base): def decode_addr(self,addr): - from ..baseconv import baseconv + from ...baseconv import baseconv def b58dec(addr_str): bc = baseconv('b58') diff --git a/mmgen/proto/zec/params.py b/mmgen/proto/zec/params.py index 220a2585..8e0c0a9b 100755 --- a/mmgen/proto/zec/params.py +++ b/mmgen/proto/zec/params.py @@ -12,9 +12,9 @@ Zcash protocol """ -from .btc import mainnet -from .common import b58chk_decode -from ..protocol import decoded_wif,decoded_addr +from ..btc.params import mainnet +from ..common import b58chk_decode +from ...protocol import decoded_wif,decoded_addr class mainnet(mainnet): base_coin = 'ZEC' @@ -28,7 +28,7 @@ class mainnet(mainnet): def __init__(self,*args,**kwargs): super().__init__(*args,**kwargs) - from ..opts import opt + from ...opts import opt self.coin_id = 'ZEC-Z' if opt.type in ('zcash_z','Z') else 'ZEC-T' def get_wif_ver_bytes_len(self,key_data): diff --git a/mmgen/protocol.py b/mmgen/protocol.py index b8508c10..2086fbf4 100755 --- a/mmgen/protocol.py +++ b/mmgen/protocol.py @@ -236,7 +236,7 @@ def init_proto(coin=None,testnet=False,regtest=False,network=None,network_id=Non setattr( CoinProtocol, proto_name, - getattr(importlib.import_module(f'mmgen.proto.{coin}'),network) + getattr(importlib.import_module(f'mmgen.proto.{coin}.params'),network) ) return getattr(CoinProtocol,proto_name)( diff --git a/setup.cfg b/setup.cfg index 9c70fbf5..ba35691d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,6 +55,13 @@ packages = mmgen.contrib mmgen.data mmgen.proto + mmgen.proto.bch + mmgen.proto.btc + mmgen.proto.etc + mmgen.proto.eth + mmgen.proto.ltc + mmgen.proto.xmr + mmgen.proto.zec mmgen.share mmgen.tool mmgen.tx diff --git a/test/overlay/__init__.py b/test/overlay/__init__.py index 2b3082a8..5895e28a 100644 --- a/test/overlay/__init__.py +++ b/test/overlay/__init__.py @@ -52,6 +52,13 @@ def overlay_setup(repo_root): 'mmgen.base_proto.monero', 'mmgen.data', 'mmgen.proto', + 'mmgen.proto.bch', + 'mmgen.proto.btc', + 'mmgen.proto.etc', + 'mmgen.proto.eth', + 'mmgen.proto.ltc', + 'mmgen.proto.xmr', + 'mmgen.proto.zec', 'mmgen.share', 'mmgen.tool', 'mmgen.tx',