Change network reference to include multiple target code points
This commit is contained in:
parent
388c676d11
commit
cd2d603164
@ -37,4 +37,4 @@ def execute(config, eargs):
|
||||
|
||||
ref = cn.reference(eargs.target)
|
||||
logg.debug('found reference {} for target {}'.format(ref, eargs.target))
|
||||
getattr(cmd_mod, 'new')(ref, ca.get())
|
||||
getattr(cmd_mod, 'new')(ref, ca.get(), signer_hint=eargs.signer)
|
||||
|
@ -11,6 +11,7 @@ logg = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def process_args(argparser):
|
||||
argparser.add_argument('--target', action='append', type=str, help='initialize network specification file with target')
|
||||
argparser.add_argument('directory', help='directory to initialize')
|
||||
|
||||
|
||||
@ -24,7 +25,7 @@ def execute(config, eargs):
|
||||
cp = Proof(eargs.directory)
|
||||
cm = Meta(eargs.directory)
|
||||
ca = Attachment(eargs.directory)
|
||||
cn = Network(eargs.directory)
|
||||
cn = Network(eargs.directory, targets=eargs.target)
|
||||
|
||||
cp.start()
|
||||
cm.start()
|
||||
|
@ -1,16 +1,18 @@
|
||||
# standard imports
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from chainlib.eth.connection import RPCConnection
|
||||
|
||||
logg = logging.getLogger(__name__)
|
||||
|
||||
|
||||
class CICEth:
|
||||
|
||||
def __init__(self, reference, proofs):
|
||||
def __init__(self, reference, proofs, signer_hint=None):
|
||||
self.reference = reference
|
||||
self.proofs = proofs
|
||||
logg.debug('eth strup with reference {} proofs {}'.format(reference, proofs))
|
||||
|
||||
|
||||
def new(reference, proofs):
|
||||
return CICEth(reference, proofs)
|
||||
def new(reference, proofs, signer_hint=None):
|
||||
return CICEth(reference, proofs, signer_hint=None)
|
||||
|
@ -8,10 +8,11 @@ from .base import *
|
||||
|
||||
class Network(Data):
|
||||
|
||||
def __init__(self, path='.'):
|
||||
def __init__(self, path='.', targets=[]):
|
||||
super(Network, self).__init__()
|
||||
self.references = None
|
||||
self.path = path
|
||||
self.targets = targets
|
||||
self.network_path = os.path.join(self.path, 'network.json')
|
||||
|
||||
|
||||
@ -31,7 +32,14 @@ class Network(Data):
|
||||
super(Network, self).load()
|
||||
|
||||
f = open(self.network_path, 'w')
|
||||
json.dump({'references': {}}, f)
|
||||
o = {'references': {}}
|
||||
|
||||
for v in self.targets:
|
||||
o['references'][v] = {
|
||||
'token': None,
|
||||
'token_index': None,
|
||||
}
|
||||
json.dump(o, f)
|
||||
f.close()
|
||||
|
||||
|
||||
@ -45,6 +53,9 @@ class Network(Data):
|
||||
def __str__(self):
|
||||
s = ''
|
||||
for k in self.references.keys():
|
||||
s += '[ref] {}: {}'.format(k, self.references[k])
|
||||
v = self.references[k]
|
||||
if v == None:
|
||||
v = ''
|
||||
s += '{}: {}\n'.format(k, v)
|
||||
|
||||
return s
|
||||
|
Loading…
Reference in New Issue
Block a user