Esempio n. 1
0
 def get_pid(self):
     #print("get_pid()")
     path = join(self.wallet_state, 'keosd.pid')
     if os.path.isfile(path):
         pid = int(file_get_contents(path))
         self.pid = pid
         return pid
Esempio n. 2
0
 def get_pid(self):
     path = join(self.path, 'node.pid')
     if os.path.isfile(path):
         pid = int(file_get_contents(path))
         self.pid = pid
         return pid
     return -1
Esempio n. 3
0
 def __init__(self, working, parent, nodeos, wallet):
     self.folder_scheme = 'tn-'
     NodeFactory.nodeos_dir = nodeos
     self.parent_dir = parent
     self.working_dir = working
     self.config_dir = join(parent, 'config/nodes.json')
     self.state = json.loads(file_get_contents(self.config_dir))
     if 'nodes' not in self.state:
         self.state['nodes'] = {}
     self.wallet = wallet
Esempio n. 4
0
 def get_pw(self, name):
     try:
         p = join(self.wallet_state, "wallet_pw.json")
         if os.path.isfile(p):
             j = json.loads(file_get_contents(p))
             if name in j:
                 return j[name]
         return None
     except Exception as e:
         print(e)
Esempio n. 5
0
 def __init__(self, parent_dir, contracts, teclos, host_address,
              account_factory):
     self.contracts_dir = join(os.path.abspath(contracts),
                               'build/contracts')
     self.teclos_dir = teclos
     self.host_address = host_address
     self.account_factory = account_factory
     accounts = fromJson(
         file_get_contents(parent_dir + '/config/accounts.json'))
     self.pre_accounts = accounts['pre-accounts']
     self.post_accounts = accounts['post-accounts']
Esempio n. 6
0
 def set_pw(self, name, pw):
     try:
         print('setting new wallet password')
         p = join(self.wallet_state, "wallet_pw.json")
         j = {}
         if not os.path.isdir(self.wallet_state):
             os.mkdir(self.wallet_state)
         if os.path.isfile(p):
             j = json.loads(file_get_contents(p))
         j[name] = pw
         with open(p, 'w') as pw_file:
             print('writing new password file')
             pw_file.write(json.dumps(j))
     except Exception as e:
         raise e
Esempio n. 7
0
 def edit_new_genesis(self, public):
     j = json.loads(
         file_get_contents(join(self.parent_dir, 'config/genesis.json')))
     j['initial_key'] = public
     create_file(join(self.parent_dir, 'config/genesis.json'),
                 json.dumps(j))
def copy_config_content(configpath):
    configexamplepath = configpath + ".example"
    content = utility.file_get_contents(configpath)
    utility.create_file_if_not_exists(configexamplepath)
    utility.write_into_file(configexamplepath, content)