From 132141c22ae1e00480e5440e2723c47645b950dc Mon Sep 17 00:00:00 2001 From: Alain Brenzikofer Date: Thu, 10 Aug 2023 13:44:55 +0100 Subject: [PATCH] extend choice of networks for bazaar helper --- client/bazaar.py | 2 +- client/py_client/helpers.py | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/client/bazaar.py b/client/bazaar.py index cf93e536..01f5a24c 100755 --- a/client/bazaar.py +++ b/client/bazaar.py @@ -37,7 +37,7 @@ @click.option('--bizaccount', required=False, help='the account of the owner in ss58 format or raw_seed.') @click.option('--price', default='0', help='price of your offering.') @click.option('--client', default='../target/release/encointer-client-notee', help='Client binary to communicate with the chain.') -@click.option('--port', default='9944', help='ws-port of the chain.') +@click.option('-p', '--port', default='9944', help='ws-port of the chain.') @click.option('-r', '--remote_chain', default=None, help='choose remote chain: gesell.') @click.pass_context def cli(ctx, client, port, cid, bizaccount, price, remote_chain): diff --git a/client/py_client/helpers.py b/client/py_client/helpers.py index 6ed392e7..ede2a012 100644 --- a/client/py_client/helpers.py +++ b/client/py_client/helpers.py @@ -37,13 +37,13 @@ def mkdir_p(path): return subprocess.run(['mkdir', '-p', path]) -# this method takes the last content identifier, which is the one of the whole folder, for a file, there is only one cid so it works, too. +# this method takes the last content identifier, which is the one of the whole folder, for a file, there is only one cid so it works, too. def take_only_last_cid(ret_cids): # last line contains the directory cid last = ret_cids.stdout.splitlines()[-1] p = re.compile('Qm\\w*') cids = p.findall(str(last)) - + if cids: print(cids[0]) return cids[0] @@ -76,6 +76,10 @@ def set_local_or_remote_chain(client: str, port: str, node_url: str): else: if node_url == "gesell": client = Client(rust_client=client, node_url='wss://gesell.encointer.org', port=443) + elif node_url == "rococo": + client = Client(rust_client=client, node_url='wss://rococo.api.encointer.org', port=443) + elif node_url == "kusama": + client = Client(rust_client=client, node_url='wss://kusama.api.encointer.org', port=443) else: raise Exception("You need to choose a valid remote chain") return client