def step0_prepare(cs_inst, logger): global addr_dict qa = cs_inst.check_output(utils.CmdBuiler.qtum_cli__getnewaddress(), shell=True) qha = utils.CQHAddress(cs_inst) qha.setQa(qa) addr_dict.update({'a': qha}) qa = cs_inst.check_output(utils.CmdBuiler.qtum_cli__getnewaddress(), shell=True) qha = utils.CQHAddress(cs_inst) qha.setQa(qa) addr_dict.update({'b': qha}) qa = cs_inst.check_output(utils.CmdBuiler.qtum_cli__getnewaddress(), shell=True) qha = utils.CQHAddress(cs_inst) qha.setQa(qa) addr_dict.update({'c': qha}) logger.info(addr_dict) if not os.path.exists('qtumjs-cli'): cs_inst.check_call( 'git clone https://github.com/danX-4q/qtumbook-mytoken-qtumjs-cli qtumjs-cli', shell=True) cs_inst.check_call( 'git clone https://github.com/OpenZeppelin/zeppelin-solidity.git qtumjs-cli/zeppelin-solidity', shell=True) os.chdir('qtumjs-cli') env_inst = utils.CEnv() def cb_apply_env(prog_env, nodes_env): for node_name in sorted(nodes_env.keys()): t = file('nodeX--index.js.tmpl') d = file(node_name + '--index.js', 'w') s = t.read() d.write(s % nodes_env[node_name]) f_r = prog_env['QTUM_DFT_NODE'] + '--' + 'index.js' f_l = 'wrp-index.js' try: os.remove(f_l) except OSError as e: if e.errno == 2: pass else: raise os.symlink(f_r, f_l) logger.info('symlink %s -> %s' % (f_l, f_r)) env_inst.apply_env_callback(cb_apply_env) cs_inst.check_call('yarn install', shell=True) else: os.chdir('qtumjs-cli')
def getnewaddress_with_names(cs_inst, logger, names) : global addr_dict for n in names : qa = cs_inst.check_output(utils.CmdBuiler.qtum_cli__getnewaddress(n), shell=True) qha = utils.CQHAddress(cs_inst) qha.setQa(qa) addr_dict.update({n : qha}) logger.info('addr_dict[%s]\t=>\tqa:%s\tha:%s' % (n, qa, qha.getHa()))