Rename chain spec members
This commit is contained in:
parent
58b92837ff
commit
92a5a86063
@ -16,12 +16,12 @@ class ChainSpec:
|
|||||||
:param tag: Descriptive tag
|
:param tag: Descriptive tag
|
||||||
:type tag: str
|
:type tag: str
|
||||||
"""
|
"""
|
||||||
def __init__(self, engine, common_name, network_id, tag=None):
|
def __init__(self, arch, fork, network_id, common_name=None):
|
||||||
self.o = {
|
self.o = {
|
||||||
'engine': engine,
|
'arch': arch,
|
||||||
'common_name': common_name,
|
'fork': fork,
|
||||||
'network_id': network_id,
|
'network_id': network_id,
|
||||||
'tag': tag,
|
'common_name': common_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
def network_id(self):
|
def network_id(self):
|
||||||
@ -48,7 +48,7 @@ class ChainSpec:
|
|||||||
:rtype: str
|
:rtype: str
|
||||||
:returns: engine
|
:returns: engine
|
||||||
"""
|
"""
|
||||||
return self.o['engine']
|
return self.o['arch']
|
||||||
|
|
||||||
|
|
||||||
def common_name(self):
|
def common_name(self):
|
||||||
@ -78,10 +78,10 @@ class ChainSpec:
|
|||||||
o = chain_str.split(':')
|
o = chain_str.split(':')
|
||||||
if len(o) < 3:
|
if len(o) < 3:
|
||||||
raise ValueError('Chain string must have three sections, got {}'.format(len(o)))
|
raise ValueError('Chain string must have three sections, got {}'.format(len(o)))
|
||||||
tag = None
|
common_name = None
|
||||||
if len(o) == 4:
|
if len(o) == 4:
|
||||||
tag = o[3]
|
common_name = o[3]
|
||||||
return ChainSpec(o[0], o[1], int(o[2]), tag)
|
return ChainSpec(o[0], o[1], int(o[2]), common_name)
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@ -100,7 +100,7 @@ class ChainSpec:
|
|||||||
:rtype: chainlib.chain.ChainSpec
|
:rtype: chainlib.chain.ChainSpec
|
||||||
:returns: Resulting chain spec
|
:returns: Resulting chain spec
|
||||||
"""
|
"""
|
||||||
return ChainSpec(o['engine'], o['common_name'], o['network_id'], tag=o['tag'])
|
return ChainSpec(o['arch'], o['fork'], o['network_id'], common_name=o['common_name'])
|
||||||
|
|
||||||
|
|
||||||
def asdict(self):
|
def asdict(self):
|
||||||
@ -113,7 +113,7 @@ class ChainSpec:
|
|||||||
|
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
s = '{}:{}:{}'.format(self.o['engine'], self.o['common_name'], self.o['network_id'])
|
s = '{}:{}:{}'.format(self.o['arch'], self.o['fork'], self.o['network_id'])
|
||||||
if self.o['tag'] != None:
|
if self.o['common_name'] != None:
|
||||||
s += ':' + self.o['tag']
|
s += ':' + self.o['common_name']
|
||||||
return s
|
return s
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = chainlib
|
name = chainlib
|
||||||
version = 0.0.9rc1
|
version = 0.0.10a1
|
||||||
description = Generic blockchain access library and tooling
|
description = Generic blockchain access library and tooling
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user