Change network reference to include multiple target code points

This commit is contained in:
nolash 2021-10-09 21:45:07 +02:00
parent 388c676d11
commit cd2d603164
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
5 changed files with 26 additions and 9 deletions

View File

@ -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)

View File

@ -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()

View File

@ -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)

View File

@ -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

View File

@ -29,3 +29,6 @@ packages =
cic
cic.runnable
cic.ext
[options.extras_require]
eth = chainlib-eth~=0.0.9rc