proto: btc.py -> btc/params.py, ... [code]
This commit is contained in:
parent
467be95e1c
commit
3f182fed64
15 changed files with 35 additions and 21 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
Ethereum Classic protocol
|
||||
"""
|
||||
|
||||
from .eth import mainnet
|
||||
from ..eth.params import mainnet
|
||||
|
||||
class mainnet(mainnet):
|
||||
chain_names = ['classic','ethereum_classic']
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
Litecoin protocol
|
||||
"""
|
||||
|
||||
from .btc import mainnet
|
||||
from ..btc.params import mainnet
|
||||
|
||||
class mainnet(mainnet):
|
||||
block0 = '12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2'
|
||||
|
|
|
|||
|
|
@ -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')
|
||||
|
|
|
|||
|
|
@ -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):
|
||||
|
|
|
|||
|
|
@ -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)(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue