def read_slave(self): if not os.path.isfile(self.slave_dat_filename): return try: with open(self.slave_dat_filename, "rb") as infile: w = qrl_pb2.Wallet() w.ParseFromString(bytes(infile.read())) return AddressSerialized(w.address, w.mnemonic, w.xmss_index) except Exception as e: logger.warning("It was not possible to open the wallet: %s", e)
def GetWallet(self, request: qrl_pb2.GetWalletReq, context) -> qrl_pb2.GetWalletResp: answer = qrl_pb2.GetWalletResp() addr_bundle = self.qrlnode.get_address_bundle(request.address) if addr_bundle is not None: answer.wallet.CopyFrom( qrl_pb2.Wallet(address=addr_bundle.address, mnemonic=addr_bundle.xmss.get_mnemonic(), xmss_index=addr_bundle.xmss.get_index())) return answer
def save_wallet(self): logger.debug('Syncing wallet file') wallet_store = qrl_pb2.WalletStore() wallets = [] for a in self.address_bundle: wallets.append(qrl_pb2.Wallet(address=a.address, mnemonic=a.xmss.get_mnemonic(), xmss_index=a.xmss.get_index())) wallet_store.wallets.extend(wallets) with open(self.wallet_dat_filename, "wb") as outfile: outfile.write(wallet_store.SerializeToString())
def save_slave(self, slave): with open(self.slave_dat_filename, "wb") as outfile: w = qrl_pb2.Wallet(address=slave.get_address(), mnemonic=slave.get_mnemonic(), xmss_index=slave.get_index()) outfile.write(w.SerializeToString())